Reputation: 31
Using virsh, I can use the following cli command to move an active disk to another location:
virsh blockcopy --domain 'mydomain' vda /my_new_path/disk.qcow2 --wait --verbose --pivot
However when I try to do the same with the libvirt api:
source = 'vda'
dest_xml = """
<disk>
<destination type='file'>/my_new_path/disk.qcow2</destination>
<format type='qcow2'/>
</disk>
"""
domain.blockCopy(source, dest_xml, {}, flags=0)
I get the following error: libvirt.libvirtError: missing source information for device.
I've tried setting the source as vda, or the full path to the source file - no luck.
Has anyone out there solved this problem? What does the source value need to be?
Upvotes: 0
Views: 83
Reputation: 31
My mistake. a bit confusingly, the destination block device path needs to be labelled as "source", in the xml snippet, thus:
<disk>
<destination type='file'>/my_new_path/disk.qcow2</destination>
<format type='qcow2'/>
</disk>
should be:
<disk>
<source type='file'>/my_new_path/disk.qcow2</destination>
<format type='qcow2'/>
</disk>
Of course this makes sense. Everything now works - I can live now migrate a virtual disk to a different path.
Hopefully people will find this answer helpful. /p
Upvotes: 0