提交 b620bdee 编写于 作者: P Pino Toscano 提交者: Michal Privoznik

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
上级 c74cae23
......@@ -36,7 +36,6 @@ test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1
Persistent: yes
Domain test has been undefined
Persistent: no
EOF
compare exp out || fail=1
......@@ -48,7 +47,6 @@ test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1
Persistent: yes
Domain 1 has been undefined
Persistent: no
EOF
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
test $? = 1 || fail=1
cat <<\EOF > expout || fail=1
Domain test is being shutdown
Domain test has been undefined
error: failed to get domain 'test'
error: Domain not found
EOF
......
......@@ -284,7 +284,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, "%s", _("Device attached successfully\n"));
vshPrintExtra(ctl, "%s", _("Device attached successfully\n"));
ret = true;
cleanup:
......@@ -764,7 +764,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
if (ret != 0) {
vshError(ctl, "%s", _("Failed to attach disk"));
} else {
vshPrint(ctl, "%s", _("Disk attached successfully\n"));
vshPrintExtra(ctl, "%s", _("Disk attached successfully\n"));
functionReturn = true;
}
......@@ -1075,7 +1075,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
if (ret != 0) {
vshError(ctl, "%s", _("Failed to attach interface"));
} else {
vshPrint(ctl, "%s", _("Interface attached successfully\n"));
vshPrintExtra(ctl, "%s", _("Interface attached successfully\n"));
functionReturn = true;
}
......@@ -1131,9 +1131,9 @@ cmdAutostart(vshControl *ctl, const vshCmd *cmd)
}
if (autostart)
vshPrint(ctl, _("Domain %s marked as autostarted\n"), name);
vshPrintExtra(ctl, _("Domain %s marked as autostarted\n"), name);
else
vshPrint(ctl, _("Domain %s unmarked as autostarted\n"), name);
vshPrintExtra(ctl, _("Domain %s unmarked as autostarted\n"), name);
virDomainFree(dom);
return true;
......@@ -2915,7 +2915,7 @@ cmdBlockResize(vshControl *ctl, const vshCmd *cmd)
if (virDomainBlockResize(dom, path, size, flags) < 0) {
vshError(ctl, _("Failed to resize block device '%s'"), path);
} else {
vshPrint(ctl, _("Block device '%s' is resized"), path);
vshPrintExtra(ctl, _("Block device '%s' is resized"), path);
ret = true;
}
......@@ -3185,7 +3185,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("Failed to update interface link state"));
goto cleanup;
} else {
vshPrint(ctl, "%s", _("Device updated successfully\n"));
vshPrintExtra(ctl, "%s", _("Device updated successfully\n"));
ret = true;
}
......@@ -3424,7 +3424,7 @@ cmdSuspend(vshControl *ctl, const vshCmd *cmd)
return false;
if (virDomainSuspend(dom) == 0) {
vshPrint(ctl, _("Domain %s suspended\n"), name);
vshPrintExtra(ctl, _("Domain %s suspended\n"), name);
} else {
vshError(ctl, _("Failed to suspend domain %s"), name);
ret = false;
......@@ -3503,7 +3503,7 @@ cmdDomPMSuspend(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("Domain %s successfully suspended"),
vshPrintExtra(ctl, _("Domain %s successfully suspended"),
virDomainGetName(dom));
ret = true;
......@@ -3550,8 +3550,8 @@ cmdDomPMWakeup(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("Domain %s successfully woken up"),
virDomainGetName(dom));
vshPrintExtra(ctl, _("Domain %s successfully woken up"),
virDomainGetName(dom));
ret = true;
......@@ -3913,7 +3913,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
out:
if (rc == 0) {
vshPrint(ctl, _("Domain %s has been undefined\n"), name);
vshPrintExtra(ctl, _("Domain %s has been undefined\n"), name);
ret = true;
} else {
vshError(ctl, _("Failed to undefine domain %s"), name);
......@@ -3924,15 +3924,15 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
if (nvols) {
for (i = 0; i < nvols; i++) {
if (wipe_storage) {
vshPrint(ctl, _("Wiping volume '%s'(%s) ... "),
vols[i].target, vols[i].source);
vshPrintExtra(ctl, _("Wiping volume '%s'(%s) ... "),
vols[i].target, vols[i].source);
fflush(stdout);
if (virStorageVolWipe(vols[i].vol, 0) < 0) {
vshError(ctl, _("Failed! Volume not removed."));
ret = false;
continue;
} else {
vshPrint(ctl, _("Done.\n"));
vshPrintExtra(ctl, _("Done.\n"));
}
}
......@@ -3942,8 +3942,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
vols[i].target, vols[i].source);
ret = false;
} else {
vshPrint(ctl, _("Volume '%s'(%s) removed.\n"),
vols[i].target, vols[i].source);
vshPrintExtra(ctl, _("Volume '%s'(%s) removed.\n"),
vols[i].target, vols[i].source);
}
}
}
......@@ -4138,8 +4138,8 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
}
started:
vshPrint(ctl, _("Domain %s started\n"),
virDomainGetName(dom));
vshPrintExtra(ctl, _("Domain %s started\n"),
virDomainGetName(dom));
#ifndef WIN32
if (console && !cmdRunConsole(ctl, dom, NULL, 0))
goto cleanup;
......@@ -4404,7 +4404,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread);
if (ret)
vshPrint(ctl, _("\nDomain %s saved to %s\n"), name, to);
vshPrintExtra(ctl, _("\nDomain %s saved to %s\n"), name, to);
cleanup:
virDomainFree(dom);
......@@ -4520,7 +4520,7 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("State file %s updated.\n"), file);
vshPrintExtra(ctl, _("State file %s updated.\n"), file);
ret = true;
cleanup:
......@@ -4711,7 +4711,7 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread);
if (ret)
vshPrint(ctl, _("\nDomain %s state saved by libvirt\n"), name);
vshPrintExtra(ctl, _("\nDomain %s state saved by libvirt\n"), name);
cleanup:
virDomainFree(dom);
......@@ -4762,11 +4762,11 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
else
vshPrint(ctl, _("Removed managedsave image for domain %s"), name);
vshPrintExtra(ctl, _("Removed managedsave image for domain %s"), name);
}
else
vshPrint(ctl, _("Domain %s has no manage save image; removal skipped"),
name);
vshPrintExtra(ctl, _("Domain %s has no manage save image; removal skipped"),
name);
ret = true;
......@@ -5078,7 +5078,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("Domain restored from %s\n"), from);
vshPrintExtra(ctl, _("Domain restored from %s\n"), from);
ret = true;
cleanup:
......@@ -5251,7 +5251,7 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread);
if (ret)
vshPrint(ctl, _("\nDomain %s dumped to %s\n"), name, to);
vshPrintExtra(ctl, _("\nDomain %s dumped to %s\n"), name, to);
cleanup:
virDomainFree(dom);
......@@ -5385,7 +5385,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
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;
cleanup:
......@@ -5458,7 +5458,7 @@ cmdSetUserPassword(vshControl *ctl, const vshCmd *cmd)
if (virDomainSetUserPassword(dom, user, password, flags) < 0)
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;
cleanup:
......@@ -5494,7 +5494,7 @@ cmdResume(vshControl *ctl, const vshCmd *cmd)
return false;
if (virDomainResume(dom) == 0) {
vshPrint(ctl, _("Domain %s resumed\n"), name);
vshPrintExtra(ctl, _("Domain %s resumed\n"), name);
} else {
vshError(ctl, _("Failed to resume domain %s"), name);
ret = false;
......@@ -5575,7 +5575,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd)
else
rv = virDomainShutdown(dom);
if (rv == 0) {
vshPrint(ctl, _("Domain %s is being shutdown\n"), name);
vshPrintExtra(ctl, _("Domain %s is being shutdown\n"), name);
} else {
vshError(ctl, _("Failed to shutdown domain %s"), name);
goto cleanup;
......@@ -5655,7 +5655,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
if (virDomainReboot(dom, flags) == 0) {
vshPrint(ctl, _("Domain %s is being rebooted\n"), name);
vshPrintExtra(ctl, _("Domain %s is being rebooted\n"), name);
} else {
vshError(ctl, _("Failed to reboot domain %s"), name);
goto cleanup;
......@@ -5698,7 +5698,7 @@ cmdReset(vshControl *ctl, const vshCmd *cmd)
return false;
if (virDomainReset(dom, 0) == 0) {
vshPrint(ctl, _("Domain %s was reset\n"), name);
vshPrintExtra(ctl, _("Domain %s was reset\n"), name);
} else {
vshError(ctl, _("Failed to reset domain %s"), name);
ret = false;
......@@ -7622,8 +7622,8 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("Domain %s created from %s\n"),
virDomainGetName(dom), from);
vshPrintExtra(ctl, _("Domain %s created from %s\n"),
virDomainGetName(dom), from);
#ifndef WIN32
if (console)
cmdRunConsole(ctl, dom, NULL, 0);
......@@ -7685,8 +7685,8 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (dom != NULL) {
vshPrint(ctl, _("Domain %s defined from %s\n"),
virDomainGetName(dom), from);
vshPrintExtra(ctl, _("Domain %s defined from %s\n"),
virDomainGetName(dom), from);
virDomainFree(dom);
} else {
vshError(ctl, _("Failed to define domain from %s"), from);
......@@ -7738,7 +7738,7 @@ cmdDestroy(vshControl *ctl, const vshCmd *cmd)
result = virDomainDestroy(dom);
if (result == 0) {
vshPrint(ctl, _("Domain %s destroyed\n"), name);
vshPrintExtra(ctl, _("Domain %s destroyed\n"), name);
} else {
vshError(ctl, _("Failed to destroy domain %s"), name);
ret = false;
......@@ -7867,9 +7867,9 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
/* Compare original XML with edited. Has it changed at all? */
if (STREQ(desc, desc_edited)) {
vshPrint(ctl, "%s",
title ? _("Domain title not changed\n") :
_("Domain description not changed\n"));
vshPrintExtra(ctl, "%s",
title ? _("Domain title not changed\n") :
_("Domain description not changed\n"));
ret = true;
goto cleanup;
}
......@@ -7885,9 +7885,9 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
_("Failed to set new domain description"));
goto cleanup;
}
vshPrint(ctl, "%s",
title ? _("Domain title updated successfully") :
_("Domain description updated successfully"));
vshPrintExtra(ctl, "%s",
title ? _("Domain title updated successfully") :
_("Domain description updated successfully"));
} else {
desc = virshGetDomainDescription(ctl, dom, title,
config?VIR_DOMAIN_XML_INACTIVE:0);
......@@ -7897,10 +7897,10 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
if (strlen(desc) > 0)
vshPrint(ctl, "%s", desc);
else
vshPrint(ctl,
title ? _("No title for domain: %s") :
_("No description for domain: %s"),
virDomainGetName(dom));
vshPrintExtra(ctl,
title ? _("No title for domain: %s") :
_("No description for domain: %s"),
virDomainGetName(dom));
}
ret = true;
......@@ -8022,15 +8022,15 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
if (rem)
vshPrint(ctl, "%s\n", _("Metadata removed"));
vshPrintExtra(ctl, "%s\n", _("Metadata removed"));
else
vshPrint(ctl, "%s\n", _("Metadata modified"));
vshPrintExtra(ctl, "%s\n", _("Metadata modified"));
} else if (edit) {
#define EDIT_GET_XML \
virshDomainGetEditMetadata(ctl, dom, uri, flags)
#define EDIT_NOT_CHANGED \
do { \
vshPrint(ctl, "%s", _("Metadata not changed")); \
vshPrintExtra(ctl, "%s", _("Metadata not changed")); \
ret = true; \
goto edit_cleanup; \
} while (0)
......@@ -8040,7 +8040,7 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd)
key, uri, flags) == 0)
#include "virsh-edit.c"
vshPrint(ctl, "%s\n", _("Metadata modified"));
vshPrintExtra(ctl, "%s\n", _("Metadata modified"));
} else {
char *data;
/* get */
......@@ -9194,8 +9194,8 @@ cmdQemuAttach(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("Domain %s attached to pid %u\n"),
virDomainGetName(dom), pid_value);
vshPrintExtra(ctl, _("Domain %s attached to pid %u\n"),
virDomainGetName(dom), pid_value);
virDomainFree(dom);
ret = true;
......@@ -9723,7 +9723,7 @@ cmdDomrename(vshControl *ctl, const vshCmd *cmd)
if (virDomainRename(dom, new_name, 0) < 0)
goto cleanup;
vshPrint(ctl, "Domain successfully renamed\n");
vshPrintExtra(ctl, "Domain successfully renamed\n");
ret = true;
cleanup:
......@@ -11220,7 +11220,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, "%s", _("Device detached successfully\n"));
vshPrintExtra(ctl, "%s", _("Device detached successfully\n"));
funcRet = true;
cleanup:
......@@ -11302,7 +11302,7 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, "%s", _("Device updated successfully\n"));
vshPrintExtra(ctl, "%s", _("Device updated successfully\n"));
ret = true;
cleanup:
......@@ -11489,7 +11489,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
if (!ret) {
vshError(ctl, "%s", _("Failed to detach interface"));
} else {
vshPrint(ctl, "%s", _("Interface detached successfully\n"));
vshPrintExtra(ctl, "%s", _("Interface detached successfully\n"));
}
VIR_FREE(doc_live);
VIR_FREE(doc_config);
......@@ -11843,7 +11843,7 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, "%s", _("Disk detached successfully\n"));
vshPrintExtra(ctl, "%s", _("Disk detached successfully\n"));
functionReturn = true;
cleanup:
......
......@@ -540,8 +540,8 @@ cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (iface != NULL) {
vshPrint(ctl, _("Interface %s defined from %s\n"),
virInterfaceGetName(iface), from);
vshPrintExtra(ctl, _("Interface %s defined from %s\n"),
virInterfaceGetName(iface), from);
virInterfaceFree(iface);
} else {
vshError(ctl, _("Failed to define interface from %s"), from);
......@@ -579,7 +579,7 @@ cmdInterfaceUndefine(vshControl *ctl, const vshCmd *cmd)
return false;
if (virInterfaceUndefine(iface) == 0) {
vshPrint(ctl, _("Interface %s undefined\n"), name);
vshPrintExtra(ctl, _("Interface %s undefined\n"), name);
} else {
vshError(ctl, _("Failed to undefine interface %s"), name);
ret = false;
......@@ -618,7 +618,7 @@ cmdInterfaceStart(vshControl *ctl, const vshCmd *cmd)
return false;
if (virInterfaceCreate(iface, 0) == 0) {
vshPrint(ctl, _("Interface %s started\n"), name);
vshPrintExtra(ctl, _("Interface %s started\n"), name);
} else {
vshError(ctl, _("Failed to start interface %s"), name);
ret = false;
......@@ -657,7 +657,7 @@ cmdInterfaceDestroy(vshControl *ctl, const vshCmd *cmd)
return false;
if (virInterfaceDestroy(iface, 0) == 0) {
vshPrint(ctl, _("Interface %s destroyed\n"), name);
vshPrintExtra(ctl, _("Interface %s destroyed\n"), name);
} else {
vshError(ctl, _("Failed to destroy interface %s"), name);
ret = false;
......@@ -696,7 +696,7 @@ cmdInterfaceBegin(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false;
}
vshPrint(ctl, "%s", _("Network config change transaction started\n"));
vshPrintExtra(ctl, "%s", _("Network config change transaction started\n"));
return true;
}
......@@ -727,7 +727,7 @@ cmdInterfaceCommit(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false;
}
vshPrint(ctl, "%s", _("Network config change transaction committed\n"));
vshPrintExtra(ctl, "%s", _("Network config change transaction committed\n"));
return true;
}
......@@ -758,7 +758,7 @@ cmdInterfaceRollback(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false;
}
vshPrint(ctl, "%s", _("Network config change transaction rolled back\n"));
vshPrintExtra(ctl, "%s", _("Network config change transaction rolled back\n"));
return true;
}
......
......@@ -123,9 +123,9 @@ cmdNetworkAutostart(vshControl *ctl, const vshCmd *cmd)
}
if (autostart)
vshPrint(ctl, _("Network %s marked as autostarted\n"), name);
vshPrintExtra(ctl, _("Network %s marked as autostarted\n"), name);
else
vshPrint(ctl, _("Network %s unmarked as autostarted\n"), name);
vshPrintExtra(ctl, _("Network %s unmarked as autostarted\n"), name);
virNetworkFree(network);
return true;
......@@ -168,8 +168,8 @@ cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (network != NULL) {
vshPrint(ctl, _("Network %s created from %s\n"),
virNetworkGetName(network), from);
vshPrintExtra(ctl, _("Network %s created from %s\n"),
virNetworkGetName(network), from);
virNetworkFree(network);
} else {
vshError(ctl, _("Failed to create network from %s"), from);
......@@ -216,8 +216,8 @@ cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (network != NULL) {
vshPrint(ctl, _("Network %s defined from %s\n"),
virNetworkGetName(network), from);
vshPrintExtra(ctl, _("Network %s defined from %s\n"),
virNetworkGetName(network), from);
virNetworkFree(network);
} else {
vshError(ctl, _("Failed to define network from %s"), from);
......@@ -255,7 +255,7 @@ cmdNetworkDestroy(vshControl *ctl, const vshCmd *cmd)
return false;
if (virNetworkDestroy(network) == 0) {
vshPrint(ctl, _("Network %s destroyed\n"), name);
vshPrintExtra(ctl, _("Network %s destroyed\n"), name);
} else {
vshError(ctl, _("Failed to destroy network %s"), name);
ret = false;
......@@ -794,7 +794,7 @@ cmdNetworkStart(vshControl *ctl, const vshCmd *cmd)
return false;
if (virNetworkCreate(network) == 0) {
vshPrint(ctl, _("Network %s started\n"), name);
vshPrintExtra(ctl, _("Network %s started\n"), name);
} else {
vshError(ctl, _("Failed to start network %s"), name);
ret = false;
......@@ -832,7 +832,7 @@ cmdNetworkUndefine(vshControl *ctl, const vshCmd *cmd)
return false;
if (virNetworkUndefine(network) == 0) {
vshPrint(ctl, _("Network %s has been undefined\n"), name);
vshPrintExtra(ctl, _("Network %s has been undefined\n"), name);
} else {
vshError(ctl, _("Failed to undefine network %s"), name);
ret = false;
......
......@@ -75,8 +75,8 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (dev != NULL) {
vshPrint(ctl, _("Node device %s created from %s\n"),
virNodeDeviceGetName(dev), from);
vshPrintExtra(ctl, _("Node device %s created from %s\n"),
virNodeDeviceGetName(dev), from);
virNodeDeviceFree(dev);
} else {
vshError(ctl, _("Failed to create node device from %s"), from);
......@@ -148,7 +148,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
}
if (virNodeDeviceDestroy(dev) == 0) {
vshPrint(ctl, _("Destroyed node device '%s'\n"), device_value);
vshPrintExtra(ctl, _("Destroyed node device '%s'\n"), device_value);
} else {
vshError(ctl, _("Failed to destroy node device '%s'"), device_value);
goto cleanup;
......@@ -632,7 +632,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
}
if (ret)
vshPrint(ctl, _("Device %s detached\n"), name);
vshPrintExtra(ctl, _("Device %s detached\n"), name);
else
vshError(ctl, _("Failed to detach device %s"), name);
......@@ -680,7 +680,7 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd)
}
if (virNodeDeviceReAttach(device) == 0) {
vshPrint(ctl, _("Device %s re-attached\n"), name);
vshPrintExtra(ctl, _("Device %s re-attached\n"), name);
} else {
vshError(ctl, _("Failed to re-attach device %s"), name);
ret = false;
......@@ -730,7 +730,7 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd)
}
if (virNodeDeviceReset(device) == 0) {
vshPrint(ctl, _("Device %s reset\n"), name);
vshPrintExtra(ctl, _("Device %s reset\n"), name);
} else {
vshError(ctl, _("Failed to reset device %s"), name);
ret = false;
......
......@@ -109,8 +109,8 @@ cmdNWFilterDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (nwfilter != NULL) {
vshPrint(ctl, _("Network filter %s defined from %s\n"),
virNWFilterGetName(nwfilter), from);
vshPrintExtra(ctl, _("Network filter %s defined from %s\n"),
virNWFilterGetName(nwfilter), from);
virNWFilterFree(nwfilter);
} else {
vshError(ctl, _("Failed to define network filter from %s"), from);
......@@ -152,7 +152,7 @@ cmdNWFilterUndefine(vshControl *ctl, const vshCmd *cmd)
return false;
if (virNWFilterUndefine(nwfilter) == 0) {
vshPrint(ctl, _("Network filter %s undefined\n"), name);
vshPrintExtra(ctl, _("Network filter %s undefined\n"), name);
} else {
vshError(ctl, _("Failed to undefine network filter %s"), name);
ret = false;
......
......@@ -209,9 +209,9 @@ cmdPoolAutostart(vshControl *ctl, const vshCmd *cmd)
}
if (autostart)
vshPrint(ctl, _("Pool %s marked as autostarted\n"), name);
vshPrintExtra(ctl, _("Pool %s marked as autostarted\n"), name);
else
vshPrint(ctl, _("Pool %s unmarked as autostarted\n"), name);
vshPrintExtra(ctl, _("Pool %s unmarked as autostarted\n"), name);
virStoragePoolFree(pool);
return true;
......@@ -276,8 +276,8 @@ cmdPoolCreate(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s created from %s\n"),
virStoragePoolGetName(pool), from);
vshPrintExtra(ctl, _("Pool %s created from %s\n"),
virStoragePoolGetName(pool), from);
virStoragePoolFree(pool);
} else {
vshError(ctl, _("Failed to create pool from %s"), from);
......@@ -449,7 +449,7 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(xml);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s created\n"), name);
vshPrintExtra(ctl, _("Pool %s created\n"), name);
virStoragePoolFree(pool);
} else {
vshError(ctl, _("Failed to create pool %s"), name);
......@@ -498,8 +498,8 @@ cmdPoolDefine(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(buffer);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s defined from %s\n"),
virStoragePoolGetName(pool), from);
vshPrintExtra(ctl, _("Pool %s defined from %s\n"),
virStoragePoolGetName(pool), from);
virStoragePoolFree(pool);
} else {
vshError(ctl, _("Failed to define pool from %s"), from);
......@@ -541,7 +541,7 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(xml);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s defined\n"), name);
vshPrintExtra(ctl, _("Pool %s defined\n"), name);
virStoragePoolFree(pool);
} else {
vshError(ctl, _("Failed to define pool %s"), name);
......@@ -590,7 +590,7 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_STORAGE_POOL_BUILD_OVERWRITE;
if (virStoragePoolBuild(pool, flags) == 0) {
vshPrint(ctl, _("Pool %s built\n"), name);
vshPrintExtra(ctl, _("Pool %s built\n"), name);
} else {
vshError(ctl, _("Failed to build pool %s"), name);
ret = false;
......@@ -631,7 +631,7 @@ cmdPoolDestroy(vshControl *ctl, const vshCmd *cmd)
return false;
if (virStoragePoolDestroy(pool) == 0) {
vshPrint(ctl, _("Pool %s destroyed\n"), name);
vshPrintExtra(ctl, _("Pool %s destroyed\n"), name);
} else {
vshError(ctl, _("Failed to destroy pool %s"), name);
ret = false;
......@@ -671,7 +671,7 @@ cmdPoolDelete(vshControl *ctl, const vshCmd *cmd)
return false;
if (virStoragePoolDelete(pool, 0) == 0) {
vshPrint(ctl, _("Pool %s deleted\n"), name);
vshPrintExtra(ctl, _("Pool %s deleted\n"), name);
} else {
vshError(ctl, _("Failed to delete pool %s"), name);
ret = false;
......@@ -711,7 +711,7 @@ cmdPoolRefresh(vshControl *ctl, const vshCmd *cmd)
return false;
if (virStoragePoolRefresh(pool, 0) == 0) {
vshPrint(ctl, _("Pool %s refreshed\n"), name);
vshPrintExtra(ctl, _("Pool %s refreshed\n"), name);
} else {
vshError(ctl, _("Failed to refresh pool %s"), name);
ret = false;
......@@ -1732,7 +1732,7 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE;
if (virStoragePoolCreate(pool, flags) == 0) {
vshPrint(ctl, _("Pool %s started\n"), name);
vshPrintExtra(ctl, _("Pool %s started\n"), name);
} else {
vshError(ctl, _("Failed to start pool %s"), name);
ret = false;
......@@ -1772,7 +1772,7 @@ cmdPoolUndefine(vshControl *ctl, const vshCmd *cmd)
return false;
if (virStoragePoolUndefine(pool) == 0) {
vshPrint(ctl, _("Pool %s has been undefined\n"), name);
vshPrintExtra(ctl, _("Pool %s has been undefined\n"), name);
} else {
vshError(ctl, _("Failed to undefine pool %s"), name);
ret = false;
......
......@@ -104,7 +104,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
vshPrint(ctl, _("Secret %s created\n"), uuid);
vshPrintExtra(ctl, _("Secret %s created\n"), uuid);
ret = true;
cleanup:
......@@ -219,7 +219,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, "%s", _("Failed to set secret value"));
goto cleanup;
}
vshPrint(ctl, "%s", _("Secret value set\n"));
vshPrintExtra(ctl, "%s", _("Secret value set\n"));
ret = true;
cleanup:
......@@ -316,7 +316,7 @@ cmdSecretUndefine(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("Failed to delete secret %s"), uuid);
goto cleanup;
}
vshPrint(ctl, _("Secret %s deleted\n"), uuid);
vshPrintExtra(ctl, _("Secret %s deleted\n"), uuid);
ret = true;
cleanup:
......
......@@ -97,9 +97,9 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
}
if (from)
vshPrint(ctl, _("Domain snapshot %s created from '%s'"), name, from);
vshPrintExtra(ctl, _("Domain snapshot %s created from '%s'"), name, from);
else
vshPrint(ctl, _("Domain snapshot %s created"), name);
vshPrintExtra(ctl, _("Domain snapshot %s created"), name);
ret = true;
......@@ -575,10 +575,10 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
edited_name = virDomainSnapshotGetName(edited);
if (STREQ(name, edited_name)) {
vshPrint(ctl, _("Snapshot %s edited.\n"), name);
vshPrintExtra(ctl, _("Snapshot %s edited.\n"), name);
} else if (clone_okay) {
vshPrint(ctl, _("Snapshot %s cloned to %s.\n"), name,
edited_name);
vshPrintExtra(ctl, _("Snapshot %s cloned to %s.\n"), name,
edited_name);
} else {
unsigned int delete_flags;
......@@ -683,7 +683,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
virDomainSnapshotFree(snapshot2);
vshPrint(ctl, _("Snapshot %s set as current"), snapshotname);
vshPrintExtra(ctl, _("Snapshot %s set as current"), snapshotname);
ret = true;
goto cleanup;
}
......@@ -1927,9 +1927,9 @@ cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd)
* list of descendants. But that's a lot of code to maintain. */
if (virDomainSnapshotDelete(snapshot, flags) == 0) {
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
vshPrint(ctl, _("Domain snapshot %s deleted\n"), name);
vshPrintExtra(ctl, _("Domain snapshot %s deleted\n"), name);
} else {
vshError(ctl, _("Failed to delete snapshot %s"), name);
goto cleanup;
......
......@@ -349,7 +349,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("Failed to create vol %s"), name);
goto cleanup;
}
vshPrint(ctl, _("Vol %s created\n"), name);
vshPrintExtra(ctl, _("Vol %s created\n"), name);
}
ret = true;
......@@ -411,8 +411,8 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd)
}
if ((vol = virStorageVolCreateXML(pool, buffer, flags))) {
vshPrint(ctl, _("Vol %s created from %s\n"),
virStorageVolGetName(vol), from);
vshPrintExtra(ctl, _("Vol %s created from %s\n"),
virStorageVolGetName(vol), from);
virStorageVolFree(vol);
ret = true;
} else {
......@@ -490,8 +490,8 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd)
newvol = virStorageVolCreateXMLFrom(pool, buffer, inputvol, flags);
if (newvol != NULL) {
vshPrint(ctl, _("Vol %s created from input vol %s\n"),
virStorageVolGetName(newvol), virStorageVolGetName(inputvol));
vshPrintExtra(ctl, _("Vol %s created from input vol %s\n"),
virStorageVolGetName(newvol), virStorageVolGetName(inputvol));
} else {
vshError(ctl, _("Failed to create vol from %s"), from);
goto cleanup;
......@@ -612,8 +612,8 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd)
newvol = virStorageVolCreateXMLFrom(origpool, (char *) newxml, origvol, flags);
if (newvol != NULL) {
vshPrint(ctl, _("Vol %s cloned from %s\n"),
virStorageVolGetName(newvol), virStorageVolGetName(origvol));
vshPrintExtra(ctl, _("Vol %s cloned from %s\n"),
virStorageVolGetName(newvol), virStorageVolGetName(origvol));
} else {
vshError(ctl, _("Failed to clone vol from %s"),
virStorageVolGetName(origvol));
......@@ -879,7 +879,7 @@ cmdVolDelete(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS;
if (virStorageVolDelete(vol, flags) == 0) {
vshPrint(ctl, _("Vol %s deleted\n"), name);
vshPrintExtra(ctl, _("Vol %s deleted\n"), name);
} else {
vshError(ctl, _("Failed to delete vol %s"), name);
ret = false;
......@@ -950,7 +950,7 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd)
goto out;
}
vshPrint(ctl, _("Vol %s wiped\n"), name);
vshPrintExtra(ctl, _("Vol %s wiped\n"), name);
ret = true;
out:
virStorageVolFree(vol);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册