virsh: respect -q/--quiet more

Turn various vshPrint() informative messages into vshPrintExtra(), so
they are not printed when requesting the quiet mode; neither XML/info
outputs nor the results of commands are affected.
Also change the expected outputs of the virsh-undefine test, since virsh
is invoked in quiet mode there.

Some informative messages might still be converted (and thus silenced
when in quiet mode), but this is an improvements nonetheless.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1358179
This commit is contained in:
Pino Toscano 2016-08-24 16:14:23 +02:00 committed by Michal Privoznik
parent c74cae234e
commit b620bdee14
10 changed files with 119 additions and 123 deletions

View File

@ -36,7 +36,6 @@ test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1 cat <<\EOF > exp || fail=1
Persistent: yes Persistent: yes
Domain test has been undefined
Persistent: no Persistent: no
EOF EOF
compare exp out || fail=1 compare exp out || fail=1
@ -48,7 +47,6 @@ test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1 cat <<\EOF > exp || fail=1
Persistent: yes Persistent: yes
Domain 1 has been undefined
Persistent: no Persistent: no
EOF EOF
compare exp out || fail=1 compare exp out || fail=1
@ -58,8 +56,6 @@ $abs_top_builddir/tools/virsh -q -c test:///default \
'shutdown test; undefine test; dominfo test' > out 2>&1 'shutdown test; undefine test; dominfo test' > out 2>&1
test $? = 1 || fail=1 test $? = 1 || fail=1
cat <<\EOF > expout || fail=1 cat <<\EOF > expout || fail=1
Domain test is being shutdown
Domain test has been undefined
error: failed to get domain 'test' error: failed to get domain 'test'
error: Domain not found error: Domain not found
EOF EOF

View File

