]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: ensure persistence and autostart are shown for dominfo and pool-info
authorJustin Clift <justin@salasaga.org>
Thu, 17 Jun 2010 07:57:12 +0000 (17:57 +1000)
committerEric Blake <eblake@redhat.com>
Thu, 17 Jun 2010 17:57:54 +0000 (11:57 -0600)
This patch adds the persistence status (yes/no) to the output of the virsh
dominfo and pool-info commands.  This patch also adds the autostart status
to the output of the virsh pool-info command.

Red Hat BZ for this:

  https://bugzilla.redhat.com/show_bug.cgi?id=603696

tests/virshtest.c
tools/virsh.c

index ad3e2fc79fba2f67ea1e704d2922c54305068873..f6790bcd30f128a6d6efd500134c4aed69447777 100644 (file)
@@ -23,6 +23,7 @@ State:          running\n\
 CPU(s):         1\n\
 Max memory:     261072 kB\n\
 Used memory:    131072 kB\n\
+Persistent:     yes\n\
 Autostart:      disable\n\
 \n";
 static const char *domuuid_fc4 = DOM_UUID "\n\n";
index c1037132a53737fbcfacbb94d435aa87bddc751c..db14f55eae135c16fc16d724f586ebe63e0f59b6 100644 (file)
@@ -1910,6 +1910,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
     virDomainPtr dom;
     virSecurityModel secmodel;
     virSecurityLabel seclabel;
+    int persistent = 0;
     int ret = TRUE, autostart;
     unsigned int id;
     char *str, uuid[VIR_UUID_STRING_BUFLEN];
@@ -1963,6 +1964,15 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
         ret = FALSE;
     }
 
+    /* Check and display whether the domain is persistent or not */
+    persistent = virDomainIsPersistent(dom);
+    vshDebug(ctl, 5, "Domain persistent flag value: %d\n", persistent);
+    if (persistent < 0)
+        vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
+    else
+        vshPrint(ctl, "%-15s %s\n", _("Persistent:"), persistent ? _("yes") : _("no"));
+
+    /* Check and display whether the domain autostarts or not */
     if (!virDomainGetAutostart(dom, &autostart)) {
         vshPrint(ctl, "%-15s %s\n", _("Autostart:"),
                  autostart ? _("enable") : _("disable") );
@@ -5141,6 +5151,8 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
 {
     virStoragePoolInfo info;
     virStoragePoolPtr pool;
+    int autostart = 0;
+    int persistent = 0;
     int ret = TRUE;
     char uuid[VIR_UUID_STRING_BUFLEN];
 
@@ -5181,6 +5193,22 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
             break;
         }
 
+        /* Check and display whether the pool is persistent or not */
+        persistent = virStoragePoolIsPersistent(pool);
+        vshDebug(ctl, 5, "Pool persistent flag value: %d\n", persistent);
+        if (persistent < 0)
+            vshPrint(ctl, "%-15s %s\n", _("Persistent:"),  _("unknown"));
+        else
+            vshPrint(ctl, "%-15s %s\n", _("Persistent:"), persistent ? _("yes") : _("no"));
+
+        /* Check and display whether the pool is autostarted or not */
+        virStoragePoolGetAutostart(pool, &autostart);
+        vshDebug(ctl, 5, "Pool autostart flag value: %d\n", autostart);
+        if (autostart < 0)
+            vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart"));
+        else
+            vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") : _("no"));
+
         if (info.state == VIR_STORAGE_POOL_RUNNING ||
             info.state == VIR_STORAGE_POOL_DEGRADED) {
             val = prettyCapacity(info.capacity, &unit);