[Libvirt-cim] [PATCH] [TEST] #2 Update RPCS/04 with the latest updatesof pool verification

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Tue May 19 05:22:28 UTC 2009



Kaitlin Rupert wrote:
>>>   Below are the part code of libvirt-cim provider. I tried to define 
>>> the test_mode as [0, 1, 2], but it
>
> What failure are you seeing?  This works for me.. here's my pywbem 
> script:
>
> from pywbem import WBEMConnection, CIMInstanceName, CIMInstance, 
> cim_types
>
> c = WBEMConnection("http://localhost",
>                    ("root", "pass"),
>                    "root/virt")
>
> c.debug = True
>
> iname = CIMInstanceName('KVM_NetPoolResourceAllocationSettingData', 
> namespace='root/virt',keybindings = {'InstanceID':'DiskPool/meep-net'})
>
> rasd = CIMInstance('KVM_NetPoolResourceAllocationSettingData', 
> path=iname, properties={"Address":"192.168.0.4", 
> "Netmask":"255.255.254.0", "IPRangeStart":"192.168.0.5", 
> "IPRangeEnd":"192.168.0.27", "ForwardMode":cim_types.Uint16(2), 
> "ForwardDevice":"eth1"})
>
> rasds = [rasd.tomof()]
>
> print rasds
>
> res = c.InvokeMethod("CreateChildResourcePool",
>                      "KVM_ResourcePoolConfigurationService",
>                      Settings=rasds,
>                      ElementName="meep-net")
>
> print c.last_request
>
>
>>>   fails yet. How to set the test_mode in cimtest for different types?
>>>
>>>
>>>         if (cu_get_u16_prop(inst, "ForwardMode", &type) != 
>>> CMPI_RC_OK) {
>>>                 pool->pool_info.net.forward_mode = strdup("nat");
>>>         } else {
>>>                 free(pool->pool_info.net.forward_mode);
>>>
>>>                 switch (type) {
>>>                 case NETPOOL_FORWARD_NONE:
>>>                         pool->pool_info.net.forward_mode = NULL;
>>>                         break;
>>>                 case NETPOOL_FORWARD_NAT:
>>>                         pool->pool_info.net.forward_mode = 
>>> strdup("nat");
>>>                         break;
>>>                 case NETPOOL_FORWARD_ROUTED:
>>>                         pool->pool_info.net.forward_mode = 
>>> strdup("route");
>>>                         break;
>>>                 default:
>>>                         return "Storage pool type not supported";
>>>
>> I checked this too in Virt_RPCS.c file..
>> Here is the XML that is generated for the route type:
>> xmlgen.c(981): Created pool XML:
>> <network>
>>  <name>testpool</name>
>>  <bridge/>
>>  <forward mode="nat" dev="eth1"/>
>>  <ip address="192.168.0.51" netmask="255.255.255.0">
>>    <dhcp>
>>      <range start="192.168.0.52" end="192.168.0.61"/>
>>    </dhcp>
>>  </ip>
>> </network>
>>
>> Seems like only the if condition is getting executed for some reason.
>>
>> Daisy,
>>
>> In your test case I think we need to specify pool_attr["ForwardMode"] 
>> = "route" and pool_attr["ForwardDevice"] = "eth1" for route type.
>>
>
> The ForwardDevice is a uint16 - it needs to take a number.  If you 
> look at the schema:
>
>       [Description ("Network pool forwarding mode"),
>         ValueMap {"0", "1", "2"},
>         Values {"None", "NAT", "Routed"}]
>       uint16 ForwardMode;
>
> In Daisy's test, she is using strings, but it should be the following:
>
>
> pool_attr["ForwardMode"] = 2  #This will give you a route pool type.
Oh! Thanks so much. Yup! I had tried with the numbers as well which had 
not worked. May be I missed something.




More information about the Libvirt-cim mailing list