All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
@ 2014-07-16 21:13 Yuanzhen Gu
  2014-07-16 21:18 ` Eric Blake
  0 siblings, 1 reply; 9+ messages in thread
From: Yuanzhen Gu @ 2014-07-16 21:13 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

Hi folks,


I am going to make a patch, and need to find the pause and thaw(restore)
function before and after taking Live QEMU Snapshot respectively.


 Basically, I'm using # (qemu) snapshot_blkdev <blockX>
<snapshot-file><format> taking snapshot,
http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work when
giving command inside QMP.


 Does anyone know how to find the pause (freeze) and restore(thaw) function
before and after taking snapshot? Or anyway using snapshot_blkdev command
outside QEMU console? Thanks a lot in advance!


 Best,

Yuanzhen


Best,
Yuanzhen

[-- Attachment #2: Type: text/html, Size: 1129 bytes --]

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-16 21:13 [Qemu-devel] pause and restore function before and after QEMU Live Snapshot Yuanzhen Gu
@ 2014-07-16 21:18 ` Eric Blake
  2014-07-16 21:25   ` Andrey Korolyov
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eric Blake @ 2014-07-16 21:18 UTC (permalink / raw)
  To: Yuanzhen Gu, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On 07/16/2014 03:13 PM, Yuanzhen Gu wrote:
> Hi folks,
> 
> 
> I am going to make a patch, and need to find the pause and thaw(restore)
> function before and after taking Live QEMU Snapshot respectively.

Libvirt has the ability to do just that, when taking external disk-only
snapshots.  You can turn on libvirt debugging to trace what QMP/agent
commands are sent during the overall snapshot operation.

> 
> 
>  Basically, I'm using # (qemu) snapshot_blkdev <blockX>
> <snapshot-file><format> taking snapshot,
> http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work when
> giving command inside QMP.
> 
> 
>  Does anyone know how to find the pause (freeze) and restore(thaw) function
> before and after taking snapshot? Or anyway using snapshot_blkdev command
> outside QEMU console? Thanks a lot in advance!

You have to coordinate multiple commands: freeze to the guest agent,
then snapshot to QMP, then thaw to the guest agent.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-16 21:18 ` Eric Blake
@ 2014-07-16 21:25   ` Andrey Korolyov
  2014-07-16 21:48     ` Yuanzhen Gu
  2014-07-16 21:44   ` Yuanzhen Gu
  2014-07-17 20:20   ` Yuanzhen Gu
  2 siblings, 1 reply; 9+ messages in thread
From: Andrey Korolyov @ 2014-07-16 21:25 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, Yuanzhen Gu

On Thu, Jul 17, 2014 at 1:18 AM, Eric Blake <eblake@redhat.com> wrote:
> On 07/16/2014 03:13 PM, Yuanzhen Gu wrote:
>> Hi folks,
>>
>>
>> I am going to make a patch, and need to find the pause and thaw(restore)
>> function before and after taking Live QEMU Snapshot respectively.
>
> Libvirt has the ability to do just that, when taking external disk-only
> snapshots.  You can turn on libvirt debugging to trace what QMP/agent
> commands are sent during the overall snapshot operation.
>
>>
>>
>>  Basically, I'm using # (qemu) snapshot_blkdev <blockX>
>> <snapshot-file><format> taking snapshot,
>> http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work when
>> giving command inside QMP.
>>
>>
>>  Does anyone know how to find the pause (freeze) and restore(thaw) function
>> before and after taking snapshot? Or anyway using snapshot_blkdev command
>> outside QEMU console? Thanks a lot in advance!
>
> You have to coordinate multiple commands: freeze to the guest agent,
> then snapshot to QMP, then thaw to the guest agent.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>

Just 2c:

