提交 e3aa4c91 编写于 作者: C Cole Robinson

virsh: Improve change-media success message

$ sudo virsh change-media f19 hdc /mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso
succeeded to complete action update on media

Change the message to:

  Successfully {inserted,ejected,changed} media.

https://bugzilla.redhat.com/show_bug.cgi?id=967946
上级 f2ab1b9e
...@@ -12295,6 +12295,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) ...@@ -12295,6 +12295,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
bool ret = false; bool ret = false;
vshUpdateDiskXMLType update_type; vshUpdateDiskXMLType update_type;
const char *action = NULL; const char *action = NULL;
const char *success_msg = NULL;
bool config = vshCommandOptBool(cmd, "config"); bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live"); bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current"); bool current = vshCommandOptBool(cmd, "current");
...@@ -12314,16 +12315,19 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) ...@@ -12314,16 +12315,19 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
if (eject) { if (eject) {
update_type = VSH_UPDATE_DISK_XML_EJECT; update_type = VSH_UPDATE_DISK_XML_EJECT;
action = "eject"; action = "eject";
success_msg = _("Successfully ejected media.");
} }
if (insert) { if (insert) {
update_type = VSH_UPDATE_DISK_XML_INSERT; update_type = VSH_UPDATE_DISK_XML_INSERT;
action = "insert"; action = "insert";
success_msg = _("Successfully inserted media.");
} }
if (update || (!eject && !insert)) { if (update || (!eject && !insert)) {
update_type = VSH_UPDATE_DISK_XML_UPDATE; update_type = VSH_UPDATE_DISK_XML_UPDATE;
action = "update"; action = "update";
success_msg = _("Successfully updated media.");
} }
VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
...@@ -12367,7 +12371,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) ...@@ -12367,7 +12371,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("succeeded to complete action %s on media\n"), action); vshPrint(ctl, "%s", success_msg);
} }
ret = true; ret = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册