@ -284,7 +284,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, "%s", _("Device attached successfully\n")); vshPrintExtra(ctl, "%s", _("Device attached successfully\n"));
ret = true; ret = true;
cleanup: cleanup:
@ -764,7 +764,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
if (ret != 0) { if (ret != 0) {
vshError(ctl, "%s", _("Failed to attach disk")); vshError(ctl, "%s", _("Failed to attach disk"));
} else { } else {
vshPrint(ctl, "%s", _("Disk attached successfully\n")); vshPrintExtra(ctl, "%s", _("Disk attached successfully\n"));
functionReturn = true; functionReturn = true;
} }
@ -1075,7 +1075,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
if (ret != 0) { if (ret != 0) {
vshError(ctl, "%s", _("Failed to attach interface")); vshError(ctl, "%s", _("Failed to attach interface"));
} else { } else {
vshPrint(ctl, "%s", _("Interface attached successfully\n")); vshPrintExtra(ctl, "%s", _("Interface attached successfully\n"));
functionReturn = true; functionReturn = true;
} }
@ -1131,9 +1131,9 @@ cmdAutostart(vshControl *ctl, const vshCmd *cmd)
} }
if (autostart) if (autostart)
vshPrint(ctl, _("Domain %s marked as autostarted\n"), name); vshPrintExtra(ctl, _("Domain %s marked as autostarted\n"), name);
else else
vshPrint(ctl, _("Domain %s unmarked as autostarted\n"), name); vshPrintExtra(ctl, _("Domain %s unmarked as autostarted\n"), name);
virDomainFree(dom); virDomainFree(dom);
return true; return true;
@ -2915,7 +2915,7 @@ cmdBlockResize(vshControl *ctl, const vshCmd *cmd)
if (virDomainBlockResize(dom, path, size, flags) < 0) { if (virDomainBlockResize(dom, path, size, flags) < 0) {
vshError(ctl, _("Failed to resize block device '%s'"), path); vshError(ctl, _("Failed to resize block device '%s'"), path);
} else { } else {
vshPrint(ctl, _("Block device '%s' is resized"), path); vshPrintExtra(ctl, _("Block device '%s' is resized"), path);
ret = true; ret = true;
} }
@ -3185,7 +3185,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("Failed to update interface link state")); vshError(ctl, _("Failed to update interface link state"));
goto cleanup; goto cleanup;
} else { } else {
vshPrint(ctl, "%s", _("Device updated successfully\n")); vshPrintExtra(ctl, "%s", _("Device updated successfully\n"));
ret = true; ret = true;
} }
@ -3424,7 +3424,7 @@ cmdSuspend(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virDomainSuspend(dom) == 0) { if (virDomainSuspend(dom) == 0) {
vshPrint(ctl, _("Domain %s suspended\n"), name); vshPrintExtra(ctl, _("Domain %s suspended\n"), name);
} else { } else {
vshError(ctl, _("Failed to suspend domain %s"), name); vshError(ctl, _("Failed to suspend domain %s"), name);
ret = false; ret = false;
@ -3503,7 +3503,7 @@ cmdDomPMSuspend(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Domain %s successfully suspended"), vshPrintExtra(ctl, _("Domain %s successfully suspended"),
virDomainGetName(dom)); virDomainGetName(dom));
ret = true; ret = true;
@ -3550,7 +3550,7 @@ cmdDomPMWakeup(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Domain %s successfully woken up"), vshPrintExtra(ctl, _("Domain %s successfully woken up"),
virDomainGetName(dom)); virDomainGetName(dom));
ret = true; ret = true;
@ -3913,7 +3913,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
out: out:
if (rc == 0) { if (rc == 0) {
vshPrint(ctl, _("Domain %s has been undefined\n"), name); vshPrintExtra(ctl, _("Domain %s has been undefined\n"), name);
ret = true; ret = true;
} else { } else {
vshError(ctl, _("Failed to undefine domain %s"), name); vshError(ctl, _("Failed to undefine domain %s"), name);
@ -3924,7 +3924,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
if (nvols) { if (nvols) {
for (i = 0; i < nvols; i++) { for (i = 0; i < nvols; i++) {
if (wipe_storage) { if (wipe_storage) {
vshPrint(ctl, _("Wiping volume '%s'(%s) ... "), vshPrintExtra(ctl, _("Wiping volume '%s'(%s) ... "),
vols[i].target, vols[i].source); vols[i].target, vols[i].source);
fflush(stdout); fflush(stdout);
if (virStorageVolWipe(vols[i].vol, 0) < 0) { if (virStorageVolWipe(vols[i].vol, 0) < 0) {
@ -3932,7 +3932,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
ret = false; ret = false;
continue; continue;
} else { } else {
vshPrint(ctl, _("Done.\n")); vshPrintExtra(ctl, _("Done.\n"));
} }
} }
@ -3942,7 +3942,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
vols[i].target, vols[i].source); vols[i].target, vols[i].source);
ret = false; ret = false;
} else { } else {
vshPrint(ctl, _("Volume '%s'(%s) removed.\n"), vshPrintExtra(ctl, _("Volume '%s'(%s) removed.\n"),
vols[i].target, vols[i].source); vols[i].target, vols[i].source);
} }
} }
@ -4138,7 +4138,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
} }
started: started:
vshPrint(ctl, _("Domain %s started\n"), vshPrintExtra(ctl, _("Domain %s started\n"),
virDomainGetName(dom)); virDomainGetName(dom));
#ifndef WIN32 #ifndef WIN32
if (console && !cmdRunConsole(ctl, dom, NULL, 0)) if (console && !cmdRunConsole(ctl, dom, NULL, 0))
@ -4404,7 +4404,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread); virThreadJoin(&workerThread);
if (ret) if (ret)
vshPrint(ctl, _("\nDomain %s saved to %s\n"), name, to); vshPrintExtra(ctl, _("\nDomain %s saved to %s\n"), name, to);
cleanup: cleanup:
virDomainFree(dom); virDomainFree(dom);
@ -4520,7 +4520,7 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("State file %s updated.\n"), file); vshPrintExtra(ctl, _("State file %s updated.\n"), file);
ret = true; ret = true;
cleanup: cleanup:
@ -4711,7 +4711,7 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread); virThreadJoin(&workerThread);
if (ret) if (ret)
vshPrint(ctl, _("\nDomain %s state saved by libvirt\n"), name); vshPrintExtra(ctl, _("\nDomain %s state saved by libvirt\n"), name);
cleanup: cleanup:
virDomainFree(dom); virDomainFree(dom);
@ -4762,10 +4762,10 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
else else
vshPrint(ctl, _("Removed managedsave image for domain %s"), name); vshPrintExtra(ctl, _("Removed managedsave image for domain %s"), name);
} }
else else
vshPrint(ctl, _("Domain %s has no manage save image; removal skipped"), vshPrintExtra(ctl, _("Domain %s has no manage save image; removal skipped"),
name); name);
ret = true; ret = true;
@ -5078,7 +5078,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Domain restored from %s\n"), from); vshPrintExtra(ctl, _("Domain restored from %s\n"), from);
ret = true; ret = true;
cleanup: cleanup:
@ -5251,7 +5251,7 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread); virThreadJoin(&workerThread);
if (ret) if (ret)
vshPrint(ctl, _("\nDomain %s dumped to %s\n"), name, to); vshPrintExtra(ctl, _("\nDomain %s dumped to %s\n"), name, to);
cleanup: cleanup:
virDomainFree(dom); virDomainFree(dom);
@ -5385,7 +5385,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Screenshot saved to %s, with type of %s"), file, mime); vshPrintExtra(ctl, _("Screenshot saved to %s, with type of %s"), file, mime);
ret = true; ret = true;
cleanup: cleanup:
@ -5458,7 +5458,7 @@ cmdSetUserPassword(vshControl *ctl, const vshCmd *cmd)
if (virDomainSetUserPassword(dom, user, password, flags) < 0) if (virDomainSetUserPassword(dom, user, password, flags) < 0)
goto cleanup; goto cleanup;
vshPrint(ctl, _("Password set successfully for %s in %s"), user, name); vshPrintExtra(ctl, _("Password set successfully for %s in %s"), user, name);
ret = true; ret = true;
cleanup: cleanup:
@ -5494,7 +5494,7 @@ cmdResume(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virDomainResume(dom) == 0) { if (virDomainResume(dom) == 0) {
vshPrint(ctl, _("Domain %s resumed\n"), name); vshPrintExtra(ctl, _("Domain %s resumed\n"), name);
} else { } else {
vshError(ctl, _("Failed to resume domain %s"), name); vshError(ctl, _("Failed to resume domain %s"), name);
ret = false; ret = false;
@ -5575,7 +5575,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd)
else else
rv = virDomainShutdown(dom); rv = virDomainShutdown(dom);
if (rv == 0) { if (rv == 0) {
vshPrint(ctl, _("Domain %s is being shutdown\n"), name); vshPrintExtra(ctl, _("Domain %s is being shutdown\n"), name);
} else { } else {
vshError(ctl, _("Failed to shutdown domain %s"), name); vshError(ctl, _("Failed to shutdown domain %s"), name);
goto cleanup; goto cleanup;
@ -5655,7 +5655,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
if (virDomainReboot(dom, flags) == 0) { if (virDomainReboot(dom, flags) == 0) {
vshPrint(ctl, _("Domain %s is being rebooted\n"), name); vshPrintExtra(ctl, _("Domain %s is being rebooted\n"), name);
} else { } else {
vshError(ctl, _("Failed to reboot domain %s"), name); vshError(ctl, _("Failed to reboot domain %s"), name);
goto cleanup; goto cleanup;
@ -5698,7 +5698,7 @@ cmdReset(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virDomainReset(dom, 0) == 0) { if (virDomainReset(dom, 0) == 0) {
vshPrint(ctl, _("Domain %s was reset\n"), name); vshPrintExtra(ctl, _("Domain %s was reset\n"), name);
} else { } else {
vshError(ctl, _("Failed to reset domain %s"), name); vshError(ctl, _("Failed to reset domain %s"), name);
ret = false; ret = false;
@ -7622,7 +7622,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Domain %s created from %s\n"), vshPrintExtra(ctl, _("Domain %s created from %s\n"),
virDomainGetName(dom), from); virDomainGetName(dom), from);
#ifndef WIN32 #ifndef WIN32
if (console) if (console)
@ -7685,7 +7685,7 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (dom != NULL) { if (dom != NULL) {
vshPrint(ctl, _("Domain %s defined from %s\n"), vshPrintExtra(ctl, _("Domain %s defined from %s\n"),
virDomainGetName(dom), from); virDomainGetName(dom), from);
virDomainFree(dom); virDomainFree(dom);
} else { } else {
@ -7738,7 +7738,7 @@ cmdDestroy(vshControl *ctl, const vshCmd *cmd)
result = virDomainDestroy(dom); result = virDomainDestroy(dom);
if (result == 0) { if (result == 0) {
vshPrint(ctl, _("Domain %s destroyed\n"), name); vshPrintExtra(ctl, _("Domain %s destroyed\n"), name);
} else { } else {
vshError(ctl, _("Failed to destroy domain %s"), name); vshError(ctl, _("Failed to destroy domain %s"), name);
ret = false; ret = false;
@ -7867,7 +7867,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
/* Compare original XML with edited. Has it changed at all? */ /* Compare original XML with edited. Has it changed at all? */
if (STREQ(desc, desc_edited)) { if (STREQ(desc, desc_edited)) {
vshPrint(ctl, "%s", vshPrintExtra(ctl, "%s",
title ? _("Domain title not changed\n") : title ? _("Domain title not changed\n") :
_("Domain description not changed\n")); _("Domain description not changed\n"));
ret = true; ret = true;
@ -7885,7 +7885,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
_("Failed to set new domain description")); _("Failed to set new domain description"));
goto cleanup; goto cleanup;
} }
vshPrint(ctl, "%s", vshPrintExtra(ctl, "%s",
title ? _("Domain title updated successfully") : title ? _("Domain title updated successfully") :
_("Domain description updated successfully")); _("Domain description updated successfully"));
} else { } else {
@ -7897,7 +7897,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
if (strlen(desc) > 0) if (strlen(desc) > 0)
vshPrint(ctl, "%s", desc); vshPrint(ctl, "%s", desc);
else else
vshPrint(ctl, vshPrintExtra(ctl,
title ? _("No title for domain: %s") : title ? _("No title for domain: %s") :
_("No description for domain: %s"), _("No description for domain: %s"),
virDomainGetName(dom)); virDomainGetName(dom));
@ -8022,15 +8022,15 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
if (rem) if (rem)
vshPrint(ctl, "%s\n", _("Metadata removed")); vshPrintExtra(ctl, "%s\n", _("Metadata removed"));
else else
vshPrint(ctl, "%s\n", _("Metadata modified")); vshPrintExtra(ctl, "%s\n", _("Metadata modified"));
} else if (edit) { } else if (edit) {
#define EDIT_GET_XML \ #define EDIT_GET_XML \
virshDomainGetEditMetadata(ctl, dom, uri, flags) virshDomainGetEditMetadata(ctl, dom, uri, flags)
#define EDIT_NOT_CHANGED \ #define EDIT_NOT_CHANGED \
do { \ do { \
vshPrint(ctl, "%s", _("Metadata not changed")); \ vshPrintExtra(ctl, "%s", _("Metadata not changed")); \
ret = true; \ ret = true; \
goto edit_cleanup; \ goto edit_cleanup; \
} while (0) } while (0)
@ -8040,7 +8040,7 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd)
key, uri, flags) == 0) key, uri, flags) == 0)
#include "virsh-edit.c" #include "virsh-edit.c"
vshPrint(ctl, "%s\n", _("Metadata modified")); vshPrintExtra(ctl, "%s\n", _("Metadata modified"));
} else { } else {
char *data; char *data;
/* get */ /* get */
@ -9194,7 +9194,7 @@ cmdQemuAttach(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Domain %s attached to pid %u\n"), vshPrintExtra(ctl, _("Domain %s attached to pid %u\n"),
virDomainGetName(dom), pid_value); virDomainGetName(dom), pid_value);
virDomainFree(dom); virDomainFree(dom);
ret = true; ret = true;
@ -9723,7 +9723,7 @@ cmdDomrename(vshControl *ctl, const vshCmd *cmd)
if (virDomainRename(dom, new_name, 0) < 0) if (virDomainRename(dom, new_name, 0) < 0)
goto cleanup; goto cleanup;
vshPrint(ctl, "Domain successfully renamed\n"); vshPrintExtra(ctl, "Domain successfully renamed\n");
ret = true; ret = true;
cleanup: cleanup:
@ -11220,7 +11220,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, "%s", _("Device detached successfully\n")); vshPrintExtra(ctl, "%s", _("Device detached successfully\n"));
funcRet = true; funcRet = true;
cleanup: cleanup:
@ -11302,7 +11302,7 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, "%s", _("Device updated successfully\n")); vshPrintExtra(ctl, "%s", _("Device updated successfully\n"));
ret = true; ret = true;
cleanup: cleanup:
@ -11489,7 +11489,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
if (!ret) { if (!ret) {
vshError(ctl, "%s", _("Failed to detach interface")); vshError(ctl, "%s", _("Failed to detach interface"));
} else { } else {
vshPrint(ctl, "%s", _("Interface detached successfully\n")); vshPrintExtra(ctl, "%s", _("Interface detached successfully\n"));
} }
VIR_FREE(doc_live); VIR_FREE(doc_live);
VIR_FREE(doc_config); VIR_FREE(doc_config);
@ -11843,7 +11843,7 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, "%s", _("Disk detached successfully\n")); vshPrintExtra(ctl, "%s", _("Disk detached successfully\n"));
functionReturn = true; functionReturn = true;
cleanup: cleanup:

