]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: don't print error info when snapshot xml is not changed
authorGuannan Ren <gren@redhat.com>
Tue, 21 Aug 2012 20:37:34 +0000 (04:37 +0800)
committerGuannan Ren <gren@redhat.com>
Wed, 22 Aug 2012 11:15:03 +0000 (19:15 +0800)
If xml is not changed, error message is printed.
So check ret value instead of edit variable for error message.

tools/virsh-snapshot.c

index aff91d3a8bc0ad7776c52e02eea96af6d72752e0..5d84f7a5fa9764e5a10e09b037129a26fbde0eba 100644 (file)
@@ -449,7 +449,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
                  _("Snapshot %s XML configuration not changed.\n"), \
                  name);                                             \
         ret = true;                                                 \
-        goto cleanup;                                               \
+        goto edit_cleanup;                                          \
     }
 #define EDIT_DEFINE \
     (strstr(doc, "<state>disk-snapshot</state>") ? \
@@ -487,10 +487,10 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
     ret = true;
 
 cleanup:
+    if (!ret)
+        vshError(ctl, _("Failed to update %s"), name);
     if (edited)
         virDomainSnapshotFree(edited);
-    else
-        vshError(ctl, _("Failed to update %s"), name);
     if (snapshot)
         virDomainSnapshotFree(snapshot);
     if (dom)