[libvirt-users] virsh snapshot-create and blockcopy

Hello. I just tried the following: virsh dumpxml --security-info gentoo-template > gentoo-template.xml virsh snapshot-create gentoo-template virsh undefine gentoo-template virsh blockcopy gentoo-template vda /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 --wait --verbose --finish virsh define gentoo-template.xml virsh snapshot-delete gentoo-template --current But if i restore the /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 the snapshot is gone. Someone has an idea what i'm missing? I suppose i'm just missunderstandig the snapshot mechanism. thanks an best regards t.

On 06/09/2013 02:46 PM, Thomas Stein wrote:
Hello.
I just tried the following:
virsh dumpxml --security-info gentoo-template > gentoo-template.xml virsh snapshot-create gentoo-template virsh undefine gentoo-template
Wait - is that really the command you used after "snapshot-create" ? Because: You cannot undefine a guest with a snapshot without first deleting its metadata To cleanly delete, maybe you should've done: $ virsh snapshot-delete --domain gentoo-template SNAPSHOTID --metadata
virsh blockcopy gentoo-template vda /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 --wait --verbose --finish virsh define gentoo-template.xml
Can you also paste the output of: $ qemu-img info --backing-chain \ /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2
virsh snapshot-delete gentoo-template --current
But if i restore the /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 the snapshot is gone.
Someone has an idea what i'm missing? I suppose i'm just missunderstandig the snapshot mechanism.
Here's how I used blockcopy (few months ago, slightly outdated) -- http://kashyapc.fedorapeople.org/virt/lc-2012/live-backup-with-blockcopy.txt
thanks an best regards t.
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
-- /kashyap

Am 10.06.13 09:07, schrieb Kashyap Chamarthy:
On 06/09/2013 02:46 PM, Thomas Stein wrote:
Hello.
I just tried the following:
virsh dumpxml --security-info gentoo-template > gentoo-template.xml virsh snapshot-create gentoo-template virsh undefine gentoo-template
Wait - is that really the command you used after "snapshot-create" ?
Because: You cannot undefine a guest with a snapshot without first deleting its metadata
To cleanly delete, maybe you should've done:
$ virsh snapshot-delete --domain gentoo-template SNAPSHOTID --metadata
Did that. But that deletes that snapshot too, no?
virsh blockcopy gentoo-template vda /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 --wait --verbose --finish virsh define gentoo-template.xml
Can you also paste the output of:
$ qemu-img info --backing-chain \ /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2
hn ~ # qemu-img info --backing-chain /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 image: /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 file format: qcow2 virtual size: 130G (139586437120 bytes) disk size: 30G cluster_size: 65536 Just to make myself clear. I want to backup the qcow image /with/ the internal snapshot. Is that even possible with blockcopy? thanks and best regards.
virsh snapshot-delete gentoo-template --current
But if i restore the /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 the snapshot is gone.
Someone has an idea what i'm missing? I suppose i'm just missunderstandig the snapshot mechanism.
Here's how I used blockcopy (few months ago, slightly outdated) -- http://kashyapc.fedorapeople.org/virt/lc-2012/live-backup-with-blockcopy.txt
thanks an best regards t.
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On 06/10/2013 01:20 PM, Thomas Stein wrote:
Am 10.06.13 09:07, schrieb Kashyap Chamarthy:
On 06/09/2013 02:46 PM, Thomas Stein wrote:
Hello.
I just tried the following:
virsh dumpxml --security-info gentoo-template > gentoo-template.xml virsh snapshot-create gentoo-template virsh undefine gentoo-template
Wait - is that really the command you used after "snapshot-create" ?
Because: You cannot undefine a guest with a snapshot without first deleting its metadata
To cleanly delete, maybe you should've done:
$ virsh snapshot-delete --domain gentoo-template SNAPSHOTID --metadata
Did that. But that deletes that snapshot too, no?
Yes. (I just understood what you wanted to do). Noted my details below.
virsh blockcopy gentoo-template vda /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 --wait --verbose --finish virsh define gentoo-template.xml
Can you also paste the output of:
$ qemu-img info --backing-chain \ /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2
hn ~ # qemu-img info --backing-chain /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 image: /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 file format: qcow2 virtual size: 130G (139586437120 bytes) disk size: 30G cluster_size: 65536
Just to make myself clear. I want to backup the qcow image /with/ the internal snapshot. Is that even possible with blockcopy?
Let's try. I just did the below test (also I noted it in the URL below) # Take an (internal) snapshot when the guest was shutdown $ virsh snapshot-list fed18 Name Creation Time State ------------------------------------------------------------ 1370847718 2013-06-10 12:31:58 +0530 shutoff # Start the guest $ virsh start fed18 # Undefine the guest while it is running - this will # make the guest transient (libvirt expects it to be 'transient') $ virsh undefine fed18 Domain fed18 has been undefined # List the guest root@~$ virsh list Id Name State ---------------------------------------------------- 3 fed18 running $ # Do blockcopy (it's only when the guest is "live") $ virsh blockcopy --domain fed18 vda \ /export/backup/images/fed18.qcow2 --wait --finish --verbose Block Copy: [ 100 %] # Query the info of original image: =========== root@~$ qemu-img info --backing-chain /var/lib/libvirt/images/el6box1.qcow2 image: /var/lib/libvirt/images/el6box1.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1370853048 0 2013-06-10 14:00:48 00:00:00.000 =========== $ qemu-img snapshot -l /var/lib/libvirt/images/el6box1.qcow2 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1370853048 0 2013-06-10 14:00:48 00:00:00.000 =========== # Query info of the backup: =========== $ qemu-img info --backing-chain /export/backup/images/el6box1-back.qcow2 image: /export/backup/images/el6box1-back.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 10G cluster_size: 65536 =========== $ qemu-img snapshot -l /export/backup/images/el6box1-back.qcow2 =========== Hm, from what it looks, it doesn't appear to preserve the internal snapshot..
http://kashyapc.fedorapeople.org/virt/lc-2012/live-backup-with-blockcopy.txt
-- /kashyap

