This allows us to differentiate between a fresh boot and a restore boot.
Signed-off-by: Joelle van Dyne <j@getutm.app>
---
softmmu/runstate.c | 1 +
softmmu/vl.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 1e68680b9d..fa3dd3a4ab 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -76,6 +76,7 @@ typedef struct {
static const RunStateTransition runstate_transitions_def[] = {
{ RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
+ { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM },
{ RUN_STATE_DEBUG, RUN_STATE_RUNNING },
{ RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 706bd7cff7..29586d94ff 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3131,6 +3131,9 @@ void qemu_init(int argc, char **argv, char **envp)
add_device_config(DEV_DEBUGCON, optarg);
break;
case QEMU_OPTION_loadvm:
+ if (!loadvm) {
+ runstate_set(RUN_STATE_RESTORE_VM);
+ }
loadvm = optarg;
break;
case QEMU_OPTION_full_screen:
--
2.28.0
On Fri, Aug 12, 2022 at 06:10:30PM -0700, Joelle van Dyne wrote:
> This allows us to differentiate between a fresh boot and a restore boot.
>
> Signed-off-by: Joelle van Dyne <j@getutm.app>
> ---
> softmmu/runstate.c | 1 +
> softmmu/vl.c | 3 +++
> 2 files changed, 4 insertions(+)
What happens if the user launches QEMU with -S and NOT -loadvm, and
then uses the 'loadvm' monitor command to restore the VM state ?
> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> index 1e68680b9d..fa3dd3a4ab 100644
> --- a/softmmu/runstate.c
> +++ b/softmmu/runstate.c
> @@ -76,6 +76,7 @@ typedef struct {
>
> static const RunStateTransition runstate_transitions_def[] = {
> { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
> + { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM },
>
> { RUN_STATE_DEBUG, RUN_STATE_RUNNING },
> { RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 706bd7cff7..29586d94ff 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3131,6 +3131,9 @@ void qemu_init(int argc, char **argv, char **envp)
> add_device_config(DEV_DEBUGCON, optarg);
> break;
> case QEMU_OPTION_loadvm:
> + if (!loadvm) {
> + runstate_set(RUN_STATE_RESTORE_VM);
> + }
> loadvm = optarg;
> break;
> case QEMU_OPTION_full_screen:
> --
> 2.28.0
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
On Mon, Aug 22, 2022 at 3:11 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Fri, Aug 12, 2022 at 06:10:30PM -0700, Joelle van Dyne wrote:
> > This allows us to differentiate between a fresh boot and a restore boot.
> >
> > Signed-off-by: Joelle van Dyne <j@getutm.app>
> > ---
> > softmmu/runstate.c | 1 +
> > softmmu/vl.c | 3 +++
> > 2 files changed, 4 insertions(+)
>
> What happens if the user launches QEMU with -S and NOT -loadvm, and
> then uses the 'loadvm' monitor command to restore the VM state ?
Sorry, this email totally slipped past me. The 'loadvm' monitor
command does this:
vm_stop(RUN_STATE_RESTORE_VM);
Which sets the correct state.
>
>
> > diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> > index 1e68680b9d..fa3dd3a4ab 100644
> > --- a/softmmu/runstate.c
> > +++ b/softmmu/runstate.c
> > @@ -76,6 +76,7 @@ typedef struct {
> >
> > static const RunStateTransition runstate_transitions_def[] = {
> > { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
> > + { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM },
> >
> > { RUN_STATE_DEBUG, RUN_STATE_RUNNING },
> > { RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
> > diff --git a/softmmu/vl.c b/softmmu/vl.c
> > index 706bd7cff7..29586d94ff 100644
> > --- a/softmmu/vl.c
> > +++ b/softmmu/vl.c
> > @@ -3131,6 +3131,9 @@ void qemu_init(int argc, char **argv, char **envp)
> > add_device_config(DEV_DEBUGCON, optarg);
> > break;
> > case QEMU_OPTION_loadvm:
> > + if (!loadvm) {
> > + runstate_set(RUN_STATE_RESTORE_VM);
> > + }
> > loadvm = optarg;
> > break;
> > case QEMU_OPTION_full_screen:
> > --
> > 2.28.0
> >
> >
>
> With regards,
> Daniel
> --
> |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o- https://fstop138.berrange.com :|
> |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
>
© 2016 - 2026 Red Hat, Inc.