[libvirt] Qemu only support VHDx disk format, but libvirt force use VHD format
MitoriAke at outlook.com
Wed Aug 9 16:07:14 UTC 2017
I am trying to use a VHDx format disk on libvirt.
According to https://en.wikibooks.org/wiki/QEMU/Images, Qemu supports
VHDx but not VHD.
But when I set disk format to 'vhdx' in virt-manager, it prompts "Error
changing VM configuration: Expected a wrapped C Object but got <type
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/addhardware.py", line
765, in change_config_helper
define_func(devobj=devobj, do_hotplug=False, **define_args)
File "/usr/share/virt-manager/virtManager/domain.py", line 847,
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line
389, in _redefine_xmlobj
File "/usr/share/virt-manager/virtManager/domain.py", line 1156,
File "/usr/share/virt-manager/virtManager/connection.py", line
678, in define_domain
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 3622, in
__tmp = virDomain(self,_obj=ret)
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 453, in
raise Exception("Expected a wrapped C Object but got %s" %
Exception: Expected a wrapped C Object but got <type 'NoneType'>
Then I use `virsh edit MyDOM` to edit my domain XML, change disk format
to "vhdx" then I get error:
"Unable to validate doc against /usr/share/libvirt/schemas/domain.rng".
So I edit /usr/share/libvirt/schemas/storagecommon.rng, change
"<value>vhd</value>" to "<value>vhdx</value>" in <define
name='storageFormat'>. But it still not works, and virsh tells me
`error: unsupported configuration: unknown driver format value 'vhdx' `.
I choice ignore , but then same error and I can't ignore: only Yes to
re-edit or No to give up.
Then I suppose "vhd" in libvirt means "vhdx", so I change disk format to
"vhd". But then when I run domain, Qemu get error: " Unknown driver
'vhd' ". It seems libvirt pass "vhd" to Qemu, but Qemu only support "vhdx"
At last, I use Qemu paramaters: ` -drive
file=/Path/To/File.vhdx,format=vhdx,if=none,id=drive-sata0-0-3 `, and it
works. When I use `-drive format=vhd` , Qemu gives me same error: "
Unknown driver 'vhd' ".
So I think it maybe a bug that libvirt forcely demand format is "vhd"
and I find no way to change it, but in same time Qemu only accept format
"vhdx" as paramater. I try to edit
`/usr/lib/python2.7/dist-packages/libvirt.py` but I have no idea how to
modify it. And it seems only changing of storagecommon.rng is not enough.
My libvirt version is 3.6.0 and Qemu version is 2.8.1.
More information about the libvir-list