Am 10.06.13 10:40, schrieb Kashyap Chamarthy:
On 06/10/2013 01:20 PM, Thomas Stein wrote:
Am 10.06.13 09:07, schrieb Kashyap Chamarthy:
On 06/09/2013 02:46 PM, Thomas Stein wrote:
Hello.
I just tried the following:
virsh dumpxml --security-info gentoo-template > gentoo-template.xml virsh snapshot-create gentoo-template virsh undefine gentoo-template
Wait - is that really the command you used after "snapshot-create" ?
Because: You cannot undefine a guest with a snapshot without first deleting its metadata
To cleanly delete, maybe you should've done:
$ virsh snapshot-delete --domain gentoo-template SNAPSHOTID --metadata
Did that. But that deletes that snapshot too, no?
Yes. (I just understood what you wanted to do). Noted my details below.
virsh blockcopy gentoo-template vda /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 --wait --verbose --finish virsh define gentoo-template.xml
Can you also paste the output of:
$ qemu-img info --backing-chain \ /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2
hn ~ # qemu-img info --backing-chain /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 image: /opt/virt-backup-blockcopy/gentoo-template/gentoo-template.qcow2 file format: qcow2 virtual size: 130G (139586437120 bytes) disk size: 30G cluster_size: 65536
Just to make myself clear. I want to backup the qcow image /with/ the internal snapshot. Is that even possible with blockcopy?
Let's try. I just did the below test (also I noted it in the URL below)
# Take an (internal) snapshot when the guest was shutdown
Okay. So even a snapshot taken while the machine is off is not preserved. That's a pity. Thank you anyway . best regards t.
$ virsh snapshot-list fed18 Name Creation Time State ------------------------------------------------------------ 1370847718 2013-06-10 12:31:58 +0530 shutoff
# Start the guest $ virsh start fed18
# Undefine the guest while it is running - this will # make the guest transient (libvirt expects it to be 'transient') $ virsh undefine fed18 Domain fed18 has been undefined
# List the guest root@~$ virsh list Id Name State ---------------------------------------------------- 3 fed18 running
$
# Do blockcopy (it's only when the guest is "live") $ virsh blockcopy --domain fed18 vda \ /export/backup/images/fed18.qcow2 --wait --finish --verbose Block Copy: [ 100 %]
# Query the info of original image: =========== root@~$ qemu-img info --backing-chain /var/lib/libvirt/images/el6box1.qcow2 image: /var/lib/libvirt/images/el6box1.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1370853048 0 2013-06-10 14:00:48 00:00:00.000 =========== $ qemu-img snapshot -l /var/lib/libvirt/images/el6box1.qcow2 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1370853048 0 2013-06-10 14:00:48 00:00:00.000 ===========
# Query info of the backup: =========== $ qemu-img info --backing-chain /export/backup/images/el6box1-back.qcow2 image: /export/backup/images/el6box1-back.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 10G cluster_size: 65536 =========== $ qemu-img snapshot -l /export/backup/images/el6box1-back.qcow2 ===========
Hm, from what it looks, it doesn't appear to preserve the internal snapshot..
http://kashyapc.fedorapeople.org/virt/lc-2012/live-backup-with-blockcopy.txt