View File

@ -540,7 +540,7 @@ cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (iface != NULL) { if (iface != NULL) {
vshPrint(ctl, _("Interface %s defined from %s\n"), vshPrintExtra(ctl, _("Interface %s defined from %s\n"),
virInterfaceGetName(iface), from); virInterfaceGetName(iface), from);
virInterfaceFree(iface); virInterfaceFree(iface);
} else { } else {
@ -579,7 +579,7 @@ cmdInterfaceUndefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virInterfaceUndefine(iface) == 0) { if (virInterfaceUndefine(iface) == 0) {
vshPrint(ctl, _("Interface %s undefined\n"), name); vshPrintExtra(ctl, _("Interface %s undefined\n"), name);
} else { } else {
vshError(ctl, _("Failed to undefine interface %s"), name); vshError(ctl, _("Failed to undefine interface %s"), name);
ret = false; ret = false;
@ -618,7 +618,7 @@ cmdInterfaceStart(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virInterfaceCreate(iface, 0) == 0) { if (virInterfaceCreate(iface, 0) == 0) {
vshPrint(ctl, _("Interface %s started\n"), name); vshPrintExtra(ctl, _("Interface %s started\n"), name);
} else { } else {
vshError(ctl, _("Failed to start interface %s"), name); vshError(ctl, _("Failed to start interface %s"), name);
ret = false; ret = false;
@ -657,7 +657,7 @@ cmdInterfaceDestroy(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virInterfaceDestroy(iface, 0) == 0) { if (virInterfaceDestroy(iface, 0) == 0) {
vshPrint(ctl, _("Interface %s destroyed\n"), name); vshPrintExtra(ctl, _("Interface %s destroyed\n"), name);
} else { } else {
vshError(ctl, _("Failed to destroy interface %s"), name); vshError(ctl, _("Failed to destroy interface %s"), name);
ret = false; ret = false;
@ -696,7 +696,7 @@ cmdInterfaceBegin(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false; return false;
} }
vshPrint(ctl, "%s", _("Network config change transaction started\n")); vshPrintExtra(ctl, "%s", _("Network config change transaction started\n"));
return true; return true;
} }
@ -727,7 +727,7 @@ cmdInterfaceCommit(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false; return false;
} }
vshPrint(ctl, "%s", _("Network config change transaction committed\n")); vshPrintExtra(ctl, "%s", _("Network config change transaction committed\n"));
return true; return true;
} }
@ -758,7 +758,7 @@ cmdInterfaceRollback(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false; return false;
} }
vshPrint(ctl, "%s", _("Network config change transaction rolled back\n")); vshPrintExtra(ctl, "%s", _("Network config change transaction rolled back\n"));
return true; return true;
} }