fsfreeze will not succeed if there are any container instances, for
example Docker, running in the VM on same filesystem. This exact case
can be fixed by extending agent` logic but it looks that the putting a
note is enough.

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-16 21:18 ` Eric Blake
  2014-07-16 21:25   ` Andrey Korolyov
@ 2014-07-16 21:44   ` Yuanzhen Gu
  2014-07-17 20:20   ` Yuanzhen Gu
  2 siblings, 0 replies; 9+ messages in thread
From: Yuanzhen Gu @ 2014-07-16 21:44 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]

Thank you very much, Eric!

So do you mean, if I turn on libvirt debugging to trace QMP/agent commands,
I can find the pause and thaw functions in the source code, is it right ?

and is there any way that I freeze and thaw outside guest agent via command
line?   or profiling tools suggest for freeze and thaw in guest agent?
thanks a lot!

Best,
Yuanzhen


On Wed, Jul 16, 2014 at 5:18 PM, Eric Blake <eblake@redhat.com> wrote:

> On 07/16/2014 03:13 PM, Yuanzhen Gu wrote:
> > Hi folks,
> >
> >
> > I am going to make a patch, and need to find the pause and thaw(restore)
> > function before and after taking Live QEMU Snapshot respectively.
>
> Libvirt has the ability to do just that, when taking external disk-only
> snapshots.  You can turn on libvirt debugging to trace what QMP/agent
> commands are sent during the overall snapshot operation.
>

    So do you mean, if I turn on libvirt debugging to trace QMP/agent
commands, I can find the pause and thaw functions in the source code, is it
right ?

>
> >
> >
> >  Basically, I'm using # (qemu) snapshot_blkdev <blockX>
> > <snapshot-file><format> taking snapshot,
> > http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work
> when
> > giving command inside QMP.
> >
> >
> >  Does anyone know how to find the pause (freeze) and restore(thaw)
> function
> > before and after taking snapshot? Or anyway using snapshot_blkdev command
> > outside QEMU console? Thanks a lot in advance!
>
> You have to coordinate multiple commands: freeze to the guest agent,
> then snapshot to QMP, then thaw to the guest agent.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>

[-- Attachment #2: Type: text/html, Size: 2742 bytes --]

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-16 21:25   ` Andrey Korolyov
@ 2014-07-16 21:48     ` Yuanzhen Gu
  2014-07-16 21:51       ` Andrey Korolyov
  0 siblings, 1 reply; 9+ messages in thread
From: Yuanzhen Gu @ 2014-07-16 21:48 UTC (permalink / raw)
  To: Andrey Korolyov; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1730 bytes --]

Thanks very much Andrey!

how can I figure out whether fsfreeze not succeed while taking snapshot, if
I run a simple application inside VM, say mysql? thanks!

Best,
Yuanzhen


On Wed, Jul 16, 2014 at 5:25 PM, Andrey Korolyov <andrey@xdel.ru> wrote:

