All of lore.kernel.org
 help / color / mirror / Atom feed
* Swap virtio images
@ 2012-06-06 13:35 Iain J. Watson
  2012-06-06 13:46 ` Mauricio Tavares
  2012-06-06 14:27 ` Kevin Wolf
  0 siblings, 2 replies; 5+ messages in thread
From: Iain J. Watson @ 2012-06-06 13:35 UTC (permalink / raw)
  To: kvm

Hello,

I am trying to find a way to use backing files to make snapshots of
running VMs. The idea is I pause the VM, use qemu-img to create a new
disk file with the currently used file as a backing file, swap the
images then unpause the VM.

Commands would be something like:

----------
  (qemu) stop
  (qemu) drive_del virtio0

  $ qemu-img create -f qcow2 -b os-disk-0.qcow2 os-disk-1.qcow2

  (qemu) drive_add 0 file=os-disk-1.qcow2   # I'm not 100% sure on the
drive_add syntax
  (qemu) c
----------

If I try and do this just now I get the error "Can't hot-add drive to
type 7" when running the drive_add command.

Is there another way to achieve this? Is this something that could
potentially be added or would architecture not support what I'm trying
to do?

Cheers,
Iain Watson
-- 
"Just think how stupid the average person is,
and then realize that half of them are even stupider!"
--George Carlin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Swap virtio images
  2012-06-06 13:35 Swap virtio images Iain J. Watson
@ 2012-06-06 13:46 ` Mauricio Tavares
  2012-06-06 14:27 ` Kevin Wolf
  1 sibling, 0 replies; 5+ messages in thread
From: Mauricio Tavares @ 2012-06-06 13:46 UTC (permalink / raw)
  To: kvm

On Wed, Jun 6, 2012 at 9:35 AM, Iain J. Watson <lists@ij-watson.co.uk> wrote:
> Hello,
>
> I am trying to find a way to use backing files to make snapshots of
> running VMs. The idea is I pause the VM, use qemu-img to create a new
> disk file with the currently used file as a backing file, swap the
> images then unpause the VM.
>
> Commands would be something like:
>
> ----------
>  (qemu) stop
>  (qemu) drive_del virtio0
>
>  $ qemu-img create -f qcow2 -b os-disk-0.qcow2 os-disk-1.qcow2
>
>  (qemu) drive_add 0 file=os-disk-1.qcow2   # I'm not 100% sure on the
> drive_add syntax
>  (qemu) c
> ----------
>
> If I try and do this just now I get the error "Can't hot-add drive to
> type 7" when running the drive_add command.
>
> Is there another way to achieve this? Is this something that could
> potentially be added or would architecture not support what I'm trying
> to do?
>
      This is probably not the answer you seek, but I create a lvm
logical volume for each vm. So, if I need to backup the "pickles" vm I
create a lvm snapshot, which can be done while the vm is happily
running along:

lvcreate -L 10G -s -n pickles_snap_`date "+%Y%m%d"` ${HOSTNAME}_vg0/pickles

If I need to go back to the snapshot I can lvconvert --merge.

> Cheers,
> Iain Watson
> --
> "Just think how stupid the average person is,
> and then realize that half of them are even stupider!"
> --George Carlin
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Swap virtio images
  2012-06-06 13:35 Swap virtio images Iain J. Watson
  2012-06-06 13:46 ` Mauricio Tavares
@ 2012-06-06 14:27 ` Kevin Wolf
  2012-06-06 15:04   ` Iain J. Watson
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2012-06-06 14:27 UTC (permalink / raw)
  To: Iain J. Watson; +Cc: kvm

Am 06.06.2012 15:35, schrieb Iain J. Watson:
> Hello,
> 
> I am trying to find a way to use backing files to make snapshots of
> running VMs. The idea is I pause the VM, use qemu-img to create a new
> disk file with the currently used file as a backing file, swap the
> images then unpause the VM.
> 
> Commands would be something like:
> 
> ----------
>   (qemu) stop
>   (qemu) drive_del virtio0
> 
>   $ qemu-img create -f qcow2 -b os-disk-0.qcow2 os-disk-1.qcow2
> 
>   (qemu) drive_add 0 file=os-disk-1.qcow2   # I'm not 100% sure on the
> drive_add syntax
>   (qemu) c
> ----------
> 
> If I try and do this just now I get the error "Can't hot-add drive to
> type 7" when running the drive_add command.
> 
> Is there another way to achieve this? Is this something that could
> potentially be added or would architecture not support what I'm trying
> to do?

You're looking for the 'snapshot_blkdev' monitor command:

(qemu) snapshot_blkdev virtio0 os-disk1.qcow2 qcow2

Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Swap virtio images
  2012-06-06 14:27 ` Kevin Wolf
