Changes

Libvirt external snapshot with GlusterFS

3,910 bytes added, 15:07, 14 May 2014
/* Command overview */
</source>
Ex.Examples:
<pre>
vm-test-02 ~ # virsh snapshot-create d4572522-eae4-4e3e-ab36-618ae4a91fb4 snap.xml --disk-only --atomic
Domain snapshot snap created from 'snap.xml'
</pre>
 
<pre>
~ # virsh snapshot-create 8196bb77-7478-4bfb-a6ea-52b3a2c65eba kvm-0022-snapshot-01.xml --disk-only --atomic --quiesce
</pre>
"id": "libvirt-28"
}
</pre>
 vmUnfortunately libvirt does not handle block-testjobs well which it didn't start. They hang forever while Qemu waits for <code>block-02 job-complete</code>:<pre>~ # virsh blockjob e43a2954-3914-465f-9391-9e63b52ec2f5 vda
Block Commit: [100 %]
~ #virsh qemu-monitor-command e43a2954-3914-465f-9391-9e63b52ec2f5 --pretty '{"execute": "query-block-jobs"}'{ "return": [ { "io-status": "ok", "device": "drive-virtio-disk0", "busy": false, "len": 214748364800, "offset": 214748364800, "paused": false, "speed": 0, "type": "commit" } ], "id": "libvirt-88"}
</pre>
The So, one has to issue the <code>block -job is running on 100% for a long time until finished.-complete</code> manually again:<pre>~ # virsh qemu-monitor-command e43a2954-3914-465f-9391-9e63b52ec2f5 --pretty '{"execute": "block-job-complete", "arguments": { "device": "drive-virtio-disk0"} }'{ "return": {  }, "id": "libvirt-93"} ~ # virsh blockjob e43a2954-3914-465f-9391-9e63b52ec2f5 vda ~ #</pre>
Check Now check the image images again:
<pre>
~ # virsh qemu-monitor-command --hmp e43a2954-3914-465f-9391-9e63b52ec2f5 "info block"
rm /var/virtualization/vm-templates/5b77d2f6-061f-410c-8ee7-9e61da6f1927/bbf7796f-90bf-45ab-8645-2894f5dae727.snap01.qcow2
</source>
 
== Command overview ==
 
<source lang='bash'>
# create a snapshot for all disks
virsh snapshot-create 8196bb77-7478-4bfb-a6ea-52b3a2c65eba kvm-0022-snapshot-01.xml --disk-only --atomic --quiesce
 
# TODO: copy images away at this point
 
# initiate the block commit for the first disk
# TODO: do this for all disks
virsh qemu-monitor-command 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --pretty '{"execute":"block-commit", "arguments": { "device":"drive-virtio-disk0", "base": "gluster://10.122.0.11/virtualization/vm-persistent/0f83f084-8080-413e-b558-b678e504836e/711b08f2-7c26-4ac3-bb46-66176523d752.qcow2", "top": "gluster://10.122.0.11/virtualization/vm-persistent/0f83f084-8080-413e-b558-b678e504836e/711b08f2-7c26-4ac3-bb46-66176523d752.snapshot-01.qcow2" } }'
 
# monitor the progress
virsh blockjob 8196bb77-7478-4bfb-a6ea-52b3a2c65eba vda
virsh qemu-monitor-command 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --pretty '{"execute": "query-block-jobs"}'
 
# when finished, have Qemu finish it (TODO: check whether we would have to install a dirty block tracer at some point):
# EDIT PKL: No we don't need to trace the dirty blocks as qemu already does something similar. After the block commit,
# both disks are in a way synchronized. I.e. if a write operation is performed, it is written to the snapshot image as
# well as to base image. After the block-job-complete command the write operations are written to the base image only
virsh qemu-monitor-command 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --pretty '{"execute": "block-job-complete", "arguments": { "device": "drive-virtio-disk0"} }'
 
# remove the snapshot information in libvirt. As an alternative, one could tell libvirt when creating the snapshot to not record any information about it (--no-metadata)
virsh snapshot-delete 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --current --metadata
 
# remove the snapshot
rm /var/virtualization/vm-persistent/0f83f084-8080-413e-b558-b678e504836e/711b08f2-7c26-4ac3-bb46-66176523d752.snapshot-01.qcow2
 
# have libvirt forget about it as well
virsh edit 8196bb77-7478-4bfb-a6ea-52b3a2c65eba
</source>
 
== VSS & Qemu-GA ==
 
'''TODO''': at the moment, the following error appears in the Windows Application Log:
<pre>
Volume Shadow Copy Service error: Unexpected error querying for the iVssWriterCallback interface, hr = 0x8007005, Access is denied.
</pre>
 
This error can be solved by executing the following steps:
* From the Start Menu, select Run
** In the Open field, input dcomcnfg and click OK.
* OR Open the PowerShell and type dcomcnfg.exe and hit enter
* Expand Component Services, Computers, and My Computer.
** Right-click My Computer and click Properties on the pop-up menu.
* Click the COM Security tab.
** Under Access Permission click Edit Default.
** From the Access Permissions dialog, add the "Network Service" account with Local Access allowed.
* Close all open dialogs.
* Restart the computer.
[[Category:Snippets]]
486
edits