]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: use vshError rather than vshPrint on failure
authorErik Skultety <eskultet@redhat.com>
Fri, 4 Nov 2016 14:21:31 +0000 (15:21 +0100)
committerErik Skultety <eskultet@redhat.com>
Mon, 14 Nov 2016 11:14:11 +0000 (12:14 +0100)
There were a few places in our virsh* code where instead of calling vshError
on failure we called vshPrint.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
tools/virsh-domain.c
tools/virsh-volume.c
tools/vsh.c

index 184f64dd599ef5f66ccb4d812f1a59adb79a9aab..a4f7eb15564f9e892dbf0e7d4444a842c3f91264 100644 (file)
@@ -2099,7 +2099,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
             break;
 
         case VIR_DOMAIN_BLOCK_JOB_FAILED:
-            vshPrint(ctl, "\n%s", _("Commit failed"));
+            vshError(ctl, "\n%s", _("Commit failed"));
             goto cleanup;
             break;
 
@@ -2408,7 +2408,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
             break;
 
         case VIR_DOMAIN_BLOCK_JOB_FAILED:
-            vshPrint(ctl, "\n%s", _("Copy failed"));
+            vshError(ctl, "\n%s", _("Copy failed"));
             goto cleanup;
             break;
 
@@ -2818,7 +2818,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
             break;
 
         case VIR_DOMAIN_BLOCK_JOB_FAILED:
-            vshPrint(ctl, "\n%s", _("Pull failed"));
+            vshError(ctl, "\n%s", _("Pull failed"));
             goto cleanup;
             break;
 
@@ -3794,7 +3794,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
                 virStoragePoolPtr storagepool = NULL;
 
                 if (!source) {
-                    vshPrint(ctl,
+                    vshError(ctl,
                              _("Missing storage volume name for disk '%s'"),
                              target);
                     continue;
@@ -3802,7 +3802,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
 
                 if (!(storagepool = virStoragePoolLookupByName(priv->conn,
                                                                pool))) {
-                    vshPrint(ctl,
+                    vshError(ctl,
                              _("Storage pool '%s' for volume '%s' not found."),
                              pool, target);
                     vshResetLibvirtError();
@@ -3817,7 +3817,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
             }
 
             if (!vol.vol) {
-                vshPrint(ctl,
+                vshError(ctl,
                          _("Storage volume '%s'(%s) is not managed by libvirt. "
                            "Remove it manually.\n"), target, source);
                 vshResetLibvirtError();
index e8cef395b7e35cbe45996031ee0ee1a5093a0ae2..8831f44d0d4b57416e1037dd437a1d4537b01309 100644 (file)
@@ -605,7 +605,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
 
     newxml = virshMakeCloneXML(origxml, name);
     if (!newxml) {
-        vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
         goto cleanup;
     }
 
index 07ceb7bf5fccb35ddded71aa8e20ee427e8f1dc1..f94eaa33d386cfed4311d0d3a61e2e69be1930a3 100644 (file)
@@ -3267,7 +3267,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
         if (xml) {
             virBufferEscapeString(&xmlbuf, "%s", arg);
             if (virBufferError(&xmlbuf)) {
-                vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+                vshError(ctl, "%s", _("Failed to allocate XML buffer"));
                 return false;
             }
             str = virBufferContentAndReset(&xmlbuf);
@@ -3284,7 +3284,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
     }
 
     if (virBufferError(&buf)) {
-        vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+        vshError(ctl, "%s", _("Failed to allocate XML buffer"));
         return false;
     }
     arg = virBufferContentAndReset(&buf);