[Libvirt-cim] [PATCH 2/3] RASD: Schema and Provider Support for Controller RASDs
Boris Fiuczynski
fiuczy at linux.vnet.ibm.com
Thu Mar 13 13:25:28 UTC 2014
On 03/13/2014 11:00 AM, Boris Fiuczynski wrote:
> On 03/03/2014 08:38 AM, Xu Wang wrote:
>> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
>> ---
>> schema/ResourceAllocationSettingData.mof | 27
>> +++++++++++++++++++++
>> schema/ResourceAllocationSettingData.registration | 3 ++
>> src/Virt_RASD.c | 24
>> ++++++++++++++++++
>> 3 files changed, 54 insertions(+), 0 deletions(-)
>>
>> diff --git a/schema/ResourceAllocationSettingData.mof
>> b/schema/ResourceAllocationSettingData.mof
>> index 6b649de..3512170 100644
>> --- a/schema/ResourceAllocationSettingData.mof
>> +++ b/schema/ResourceAllocationSettingData.mof
>> @@ -328,6 +328,33 @@ class LXC_InputResourceAllocationSettingData :
>> LXC_ResourceAllocationSettingData
>> string BusType;
>> };
>>
>> +[Description ("Xen virtual controller device"),
>> + Provider("cmpi::Virt_RASD")
>> +]
>> +class Xen_ControllerResourceAllocationSettingData :
>> Xen_ResourceAllocationSettingData
>> +{
>> + string Type;
>> + string Model;
>> +};
>> +
>> +[Description ("KVM virtual controller device"),
>> + Provider("cmpi::Virt_RASD")
>> +]
>> +class KVM_ControllerResourceAllocationSettingData :
>> KVM_ResourceAllocationSettingData
>> +{
>> + string Type;
> The class CIM_ResourceAllocationSettingData has an attribute
> ResourceSubType. I think there is no need to introduce this new
> attribute here.
>> + string Model;
> I think that there should at least be some minimum documentation of the
> attributes in the mof as well. e.g.
> [Description ("Order in which the bus controller is encountered. "
> "The order is controller type scoped.")]
> uint64 Index;
>
>> +};
> As already said in patch 1/3 I think that you need to add the index.
After reading John's mail about the BZ, I would suggest to also add
[Description ("Device address property names")]
string AddressProperties[];
[Description ("Device address property values")]
string AddressValues[];
These attributes already exist on the Disk and Net.
The provider code for this is reusable and generic. See below...
Below I added some code snippets for support and also will do that for
hopefully most of the other spots.
>
>> +
>> +[Description ("LXC virtual controller device"),
>> + Provider("cmpi::Virt_RASD")
>> +]
>> +class LXC_ControllerResourceAllocationSettingData :
>> LXC_ResourceAllocationSettingData
>> +{
>> + string Type;
>> + string Model;
>> +};
>> +
>> [Description ("Xen virtual network pool settings"),
>> Provider("cmpi::Virt_RASD")
>> ]
>> diff --git a/schema/ResourceAllocationSettingData.registration
>> b/schema/ResourceAllocationSettingData.registration
>> index b969bfe..1142376 100644
>> --- a/schema/ResourceAllocationSettingData.registration
>> +++ b/schema/ResourceAllocationSettingData.registration
>> @@ -7,6 +7,7 @@ Xen_MemResourceAllocationSettingData root/virt
>> Virt_RASD Virt_RASD instance
>> Xen_GraphicsResourceAllocationSettingData root/virt Virt_RASD
>> Virt_RASD instance
>> Xen_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD
>> instance
>> Xen_ConsoleResourceAllocationSettingData root/virt Virt_RASD
>> Virt_RASD instance
>> +Xen_ControllerResourceAllocationSettingData root/virt Virt_RASD
>> Virt_RASD instance
>> KVM_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD
>> instance
>> KVM_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD
>> instance
>> KVM_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD
>> instance
>> @@ -14,9 +15,11 @@ 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
>> LXC_GraphicsResourceAllocationSettingData root/virt Virt_RASD
>> Virt_RASD instance
>> LXC_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD
>> instance
>> LXC_ConsoleResourceAllocationSettingData root/virt Virt_RASD
>> Virt_RASD instance
>> +LXC_ControllerResourceAllocationSettingData root/virt Virt_RASD
>> Virt_RASD instance
>> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
>> index abfb09f..594fe83 100644
>> --- a/src/Virt_RASD.c
>> +++ b/src/Virt_RASD.c
>> @@ -915,6 +915,20 @@ static CMPIStatus set_input_rasd_params(const
>> struct virt_device *dev,
>> return s;
>> }
>>
>> +static CMPIStatus set_controller_rasd_params(const struct virt_device
>> *dev,
>> + CMPIInstance *inst)
static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker,
const CMPIObjectPath *ref,
const struct virt_device
*vdev,
CMPIInstance *inst)
>> +{
>> + CMPIStatus s = {CMPI_RC_OK, NULL};
>> +
>> + CMSetProperty(inst, "Type",
>> + (CMPIValue *)dev->dev.controller.type,
>> CMPI_chars);
>> +
>> + CMSetProperty(inst, "Model",
>> + (CMPIValue *)dev->dev.controller.model,
>> CMPI_chars);
if (dev->dev.controller.address.ct > 0)
set_rasd_device_address(broker, ref,
&dev->dev.controller.address, inst);
>> +
>> + return s;
>> +}
>> +
>> CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
>> struct virt_device *dev,
>> const char *host,
>> @@ -949,6 +963,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_CONTROLLER;
> Setting the attribute ResourceType to CIM_RES_TYPE_OTHER since there is
> no value in the DMTF defined space that would fit a generic controller.
> By setting it to "Other" or "1" you should specify attributes
> OtherResourceType and ResourceSubType.
> I suggest to set OtherResourceType to "Controller" and as mentioned
> above set the ResourceSubType according to the controller type
> specified. You need to set these in method set_controller_rasd_params.
>> + base = "ControllerResourceAllocationSettingData";
>> } else {
>> return NULL;
>> }
>> @@ -1004,6 +1021,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(dev, inst);
s = set_controller_rasd_params(broker, rev, dev, inst);
>> }
>>
>> /* FIXME: Put the HostResource in place */
>> @@ -1138,6 +1157,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;
>>
>> @@ -1175,6 +1196,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;
>> }
>>
>
>
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the Libvirt-cim
mailing list