[libvirt] [PATCH] Quieten virsh schedinfo for shutoff domain

john.levon at sun.com john.levon at sun.com
Fri Jan 23 01:49:12 UTC 2009


# HG changeset patch
# User john.levon at sun.com
# Date 1232675291 28800
# Node ID 3ef027308b88b47b2f3ca721bf88f2e606d8e3bc
# Parent  903a29e99c80a35ce7f4754a3bcc3ab34bf32d8a
Quieten virsh schedinfo for shutoff domain

Quietly return failure for a shutoff domain in the sched params driver
routines.

Signed-off-by: John Levon <john.levon at sun.com>

diff --git a/src/xen_internal.c b/src/xen_internal.c
--- a/src/xen_internal.c
+++ b/src/xen_internal.c
@@ -1069,11 +1069,17 @@ xenHypervisorGetSchedulerType(virDomainP
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
-    if (priv->handle < 0 || domain->id < 0) {
+    if (priv->handle < 0) {
         virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
-                        "priv->handle or domain->id invalid", 0);
+                        "priv->handle invalid", 0);
         return NULL;
     }
+
+    /*
+     * If it's not running, we can't help.
+     */
+    if (domain->id < 0)
+        return NULL;
 
     /*
      * Support only dom_interface_version >=5
@@ -1144,11 +1150,17 @@ xenHypervisorGetSchedulerParameters(virD
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
-    if (priv->handle < 0 || domain->id < 0) {
+    if (priv->handle < 0) {
         virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
-                        "priv->handle or domain->id invalid", 0);
+                        "priv->handle invalid", 0);
         return -1;
     }
+
+    /*
+     * If it's not running, we can't help.
+     */
+    if (domain->id < 0)
+        return -1;
 
     /*
      * Support only dom_interface_version >=5
@@ -1242,11 +1254,17 @@ xenHypervisorSetSchedulerParameters(virD
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
-    if (priv->handle < 0 || domain->id < 0) {
+    if (priv->handle < 0) {
         virXenErrorFunc (domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
-                         "priv->handle or domain->id invalid", 0);
+                         "priv->handle invalid", 0);
         return -1;
     }
+
+    /*
+     * If it's not running, we can't help.
+     */
+    if (domain->id < 0)
+        return -1;
 
     /*
      * Support only dom_interface_version >=5




More information about the libvir-list mailing list