[PATCH] Add hypervisor version information to the Caption field of the VSMS

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1216826114 25200 # Node ID 8d236493f5d67a952bfab94a3fc19a34b3fdf394 # Parent caa024a3a0938bcb709df190a02fcce0d738c165 Add hypervisor version information to the Caption field of the VSMS. I don't really see anywhere else this fits into the model, so setting the caption as such seems reasonable to me. Comments and arguments are welcome :) Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r caa024a3a093 -r 8d236493f5d6 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Jul 23 07:53:08 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 23 08:15:14 2008 -0700 @@ -1706,6 +1706,9 @@ const char *name = NULL; const char *ccname = NULL; virConnectPtr conn = NULL; + unsigned long hv_version = 0; + const char * hv_type = NULL; + char *caption = NULL; *_inst = NULL; conn = connect_by_classname(broker, CLASSNAME(reference), &s); @@ -1742,6 +1745,30 @@ goto out; } + hv_type = virConnectGetType(conn); + if (hv_type == NULL) + hv_type = "Unkown"; + + if (virConnectGetVersion(conn, &hv_version) < 0) { + CU_DEBUG("Unable to get hypervisor version"); + hv_version = 0; + } + + if (asprintf(&caption, + "%s %lu.%lu.%lu", + hv_type, + hv_version / 1000000, + (hv_version % 1000000) / 1000, + (hv_version % 1000000) % 1000) == -1) + caption = NULL; + + if (caption != NULL) + CMSetProperty(inst, "Caption", + (CMPIValue *)caption, CMPI_chars); + else + CMSetProperty(inst, "Caption", + (CMPIValue *)"Unknown Hypervisor", CMPI_chars); + CMSetProperty(inst, "Name", (CMPIValue *)"Management Service", CMPI_chars); @@ -1767,6 +1794,7 @@ CMPI_RC_OK, ""); out: + free(caption); virConnectClose(conn); *_inst = inst;

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1216826114 25200 # Node ID 8d236493f5d67a952bfab94a3fc19a34b3fdf394 # Parent caa024a3a0938bcb709df190a02fcce0d738c165 Add hypervisor version information to the Caption field of the VSMS.
I don't really see anywhere else this fits into the model, so setting the caption as such seems reasonable to me.
Comments and arguments are welcome :)
Is there any plan to use the caption for anything else. If so, formatting the hypervisor version in this way might make it difficult to parse the string. You'd end up with something like: "QEMU 0.9.1 myotherinfohere" -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

KR> Is there any plan to use the caption for anything else. I dunno. KR> If so, formatting the hypervisor version in this way might make it KR> difficult to parse the string. You'd end up with something like: KR> "QEMU 0.9.1 myotherinfohere" I hear complaints but no suggestions :) We could certainly add an attribute to the service, if you'd rather. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

KR> If so, formatting the hypervisor version in this way might make it KR> difficult to parse the string. You'd end up with something like:
KR> "QEMU 0.9.1 myotherinfohere"
I hear complaints but no suggestions :)
Fair enough. =) You could add some kind of demarcation between items, but you'd have to ensure that demarcation won't potentially show up as part of a string. You could also do something like: "Hypervisor: QEMU 0.9.1" Or, we can just handle that case when it happens. I have no real complaints with it how it is.
We could certainly add an attribute to the service, if you'd rather.
Naa.. adding yet another attribute isn't worthwhile. I agree with the choice you made here. I forgot to note - I tested this out. +1 in that regard. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

KR> Fair enough. =) You could add some kind of demarcation between KR> items, but you'd have to ensure that demarcation won't potentially KR> show up as part of a string. KR> You could also do something like: "Hypervisor: QEMU 0.9.1" My problem with that is that I believe the caption is intended to be something displayed by a client to a user. Either as a part of a larger client-generated string, or as it is. Doing something like the above, or trying to make the values separated by a delimiter means that the client is forced to parse it up to display it the way they want. For example, if they wanted to display the caption as: "Xen System: $CAPTION" It might break some visual guidelines to have that read: "Xen System: Hypervisor: QEMU 0.9.1" which is kinda awkward. So, I dunno, it's not a very formal interface and thus shouldn't really be parsed by the client as it could change. But if we try to strive for something that could reasonably be displayed to the user as it is, that seems reasonable to me. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> Fair enough. =) You could add some kind of demarcation between KR> items, but you'd have to ensure that demarcation won't potentially KR> show up as part of a string.
KR> You could also do something like: "Hypervisor: QEMU 0.9.1"
My problem with that is that I believe the caption is intended to be something displayed by a client to a user. Either as a part of a larger client-generated string, or as it is. Doing something like the above, or trying to make the values separated by a delimiter means that the client is forced to parse it up to display it the way they want. For example, if they wanted to display the caption as:
"Xen System: $CAPTION"
It might break some visual guidelines to have that read:
"Xen System: Hypervisor: QEMU 0.9.1"
which is kinda awkward.
This is a really good point. I fine with this. Especially since we aren't planning to put anything else there at the moment. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert