os-cmpi-xen

changeset 104:b66e845be7e4

Fixed crashes when enumerating Xen_Memory[SettingData], Xen_Processor[SettingData], and Xen_OperatingSystem.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author Jim Fehlig <jfehlig@novell.com>
date Wed May 09 18:04:04 2007 -0600 (2007-05-09)
parents fa1ca0490794
children 05efdeb98072
files ChangeLog src/Xen_MemorySettingData_Resource.c src/Xen_Memory_Resource.c src/Xen_OperatingSystem_Resource.c src/Xen_ProcessorSettingData_Resource.c src/Xen_Processor_Resource.c
line diff
     1.1 --- a/ChangeLog	Wed May 09 17:24:20 2007 -0600
     1.2 +++ b/ChangeLog	Wed May 09 18:04:04 2007 -0600
     1.3 @@ -1,3 +1,9 @@
     1.4 +-------------------------------------------------------------------
     1.5 +Wed May  9 18:01:49 MDT 2007 - jfehlig@novell.com
     1.6 +
     1.7 +        - Fixed crashes when enumerating Xen_Memory[SettingData],
     1.8 +          Xen_Processor[SettingData], and Xen_OperatingSystem.
     1.9 +
    1.10  -------------------------------------------------------------------
    1.11  Wed May  9 17:19:27 MDT 2007 - jfehlig@novell.com
    1.12  
     2.1 --- a/src/Xen_MemorySettingData_Resource.c	Wed May 09 17:24:20 2007 -0600
     2.2 +++ b/src/Xen_MemorySettingData_Resource.c	Wed May 09 18:04:04 2007 -0600
     2.3 @@ -127,7 +127,7 @@ int Xen_MemorySettingData_freeResource(_
     2.4  
     2.5  /* Set the property values of a CMPI instance from a specific resource. */
     2.6  int Xen_MemorySettingData_setInstanceFromResource(xen_utils_session *session,
     2.7 -						  _RESOURCE * resource,
     2.8 +                                                  _RESOURCE * resource,
     2.9                                                    const CMPIInstance * instance,
    2.10                                                    const CMPIBroker * broker)
    2.11  {
    2.12 @@ -153,10 +153,10 @@ int Xen_MemorySettingData_setInstanceFro
    2.13     if (resource->metrics->is_record)
    2.14  	memory=resource->metrics->u.record->memory_actual;
    2.15     else	
    2.16 -	xen_vm_metrics_get_memory_actual(session, &memory, resource->metrics->u.handle);;
    2.17 +	xen_vm_metrics_get_memory_actual(session->xen, &memory, resource->metrics->u.handle);;
    2.18     CMSetProperty(instance, "Reservation",(CMPIValue *)&memory, CMPI_uint64);
    2.19 +   memory = resource->memory_dynamic_max;
    2.20     CMSetProperty(instance, "VirtualQuantity",(CMPIValue *)&memory, CMPI_uint64);
    2.21 -   memory = resource->memory_dynamic_max;
    2.22     CMSetProperty(instance, "Limit",(CMPIValue *)&memory, CMPI_uint64);
    2.23     
    2.24     CMSetProperty(instance, "AllocationUnits",(CMPIValue *)"Bytes", CMPI_chars);
     3.1 --- a/src/Xen_Memory_Resource.c	Wed May 09 17:24:20 2007 -0600
     3.2 +++ b/src/Xen_Memory_Resource.c	Wed May 09 18:04:04 2007 -0600
     3.3 @@ -176,7 +176,7 @@ int Xen_Memory_setInstanceFromResource(x
     3.4     if (resource->metrics->is_record)
     3.5  	blocks=resource->metrics->u.record->memory_actual;
     3.6     else	
     3.7 -	xen_vm_metrics_get_memory_actual(session, &blocks, resource->metrics->u.handle);
     3.8 +	xen_vm_metrics_get_memory_actual(session->xen, &blocks, resource->metrics->u.handle);
     3.9     CMSetProperty(instance, "ConsumableBlocks", (CMPIValue *)&blocks, CMPI_uint64);
    3.10  
    3.11     if (resource->power_state == XEN_VM_POWER_STATE_RUNNING) 
     4.1 --- a/src/Xen_OperatingSystem_Resource.c	Wed May 09 17:24:20 2007 -0600
     4.2 +++ b/src/Xen_OperatingSystem_Resource.c	Wed May 09 18:04:04 2007 -0600
     4.3 @@ -118,7 +118,7 @@ int Xen_OperatingSystem_freeResource(_RE
     4.4  
     4.5  /* Set the property values of a CMPI instance from a specific resource. */
     4.6  int Xen_OperatingSystem_setInstanceFromResource(xen_utils_session *session,
     4.7 -						_RESOURCE * resource,
     4.8 +                                                _RESOURCE * resource,
     4.9                                                  const CMPIInstance * instance,
    4.10                                                  const CMPIBroker * broker)
    4.11  {
    4.12 @@ -200,7 +200,7 @@ int Xen_OperatingSystem_setInstanceFromR
    4.13     if (resource->metrics->is_record)
    4.14  	memory=resource->metrics->u.record->memory_actual;
    4.15     else	
    4.16 -	xen_vm_metrics_get_memory_actual(session, &memory, resource->metrics->u.handle);
    4.17 +	xen_vm_metrics_get_memory_actual(session->xen, &memory, resource->metrics->u.handle);
    4.18     
    4.19     CMSetProperty(instance, "TotalVisibleMemorySize", (CMPIValue *)&(memory), CMPI_uint64);
    4.20  
     5.1 --- a/src/Xen_ProcessorSettingData_Resource.c	Wed May 09 17:24:20 2007 -0600
     5.2 +++ b/src/Xen_ProcessorSettingData_Resource.c	Wed May 09 18:04:04 2007 -0600
     5.3 @@ -127,7 +127,7 @@ int Xen_ProcessorSettingData_freeResourc
     5.4     We also pass in the session object so that the metrics class can be accessed when required.
     5.5  */
     5.6  int Xen_ProcessorSettingData_setInstanceFromResource(xen_utils_session *session,
     5.7 -						     _RESOURCE * resource,
     5.8 +                                                     _RESOURCE * resource,
     5.9                                                       const CMPIInstance * instance,
    5.10                                                       const CMPIBroker * broker)
    5.11  {
    5.12 @@ -152,11 +152,7 @@ int Xen_ProcessorSettingData_setInstance
    5.13     CMSetProperty(instance, "Reservation",(CMPIValue *)&cpus, CMPI_uint64);
    5.14     CMSetProperty(instance, "Limit",(CMPIValue *)&cpus, CMPI_uint64);
    5.15     CMSetProperty(instance, "AllocationUnits",(CMPIValue *)"Cores", CMPI_chars);
    5.16 -   if (resource->metrics->is_record)
    5.17 -	cpus=resource->metrics->u.record->vcpus_number;
    5.18 -   else	
    5.19 -	xen_vm_metrics_get_vcpus_number(session, &cpus, resource->metrics->u.handle);
    5.20 -      CMSetProperty(instance, "VirtualQuantity",(CMPIValue *)&cpus, CMPI_uint64);
    5.21 +   CMSetProperty(instance, "VirtualQuantity",(CMPIValue *)&(resource->vcpus_at_startup), CMPI_uint64);
    5.22  
    5.23     int alloctype = 1;
    5.24     CMSetProperty(instance, "AutomaticAllocation" , (CMPIValue *)&alloctype, CMPI_boolean);
     6.1 --- a/src/Xen_Processor_Resource.c	Wed May 09 17:24:20 2007 -0600
     6.2 +++ b/src/Xen_Processor_Resource.c	Wed May 09 18:04:04 2007 -0600
     6.3 @@ -105,7 +105,7 @@ int Xen_Processor_getNextResource(xen_ut
     6.4     if ((*resource)->metrics->is_record)
     6.5  	vcpus_number=(*resource)->metrics->u.record->vcpus_number;
     6.6     else	
     6.7 -	xen_vm_metrics_get_vcpus_number(session, &vcpus_number, (*resource)->metrics->u.handle);
     6.8 +	xen_vm_metrics_get_vcpus_number(session->xen, &vcpus_number, (*resource)->metrics->u.handle);
     6.9     if (resources->currentprocessornum <= vcpus_number)
    6.10        return 1; 
    6.11