Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
14.5.16. Using blockpull to Shorten a Backing Chain
blockpull can be used in in the following applications:
- Flattens an image by populating it with data from its backing image chain. This makes the image file self-contained so that it no longer depends on backing images and looks like this:
- Before: base.img ← Active
- After: base.img is no longer used by the guest and Active contains all of the data.
- Flattens part of the backing image chain. This can be used to flatten snapshots into the top-level image and looks like this:
- Before: base ← sn1 ←sn2 ← active
- After: base.img ← active. Note that active now contains all data from sn1 and sn2 and neither sn1 nor sn2 are used by the guest.
- Moves the disk image to a new file system on the host. This is allows image files to be moved while the guest is running and looks like this:
- Before (The original image file):
/fs1/base.vm.img - After:
/fs2/active.vm.qcow2is now the new file system and/fs1/base.vm.imgis no longer used.
- Useful in live migration with post-copy storage migration. The disk image is copied from the source host to the destination host after live migration completes.In short this is what happens: Before:
/source-host/base.vm.imgAfter:/destination-host/active.vm.qcow2./source-host/base.vm.imgis no longer used.
Procedure 14.3. Using blockpull to Shorten a Backing Chain
- It may be helpful to run this command prior to running
blockpull:virsh snapshot-create-as $dom $name - disk-only
# virsh snapshot-create-as $dom $name - disk-onlyCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If the chain looks like this:
base ← snap1 ← snap2 ← activerun the following:virsh blockpull $dom $disk snap1
# virsh blockpull $dom $disk snap1Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command makes 'snap1' the backing file of active, by pulling data from snap2 into active resulting in: base ← snap1 ← active. - Once the
blockpullis complete, the libvirt tracking of the snapshot that created the extra image in the chain is no longer useful. Delete the tracking on the outdated snapshot with this command:virsh snapshot-delete $dom $name - metadata
# virsh snapshot-delete $dom $name - metadataCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional applications of
blockpull can be done as follows:
- To flatten a single image and populate it with data from its backing image chain:
# virsh blockpull example-domain vda - wait - To flatten part of the backing image chain:
# virsh blockpull example-domain vda - base /path/to/base.img - wait - To move the disk image to a new file system on the host:
# virsh snapshot-create example-domaine - xmlfile /path/to/new.xml - disk-onlyfollowed by# virsh blockpull example-domain vda - wait - To use live migration with post-copy storage migration:
- On the destination run:
qemu-img create -f qcow2 -o backing_file=/source-host/vm.img /destination-host/vm.qcow2
# qemu-img create -f qcow2 -o backing_file=/source-host/vm.img /destination-host/vm.qcow2Copy to Clipboard Copied! Toggle word wrap Toggle overflow - On the source run:
virsh migrate example-domain
# virsh migrate example-domainCopy to Clipboard Copied! Toggle word wrap Toggle overflow - On the destination run:
virsh blockpull example-domain vda - wait
# virsh blockpull example-domain vda - waitCopy to Clipboard Copied! Toggle word wrap Toggle overflow