[Libvirt-cim] [PATCH V2 5/5] Virt_Device: Add a device class for controllers

John Ferlan jferlan at redhat.com
Wed Mar 26 23:36:28 UTC 2014


I'm still working my way through merging - I've had some fat finger
moments and some not paying attention moments which caused me some git
grief, but I'm working my way through it.

I will post something tomorrow at some point... It's late for me now.


On 03/25/2014 03:21 AM, Xu Wang wrote:
> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
> ---
>  Makefile.am                         |    2 ++
>  libvirt-cim.spec.in                 |    2 ++
>  schema/Controller.mof               |   16 ++++++++++++++++
>  schema/Controller.registration      |    5 +++++
>  src/Virt_Device.c                   |    4 +++-
>  src/Virt_ElementAllocatedFromPool.c |    6 ++++++
>  src/Virt_ElementSettingData.c       |    3 +++
>  src/Virt_ServiceAffectsElement.c    |    6 +++++-
>  src/Virt_SettingsDefineState.c      |    6 ++++++
>  src/Virt_SystemDevice.c             |    3 +++
>  src/Virt_VSSDComponent.c            |    3 +++
>  11 files changed, 54 insertions(+), 2 deletions(-)
>  create mode 100644 schema/Controller.mof
>  create mode 100644 schema/Controller.registration
> 
> diff --git a/Makefile.am b/Makefile.am
> index 69b65cf..f38c8fc 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -52,6 +52,7 @@ MOFS = \
>  	$(top_srcdir)/schema/ServiceAffectsElement.mof \
>  	$(top_srcdir)/schema/KVMRedirectionSAP.mof \
>  	$(top_srcdir)/schema/DisplayController.mof \
> +	$(top_srcdir)/schema/Controller.mof \
>  	$(top_srcdir)/schema/PointingDevice.mof \
>  	$(top_srcdir)/schema/GraphicsPool.mof \
>  	$(top_srcdir)/schema/InputPool.mof \
> @@ -142,6 +143,7 @@ REGS = \
>  	$(top_srcdir)/schema/ServiceAffectsElement.registration \
>  	$(top_srcdir)/schema/KVMRedirectionSAP.registration \
>  	$(top_srcdir)/schema/DisplayController.registration \
> +	$(top_srcdir)/schema/Controller.registration \
>  	$(top_srcdir)/schema/PointingDevice.registration \
>  	$(top_srcdir)/schema/GraphicsPool.registration \
>  	$(top_srcdir)/schema/InputPool.registration \
> diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
> index 01ee329..809b9db 100644
> --- a/libvirt-cim.spec.in
> +++ b/libvirt-cim.spec.in
> @@ -121,6 +121,7 @@ rm -fr $RPM_BUILD_ROOT
>      %{_datadir}/%{name}/EntriesInFilterList.registration \\\
>      %{_datadir}/%{name}/NestedFilterList.registration \\\
>      %{_datadir}/%{name}/AppliedFilterList.registration \\\
> +    %{_datadir}/%{name}/Controller.registration \\\
>      %{_datadir}/%{name}/HostedFilterList.registration
>  
>  %define SCHEMA %{_datadir}/%{name}/ComputerSystem.mof \\\
> @@ -182,6 +183,7 @@ rm -fr $RPM_BUILD_ROOT
>      %{_datadir}/%{name}/EntriesInFilterList.mof \\\
>      %{_datadir}/%{name}/NestedFilterList.mof \\\
>      %{_datadir}/%{name}/AppliedFilterList.mof \\\
> +    %{_datadir}/%{name}/Controller.mof \\\
>      %{_datadir}/%{name}/HostedFilterList.mof
>  
>  %define INTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\
> diff --git a/schema/Controller.mof b/schema/Controller.mof
> new file mode 100644
> index 0000000..91475a9
> --- /dev/null
> +++ b/schema/Controller.mof
> @@ -0,0 +1,16 @@
> +// Copyright IBM Corp. 2014
> +
> +[ Provider("cmpi::Virt_Device") ]
> +class Xen_Controller : CIM_Controller
> +{
> +};
> +
> +[ Provider("cmpi::Virt_Device") ]
> +class KVM_Controller : CIM_Controller
> +{
> +};
> +
> +[ Provider("cmpi::Virt_Device") ]
> +class LXC_Controller : CIM_Controller
> +{
> +};

