提交 53525f91 编写于 作者: E Erik Skultety

tools: use vshError rather than vshPrint on failure

There were a few places in our virsh* code where instead of calling vshError
on failure we called vshPrint.
Signed-off-by: NErik Skultety <eskultet@redhat.com>
上级 58054920
...@@ -2099,7 +2099,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd) ...@@ -2099,7 +2099,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
break; break;
case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_FAILED:
vshPrint(ctl, "\n%s", _("Commit failed")); vshError(ctl, "\n%s", _("Commit failed"));
goto cleanup; goto cleanup;
break; break;
...@@ -2408,7 +2408,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) ...@@ -2408,7 +2408,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
break; break;
case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_FAILED:
vshPrint(ctl, "\n%s", _("Copy failed")); vshError(ctl, "\n%s", _("Copy failed"));
goto cleanup; goto cleanup;
break; break;
...@@ -2818,7 +2818,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd) ...@@ -2818,7 +2818,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
break; break;
case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_FAILED:
vshPrint(ctl, "\n%s", _("Pull failed")); vshError(ctl, "\n%s", _("Pull failed"));
goto cleanup; goto cleanup;
break; break;
...@@ -3794,7 +3794,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ...@@ -3794,7 +3794,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
virStoragePoolPtr storagepool = NULL; virStoragePoolPtr storagepool = NULL;
if (!source) { if (!source) {
vshPrint(ctl, vshError(ctl,
_("Missing storage volume name for disk '%s'"), _("Missing storage volume name for disk '%s'"),
target); target);
continue; continue;
...@@ -3802,7 +3802,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ...@@ -3802,7 +3802,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
if (!(storagepool = virStoragePoolLookupByName(priv->conn, if (!(storagepool = virStoragePoolLookupByName(priv->conn,
pool))) { pool))) {
vshPrint(ctl, vshError(ctl,
_("Storage pool '%s' for volume '%s' not found."), _("Storage pool '%s' for volume '%s' not found."),
pool, target); pool, target);
vshResetLibvirtError(); vshResetLibvirtError();
...@@ -3817,7 +3817,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ...@@ -3817,7 +3817,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
} }
if (!vol.vol) { if (!vol.vol) {
vshPrint(ctl, vshError(ctl,
_("Storage volume '%s'(%s) is not managed by libvirt. " _("Storage volume '%s'(%s) is not managed by libvirt. "
"Remove it manually.\n"), target, source); "Remove it manually.\n"), target, source);
vshResetLibvirtError(); vshResetLibvirtError();
......
...@@ -605,7 +605,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd) ...@@ -605,7 +605,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
newxml = virshMakeCloneXML(origxml, name); newxml = virshMakeCloneXML(origxml, name);
if (!newxml) { if (!newxml) {
vshPrint(ctl, "%s", _("Failed to allocate XML buffer")); vshError(ctl, "%s", _("Failed to allocate XML buffer"));
goto cleanup; goto cleanup;
} }
......
...@@ -3267,7 +3267,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd) ...@@ -3267,7 +3267,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
if (xml) { if (xml) {
virBufferEscapeString(&xmlbuf, "%s", arg); virBufferEscapeString(&xmlbuf, "%s", arg);
if (virBufferError(&xmlbuf)) { if (virBufferError(&xmlbuf)) {
vshPrint(ctl, "%s", _("Failed to allocate XML buffer")); vshError(ctl, "%s", _("Failed to allocate XML buffer"));
return false; return false;
} }
str = virBufferContentAndReset(&xmlbuf); str = virBufferContentAndReset(&xmlbuf);
...@@ -3284,7 +3284,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd) ...@@ -3284,7 +3284,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
} }
if (virBufferError(&buf)) { if (virBufferError(&buf)) {
vshPrint(ctl, "%s", _("Failed to allocate XML buffer")); vshError(ctl, "%s", _("Failed to allocate XML buffer"));
return false; return false;
} }
arg = virBufferContentAndReset(&buf); arg = virBufferContentAndReset(&buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册