[libvirt] [PATCH] Add success output to virsh attach/detach commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The virsh attach-* and detach-* commands don't say
anything if the operation succeeds, which doesn't
seem very polite. The attached adds some simple
feedback.

Thanks,
Cole

commit eda28c5de3d367d001ca89ffc969fcc3c0185abb
Author: Cole Robinson <crobinso@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date:   Thu Aug 21 17:59:13 2008 -0400

    Report success message for virsh attach-* and detach-*

diff --git a/src/virsh.c b/src/virsh.c
index 67d9658..c22cdc4 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -4490,6 +4490,8 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
         vshError(ctl, FALSE, _("Failed to attach device from %s"), from);
         virDomainFree(dom);
         return FALSE;
+    } else {
+        vshPrint(ctl, _("Device attached successfully\n"));
     }
 
     virDomainFree(dom);
@@ -4547,6 +4549,8 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
         vshError(ctl, FALSE, _("Failed to detach device from %s"), from);
         virDomainFree(dom);
         return FALSE;
+    } else {
+        vshPrint(ctl, _("Device detached successfully\n"));
     }
 
     virDomainFree(dom);
@@ -4655,8 +4659,11 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
     if (!buf) goto cleanup;
     strcat(buf, "    </interface>\n");
 
-    if (virDomainAttachDevice(dom, buf))
+    if (virDomainAttachDevice(dom, buf)) {
         goto cleanup;
+    } else {
+        vshPrint(ctl, _("Interface attached successfully\n"));
+    }
 
     ret = TRUE;
 
@@ -4772,8 +4779,10 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
     ret = virDomainDetachDevice(dom, (char *)xmlBufferContent(xml_buf));
     if (ret != 0)
         ret = FALSE;
-    else
+    else {
+        vshPrint(ctl, _("Interface detached successfully\n"));
         ret = TRUE;
+    }
 
  cleanup:
     if (dom)
@@ -4939,6 +4948,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
 
     if (virDomainAttachDevice(dom, buf))
         goto cleanup;
+    else
+        vshPrint(ctl, _("Disk attached successfully\n"));
 
     ret = TRUE;
 
@@ -5046,8 +5057,10 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
     ret = virDomainDetachDevice(dom, (char *)xmlBufferContent(xml_buf));
     if (ret != 0)
         ret = FALSE;
-    else
+    else {
+        vshPrint(ctl, _("Disk detached successfully\n"));
         ret = TRUE;
+    }
 
  cleanup:
     xmlXPathFreeObject(obj);
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]