[Libvirt-cim] [PATCH 2/3] RASD: Schema and Provider Support for Controller RASDs

John Ferlan jferlan at redhat.com
Fri Mar 14 15:14:13 UTC 2014



On 03/14/2014 10:23 AM, Boris Fiuczynski wrote:
> On 03/14/2014 01:56 PM, John Ferlan wrote:
>> From: Xu Wang <gesaint at linux.vnet.ibm.com>
>>
>> Add the various controller fields and support for RASDs
>>
>> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
>> Signed-off-by: John Ferlan <jferlan at redhat.com>
>> ---
>>   schema/ResourceAllocationSettingData.mof          | 41 ++++++++++++
>>   schema/ResourceAllocationSettingData.registration |  1 +
>>   src/Virt_ElementSettingData.c                     |  1 +
>>   src/Virt_RASD.c                                   | 81 ++++++++++++++++++++---
>>   src/Virt_SettingsDefineState.c                    |  1 +
>>   src/Virt_VSSDComponent.c                          |  1 +
>>   6 files changed, 118 insertions(+), 8 deletions(-)
>>
>> diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof
>> index bf1fbb6..30e62c4 100644
>> --- a/schema/ResourceAllocationSettingData.mof
>> +++ b/schema/ResourceAllocationSettingData.mof
>> @@ -322,6 +322,47 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData
>>         string BusType;
>>   };
>>
>> +[Description ("KVM virtual controller device. It is identified by: "
>> +              "CIM_ResourceAllocationSettingData.ResourceType=1 ('Other'), "
>> +              "CIM_ResourceAllocationSettingData.OtherResourceType='controller'"
>> +              " and CIM_ResourceAllocationSettingData.ResourceSubType set to "
>> +              "one of 'ide', 'fdc', 'scsi', 'sata', 'ccid', 'virtio-serial', "
>> +              "or 'pci'."),
>> + Provider("cmpi::Virt_RASD")
>> +]
>> +class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData
>> +{
>> +      [Description ("Order in which the bus controller is encountered. "
>> +                    "The order is controller type scoped.")]
>> +      uint64 Index;
>> +
>> +      [Description ("Optional string providing a specific model "
>> +                    "information based on the controller type.")]
>> +      string Model;
>> +
>> +      [Description ("The 'virtio-serial' controller uses the Ports and "
>> +                    "Vectors to control how many devices can be connected "
>> +                    "through the controller.")]
>> +      uint64 Ports;
>> +      uint64 Vectors;
>> +
>> +      [Description ("Number of queues for the controller.")]
>> +      uint64 Queues;
>> +
>> +      [Description ("Device master property names")]
>> +      string MasterProperties[];
>> +
>> +      [Description ("Device master property values")]
>> +      string MasterValues[];
>> +
>> +      [Description ("For controllers that are themselves devices on a "
>> +                    "bus an optional element to specify the exact "
>> +                    "relationship of the controller to its master bus. "
>> +                    "Stored in the property and value arrays.")]
>> +      string AddressProperties[];
>> +      string AddressValues[];
>> +};
>> +
>>   [Description ("Xen virtual network pool settings"),
>>    Provider("cmpi::Virt_RASD")
>>   ]
>> diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration
>> index b969bfe..da0b7d9 100644
>> --- a/schema/ResourceAllocationSettingData.registration
>> +++ b/schema/ResourceAllocationSettingData.registration
>> @@ -14,6 +14,7 @@ KVM_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>>   KVM_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>>   KVM_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>>   KVM_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>> +KVM_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>>   LXC_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>>   LXC_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>>   LXC_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance
>> diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c
>> index c088e49..1fa81f2 100644
>> --- a/src/Virt_ElementSettingData.c
>> +++ b/src/Virt_ElementSettingData.c
>> @@ -137,6 +137,7 @@ static char* resource_allocation_setting_data[] = {
>>           "KVM_GraphicsResourceAllocationSettingData",
>>           "KVM_ConsoleResourceAllocationSettingData",
>>           "KVM_InputResourceAllocationSettingData",
>> +        "KVM_ControllerResourceAllocationSettingData",
>>           "LXC_DiskResourceAllocationSettingData",
>>           "LXC_MemResourceAllocationSettingData",
>>           "LXC_NetResourceAllocationSettingData",
>> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
>> index df1e921..d3922cf 100644
>> --- a/src/Virt_RASD.c
>> +++ b/src/Virt_RASD.c
>> @@ -289,10 +289,12 @@ static bool get_vol_size(const CMPIBroker *broker,
>>   }
>>   #endif
>>
>> -static CMPIStatus set_rasd_device_address(const CMPIBroker *broker,
>> +static CMPIStatus set_rasd_property_value(const CMPIBroker *broker,
>>                                             const CMPIObjectPath *ref,
>>                                             const struct device_address *addr,
>> -                                          CMPIInstance *inst)
>> +                                          CMPIInstance *inst,
>> +                                          const char *property_name,
>> +                                          const char *property_value)
>>   {
>>           int i;
>>           CMPIArray *arr_key;
>> @@ -338,11 +340,11 @@ static CMPIStatus set_rasd_device_address(const CMPIBroker *broker,
>>                                       CMPI_string);
>>           }
>>
>> -        CMSetProperty(inst, "AddressProperties",
>> +        CMSetProperty(inst, property_name,
>>                         (CMPIValue *)&arr_key,
>>                         CMPI_stringA);
>>
>> -        CMSetProperty(inst, "AddressValues",
>> +        CMSetProperty(inst, property_value,
>>                         (CMPIValue *)&arr_value,
>>                         CMPI_stringA);
>>
>> @@ -489,10 +491,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker,
>>                                 CMPI_boolean);
>>
>>           if (dev->dev.disk.address.ct > 0)
>> -                set_rasd_device_address(broker,
>> +                set_rasd_property_value(broker,
>>                                           ref,
>>                                           &dev->dev.disk.address,
>> -                                        inst);
>> +                                        inst,
>> +                                        "AddressProperties",
>> +                                        "AddressValues");
>>
>>           virStoragePoolFree(pool);
>>           virStorageVolFree(vol);
>> @@ -658,10 +662,12 @@ static CMPIStatus set_net_rasd_params(const CMPIBroker *broker,
>>                                 CMPI_chars);
>>
>>           if (dev->dev.net.address.ct > 0)
>> -                set_rasd_device_address(broker,
>> +                set_rasd_property_value(broker,
>>                                           ref,
>>                                           &dev->dev.net.address,
>> -                                        inst);
>> +                                        inst,
>> +                                        "AddressProperties",
>> +                                        "AddressValues");
>>
>>   #if LIBVIR_VERSION_NUMBER < 9000
>>   out:
>> @@ -903,6 +909,55 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev,
>>           return s;
>>   }
>>
>> +static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker,
>> +                                             const CMPIObjectPath *ref,
>> +                                             const struct virt_device *dev,
>> +                                             CMPIInstance *inst)
>> +{
>> +        CMPIStatus s = {CMPI_RC_OK, NULL};
>> +
>> +        CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars);
>> +        CMSetProperty(inst, "ResourceSubType",
>> +                      (CMPIValue *)dev->dev.controller.type, CMPI_chars);
>> +        CMSetProperty(inst, "Index",
>> +                      (CMPIValue *)dev->dev.controller.index, CMPI_uint32);
>                     (CMPIValue *)dev->dev.controller.index, CMPI_uint64);