Just to make myself clear. I want to backup the qcow image /with/ the internal snapshot. Is that even possible with blockcopy?
Let's try. I just did the below test (also I noted it in the URL below)
# Take an (internal) snapshot when the guest was shutdown
Okay. So even a snapshot taken while the machine is off is not preserved. That's a pity.
Some more details - blockcopy's usecase is different:
From my notes w/ previous interactions w/ Eric (Blocklayer primary dev), blockcopy allows you
(1) to create a copy of a chain, and optionally "pivoting" live qemu to use that copy instead of the original. Here, 'pivoting' means: Going from base<-snap1<-path1/to/snap2 to base<-snap1<-path2/to/snap2, where path{1,2}/to/snap2 are copies at the time of the pivot. (2) It is also possible to take a copy but not pivot to it, for backup purpose, so blockcopy has a choice of shallow or full: If you use --shallow, only the leaf image is copied, the rest of the chain is untouched. So if you have base <- snap1 <- active; copy --shallow creates base <- snap1 <- copy (where copy matches active); copy without shallow creates "copy", where copy matches the entire chain.
Thank you anyway .
best regards t.
$ virsh snapshot-list fed18 Name Creation Time State ------------------------------------------------------------ 1370847718 2013-06-10 12:31:58 +0530 shutoff
# Start the guest $ virsh start fed18
# Undefine the guest while it is running - this will # make the guest transient (libvirt expects it to be 'transient') $ virsh undefine fed18 Domain fed18 has been undefined
# List the guest root@~$ virsh list Id Name State ---------------------------------------------------- 3 fed18 running
$
# Do blockcopy (it's only when the guest is "live") $ virsh blockcopy --domain fed18 vda \ /export/backup/images/fed18.qcow2 --wait --finish --verbose Block Copy: [ 100 %]
# Query the info of original image: =========== root@~$ qemu-img info --backing-chain /var/lib/libvirt/images/el6box1.qcow2 image: /var/lib/libvirt/images/el6box1.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1370853048 0 2013-06-10 14:00:48 00:00:00.000 =========== $ qemu-img snapshot -l /var/lib/libvirt/images/el6box1.qcow2 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1370853048 0 2013-06-10 14:00:48 00:00:00.000 ===========
# Query info of the backup: =========== $ qemu-img info --backing-chain /export/backup/images/el6box1-back.qcow2 image: /export/backup/images/el6box1-back.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 10G cluster_size: 65536 =========== $ qemu-img snapshot -l /export/backup/images/el6box1-back.qcow2 ===========
Hm, from what it looks, it doesn't appear to preserve the internal snapshot..
http://kashyapc.fedorapeople.org/virt/lc-2012/live-backup-with-blockcopy.txt
-- /kashyap
participants (2)
-
Kashyap Chamarthy
-
Thomas Stein