Again, not sure if Xen makes sense and definitely LXC doesn't

> diff --git a/schema/Controller.registration b/schema/Controller.registration
> new file mode 100644
> index 0000000..cc73b7a
> --- /dev/null
> +++ b/schema/Controller.registration
> @@ -0,0 +1,5 @@
> +# Copyright IBM Corp. 2014
> +# Classname Namespace ProviderName ProviderModule ProviderTypes
> +Xen_Controller root/virt Virt_Device Virt_Device instance
> +KVM_Controller root/virt Virt_Device Virt_Device instance
> +LXC_Controller root/virt Virt_Device Virt_Device instance

Adjustments here too.

> diff --git a/src/Virt_Device.c b/src/Virt_Device.c
> index f100f6b..3f73a76 100644
> --- a/src/Virt_Device.c
> +++ b/src/Virt_Device.c
> @@ -381,7 +381,7 @@ static CMPIInstance *controller_instance(const CMPIBroker *broker,
>                                    ns,
>                                    true);
>          if (inst == NULL) {
> -                CU_DEBUG("Failed to get instance of ControllerDevice");
> +                CU_DEBUG("Failed to get instance of Controller");
>                  return NULL;
>          }
>  
> @@ -587,6 +587,8 @@ uint16_t res_type_from_device_classname(const char *classname)
>                  return CIM_RES_TYPE_GRAPHICS;
>          else if (strstr(classname, "PointingDevice"))
>                  return CIM_RES_TYPE_INPUT;
> +        else if (strstr(classname, "Controller"))
> +                return CIM_RES_TYPE_CONTROLLER;
>          else
>                  return CIM_RES_TYPE_UNKNOWN;
>  }
> diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c
> index 2c2f2d1..7ba3a53 100644
> --- a/src/Virt_ElementAllocatedFromPool.c
> +++ b/src/Virt_ElementAllocatedFromPool.c
> @@ -269,18 +269,21 @@ static char* device[] = {
>          "Xen_LogicalDisk",
>          "Xen_DisplayController",
>          "Xen_PointingDevice",
> +        "Xen_Controller",
>          "KVM_Processor",
>          "KVM_Memory",
>          "KVM_NetworkPort",
>          "KVM_LogicalDisk",
>          "KVM_DisplayController",
>          "KVM_PointingDevice",
> +        "KVM_Controller",
>          "LXC_Processor",
>          "LXC_Memory",
>          "LXC_NetworkPort",
>          "LXC_LogicalDisk",
>          "LXC_DisplayController",
>          "LXC_PointingDevice",
> +        "LXC_Controller",
>          NULL

No Xen/LXC

>  };
>  
> @@ -291,18 +294,21 @@ static char* device_or_pool[] = {
>          "Xen_LogicalDisk",
>          "Xen_DisplayController",
>          "Xen_PointingDevice",
> +        "Xen_Controller",
>          "KVM_Processor",
>          "KVM_Memory",
>          "KVM_NetworkPort",
>          "KVM_LogicalDisk",
>          "KVM_DisplayController",
>          "KVM_PointingDevice",
> +        "KVM_Controller",
>          "LXC_Processor",
>          "LXC_Memory",
>          "LXC_NetworkPort",
>          "LXC_LogicalDisk",
>          "LXC_DisplayController",
>          "LXC_PointingDevice",
> +        "LXC_Controller",
>          "Xen_ProcessorPool",
>          "Xen_MemoryPool",
>          "Xen_NetworkPool",

No Xen/LXC

> diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c
> index c088e49..38d7821 100644
> --- a/src/Virt_ElementSettingData.c
> +++ b/src/Virt_ElementSettingData.c
> @@ -130,6 +130,7 @@ static char* resource_allocation_setting_data[] = {
>          "Xen_GraphicsResourceAllocationSettingData",
>          "Xen_ConsoleResourceAllocationSettingData",
>          "Xen_InputResourceAllocationSettingData",
> +        "Xen_ControllerResourceAllocationSettingData",
>          "KVM_DiskResourceAllocationSettingData",
>          "KVM_MemResourceAllocationSettingData",
>          "KVM_NetResourceAllocationSettingData",
> @@ -137,6 +138,7 @@ static char* resource_allocation_setting_data[] = {
>          "KVM_GraphicsResourceAllocationSettingData",
>          "KVM_ConsoleResourceAllocationSettingData",
>          "KVM_InputResourceAllocationSettingData",
> +        "KVM_ControllerResourceAllocationSettingData",
>          "LXC_DiskResourceAllocationSettingData",
>          "LXC_MemResourceAllocationSettingData",
>          "LXC_NetResourceAllocationSettingData",
> @@ -144,6 +146,7 @@ static char* resource_allocation_setting_data[] = {
>          "LXC_GraphicsResourceAllocationSettingData",
>          "LXC_ConsoleResourceAllocationSettingData",
>          "LXC_InputResourceAllocationSettingData",
> +        "LXC_ControllerResourceAllocationSettingData",
>          NULL
>  };

No Xen/LXC

>  
> diff --git a/src/Virt_ServiceAffectsElement.c b/src/Virt_ServiceAffectsElement.c
> index 9810e02..ff63ab2 100644
> --- a/src/Virt_ServiceAffectsElement.c
> +++ b/src/Virt_ServiceAffectsElement.c
> @@ -102,7 +102,8 @@ static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context,
>          if (STREQC(classname, "ComputerSystem")) {
>                  s = get_domain_by_ref(_BROKER, ref, &inst);
>          } else if ((STREQC(classname, "PointingDevice"))  || 
> -                   (STREQC(classname, "DisplayController"))) {
> +                   (STREQC(classname, "DisplayController")) ||
> +                   (STREQC(classname, "Controller"))) {
>                  s = get_device_by_ref(_BROKER, ref, &inst);        
>          }
>  
> @@ -146,6 +147,9 @@ static char* affected_ele[] = {
>          "Xen_DisplayController",
>          "KVM_DisplayController",
>          "LXC_DisplayController",
> +        "Xen_Controller",
> +        "KVM_Controller",
> +        "LXC_Controller",


No Xen/LXC

>          NULL
>  };
>  
> diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c
> index c8cda97..9024fda 100644
> --- a/src/Virt_SettingsDefineState.c
> +++ b/src/Virt_SettingsDefineState.c
> @@ -329,6 +329,7 @@ static char* logical_device[] = {
>          "Xen_DisplayController",
>          "Xen_ConsoleDisplayController",
>          "Xen_PointingDevice",
> +        "Xen_Controller",
>          "KVM_Processor",
>          "KVM_Memory",
>          "KVM_NetworkPort",
> @@ -336,6 +337,7 @@ static char* logical_device[] = {
>          "KVM_DisplayController",
>          "KVM_ConsoleDisplayController",
>          "KVM_PointingDevice",
> +        "KVM_Controller",
>          "LXC_Processor",
>          "LXC_Memory",
>          "LXC_NetworkPort",
> @@ -343,6 +345,7 @@ static char* logical_device[] = {
>          "LXC_DisplayController",
>          "LXC_ConsoleDisplayController",
>          "LXC_PointingDevice",
> +        "LXC_Controller",
>          NULL

No Xen/LXC

>  };
>  
> @@ -354,6 +357,7 @@ static char* resource_allocation_setting_data[] = {
>          "Xen_GraphicsResourceAllocationSettingData",
>          "Xen_InputResourceAllocationSettingData",
>          "Xen_ConsoleResourceAllocationSettingData",
> +        "Xen_ControllerResourceAllocationSettingData",
>          "KVM_DiskResourceAllocationSettingData",
>          "KVM_MemResourceAllocationSettingData",
>          "KVM_NetResourceAllocationSettingData",
> @@ -361,6 +365,7 @@ static char* resource_allocation_setting_data[] = {
>          "KVM_GraphicsResourceAllocationSettingData",
>          "KVM_InputResourceAllocationSettingData",
>          "KVM_ConsoleResourceAllocationSettingData",
> +        "KVM_ControllerResourceAllocationSettingData",
>          "LXC_DiskResourceAllocationSettingData",
>          "LXC_MemResourceAllocationSettingData",
>          "LXC_NetResourceAllocationSettingData",
> @@ -368,6 +373,7 @@ static char* resource_allocation_setting_data[] = {
>          "LXC_GraphicsResourceAllocationSettingData",
>          "LXC_InputResourceAllocationSettingData",
>          "LXC_ConsoleResourceAllocationSettingData",
> +        "LXC_ControllerResourceAllocationSettingData",
>          NULL

No Xen/LXC

>  };
>  
> diff --git a/src/Virt_SystemDevice.c b/src/Virt_SystemDevice.c
> index d2e526d..92dfe19 100644
> --- a/src/Virt_SystemDevice.c
> +++ b/src/Virt_SystemDevice.c
> @@ -137,6 +137,7 @@ static char* part_component[] = {
>          "Xen_DisplayController",
>          "Xen_ConsoleDisplayController",
>          "Xen_PointingDevice",
> +        "Xen_Controller",
>          "KVM_Processor",
>          "KVM_Memory",
>          "KVM_NetworkPort",
> @@ -144,6 +145,7 @@ static char* part_component[] = {
>          "KVM_DisplayController",
>          "KVM_ConsoleDisplayController",
>          "KVM_PointingDevice",
> +        "KVM_Controller",
>          "LXC_Processor",
>          "LXC_Memory",
>          "LXC_NetworkPort",
> @@ -151,6 +153,7 @@ static char* part_component[] = {
>          "LXC_DisplayController",
>          "LXC_ConsoleDisplayController",
>          "LXC_PointingDevice",
> +        "LXC_Controller",

No Xen/LXC

>          NULL
>  };
>  
> diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c
> index 35bffde..1fd1221 100644
> --- a/src/Virt_VSSDComponent.c
> +++ b/src/Virt_VSSDComponent.c
> @@ -134,6 +134,7 @@ static char* part_component[] = {
>          "Xen_GraphicsResourceAllocationSettingData",
>          "Xen_ConsoleResourceAllocationSettingData",
>          "Xen_InputResourceAllocationSettingData",
> +        "Xen_ControllerResourceAllocationSettingData",
>          "KVM_DiskResourceAllocationSettingData",
>          "KVM_MemResourceAllocationSettingData",
>          "KVM_NetResourceAllocationSettingData",
> @@ -141,6 +142,7 @@ static char* part_component[] = {
>          "KVM_GraphicsResourceAllocationSettingData",
>          "KVM_InputResourceAllocationSettingData",
>          "KVM_ConsoleResourceAllocationSettingData",
> +        "KVM_ControllerResourceAllocationSettingData",
>          "LXC_DiskResourceAllocationSettingData",
>          "LXC_MemResourceAllocationSettingData",
>          "LXC_NetResourceAllocationSettingData",
> @@ -148,6 +150,7 @@ static char* part_component[] = {
>          "LXC_GraphicsResourceAllocationSettingData",
>          "LXC_InputResourceAllocationSettingData",
>          "LXC_ConsoleResourceAllocationSettingData",
> +        "LXC_ControllerResourceAllocationSettingData",

No Xen/LXC


>          NULL
>  };
>  
> 




More information about the Libvirt-cim mailing list