> On Thu, Jul 17, 2014 at 1:18 AM, Eric Blake <eblake@redhat.com> wrote:
> > On 07/16/2014 03:13 PM, Yuanzhen Gu wrote:
> >> Hi folks,
> >>
> >>
> >> I am going to make a patch, and need to find the pause and thaw(restore)
> >> function before and after taking Live QEMU Snapshot respectively.
> >
> > Libvirt has the ability to do just that, when taking external disk-only
> > snapshots.  You can turn on libvirt debugging to trace what QMP/agent
> > commands are sent during the overall snapshot operation.
> >
> >>
> >>
> >>  Basically, I'm using # (qemu) snapshot_blkdev <blockX>
> >> <snapshot-file><format> taking snapshot,
> >> http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work
> when
> >> giving command inside QMP.
> >>
> >>
> >>  Does anyone know how to find the pause (freeze) and restore(thaw)
> function
> >> before and after taking snapshot? Or anyway using snapshot_blkdev
> command
> >> outside QEMU console? Thanks a lot in advance!
> >
> > You have to coordinate multiple commands: freeze to the guest agent,
> > then snapshot to QMP, then thaw to the guest agent.
> >
> > --
> > Eric Blake   eblake redhat com    +1-919-301-3266
> > Libvirt virtualization library http://libvirt.org
> >
>
> Just 2c:
>
> fsfreeze will not succeed if there are any container instances, for
> example Docker, running in the VM on same filesystem. This exact case
> can be fixed by extending agent` logic but it looks that the putting a
> note is enough.
>
>

[-- Attachment #2: Type: text/html, Size: 2662 bytes --]

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-16 21:48     ` Yuanzhen Gu
@ 2014-07-16 21:51       ` Andrey Korolyov
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Korolyov @ 2014-07-16 21:51 UTC (permalink / raw)
  To: Yuanzhen Gu; +Cc: qemu-devel

On Thu, Jul 17, 2014 at 1:48 AM, Yuanzhen Gu <yg185@cs.rutgers.edu> wrote:
> Thanks very much Andrey!
>
> how can I figure out whether fsfreeze not succeed while taking snapshot, if
> I run a simple application inside VM, say mysql? thanks!
>
> Best,
> Yuanzhen
>
>
> On Wed, Jul 16, 2014 at 5:25 PM, Andrey Korolyov <andrey@xdel.ru> wrote:
>>
>> On Thu, Jul 17, 2014 at 1:18 AM, Eric Blake <eblake@redhat.com> wrote:
>> > On 07/16/2014 03:13 PM, Yuanzhen Gu wrote:
>> >> Hi folks,
>> >>
>> >>
>> >> I am going to make a patch, and need to find the pause and
>> >> thaw(restore)
>> >> function before and after taking Live QEMU Snapshot respectively.
>> >
>> > Libvirt has the ability to do just that, when taking external disk-only
>> > snapshots.  You can turn on libvirt debugging to trace what QMP/agent
>> > commands are sent during the overall snapshot operation.
>> >
>> >>
>> >>
>> >>  Basically, I'm using # (qemu) snapshot_blkdev <blockX>
>> >> <snapshot-file><format> taking snapshot,
>> >> http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work
>> >> when
>> >> giving command inside QMP.
>> >>
>> >>
>> >>  Does anyone know how to find the pause (freeze) and restore(thaw)
>> >> function
>> >> before and after taking snapshot? Or anyway using snapshot_blkdev
>> >> command
>> >> outside QEMU console? Thanks a lot in advance!
>> >
>> > You have to coordinate multiple commands: freeze to the guest agent,
>> > then snapshot to QMP, then thaw to the guest agent.
>> >
>> > --
>> > Eric Blake   eblake redhat com    +1-919-301-3266
>> > Libvirt virtualization library http://libvirt.org
>> >
>>
>> Just 2c:
>>
>> fsfreeze will not succeed if there are any container instances, for
>> example Docker, running in the VM on same filesystem. This exact case
>> can be fixed by extending agent` logic but it looks that the putting a
>> note is enough.
>>
>

Just non-zero exit code from agent`s operation, not matter if you
communicating directly via json exchange or via libvirt.

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-16 21:18 ` Eric Blake
  2014-07-16 21:25   ` Andrey Korolyov
  2014-07-16 21:44   ` Yuanzhen Gu
@ 2014-07-17 20:20   ` Yuanzhen Gu
  2014-07-17 21:26     ` Eric Blake
  2 siblings, 1 reply; 9+ messages in thread
From: Yuanzhen Gu @ 2014-07-17 20:20 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1644 bytes --]

Hi Eric,

Thank you very much for your suggestion, it do help.

I enabled libvirt debugging, and saw the log file under
/var/log/libvirt/libvirtd.log,

for example, I saw
2014-07-17 20:06:55.992+0000: 4391: debug : qemuProcessHandleResume:575 :
Transitioned guest ubuntu out of paused into resumed state

my further question is, is there any way to locate the function call for
pause and resume from source code, based on the log info? thanks!

Best,
Yuanzhen


On Wed, Jul 16, 2014 at 5:18 PM, Eric Blake <eblake@redhat.com> wrote:

> On 07/16/2014 03:13 PM, Yuanzhen Gu wrote:
> > Hi folks,
> >
> >
> > I am going to make a patch, and need to find the pause and thaw(restore)
> > function before and after taking Live QEMU Snapshot respectively.
>
> Libvirt has the ability to do just that, when taking external disk-only
> snapshots.  You can turn on libvirt debugging to trace what QMP/agent
> commands are sent during the overall snapshot operation.
>
> >
> >
> >  Basically, I'm using # (qemu) snapshot_blkdev <blockX>
> > <snapshot-file><format> taking snapshot,
> > http://wiki.qemu.org/Features/Snapshots    my profile tool didn't work
> when
> > giving command inside QMP.
> >
> >
> >  Does anyone know how to find the pause (freeze) and restore(thaw)
> function
> > before and after taking snapshot? Or anyway using snapshot_blkdev command
> > outside QEMU console? Thanks a lot in advance!
>
> You have to coordinate multiple commands: freeze to the guest agent,
> then snapshot to QMP, then thaw to the guest agent.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>

