[Libvirt-cim] [PATCH 1 of 2] Add parent_device_pool() which returnsthe parent pool for a given device type

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon May 11 17:35:40 UTC 2009


>>  {
>>          CMPIInstance *inst = NULL;
>>          struct inst_list list;
>> +        bool val;
>>
>> -        inst_list_init(&list);
>> +        if ((type == CIM_RES_TYPE_DISK) || (type == CIM_RES_TYPE_NET)) {
>> +                int i = 0;
>> +                CMPIrc rc;
>>
>> -        if (type == CIM_RES_TYPE_MEM) {
>> -                *s = get_pool_by_name(broker, reference, 
>> "MemoryPool/0", &inst);
>> -        } else if (type == CIM_RES_TYPE_PROC) {
>> -                *s = get_pool_by_name(broker, reference, 
>> "ProcessorPool/0", &inst);
>> -        } else if (type == CIM_RES_TYPE_DISK) {
>> +                inst_list_init(&list);
>> +
>>                  *s = enum_pools(broker, reference, type, &list);
>> -                if ((s->rc == CMPI_RC_OK) && (list.cur > 0))
> 
> You probably should insert a CU_DEBUG here just to help debug

The code bit above is being removed, not added.

> 
>> -                        inst = list.list[0];
>> -        } else if (type == CIM_RES_TYPE_NET) {
>> -                *s = enum_pools(broker, reference, type, &list);
>> -                if ((s->rc == CMPI_RC_OK) && (list.cur > 0))
>> -                        inst = list.list[0];
> Same here

Same here - this code bit it being removed.

>> -        } else if (type == CIM_RES_TYPE_GRAPHICS) {
>> -                *s = get_pool_by_name(broker, 
>> -                                      reference, 
>> -                                      "GraphicsPool/0", 
>> -                                      &inst);
> Same here

It's been removed here as well.

>> -        } else if (type == CIM_RES_TYPE_INPUT) {
>> -                *s = get_pool_by_name(broker, 
>> -                                      reference, 
>> -                                      "InputPool/0", 
>> -                                      &inst);
>> +                if ((s->rc == CMPI_RC_OK) && (list.cur > 0)) {
>> +                        +                        for (i = 0; i < 
>> list.cur; i++) {
>> +                                rc = cu_get_bool_prop(list.list[i], 
>> +                                                      "Primordial", 
>> +                                                      &val);
>> +                                if ((rc != CMPI_RC_OK) || (val))
>> +                                        continue;
>> +
>> +                                inst = list.list[i];
>> +                                break;
>> +                        }
> Same here

I'll fix this and send an updated patch.


-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list