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

Re: [Libvir] [PATCH] add scheduler API(take 3?)



+char *
+virDomainGetSchedulerType(virDomainPtr domain, int *nparams)
+{
+    virConnectPtr conn;
+    char *schedtype;
+
+    if (domain == NULL) {
+        TODO
+        return NULL;
+    }

Is this case an error, or were you thinking of adding more semantics later on here?

(and the same comment for virDomainGet/SetSchedulerParameters)

+static int
+cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
+{
[...]
+    char *str_weight = strdup("weight");
+    char *str_cap    = strdup("cap");
+
+    nparams = malloc(sizeof(int));
+    *nparams = 0;
+
+    if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+        return FALSE;

There's still a problem memory leak here.


+    /* Currently supports Xen Credit only */
+    weight = vshCommandOptInt(cmd, "weight", &weightfound);
+    if(weightfound){ inputparam++; }
+
+    cap    = vshCommandOptInt(cmd, "cap", &capfound);
+    if(capfound){ inputparam++; }

and can this be made so it isn't Xen-specific?

+    if ((domain == NULL) || (domain->conn == NULL))
+        return -1;
+
+    priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
+    if (priv->handle < 0 || domain->id < 0)
+        return -1;

At the lowest level, these functions should return error messages back to the upper layers. Otherwise users have nothing to diagnose errors with.

+    /*
+     * Support only dom_interface_version >=5
+     * (Xen3.1.0 or later)
+     */
+    if (dom_interface_version < 5)
+        return -1;

Is this because earlier hypervisors didn't support this, or is it just not implemented?

Rich.


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