On 11/19/2012 09:06 AM, Peter Krempa wrote:
> Some hypervisors require a respawn of the hypervisor to allow reverting
> to some snapshot states. This patch adds flag to remove the default
> safe approach to not allow this. When this flag is specified the
> hypervisor driver should re-emit events to allow management apps to
> reconnect.
> 
> This flag is meant as a lesser way to enforce the restart of the
> hypervisor, that is a fairly common possibility compared to other
> meanings that the existing force flag has.
> ---
> Force now selects this flag and this flag can be used with internal snapshots 
> too.
> ---

> @@ -12129,7 +12129,11 @@ static int 
> qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
> 
>      virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
>                    VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED |
> -                  VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, -1);
> +                  VIR_DOMAIN_SNAPSHOT_REVERT_FORCE |
> +                  VIR_DOMAIN_SNAPSHOT_REVERT_RESPAWN, -1);
> +
> +    if (flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)
> +        flags |= VIR_DOMAIN_SNAPSHOT_REVERT_RESPAWN;

Up to here looks fine.

> 
>      /* We have the following transitions, which create the following events:
>       * 1. inactive -> inactive: none
> @@ -12249,7 +12253,7 @@ static int 
> qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,

Hmm, this is incomplete.  Earlier, inside a
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE check, we have:

        if (virDomainObjIsActive(vm) &&
            !(snap->def->state == VIR_DOMAIN_RUNNING
              || snap->def->state == VIR_DOMAIN_PAUSED) &&
            (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
                      VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) {
            virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s",
                           _("must respawn qemu to start inactive
snapshot"));
            goto cleanup;

which should be converted to the new flag.

>              if (config && !virDomainDefCheckABIStability(vm->def, config)) {
>                  virErrorPtr err = virGetLastError();
> 
> -                if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) {
> +                if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_RESPAWN)) {
>                      /* Re-spawn error using correct category. */

I think this one is correct, though.

> @@ -2830,6 +2830,10 @@ I<--running> or I<--paused> flags when reverting to a 
> disk snapshot of a
>  transient domain. The I<--stopped> flag cannot be used on snapshots
>  of transient domains.
> 
> +Some snapshot revert approaches may require a respawn of the hypervisor
> +process. This is not allowed by default. You may specify I<--allow-respawn>
> +to override this limit.

It might be worth mentioning that --force implies --allow-respawn (that
is, --force is a supserset of --allow-respawn, in that it can force
situations that --allow-respawn will not).

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to