guestfish修改鏡像內容
阿新 • • 發佈:2017-09-24
class play embed pack pro yum spa all tools
1、安裝guestfish
yum install libguestfs-tools
註意,如果要修改windows鏡像需要安裝
yum install libguestfs-winsupport
2、修改配置文件:/etc/libvirt/qemu.conf
user = "root" # The group for QEMU processes run by the system instance. It can be # specified in a similar way to user. group = "root"
將user和group前面的#號放開
然後重啟:
systemctl start libvirtd
3、修改文件內容
以下示例是將鏡像裏面的/opt/scalarizr/embedded/lib/python2.7/site-packages/scalarizr-3.3.4-py2.7.egg/scalarizr/storage2/volumes/cinder.py
的233行裏面的display_description改成description
guestfish -a redhat6.7-kvm-oracle11g-22disk-pulsar2.2.qcow2 -i sh "sed -i ‘233s/display_description/description/‘ /opt/scalarizr/embedded/lib/python2.7/site-packages/scalarizr-3.3.4-py2.7.egg/scalarizr/storage2/volumes/cinder.py"
註意,不使用-i參數的話,需要在交互shell中運行
更多guestfish用法可以參考:http://xiaoli110.blog.51cto.com/1724/1568307/
guestfish修改鏡像內容