[-- Attachment #2: Type: text/html, Size: 2530 bytes --]

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-17 20:20   ` Yuanzhen Gu
@ 2014-07-17 21:26     ` Eric Blake
  2014-07-17 21:45       ` Yuanzhen Gu
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Blake @ 2014-07-17 21:26 UTC (permalink / raw)
  To: Yuanzhen Gu; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

On 07/17/2014 02:20 PM, Yuanzhen Gu wrote:
> Hi Eric,

[please don't top-post on technical lists]

> I enabled libvirt debugging, and saw the log file under
> /var/log/libvirt/libvirtd.log,

Which debugging filters did you enable? In particular, you'll want to
turn on LIBVIRT_LOG_FILTERS="1:qemu" for full libvirt logging of qemu
interaction (see http://libvirt.org/logging.html for details); at which
point you can then search for QEMU_MONITOR_IO_PROCESS lines to see when
libvirt sends commands to QMP and gets replies back.  This sort of
question may be better asked on the libvirt-users@redhat.com list.

> 
> for example, I saw
> 2014-07-17 20:06:55.992+0000: 4391: debug : qemuProcessHandleResume:575 :
> Transitioned guest ubuntu out of paused into resumed state
> 
> my further question is, is there any way to locate the function call for
> pause and resume from source code, based on the log info? thanks!

Are you looking for where in the libvirt source code a snapshot manages
qemu commands?  Look for
src/qemu/qemu_driver.c:qemuDomainSnapshotCreateActiveExternal, and trace
through the code it calls for qemuDomainSnapshotFSFreeze and
qemuMonitorTransaction.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] pause and restore function before and after QEMU Live Snapshot
  2014-07-17 21:26     ` Eric Blake
@ 2014-07-17 21:45       ` Yuanzhen Gu
  0 siblings, 0 replies; 9+ messages in thread
From: Yuanzhen Gu @ 2014-07-17 21:45 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]

I see, thank you very much, Eric!

Best,
Yuanzhen


On Thu, Jul 17, 2014 at 5:26 PM, Eric Blake <eblake@redhat.com> wrote:

> On 07/17/2014 02:20 PM, Yuanzhen Gu wrote:
> > Hi Eric,
>
> [please don't top-post on technical lists]
>
> > I enabled libvirt debugging, and saw the log file under
> > /var/log/libvirt/libvirtd.log,
>
> Which debugging filters did you enable? In particular, you'll want to
> turn on LIBVIRT_LOG_FILTERS="1:qemu" for full libvirt logging of qemu
> interaction (see http://libvirt.org/logging.html for details); at which
> point you can then search for QEMU_MONITOR_IO_PROCESS lines to see when
> libvirt sends commands to QMP and gets replies back.  This sort of
> question may be better asked on the libvirt-users@redhat.com list.
>
> >
> > for example, I saw
> > 2014-07-17 20:06:55.992+0000: 4391: debug : qemuProcessHandleResume:575 :
> > Transitioned guest ubuntu out of paused into resumed state
> >
> > my further question is, is there any way to locate the function call for
> > pause and resume from source code, based on the log info? thanks!
>
> Are you looking for where in the libvirt source code a snapshot manages
> qemu commands?  Look for
> src/qemu/qemu_driver.c:qemuDomainSnapshotCreateActiveExternal, and trace
> through the code it calls for qemuDomainSnapshotFSFreeze and
> qemuMonitorTransaction.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>

[-- Attachment #2: Type: text/html, Size: 2281 bytes --]

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

end of thread, other threads:[~2014-07-17 21:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16 21:13 [Qemu-devel] pause and restore function before and after QEMU Live Snapshot Yuanzhen Gu
2014-07-16 21:18 ` Eric Blake
2014-07-16 21:25   ` Andrey Korolyov
2014-07-16 21:48     ` Yuanzhen Gu
2014-07-16 21:51       ` Andrey Korolyov
2014-07-16 21:44   ` Yuanzhen Gu
2014-07-17 20:20   ` Yuanzhen Gu
2014-07-17 21:26     ` Eric Blake
2014-07-17 21:45       ` Yuanzhen Gu

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.