@ 2012-06-06 15:04   ` Iain J. Watson
       [not found]     ` <4FCF76AA.9070903@suresafe.co.uk>
  0 siblings, 1 reply; 5+ messages in thread
From: Iain J. Watson @ 2012-06-06 15:04 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: kvm

On Wed, Jun 6, 2012 at 3:27 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 06.06.2012 15:35, schrieb Iain J. Watson:
>> Hello,
>>
>> I am trying to find a way to use backing files to make snapshots of
>> running VMs. The idea is I pause the VM, use qemu-img to create a new
>> disk file with the currently used file as a backing file, swap the
>> images then unpause the VM.
>>
>> Commands would be something like:
>>
>> ----------
>>   (qemu) stop
>>   (qemu) drive_del virtio0
>>
>>   $ qemu-img create -f qcow2 -b os-disk-0.qcow2 os-disk-1.qcow2
>>
>>   (qemu) drive_add 0 file=os-disk-1.qcow2   # I'm not 100% sure on the
>> drive_add syntax
>>   (qemu) c
>> ----------
>>
>> If I try and do this just now I get the error "Can't hot-add drive to
>> type 7" when running the drive_add command.
>>
>> Is there another way to achieve this? Is this something that could
>> potentially be added or would architecture not support what I'm trying
>> to do?
>
> You're looking for the 'snapshot_blkdev' monitor command:
>
> (qemu) snapshot_blkdev virtio0 os-disk1.qcow2 qcow2
>
> Kevin

Ha, it was right in front of my eyes all the time. I thought I'd read
that would only do the qcow2 internal snapshot. Guess I was wrong.

Quickly trying that throws up an error about not being able to open
the new file but I'll debug that a bit before seeking more help.

Cheers,
Iain
-- 
"Just think how stupid the average person is,
and then realize that half of them are even stupider!"
--George Carlin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Swap virtio images
       [not found]     ` <4FCF76AA.9070903@suresafe.co.uk>
@ 2012-06-06 15:51       ` Iain J. Watson
  0 siblings, 0 replies; 5+ messages in thread
From: Iain J. Watson @ 2012-06-06 15:51 UTC (permalink / raw)
  To: Jim; +Cc: Kevin Wolf, kvm

On Wed, Jun 6, 2012 at 4:26 PM, Jim <jim@suresafe.co.uk> wrote:
>
>
> Is this not what virsh create-snapshot is supposed to do for you ?
>
> However, https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1004606
> suggests this is not really working right now.
>
> Is this an Ubuntu screw-up or is it a known issue not yet selected for
> fixing (the bug is shown as confirmed) ?
>
>

For my own question, I'm deliberately not using libvirt so I can't
comment on that.

I can happily confirm that the monitor command 'snapshot_blkdev' works
fine for me on Ubuntu 12.04

Cheers,
Iain
-- 
"Just think how stupid the average person is,
and then realize that half of them are even stupider!"
--George Carlin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-06 15:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 13:35 Swap virtio images Iain J. Watson
2012-06-06 13:46 ` Mauricio Tavares
2012-06-06 14:27 ` Kevin Wolf
2012-06-06 15:04   ` Iain J. Watson
     [not found]     ` <4FCF76AA.9070903@suresafe.co.uk>
2012-06-06 15:51       ` Iain J. Watson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.