[Libvirt-cim] [PATCH V2 3/5] VSMS: Support for domains with controller devices
John Ferlan
jferlan at redhat.com
Wed Mar 26 23:32:20 UTC 2014
On 03/25/2014 03:20 AM, Xu Wang wrote:
> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
> ---
> src/Virt_VirtualSystemManagementService.c | 44 +++++++++++++++++++++++++++++
> 1 files changed, 44 insertions(+), 0 deletions(-)
>
> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
> index e146470..1a34ff8 100644
> --- a/src/Virt_VirtualSystemManagementService.c
> +++ b/src/Virt_VirtualSystemManagementService.c
> @@ -1848,6 +1848,28 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst,
> return NULL;
> }
>
> +static const char *controller_rasd_to_vdev(CMPIInstance *inst,
> + struct virt_device *dev)
> +{
> + const char *val;
> +
> + if (cu_get_str_prop(inst, "Type", &val) != CMPI_RC_OK) {
> + CU_DEBUG("ControllerRASD Type field not valid");
> + goto out;
> + }
> + dev->dev.controller.type = strdup(val);
> +
> + if (cu_get_str_prop(inst, "Model", &val) != CMPI_RC_OK) {
> + CU_DEBUG("Invalid value for Model in ControllerRASD");
> + goto out;
> + }
> + dev->dev.controller.model = strdup(val);
Based on the changes I've made there will need to be some adjustments here.
> +
> + out:
> +
> + return NULL;
> +}
> +
> static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst,
> struct virt_device *dev,
> uint16_t type,
> @@ -1868,6 +1890,8 @@ static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst,
> return console_rasd_to_vdev(inst, dev);
> } else if (type == CIM_RES_TYPE_INPUT) {
> return input_rasd_to_vdev(inst, dev);
> + } else if (type == CIM_RES_TYPE_CONTROLLER) {
> + return controller_rasd_to_vdev(inst, dev);
> }
>
> return "Resource type not supported on this platform";
> @@ -1888,6 +1912,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst,
> return lxc_proc_rasd_to_vdev(inst, dev);
> } else if (type == CIM_RES_TYPE_INPUT) {
> return input_rasd_to_vdev(inst, dev);
> + } else if (type == CIM_RES_TYPE_CONTROLLER) {
> + return controller_rasd_to_vdev(inst, dev);
> }
>
> return "Resource type not supported on this platform";
> @@ -1997,6 +2023,9 @@ static const char *classify_resources(CMPIArray *resources,
> if (!make_space(&domain->dev_input, domain->dev_input_ct, count))
> return "Failed to alloc input list";
>
> + if (!make_space(&domain->dev_controller, domain->dev_controller_ct, count))
> + return "Failed to alloc controller list";
> +
> for (i = 0; i < count; i++) {
> CMPIObjectPath *op;
> CMPIData item;
> @@ -2111,7 +2140,16 @@ static const char *classify_resources(CMPIArray *resources,
> &domain->dev_input[0],
> ns,
> p_error);
> + } else if (type == CIM_RES_TYPE_CONTROLLER) {
> + msg = rasd_to_vdev(inst,
> + domain,
> + &domain->dev_controller[domain->dev_controller_ct],
> + ns,
> + p_error);
> + if (msg == NULL)
> + domain->dev_controller_ct += 1;
> }
> +
> if (msg != NULL)
> return msg;
>
> @@ -2918,6 +2956,9 @@ static struct virt_device **find_list(struct domain *dominfo,
> } else if (type == CIM_RES_TYPE_INPUT) {
> list = &dominfo->dev_input;
> *count = &dominfo->dev_input_ct;
> + } else if (type == CIM_RES_TYPE_CONTROLLER) {
> + list = &dominfo->dev_controller;
> + *count = &dominfo->dev_controller_ct;
> }
>
> return list;
> @@ -3039,6 +3080,7 @@ static CMPIStatus resource_del(struct domain *dominfo,
> if (STREQ(dev->id, devid)) {
> if ((type == CIM_RES_TYPE_GRAPHICS) ||
> (type == CIM_RES_TYPE_CONSOLE) ||
> + (type == CIM_RES_TYPE_CONTROLLER) ||
> (type == CIM_RES_TYPE_INPUT))
> cu_statusf(_BROKER, &s, CMPI_RC_OK, "");
> else {
> @@ -3121,6 +3163,7 @@ static CMPIStatus resource_add(struct domain *dominfo,
>
> if ((type == CIM_RES_TYPE_GRAPHICS) ||
> (type == CIM_RES_TYPE_INPUT) ||
> + (type == CIM_RES_TYPE_CONTROLLER) ||
> (type == CIM_RES_TYPE_CONSOLE)) {
> (*count)++;
> cu_statusf(_BROKER, &s, CMPI_RC_OK, "");
> @@ -3198,6 +3241,7 @@ static CMPIStatus resource_mod(struct domain *dominfo,
>
> if ((type == CIM_RES_TYPE_GRAPHICS) ||
> (type == CIM_RES_TYPE_INPUT) ||
> + (type == CIM_RES_TYPE_CONTROLLER) ||
> (type == CIM_RES_TYPE_CONSOLE))
> cu_statusf(_BROKER, &s, CMPI_RC_OK, "");
> else {
>
More information about the Libvirt-cim
mailing list