]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDomainCheckpointRedefinePrep: Set 'current' checkpoint if there isn't any
authorPeter Krempa <pkrempa@redhat.com>
Wed, 1 Apr 2020 12:34:15 +0000 (14:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 3 Apr 2020 07:56:57 +0000 (09:56 +0200)
When redefining checkpoints from scratch we'd not set the 'current'
checkpoint if there wasn't any. This meant that the code wasn't ever
able to set a 'current' checkpoint as any other one looks up if the
parent of the redefined checkpoint is current.

Since the backup code then requires the current checkpoint to start the
lookup we'd not be able to perform a backup after restoring the
checkpoint hierarchy.

Reported-by: Eyal Shenitzky <eshenitz@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/conf/checkpoint_conf.c

index 26bcfc16b7d652b387ba641a1e6f06785a98e73e..d557fada490465eb1333531bb92ffed5c35776e2 100644 (file)
@@ -550,6 +550,10 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
             *update_current = true;
     }
 
+    /* set the first redefined checkpoint as current */
+    if (virDomainCheckpointGetCurrent(vm->checkpoints) == NULL)
+        *update_current = true;
+
     other = virDomainCheckpointFindByName(vm->checkpoints, def->parent.name);
     if (other) {
         otherdef = virDomainCheckpointObjGetDef(other);