# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1243891178 10800
# Node ID abc90cae6c08598d0ada357a6cf2f4bb2b2cd1c7
# Parent aa8e071730d2ce20064f1c0295a8005e31ef2cea
Added support to convert data in the internal format to the format used by the BootDevices
property
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r aa8e071730d2 -r abc90cae6c08 schema/VSSD.mof
--- a/schema/VSSD.mof Wed May 20 10:41:46 2009 -0700
+++ b/schema/VSSD.mof Mon Jun 01 18:19:38 2009 -0300
@@ -27,7 +27,7 @@
[Description ("The device to boot from when in fully-virtualized mode."
"One of hd,fd,cdrom.")]
- string BootDevice;
+ string BootDevices[];
[Description ("The emulator the guest should use during runtime.")]
string Emulator;
@@ -42,8 +42,8 @@
class KVM_VirtualSystemSettingData : Virt_VirtualSystemSettingData
{
- [Description ("The device to boot from. One of hd,fd,cdrom.")]
- string BootDevice;
+ [Description ("The list of devices to boot from. hd,fd,cdrom.")]
+ string BootDevices[];
[Description ("The emulator the guest should use during runtime.")]
string Emulator;
diff -r aa8e071730d2 -r abc90cae6c08 src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Wed May 20 10:41:46 2009 -0700
+++ b/src/Virt_VSSD.c Mon Jun 01 18:19:38 2009 -0300
@@ -38,20 +38,79 @@
const static CMPIBroker *_BROKER;
-static void _set_fv_prop(struct domain *dominfo,
- CMPIInstance *inst)
+static CMPIStatus _set_fv_prop(struct domain *dominfo,
+ CMPIInstance *inst)
{
bool fv = true;
+ CMPIArray *array;
+ CMPICount bl_ct;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
if (dominfo->type == DOMAIN_XENFV)
CMSetProperty(inst, "IsFullVirt",
(CMPIValue *)&fv, CMPI_boolean);
- if (dominfo->os_info.fv.boot != NULL)
- CMSetProperty(inst,
- "BootDevice",
- (CMPIValue *)dominfo->os_info.fv.boot,
- CMPI_chars);
+ bl_ct = dominfo->os_info.fv.bootlist_ct;
+ if (bl_ct > 0) {
+ CMPICount i;
+ CMPIStatus s;
+
+ CU_DEBUG("bootlist_ct = %d", bl_ct);
+
+ array = CMNewArray(_BROKER,
+ bl_ct,
+ CMPI_string,
+ &s);
+
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Error creating BootDevice list");
+ goto error;
+ }
+
+ for (i = 0; i < bl_ct; i++) {
+ CMPIString *cm_str;
+
+ CU_DEBUG("BootList[%u]=%s",
+ i,
+ dominfo->os_info.fv.bootlist[i]);
+
+ cm_str = CMNewString(_BROKER,
+ (const char *)dominfo->os_info.
+ fv.bootlist[i],
+ &s);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Error creating CMPIString");
+ goto error;
+ }
+
+ s = CMSetArrayElementAt(array,
+ i,
+ (CMPIValue *)&cm_str,
+ CMPI_string);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Error setting BootDevice array "
+ "element");
+ goto error;
+ }
+ }
+
+ s = CMSetProperty(inst,
+ "BootDevices",
+ (CMPIValue *)&array,
+ CMPI_stringA);
+
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Error setting BootDevices property");
+ goto error;
+ }
+ }
+ return s;
+
+ error:
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to set BootDevices property");
+ return s;
}
static void _set_pv_prop(struct domain *dominfo,
@@ -104,6 +163,7 @@
char *pfx = NULL;
char *vsid = NULL;
int ret = 1;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIObjectPath *op;
struct domain *dominfo = NULL;
@@ -158,7 +218,12 @@
if ((dominfo->type == DOMAIN_XENFV) ||
(dominfo->type == DOMAIN_KVM) || (dominfo->type == DOMAIN_QEMU))
- _set_fv_prop(dominfo, inst);
+ s = _set_fv_prop(dominfo, inst);
+ if (s.rc != CMPI_RC_OK) {
+ ret = 0;
+ goto out;
+ }
+
else if (dominfo->type == DOMAIN_XENPV)
_set_pv_prop(dominfo, inst);
else if (dominfo->type == DOMAIN_LXC)