os-cmpi-xen
changeset 94:eb8803aa395b
Added support for acpi, apic, pae, usb, and usbdevice settings for HVM guests.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author | Jim Fehlig <jfehlig@novell.com> |
---|---|
date | Tue Mar 20 17:53:19 2007 -0600 (2007-03-20) |
parents | 44127f60b2da |
children | 549c7fdf185a |
files | ChangeLog schema/Xen_ComputerSystemSettingData.mof src/Xen_ComputerSystemSettingData_Resource.c src/Xen_VirtualSystemManagementService.c |
line diff
1.1 --- a/ChangeLog Tue Mar 20 16:28:56 2007 -0600 1.2 +++ b/ChangeLog Tue Mar 20 17:53:19 2007 -0600 1.3 @@ -1,3 +1,9 @@ 1.4 +------------------------------------------------------------------- 1.5 +Tue Mar 20 17:51:34 MDT 2007 - jfehlig@novell.com 1.6 + 1.7 + - Added support for acpi, apic, pae, usb, and usbdevice 1.8 + settings for HVM guests. 1.9 + 1.10 ------------------------------------------------------------------- 1.11 Tue Mar 20 16:23:35 MDT 2007 - jfehlig@novell.com 1.12
2.1 --- a/schema/Xen_ComputerSystemSettingData.mof Tue Mar 20 16:28:56 2007 -0600 2.2 +++ b/schema/Xen_ComputerSystemSettingData.mof Tue Mar 20 17:53:19 2007 -0600 2.3 @@ -49,6 +49,22 @@ class Xen_ComputerSystemSettingData : CI 2.4 [Description ("UUID assigned to this domain.")] 2.5 string UUID; 2.6 2.7 + [Description ("Enable/disable virtual APIC in domain.")] 2.8 + boolean apic; 2.9 + 2.10 + [Description ("Enable/disable virtual ACPI in domain.")] 2.11 + boolean acpi; 2.12 + 2.13 + [Description ("Enable/disable PAE in domain.")] 2.14 + boolean pae; 2.15 + 2.16 + [Description ("If \"True\", emulate USB controller in domain.")] 2.17 + boolean usb; 2.18 + 2.19 + [Description ("Specifies type of emulated USB device to add, " 2.20 + "e.g. \"mouse\" or \"tablet\".")] 2.21 + string usbdevice; 2.22 + 2.23 [Description ("Specify whether domain expects virtual hardware " 2.24 "clock to be in local time or UTC.")] 2.25 boolean localtime;
3.1 --- a/src/Xen_ComputerSystemSettingData_Resource.c Tue Mar 20 16:28:56 2007 -0600 3.2 +++ b/src/Xen_ComputerSystemSettingData_Resource.c Tue Mar 20 17:53:19 2007 -0600 3.3 @@ -50,6 +50,18 @@ static int get_platform_bool_val(_RESOUR 3.4 return 0; 3.5 } 3.6 3.7 +static char *get_platform_string_val(_RESOURCE *resource, char *key) 3.8 +{ 3.9 + int i; 3.10 + 3.11 + xen_string_string_map *map = resource->platform; 3.12 + for (i = 0; i < map->size; i++) 3.13 + if (strcmp(map->contents[i].key, key) == 0) 3.14 + return map->contents[i].val; 3.15 + 3.16 + return NULL; 3.17 +} 3.18 + 3.19 3.20 // ---------------------------------------------------------------------------- 3.21 3.22 @@ -143,7 +155,8 @@ int Xen_ComputerSystemSettingData_setIns 3.23 const CMPIBroker * broker) 3.24 { 3.25 char inst_id[1024]; 3.26 - int prop_val; 3.27 + int prop_bool_val; 3.28 + char *prop_string_val; 3.29 3.30 if (resource == NULL) return 0; 3.31 if (CMIsNullObject(instance)) return 0; 3.32 @@ -156,8 +169,24 @@ int Xen_ComputerSystemSettingData_setIns 3.33 /* HVM settings */ 3.34 CMSetProperty(instance, "VirtualSystemType", (CMPIValue *)"Xen HVM", CMPI_chars); 3.35 CMSetProperty(instance, "BootOrder", (CMPIValue *)resource->hvm_boot, CMPI_chars); 3.36 - prop_val = get_platform_bool_val(resource, "stdvga"); 3.37 - CMSetProperty(instance, "stdvga", (CMPIValue *)&prop_val, CMPI_boolean); 3.38 + prop_bool_val = get_platform_bool_val(resource, "stdvga"); 3.39 + CMSetProperty(instance, "stdvga", (CMPIValue *)&prop_bool_val, CMPI_boolean); 3.40 + 3.41 + prop_bool_val = get_platform_bool_val(resource, "apic"); 3.42 + CMSetProperty(instance, "apic", (CMPIValue *)&prop_bool_val, CMPI_boolean); 3.43 + 3.44 + prop_bool_val = get_platform_bool_val(resource, "acpi"); 3.45 + CMSetProperty(instance, "acpi", (CMPIValue *)&prop_bool_val, CMPI_boolean); 3.46 + 3.47 + prop_bool_val = get_platform_bool_val(resource, "pae"); 3.48 + CMSetProperty(instance, "pae", (CMPIValue *)&prop_bool_val, CMPI_boolean); 3.49 + 3.50 + prop_bool_val = get_platform_bool_val(resource, "usb"); 3.51 + CMSetProperty(instance, "usb", (CMPIValue *)&prop_bool_val, CMPI_boolean); 3.52 + 3.53 + prop_string_val = get_platform_string_val(resource, "usbdevice"); 3.54 + if (prop_string_val != NULL) 3.55 + CMSetProperty(instance, "usbdevice", (CMPIValue *)prop_string_val, CMPI_chars); 3.56 } 3.57 else { 3.58 /* PV settings */ 3.59 @@ -182,8 +211,8 @@ int Xen_ComputerSystemSettingData_setIns 3.60 if (resource->uuid && (resource->uuid[0] != '\0')) 3.61 CMSetProperty(instance, "UUID", (CMPIValue *)resource->uuid, CMPI_chars); 3.62 3.63 - prop_val = get_platform_bool_val(resource, "localtime"); 3.64 - CMSetProperty(instance, "localtime", (CMPIValue *)&prop_val, CMPI_boolean); 3.65 + prop_bool_val = get_platform_bool_val(resource, "localtime"); 3.66 + CMSetProperty(instance, "localtime", (CMPIValue *)&prop_bool_val, CMPI_boolean); 3.67 3.68 CMSetProperty(instance, "OnPoweroff", (CMPIValue *)&(resource->actions_after_shutdown), CMPI_uint16); 3.69 CMSetProperty(instance, "OnReboot", (CMPIValue *)&(resource->actions_after_reboot), CMPI_uint16);
4.1 --- a/src/Xen_VirtualSystemManagementService.c Tue Mar 20 16:28:56 2007 -0600 4.2 +++ b/src/Xen_VirtualSystemManagementService.c Tue Mar 20 17:53:19 2007 -0600 4.3 @@ -1706,6 +1706,83 @@ static int vssd2xenconfig(CMPIInstance * 4.4 "Unable to malloc memory"); 4.5 return 0; 4.6 } 4.7 + 4.8 + propertyvalue = CMGetProperty(vssd, "apic", status); 4.9 + if ((status->rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) { 4.10 + if (propertyvalue.value.boolean) 4.11 + plat_val = "1"; 4.12 + else 4.13 + plat_val = "0"; 4.14 + 4.15 + if (!add_strings_to_map("apic", plat_val, &(vm_rec->platform))) { 4.16 + _SBLIM_TRACE(1, 4.17 + ("Cannot malloc memory for xend platform settings list")); 4.18 + CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM, 4.19 + "Unable to malloc memory"); 4.20 + return 0; 4.21 + } 4.22 + } 4.23 + 4.24 + propertyvalue = CMGetProperty(vssd, "acpi", status); 4.25 + if ((status->rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) { 4.26 + if (propertyvalue.value.boolean) 4.27 + plat_val = "1"; 4.28 + else 4.29 + plat_val = "0"; 4.30 + 4.31 + if (!add_strings_to_map("acpi", plat_val, &(vm_rec->platform))) { 4.32 + _SBLIM_TRACE(1, 4.33 + ("Cannot malloc memory for xend platform settings list")); 4.34 + CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM, 4.35 + "Unable to malloc memory"); 4.36 + return 0; 4.37 + } 4.38 + } 4.39 + 4.40 + propertyvalue = CMGetProperty(vssd, "pae", status); 4.41 + if ((status->rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) { 4.42 + if (propertyvalue.value.boolean) 4.43 + plat_val = "1"; 4.44 + else 4.45 + plat_val = "0"; 4.46 + 4.47 + if (!add_strings_to_map("pae", plat_val, &(vm_rec->platform))) { 4.48 + _SBLIM_TRACE(1, 4.49 + ("Cannot malloc memory for xend platform settings list")); 4.50 + CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM, 4.51 + "Unable to malloc memory"); 4.52 + return 0; 4.53 + } 4.54 + } 4.55 + 4.56 + propertyvalue = CMGetProperty(vssd, "usb", status); 4.57 + if ((status->rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) { 4.58 + if (propertyvalue.value.boolean) 4.59 + plat_val = "1"; 4.60 + else 4.61 + plat_val = "0"; 4.62 + 4.63 + if (!add_strings_to_map("usb", plat_val, &(vm_rec->platform))) { 4.64 + _SBLIM_TRACE(1, 4.65 + ("Cannot malloc memory for xend platform settings list")); 4.66 + CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM, 4.67 + "Unable to malloc memory"); 4.68 + return 0; 4.69 + } 4.70 + } 4.71 + 4.72 + propertyvalue = CMGetProperty(vssd, "usbdevice", status); 4.73 + if ((status->rc == CMPI_RC_OK) && !CMIsNullValue(propertyvalue)) { 4.74 + plat_val = CMGetCharPtr(propertyvalue.value.string); 4.75 + 4.76 + if (!add_strings_to_map("usbdevice", plat_val, &(vm_rec->platform))) { 4.77 + _SBLIM_TRACE(1, 4.78 + ("Cannot malloc memory for xend platform settings list")); 4.79 + CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM, 4.80 + "Unable to malloc memory"); 4.81 + return 0; 4.82 + } 4.83 + } 4.84 } 4.85 else { 4.86 _SBLIM_TRACE(1,("--- Invalid VirtualSystemType %s specified", vsType));