Re: [PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart
On 9/11/2020 2:44 PM, Dr. David Alan Gilbert wrote: > * Steve Sistare (steven.sist...@oracle.com) wrote: >> Add the VMS_RESTART variant of vmstate, for use when upgrading qemu in place >> on the same host without a reboot. Invoke it using: >> cprsave restart >> >> VMS_RESTART supports guest ram mapped by private anonymous memory, versus >> VMS_REBOOT which requires that guest ram be mapped by persistent shared >> memory. Subsequent patches complete its implementation. >> >> Signed-off-by: Steve Sistare > > You should find with the enum like Eric suggests this mostly disappears; > but also you might want to put it after the patches that implement it. Sure. If this gets too small I will add it to the implementation patch. I cannot move this after the impl, because the impl has additional uses of VMS_RESTART. - Steve >> --- >> hmp-commands.hx | 4 +++- >> include/migration/vmstate.h | 1 + >> migration/savevm.c | 4 +++- >> monitor/qmp-cmds.c | 2 +- >> qapi/migration.json | 1 + >> 5 files changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/hmp-commands.hx b/hmp-commands.hx >> index 7517876..11a2089 100644 >> --- a/hmp-commands.hx >> +++ b/hmp-commands.hx >> @@ -369,7 +369,7 @@ ERST >> { >> .name = "cprsave", >> .args_type = "file:s,mode:s", >> -.params = "file 'reboot'", >> +.params = "file 'restart'|'reboot'", >> .help = "create a checkpoint of the VM in file", >> .cmd= hmp_cprsave, >> }, >> @@ -380,6 +380,8 @@ SRST >>in *file*. >>If *mode* is 'reboot', the checkpoint can be cprload'ed after a host kexec >>reboot. >> + If *mode* is 'restart', the checkpoint can be cprload'ed after restarting >> + qemu. >>exec() /usr/bin/qemu-exec if it exists, else exec >> /usr/bin/qemu-system-x86_64, >>passing all the original command line arguments. The VCPUs remain paused. >> ERST >> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h >> index c58551a..8239b84 100644 >> --- a/include/migration/vmstate.h >> +++ b/include/migration/vmstate.h >> @@ -162,6 +162,7 @@ typedef enum { >> VMS_MIGRATE = (1U << 1), >> VMS_SNAPSHOT = (1U << 2), >> VMS_REBOOT = (1U << 3), >> +VMS_RESTART = (1U << 4), >> VMS_MODE_ALL = ~0U >> } VMStateMode; >> >> diff --git a/migration/savevm.c b/migration/savevm.c >> index 00f493b..38cc63a 100644 >> --- a/migration/savevm.c >> +++ b/migration/savevm.c >> @@ -2708,6 +2708,8 @@ void save_cpr_snapshot(const char *file, const char >> *mode, Error **errp) >> >> if (!strcmp(mode, "reboot")) { >> op = VMS_REBOOT; >> +} else if (!strcmp(mode, "restart")) { >> +op = VMS_RESTART; >> } else { >> error_setg(errp, "cprsave: bad mode %s", mode); >> return; >> @@ -2973,7 +2975,7 @@ void load_cpr_snapshot(const char *file, Error **errp) >> return; >> } >> >> -ret = qemu_loadvm_state(f, VMS_REBOOT); >> +ret = qemu_loadvm_state(f, VMS_REBOOT | VMS_RESTART); >> qemu_fclose(f); >> if (ret < 0) { >> error_setg(errp, "Error %d while loading VM state", ret); >> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c >> index 8c400e6..8a74c6e 100644 >> --- a/monitor/qmp-cmds.c >> +++ b/monitor/qmp-cmds.c >> @@ -164,7 +164,7 @@ void qmp_cont(Error **errp) >> >> char *qmp_cprinfo(Error **errp) >> { >> -return g_strdup("reboot"); >> +return g_strdup("reboot restart"); >> } >> >> void qmp_cprsave(const char *file, const char *mode, Error **errp) >> diff --git a/qapi/migration.json b/qapi/migration.json >> index 8190b16..d22992b 100644 >> --- a/qapi/migration.json >> +++ b/qapi/migration.json >> @@ -1639,6 +1639,7 @@ >> # >> # @file: name of checkpoint file >> # @mode: 'reboot' : checkpoint can be cprload'ed after a host kexec reboot. >> +#'restart': checkpoint can be cprload'ed after restarting qemu. >> # >> # Since 5.0 >> ## >> -- >> 1.8.3.1 >>
Re: [PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart
* Steve Sistare (steven.sist...@oracle.com) wrote: > Add the VMS_RESTART variant of vmstate, for use when upgrading qemu in place > on the same host without a reboot. Invoke it using: > cprsave restart > > VMS_RESTART supports guest ram mapped by private anonymous memory, versus > VMS_REBOOT which requires that guest ram be mapped by persistent shared > memory. Subsequent patches complete its implementation. > > Signed-off-by: Steve Sistare You should find with the enum like Eric suggests this mostly disappears; but also you might want to put it after the patches that implement it. Dave > --- > hmp-commands.hx | 4 +++- > include/migration/vmstate.h | 1 + > migration/savevm.c | 4 +++- > monitor/qmp-cmds.c | 2 +- > qapi/migration.json | 1 + > 5 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/hmp-commands.hx b/hmp-commands.hx > index 7517876..11a2089 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -369,7 +369,7 @@ ERST > { > .name = "cprsave", > .args_type = "file:s,mode:s", > -.params = "file 'reboot'", > +.params = "file 'restart'|'reboot'", > .help = "create a checkpoint of the VM in file", > .cmd= hmp_cprsave, > }, > @@ -380,6 +380,8 @@ SRST >in *file*. >If *mode* is 'reboot', the checkpoint can be cprload'ed after a host kexec >reboot. > + If *mode* is 'restart', the checkpoint can be cprload'ed after restarting > + qemu. >exec() /usr/bin/qemu-exec if it exists, else exec > /usr/bin/qemu-system-x86_64, >passing all the original command line arguments. The VCPUs remain paused. > ERST > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > index c58551a..8239b84 100644 > --- a/include/migration/vmstate.h > +++ b/include/migration/vmstate.h > @@ -162,6 +162,7 @@ typedef enum { > VMS_MIGRATE = (1U << 1), > VMS_SNAPSHOT = (1U << 2), > VMS_REBOOT = (1U << 3), > +VMS_RESTART = (1U << 4), > VMS_MODE_ALL = ~0U > } VMStateMode; > > diff --git a/migration/savevm.c b/migration/savevm.c > index 00f493b..38cc63a 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -2708,6 +2708,8 @@ void save_cpr_snapshot(const char *file, const char > *mode, Error **errp) > > if (!strcmp(mode, "reboot")) { > op = VMS_REBOOT; > +} else if (!strcmp(mode, "restart")) { > +op = VMS_RESTART; > } else { > error_setg(errp, "cprsave: bad mode %s", mode); > return; > @@ -2973,7 +2975,7 @@ void load_cpr_snapshot(const char *file, Error **errp) > return; > } > > -ret = qemu_loadvm_state(f, VMS_REBOOT); > +ret = qemu_loadvm_state(f, VMS_REBOOT | VMS_RESTART); > qemu_fclose(f); > if (ret < 0) { > error_setg(errp, "Error %d while loading VM state", ret); > diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c > index 8c400e6..8a74c6e 100644 > --- a/monitor/qmp-cmds.c > +++ b/monitor/qmp-cmds.c > @@ -164,7 +164,7 @@ void qmp_cont(Error **errp) > > char *qmp_cprinfo(Error **errp) > { > -return g_strdup("reboot"); > +return g_strdup("reboot restart"); > } > > void qmp_cprsave(const char *file, const char *mode, Error **errp) > diff --git a/qapi/migration.json b/qapi/migration.json > index 8190b16..d22992b 100644 > --- a/qapi/migration.json > +++ b/qapi/migration.json > @@ -1639,6 +1639,7 @@ > # > # @file: name of checkpoint file > # @mode: 'reboot' : checkpoint can be cprload'ed after a host kexec reboot. > +#'restart': checkpoint can be cprload'ed after restarting qemu. > # > # Since 5.0 > ## > -- > 1.8.3.1 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
Re: [PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart
On 7/30/2020 12:22 PM, Eric Blake wrote: > On 7/30/20 10:14 AM, Steve Sistare wrote: >> Add the VMS_RESTART variant of vmstate, for use when upgrading qemu in place >> on the same host without a reboot. Invoke it using: >> cprsave restart >> >> VMS_RESTART supports guest ram mapped by private anonymous memory, versus >> VMS_REBOOT which requires that guest ram be mapped by persistent shared >> memory. Subsequent patches complete its implementation. >> >> Signed-off-by: Steve Sistare >> --- > >> +++ b/qapi/migration.json >> @@ -1639,6 +1639,7 @@ >> # >> # @file: name of checkpoint file >> # @mode: 'reboot' : checkpoint can be cprload'ed after a host kexec reboot. >> +# 'restart': checkpoint can be cprload'ed after restarting qemu. > > This should be a modification to an enum type (the 'CprMode' type I suggested > earlier in the series). Will do - steve
Re: [PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart
On 7/30/20 10:14 AM, Steve Sistare wrote: Add the VMS_RESTART variant of vmstate, for use when upgrading qemu in place on the same host without a reboot. Invoke it using: cprsave restart VMS_RESTART supports guest ram mapped by private anonymous memory, versus VMS_REBOOT which requires that guest ram be mapped by persistent shared memory. Subsequent patches complete its implementation. Signed-off-by: Steve Sistare --- +++ b/qapi/migration.json @@ -1639,6 +1639,7 @@ # # @file: name of checkpoint file # @mode: 'reboot' : checkpoint can be cprload'ed after a host kexec reboot. +#'restart': checkpoint can be cprload'ed after restarting qemu. This should be a modification to an enum type (the 'CprMode' type I suggested earlier in the series). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org