[Libvir] [PATCH][RFC] shows scheduler information

Richard W.M. Jones rjones at redhat.com
Wed Apr 11 13:22:43 UTC 2007


--- libvirt.orig/src/libvirt.c	2007-04-04 23:19:49.000000000 +0900
+++ libvirt.sched/src/libvirt.c	2007-04-06 14:06:08.000000000 +0900
@@ -1423,6 +1423,113 @@ virConnectGetCapabilities (virConnectPtr
      return NULL;
  }

+/**
+ * virDomainGetSchedulerType:
+ * @dom: pointer to the hypervisor connection
+ *
+ * Get the scheduler type.
+ *
+ * Returns NULL in case of error.
+ */
+const char *
+virDomainGetSchedulerType(virDomainPtr domain, int *nparams)

[...]

  /*
+ * xenHypervisorGetSchedulerType:
+ * @domain: pointer to the Xen Hypervisor block
+ *
+ * Do a low level hypercall to get scheduler type
+ *
+ * Returns scheduler name or NULL in case of failure
+ */
+const char *
+xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
+{
[...]
+        switch (op.u.getschedulerid.sched_id){
+        case XEN_SCHEDULER_SEDF:
+            schedulertype = "sedf";
+            *nparams = 6;
+            break;
+        case XEN_SCHEDULER_CREDIT:
+            schedulertype = "credit";
+            *nparams = 2;
+            break;

Please don't return static strings from functions.  It does not work 
well in the remote case.

I don't like the dynamic typing going on in this patch altogether, but 
with the above statically allocated strings, I think this patch should 
not go in in its current form.

Rich.

-- 
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421

Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.
Registered in England and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070411/576a9e47/attachment-0001.bin>


More information about the libvir-list mailing list