[libvirt] [PATCH] virsh: desc command in --title mode mentions description instead of title

Peter Krempa pkrempa at redhat.com
Wed Sep 10 08:51:14 UTC 2014


Tweak the messages so that they mention "title" rather than
"description" when operating in title mode. Also fixes one missing "%s"
before non-formatted gettext message.

Before:
 $ virsh desc --title dom
 No description for domain: dom

After:
 $ virsh desc --title dom
 No title for domain: dom

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140034
---
 tools/virsh-domain.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 86deae6..6aa8631 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7219,7 +7219,9 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)

             /* Compare original XML with edited.  Has it changed at all? */
             if (STREQ(desc, desc_edited)) {
-                vshPrint(ctl, _("Domain description not changed.\n"));
+                vshPrint(ctl, "%s",
+                         title ? _("Domain title not changed\n") :
+                                 _("Domain description not changed\n"));
                 ret = true;
                 goto cleanup;
             }
@@ -7231,10 +7233,13 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)

         if (virDomainSetMetadata(dom, type, desc, NULL, NULL, flags) < 0) {
             vshError(ctl, "%s",
-                     _("Failed to set new domain description"));
+                     title ? _("Failed to set new domain title") :
+                             _("Failed to set new domain description"));
             goto cleanup;
         }
-        vshPrint(ctl, "%s", _("Domain description updated successfully"));
+        vshPrint(ctl, "%s",
+                 title ? _("Domain title updated successfully") :
+                         _("Domain description updated successfully"));
     } else {
         desc = vshGetDomainDescription(ctl, dom, title,
                                        config?VIR_DOMAIN_XML_INACTIVE:0);
@@ -7244,7 +7249,9 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
         if (strlen(desc) > 0)
             vshPrint(ctl, "%s", desc);
         else
-            vshPrint(ctl, _("No description for domain: %s"),
+            vshPrint(ctl,
+                     title ? _("No title for domain: %s") :
+                             _("No description for domain: %s"),
                      virDomainGetName(dom));
     }

-- 
2.0.2




More information about the libvir-list mailing list