On Tue, Sep 08, 2015 at 11:00:25AM +0300, Denis V. Lunev wrote: > From: Raushaniya Maksudova <rmaksud...@virtuozzo.com> > > In some cases one needs to pause and resume a Virtual Machine from inside > of Qemu. Currently there are request functions to pause VM (vmstop), but > there are no respective ones to resume VM. > > Signed-off-by: Raushaniya Maksudova <rmaksud...@virtuozzo.com> > Signed-off-by: Denis V. Lunev <d...@openvz.org> > CC: Stefan Hajnoczi <stefa...@redhat.com> > CC: Kevin Wolf <kw...@redhat.com> > CC: Paolo Bonzini <pbonz...@redhat.com> > --- > include/sysemu/sysemu.h | 1 + > stubs/vm-stop.c | 5 +++++ > vl.c | 18 ++++++++++++++++++ > 3 files changed, 24 insertions(+)
Why can't vm_start() be used? > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 44570d1..a382ae1 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -62,6 +62,7 @@ void qemu_system_shutdown_request(void); > void qemu_system_powerdown_request(void); > void qemu_register_powerdown_notifier(Notifier *notifier); > void qemu_system_debug_request(void); > +void qemu_system_vmstart_request(void); > void qemu_system_vmstop_request(RunState reason); > void qemu_system_vmstop_request_prepare(void); > int qemu_shutdown_requested_get(void); > diff --git a/stubs/vm-stop.c b/stubs/vm-stop.c > index 69fd86b..c8e2cdd 100644 > --- a/stubs/vm-stop.c > +++ b/stubs/vm-stop.c > @@ -10,3 +10,8 @@ void qemu_system_vmstop_request(RunState state) > { > abort(); > } > + > +void qemu_system_vmstart_request(void) > +{ > + abort(); > +} > diff --git a/vl.c b/vl.c > index 584ca88..63f10d3 100644 > --- a/vl.c > +++ b/vl.c > @@ -563,6 +563,7 @@ static RunState current_run_state = RUN_STATE_PRELAUNCH; > /* We use RUN_STATE_MAX but any invalid value will do */ > static RunState vmstop_requested = RUN_STATE_MAX; > static QemuMutex vmstop_lock; > +static bool vmstart_requested; > > typedef struct { > RunState from; > @@ -723,6 +724,19 @@ void qemu_system_vmstop_request(RunState state) > qemu_notify_event(); > } > > +static bool qemu_vmstart_requested(void) > +{ > + bool r = vmstart_requested; > + vmstart_requested = false; > + return r; > +} > + > +void qemu_system_vmstart_request(void) > +{ > + vmstart_requested = true; > + qemu_notify_event(); > +} > + > void vm_start(void) > { > RunState requested; > @@ -1884,6 +1898,10 @@ static bool main_loop_should_exit(void) > if (qemu_vmstop_requested(&r)) { > vm_stop(r); > } > + if (qemu_vmstart_requested()) { > + vm_start(); > + } > + > return false; > } > > -- > 2.1.4 > >