View File

@ -123,9 +123,9 @@ cmdNetworkAutostart(vshControl *ctl, const vshCmd *cmd)
} }
if (autostart) if (autostart)
vshPrint(ctl, _("Network %s marked as autostarted\n"), name); vshPrintExtra(ctl, _("Network %s marked as autostarted\n"), name);
else else
vshPrint(ctl, _("Network %s unmarked as autostarted\n"), name); vshPrintExtra(ctl, _("Network %s unmarked as autostarted\n"), name);
virNetworkFree(network); virNetworkFree(network);
return true; return true;
@ -168,7 +168,7 @@ cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (network != NULL) { if (network != NULL) {
vshPrint(ctl, _("Network %s created from %s\n"), vshPrintExtra(ctl, _("Network %s created from %s\n"),
virNetworkGetName(network), from); virNetworkGetName(network), from);
virNetworkFree(network); virNetworkFree(network);
} else { } else {
@ -216,7 +216,7 @@ cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (network != NULL) { if (network != NULL) {
vshPrint(ctl, _("Network %s defined from %s\n"), vshPrintExtra(ctl, _("Network %s defined from %s\n"),
virNetworkGetName(network), from); virNetworkGetName(network), from);
virNetworkFree(network); virNetworkFree(network);
} else { } else {
@ -255,7 +255,7 @@ cmdNetworkDestroy(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNetworkDestroy(network) == 0) { if (virNetworkDestroy(network) == 0) {
vshPrint(ctl, _("Network %s destroyed\n"), name); vshPrintExtra(ctl, _("Network %s destroyed\n"), name);
} else { } else {
vshError(ctl, _("Failed to destroy network %s"), name); vshError(ctl, _("Failed to destroy network %s"), name);
ret = false; ret = false;
@ -794,7 +794,7 @@ cmdNetworkStart(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNetworkCreate(network) == 0) { if (virNetworkCreate(network) == 0) {
vshPrint(ctl, _("Network %s started\n"), name); vshPrintExtra(ctl, _("Network %s started\n"), name);
} else { } else {
vshError(ctl, _("Failed to start network %s"), name); vshError(ctl, _("Failed to start network %s"), name);
ret = false; ret = false;
@ -832,7 +832,7 @@ cmdNetworkUndefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNetworkUndefine(network) == 0) { if (virNetworkUndefine(network) == 0) {
vshPrint(ctl, _("Network %s has been undefined\n"), name); vshPrintExtra(ctl, _("Network %s has been undefined\n"), name);
} else { } else {
vshError(ctl, _("Failed to undefine network %s"), name); vshError(ctl, _("Failed to undefine network %s"), name);
ret = false; ret = false;

View File

@ -75,7 +75,7 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (dev != NULL) { if (dev != NULL) {
vshPrint(ctl, _("Node device %s created from %s\n"), vshPrintExtra(ctl, _("Node device %s created from %s\n"),
virNodeDeviceGetName(dev), from); virNodeDeviceGetName(dev), from);
virNodeDeviceFree(dev); virNodeDeviceFree(dev);
} else { } else {
@ -148,7 +148,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
} }
if (virNodeDeviceDestroy(dev) == 0) { if (virNodeDeviceDestroy(dev) == 0) {
vshPrint(ctl, _("Destroyed node device '%s'\n"), device_value); vshPrintExtra(ctl, _("Destroyed node device '%s'\n"), device_value);
} else { } else {
vshError(ctl, _("Failed to destroy node device '%s'"), device_value); vshError(ctl, _("Failed to destroy node device '%s'"), device_value);
goto cleanup; goto cleanup;
@ -632,7 +632,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
} }
if (ret) if (ret)
vshPrint(ctl, _("Device %s detached\n"), name); vshPrintExtra(ctl, _("Device %s detached\n"), name);
else else
vshError(ctl, _("Failed to detach device %s"), name); vshError(ctl, _("Failed to detach device %s"), name);
@ -680,7 +680,7 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd)
} }
if (virNodeDeviceReAttach(device) == 0) { if (virNodeDeviceReAttach(device) == 0) {
vshPrint(ctl, _("Device %s re-attached\n"), name); vshPrintExtra(ctl, _("Device %s re-attached\n"), name);
} else { } else {
vshError(ctl, _("Failed to re-attach device %s"), name); vshError(ctl, _("Failed to re-attach device %s"), name);
ret = false; ret = false;
@ -730,7 +730,7 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd)
} }
if (virNodeDeviceReset(device) == 0) { if (virNodeDeviceReset(device) == 0) {
vshPrint(ctl, _("Device %s reset\n"), name); vshPrintExtra(ctl, _("Device %s reset\n"), name);
} else { } else {
vshError(ctl, _("Failed to reset device %s"), name); vshError(ctl, _("Failed to reset device %s"), name);
ret = false; ret = false;

View File

@ -109,7 +109,7 @@ cmdNWFilterDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (nwfilter != NULL) { if (nwfilter != NULL) {
vshPrint(ctl, _("Network filter %s defined from %s\n"), vshPrintExtra(ctl, _("Network filter %s defined from %s\n"),
virNWFilterGetName(nwfilter), from); virNWFilterGetName(nwfilter), from);
virNWFilterFree(nwfilter); virNWFilterFree(nwfilter);
} else { } else {
@ -152,7 +152,7 @@ cmdNWFilterUndefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNWFilterUndefine(nwfilter) == 0) { if (virNWFilterUndefine(nwfilter) == 0) {
vshPrint(ctl, _("Network filter %s undefined\n"), name); vshPrintExtra(ctl, _("Network filter %s undefined\n"), name);
} else { } else {
vshError(ctl, _("Failed to undefine network filter %s"), name); vshError(ctl, _("Failed to undefine network filter %s"), name);
ret = false; ret = false;

View File

@ -209,9 +209,9 @@ cmdPoolAutostart(vshControl *ctl, const vshCmd *cmd)
} }
if (autostart) if (autostart)
vshPrint(ctl, _("Pool %s marked as autostarted\n"), name); vshPrintExtra(ctl, _("Pool %s marked as autostarted\n"), name);
else else
vshPrint(ctl, _("Pool %s unmarked as autostarted\n"), name); vshPrintExtra(ctl, _("Pool %s unmarked as autostarted\n"), name);
virStoragePoolFree(pool); virStoragePoolFree(pool);
return true; return true;
@ -276,7 +276,7 @@ cmdPoolCreate(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (pool != NULL) { if (pool != NULL) {
vshPrint(ctl, _("Pool %s created from %s\n"), vshPrintExtra(ctl, _("Pool %s created from %s\n"),
virStoragePoolGetName(pool), from); virStoragePoolGetName(pool), from);
virStoragePoolFree(pool); virStoragePoolFree(pool);
} else { } else {
@ -449,7 +449,7 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(xml); VIR_FREE(xml);
if (pool != NULL) { if (pool != NULL) {
vshPrint(ctl, _("Pool %s created\n"), name); vshPrintExtra(ctl, _("Pool %s created\n"), name);
virStoragePoolFree(pool); virStoragePoolFree(pool);
} else { } else {
vshError(ctl, _("Failed to create pool %s"), name); vshError(ctl, _("Failed to create pool %s"), name);
@ -498,7 +498,7 @@ cmdPoolDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer); VIR_FREE(buffer);
if (pool != NULL) { if (pool != NULL) {
vshPrint(ctl, _("Pool %s defined from %s\n"), vshPrintExtra(ctl, _("Pool %s defined from %s\n"),
virStoragePoolGetName(pool), from); virStoragePoolGetName(pool), from);
virStoragePoolFree(pool); virStoragePoolFree(pool);
} else { } else {
@ -541,7 +541,7 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(xml); VIR_FREE(xml);
if (pool != NULL) { if (pool != NULL) {
vshPrint(ctl, _("Pool %s defined\n"), name); vshPrintExtra(ctl, _("Pool %s defined\n"), name);
virStoragePoolFree(pool); virStoragePoolFree(pool);
} else { } else {
vshError(ctl, _("Failed to define pool %s"), name); vshError(ctl, _("Failed to define pool %s"), name);
@ -590,7 +590,7 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_STORAGE_POOL_BUILD_OVERWRITE; flags |= VIR_STORAGE_POOL_BUILD_OVERWRITE;
if (virStoragePoolBuild(pool, flags) == 0) { if (virStoragePoolBuild(pool, flags) == 0) {
vshPrint(ctl, _("Pool %s built\n"), name); vshPrintExtra(ctl, _("Pool %s built\n"), name);
} else { } else {
vshError(ctl, _("Failed to build pool %s"), name); vshError(ctl, _("Failed to build pool %s"), name);
ret = false; ret = false;
@ -631,7 +631,7 @@ cmdPoolDestroy(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virStoragePoolDestroy(pool) == 0) { if (virStoragePoolDestroy(pool) == 0) {
vshPrint(ctl, _("Pool %s destroyed\n"), name); vshPrintExtra(ctl, _("Pool %s destroyed\n"), name);
} else { } else {
vshError(ctl, _("Failed to destroy pool %s"), name); vshError(ctl, _("Failed to destroy pool %s"), name);
ret = false; ret = false;
@ -671,7 +671,7 @@ cmdPoolDelete(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virStoragePoolDelete(pool, 0) == 0) { if (virStoragePoolDelete(pool, 0) == 0) {
vshPrint(ctl, _("Pool %s deleted\n"), name); vshPrintExtra(ctl, _("Pool %s deleted\n"), name);
} else { } else {
vshError(ctl, _("Failed to delete pool %s"), name); vshError(ctl, _("Failed to delete pool %s"), name);
ret = false; ret = false;
@ -711,7 +711,7 @@ cmdPoolRefresh(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virStoragePoolRefresh(pool, 0) == 0) { if (virStoragePoolRefresh(pool, 0) == 0) {
vshPrint(ctl, _("Pool %s refreshed\n"), name); vshPrintExtra(ctl, _("Pool %s refreshed\n"), name);
} else { } else {
vshError(ctl, _("Failed to refresh pool %s"), name); vshError(ctl, _("Failed to refresh pool %s"), name);
ret = false; ret = false;
@ -1732,7 +1732,7 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE; flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE;
if (virStoragePoolCreate(pool, flags) == 0) { if (virStoragePoolCreate(pool, flags) == 0) {
vshPrint(ctl, _("Pool %s started\n"), name); vshPrintExtra(ctl, _("Pool %s started\n"), name);
} else { } else {
vshError(ctl, _("Failed to start pool %s"), name); vshError(ctl, _("Failed to start pool %s"), name);
ret = false; ret = false;
@ -1772,7 +1772,7 @@ cmdPoolUndefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virStoragePoolUndefine(pool) == 0) { if (virStoragePoolUndefine(pool) == 0) {
vshPrint(ctl, _("Pool %s has been undefined\n"), name); vshPrintExtra(ctl, _("Pool %s has been undefined\n"), name);
} else { } else {
vshError(ctl, _("Failed to undefine pool %s"), name); vshError(ctl, _("Failed to undefine pool %s"), name);
ret = false; ret = false;

View File

@ -104,7 +104,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Secret %s created\n"), uuid); vshPrintExtra(ctl, _("Secret %s created\n"), uuid);
ret = true; ret = true;
cleanup: cleanup:
@ -219,7 +219,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, "%s", _("Failed to set secret value")); vshError(ctl, "%s", _("Failed to set secret value"));
goto cleanup; goto cleanup;
} }
vshPrint(ctl, "%s", _("Secret value set\n")); vshPrintExtra(ctl, "%s", _("Secret value set\n"));
ret = true; ret = true;
cleanup: cleanup:
@ -316,7 +316,7 @@ cmdSecretUndefine(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("Failed to delete secret %s"), uuid); vshError(ctl, _("Failed to delete secret %s"), uuid);
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Secret %s deleted\n"), uuid); vshPrintExtra(ctl, _("Secret %s deleted\n"), uuid);
ret = true; ret = true;
cleanup: cleanup:

View File

@ -97,9 +97,9 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
} }
if (from) if (from)
vshPrint(ctl, _("Domain snapshot %s created from '%s'"), name, from); vshPrintExtra(ctl, _("Domain snapshot %s created from '%s'"), name, from);
else else
vshPrint(ctl, _("Domain snapshot %s created"), name); vshPrintExtra(ctl, _("Domain snapshot %s created"), name);
ret = true; ret = true;
@ -575,9 +575,9 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
edited_name = virDomainSnapshotGetName(edited); edited_name = virDomainSnapshotGetName(edited);
if (STREQ(name, edited_name)) { if (STREQ(name, edited_name)) {
vshPrint(ctl, _("Snapshot %s edited.\n"), name); vshPrintExtra(ctl, _("Snapshot %s edited.\n"), name);
} else if (clone_okay) { } else if (clone_okay) {
vshPrint(ctl, _("Snapshot %s cloned to %s.\n"), name, vshPrintExtra(ctl, _("Snapshot %s cloned to %s.\n"), name,
edited_name); edited_name);
} else { } else {
unsigned int delete_flags; unsigned int delete_flags;
@ -683,7 +683,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
virDomainSnapshotFree(snapshot2); virDomainSnapshotFree(snapshot2);
vshPrint(ctl, _("Snapshot %s set as current"), snapshotname); vshPrintExtra(ctl, _("Snapshot %s set as current"), snapshotname);
ret = true; ret = true;
goto cleanup; goto cleanup;
} }
@ -1927,9 +1927,9 @@ cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd)
* list of descendants. But that's a lot of code to maintain. */ * list of descendants. But that's a lot of code to maintain. */
if (virDomainSnapshotDelete(snapshot, flags) == 0) { if (virDomainSnapshotDelete(snapshot, flags) == 0) {
if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)
vshPrint(ctl, _("Domain snapshot %s children deleted\n"), name); vshPrintExtra(ctl, _("Domain snapshot %s children deleted\n"), name);
else else
vshPrint(ctl, _("Domain snapshot %s deleted\n"), name); vshPrintExtra(ctl, _("Domain snapshot %s deleted\n"), name);
} else { } else {
vshError(ctl, _("Failed to delete snapshot %s"), name); vshError(ctl, _("Failed to delete snapshot %s"), name);
goto cleanup; goto cleanup;

View File

@ -349,7 +349,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("Failed to create vol %s"), name); vshError(ctl, _("Failed to create vol %s"), name);
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("Vol %s created\n"), name); vshPrintExtra(ctl, _("Vol %s created\n"), name);
} }
ret = true; ret = true;
@ -411,7 +411,7 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd)
} }
if ((vol = virStorageVolCreateXML(pool, buffer, flags))) { if ((vol = virStorageVolCreateXML(pool, buffer, flags))) {
vshPrint(ctl, _("Vol %s created from %s\n"), vshPrintExtra(ctl, _("Vol %s created from %s\n"),
virStorageVolGetName(vol), from); virStorageVolGetName(vol), from);
virStorageVolFree(vol); virStorageVolFree(vol);
ret = true; ret = true;
@ -490,7 +490,7 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd)
newvol = virStorageVolCreateXMLFrom(pool, buffer, inputvol, flags); newvol = virStorageVolCreateXMLFrom(pool, buffer, inputvol, flags);
if (newvol != NULL) { if (newvol != NULL) {
vshPrint(ctl, _("Vol %s created from input vol %s\n"), vshPrintExtra(ctl, _("Vol %s created from input vol %s\n"),
virStorageVolGetName(newvol), virStorageVolGetName(inputvol)); virStorageVolGetName(newvol), virStorageVolGetName(inputvol));
} else { } else {
vshError(ctl, _("Failed to create vol from %s"), from); vshError(ctl, _("Failed to create vol from %s"), from);
@ -612,7 +612,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
newvol = virStorageVolCreateXMLFrom(origpool, (char *) newxml, origvol, flags); newvol = virStorageVolCreateXMLFrom(origpool, (char *) newxml, origvol, flags);
if (newvol != NULL) { if (newvol != NULL) {
vshPrint(ctl, _("Vol %s cloned from %s\n"), vshPrintExtra(ctl, _("Vol %s cloned from %s\n"),
virStorageVolGetName(newvol), virStorageVolGetName(origvol)); virStorageVolGetName(newvol), virStorageVolGetName(origvol));
} else { } else {
vshError(ctl, _("Failed to clone vol from %s"), vshError(ctl, _("Failed to clone vol from %s"),
@ -879,7 +879,7 @@ cmdVolDelete(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS; flags |= VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS;
if (virStorageVolDelete(vol, flags) == 0) { if (virStorageVolDelete(vol, flags) == 0) {
vshPrint(ctl, _("Vol %s deleted\n"), name); vshPrintExtra(ctl, _("Vol %s deleted\n"), name);
} else { } else {
vshError(ctl, _("Failed to delete vol %s"), name); vshError(ctl, _("Failed to delete vol %s"), name);
ret = false; ret = false;
@ -950,7 +950,7 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd)
goto out; goto out;
} }
vshPrint(ctl, _("Vol %s wiped\n"), name); vshPrintExtra(ctl, _("Vol %s wiped\n"), name);
ret = true; ret = true;
out: out:
virStorageVolFree(vol); virStorageVolFree(vol);