yep - saw that too when I went back to change the others back to chars

John
>> +
>> +        if (dev->dev.controller.model)
>> +            CMSetProperty(inst, "Model",
>> +                          (CMPIValue *)dev->dev.controller.model, CMPI_chars);
>> +
>> +        if (dev->dev.controller.ports)
>> +            CMSetProperty(inst, "Ports",
>> +                          (CMPIValue *)dev->dev.controller.ports, CMPI_uint32);
> I leave these undocumented since you are going to change according to 
> the cover letter back to chars.
>> +
>> +        if (dev->dev.controller.vectors)
>> +            CMSetProperty(inst, "Vectors",
>> +                          (CMPIValue *)dev->dev.controller.vectors,
>> +                          CMPI_uint32);
>> +
>> +        if (dev->dev.controller.queues)
>> +            CMSetProperty(inst, "Queues",
>> +                          (CMPIValue *)dev->dev.controller.queues, CMPI_uint32);
>> +
>> +        if (dev->dev.controller.master.ct > 0)
>> +            set_rasd_property_value(broker,
>> +                                    ref,
>> +                                    &dev->dev.controller.address,
>> +                                    inst,
>> +                                    "MasterProperties",
>> +                                    "MasterValues");
>> +
>> +        if (dev->dev.controller.address.ct > 0)
>> +            set_rasd_property_value(broker,
>> +                                    ref,
>> +                                    &dev->dev.controller.address,
>> +                                    inst,
>> +                                    "AddressProperties",
>> +                                    "AddressValues");
>> +
>> +        return s;
>> +}
>> +
>>   CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
>>                                       struct virt_device *dev,
>>                                       const char *host,
>> @@ -937,6 +992,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
>>           } else if (dev->type == CIM_RES_TYPE_INPUT) {
>>                   type = CIM_RES_TYPE_INPUT;
>>                   base = "InputResourceAllocationSettingData";
>> +        } else if (dev->type == CIM_RES_TYPE_CONTROLLER) {
>> +                type = CIM_RES_TYPE_OTHER;
>> +                base = "ControllerResourceAllocationSettingData";
>>           } else {
>>                   return NULL;
>>           }
>> @@ -992,6 +1050,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
>>                   s = set_input_rasd_params(dev, inst);
>>           } else if (dev->type == CIM_RES_TYPE_CONSOLE) {
>>                   s = set_console_rasd_params(dev, inst);
>> +        } else if (dev->type == CIM_RES_TYPE_CONTROLLER) {
>> +                s = set_controller_rasd_params(broker, ref, dev, inst);
>>           }
>>
>>           /* FIXME: Put the HostResource in place */
>> @@ -1126,6 +1186,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type)
>>                  *type = CIM_RES_TYPE_IMAGE;
>>          else if (STREQ(base, "ConsoleResourceAllocationSettingData"))
>>                  *type = CIM_RES_TYPE_CONSOLE;
>> +       else if (STREQ(base, "ControllerResourceAllocationSettingData"))
>> +               *type = CIM_RES_TYPE_CONTROLLER;
>>          else
>>                  goto out;
>>
>> @@ -1163,6 +1225,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname)
>>           case CIM_RES_TYPE_INPUT:
>>                   *classname = "InputResourceAllocationSettingData";
>>                   break;
>> +        case CIM_RES_TYPE_CONTROLLER:
>> +                *classname = "ControllerResourceAllocationSettingData";
>> +                break;
>>           default:
>>                   rc = CMPI_RC_ERR_FAILED;
>>           }
>> diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c
>> index c8cda97..d5c6726 100644
>> --- a/src/Virt_SettingsDefineState.c
>> +++ b/src/Virt_SettingsDefineState.c
>> @@ -361,6 +361,7 @@ static char* resource_allocation_setting_data[] = {
>>           "KVM_GraphicsResourceAllocationSettingData",
>>           "KVM_InputResourceAllocationSettingData",
>>           "KVM_ConsoleResourceAllocationSettingData",
>> +        "KVM_ControllerResourceAllocationSettingData",
>>           "LXC_DiskResourceAllocationSettingData",
>>           "LXC_MemResourceAllocationSettingData",
>>           "LXC_NetResourceAllocationSettingData",
>> diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c
>> index 35bffde..734271c 100644
>> --- a/src/Virt_VSSDComponent.c
>> +++ b/src/Virt_VSSDComponent.c
>> @@ -141,6 +141,7 @@ static char* part_component[] = {
>>           "KVM_GraphicsResourceAllocationSettingData",
>>           "KVM_InputResourceAllocationSettingData",
>>           "KVM_ConsoleResourceAllocationSettingData",
>> +        "KVM_ControllerResourceAllocationSettingData",
>>           "LXC_DiskResourceAllocationSettingData",
>>           "LXC_MemResourceAllocationSettingData",
>>           "LXC_NetResourceAllocationSettingData",
>>
> 
> 




More information about the Libvirt-cim mailing list