KVM SR: new way of exporting disk image.

Using new built-in feature of qemu 1.6.
parent 6b05014f
No related merge requests found
......@@ -133,7 +133,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/kvm-export.sh.in
filename = kvm-export.sh.in
md5sum = 844ffe5e01dedbf0a261edf52e067cbe
md5sum = 95fde96f35cbf90d677c44d18b60fafb
download-only = true
mode = 0755
......
#!/bin/bash
# Create a backup of the disk image of the virtual machine
QEMU_IMG=${kvm-instance:qemu-img-path}
SNAPSHOT_NAME=$(date +%s)
DISK_PATH=${kvm-instance:disk-path}
BACKUP_PATH=${:backup-disk-path}
QMP_CLIENT=${buildout:directory}/software_release/bin/qemu-qmp-client
......@@ -11,15 +8,5 @@ if [ ! -f $DISK_PATH ]; then
exit 0;
fi
$QMP_CLIENT ${kvm-instance:socket-path} suspend && \
$QEMU_IMG snapshot -c $SNAPSHOT_NAME $DISK_PATH
$QMP_CLIENT ${kvm-instance:socket-path} resume
$QMP_CLIENT --socket ${kvm-instance:socket-path} --drive-backup $BACKUP_PATH
if [ -f $BACKUP_PATH ]; then
rm $BACKUP_PATH
fi
$QEMU_IMG convert -f qcow2 -O qcow2 -s $SNAPSHOT_NAME $DISK_PATH $BACKUP_PATH
$QMP_CLIENT ${kvm-instance:socket-path} suspend && \
$QEMU_IMG snapshot -d $SNAPSHOT_NAME $DISK_PATH
$QMP_CLIENT ${kvm-instance:socket-path} resume
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment