[PATCH 0 of 2] #4 Added ServiceAccessBySAP association (ConsoleRedirectionService <-> KVMRedirectionSAP)

This patch depends on the patch which adds the HostedAccessPoint association

# HG changeset patch # User Richard Maciel <richardm@br.ibm.com> # Date 1228248506 7200 # Node ID d0e5e8ae4c243dd119f1d539c5cb258301891cee # Parent 21a9102b8eefde69aad9ec2dc0481db5f888ab96 Added ServiceAccessBySAP association (ConsoleRedirectionService <-> KVMRedirectionSAP) * Created mof and registration files * Changed Makefile to use newly created files Changes for submission #2 * Removed registration for CIMV2 in ServiceAccessBySAP.registration file Changes for submission #3 * Fixed indents in the Makefile.am Changes for submission #4 * Fixed all wrong indents in the Makefile.am Signed-off-by: Richard Maciel <richardm@br.ibm.com> diff -r 21a9102b8eef -r d0e5e8ae4c24 Makefile.am --- a/Makefile.am Thu Dec 04 20:15:50 2008 -0200 +++ b/Makefile.am Tue Dec 02 18:08:26 2008 -0200 @@ -4,47 +4,47 @@ SUBDIRS = libxkutil src doc base_schema MOFS = \ - schema/ComputerSystem.mof \ - schema/LogicalDisk.mof \ - schema/NetworkPort.mof \ - schema/Memory.mof \ - schema/Processor.mof \ - schema/SystemDevice.mof \ - schema/VSSD.mof \ - schema/HostSystem.mof \ - schema/HostedDependency.mof \ - schema/VirtualSystemManagementService.mof \ - schema/VirtualSystemManagementCapabilities.mof \ - schema/EnabledLogicalElementCapabilities.mof \ - schema/AllocationCapabilities.mof \ - schema/SettingsDefineCapabilities.mof \ - schema/MemoryPool.mof \ - schema/ElementCapabilities.mof \ - schema/ProcessorPool.mof \ - schema/DiskPool.mof \ - schema/HostedResourcePool.mof \ - schema/RegisteredProfile.mof \ - schema/ElementConformsToProfile.mof \ - schema/ComputerSystemIndication.mof \ - schema/ComputerSystemMigrationIndication.mof \ - schema/Virt_ResourceAllocationSettingData.mof \ - schema/ResourceAllocationSettingData.mof \ - schema/ResourcePoolConfigurationService.mof \ - schema/ResourcePoolConfigurationCapabilities.mof \ - schema/VSSDComponent.mof \ - schema/SettingsDefineState.mof \ - schema/NetPool.mof \ - schema/ResourceAllocationFromPool.mof \ - schema/ElementAllocatedFromPool.mof \ - schema/HostedService.mof \ - schema/ElementSettingData.mof \ - schema/VSMigrationCapabilities.mof \ - schema/VSMigrationService.mof \ - schema/VSMigrationSettingData.mof \ - schema/VirtualSystemSnapshotService.mof \ - schema/VirtualSystemSnapshotServiceCapabilities.mof \ - schema/ConcreteComponent.mof \ - schema/ConsoleRedirectionService.mof \ + schema/ComputerSystem.mof \ + schema/LogicalDisk.mof \ + schema/NetworkPort.mof \ + schema/Memory.mof \ + schema/Processor.mof \ + schema/SystemDevice.mof \ + schema/VSSD.mof \ + schema/HostSystem.mof \ + schema/HostedDependency.mof \ + schema/VirtualSystemManagementService.mof \ + schema/VirtualSystemManagementCapabilities.mof \ + schema/EnabledLogicalElementCapabilities.mof \ + schema/AllocationCapabilities.mof \ + schema/SettingsDefineCapabilities.mof \ + schema/MemoryPool.mof \ + schema/ElementCapabilities.mof \ + schema/ProcessorPool.mof \ + schema/DiskPool.mof \ + schema/HostedResourcePool.mof \ + schema/RegisteredProfile.mof \ + schema/ElementConformsToProfile.mof \ + schema/ComputerSystemIndication.mof \ + schema/ComputerSystemMigrationIndication.mof \ + schema/Virt_ResourceAllocationSettingData.mof \ + schema/ResourceAllocationSettingData.mof \ + schema/ResourcePoolConfigurationService.mof \ + schema/ResourcePoolConfigurationCapabilities.mof \ + schema/VSSDComponent.mof \ + schema/SettingsDefineState.mof \ + schema/NetPool.mof \ + schema/ResourceAllocationFromPool.mof \ + schema/ElementAllocatedFromPool.mof \ + schema/HostedService.mof \ + schema/ElementSettingData.mof \ + schema/VSMigrationCapabilities.mof \ + schema/VSMigrationService.mof \ + schema/VSMigrationSettingData.mof \ + schema/VirtualSystemSnapshotService.mof \ + schema/VirtualSystemSnapshotServiceCapabilities.mof \ + schema/ConcreteComponent.mof \ + schema/ConsoleRedirectionService.mof \ schema/ConsoleRedirectionServiceCapabilities.mof \ schema/ServiceAffectsElement.mof \ schema/KVMRedirectionSAP.mof \ @@ -52,70 +52,71 @@ schema/PointingDevice.mof \ schema/GraphicsPool.mof \ schema/InputPool.mof \ + schema/HostedAccessPoint.mof \ + schema/ServiceAccessBySAP.mof + +INTEROP_MOFS = \ + schema/ComputerSystem.mof \ + schema/HostSystem.mof \ + schema/RegisteredProfile.mof \ + schema/DiskPool.mof \ + schema/MemoryPool.mof \ + schema/NetPool.mof \ + schema/ProcessorPool.mof \ + schema/VSMigrationService.mof \ + schema/ElementConformsToProfile.mof \ + schema/ReferencedProfile.mof + +CIMV2_MOFS = \ + schema/HostedResourcePool.mof \ + schema/ElementCapabilities.mof \ + schema/HostedService.mof \ + schema/HostedDependency.mof \ + schema/RegisteredProfile.mof \ + schema/ComputerSystem.mof \ + schema/ElementConformsToProfile.mof \ schema/HostedAccessPoint.mof -INTEROP_MOFS = \ - schema/ComputerSystem.mof \ - schema/HostSystem.mof \ - schema/RegisteredProfile.mof \ - schema/DiskPool.mof \ - schema/MemoryPool.mof \ - schema/NetPool.mof \ - schema/ProcessorPool.mof \ - schema/VSMigrationService.mof \ - schema/ElementConformsToProfile.mof \ - schema/ReferencedProfile.mof - -CIMV2_MOFS = \ - schema/HostedResourcePool.mof \ - schema/ElementCapabilities.mof \ - schema/HostedService.mof \ - schema/HostedDependency.mof \ - schema/RegisteredProfile.mof \ - schema/ComputerSystem.mof \ - schema/ElementConformsToProfile.mof \ - schema/HostedAccessPoint.mof - REGS = \ - schema/ComputerSystem.registration \ - schema/LogicalDisk.registration \ - schema/NetworkPort.registration \ - schema/Memory.registration \ - schema/Processor.registration \ - schema/SystemDevice.registration \ - schema/VSSD.registration \ - schema/HostSystem.registration \ - schema/HostedDependency.registration \ - schema/VirtualSystemManagementService.registration \ - schema/VirtualSystemManagementCapabilities.registration \ - schema/EnabledLogicalElementCapabilities.registration \ - schema/AllocationCapabilities.registration \ - schema/SettingsDefineCapabilities.registration \ - schema/MemoryPool.registration \ - schema/ElementCapabilities.registration \ - schema/ProcessorPool.registration \ - schema/DiskPool.registration \ - schema/HostedResourcePool.registration \ - schema/ComputerSystemIndication.registration \ - schema/ComputerSystemMigrationIndication.registration \ - schema/ResourceAllocationSettingData.registration \ - schema/ResourcePoolConfigurationService.registration \ - schema/ResourcePoolConfigurationCapabilities.registration \ - schema/VSSDComponent.registration \ - schema/SettingsDefineState.registration \ - schema/NetPool.registration \ - schema/ResourceAllocationFromPool.registration \ - schema/ElementAllocatedFromPool.registration \ - schema/HostedService.registration \ - schema/ElementSettingData.registration \ - schema/VSMigrationCapabilities.registration \ - schema/VSMigrationService.registration \ - schema/ElementConformsToProfile.registration \ - schema/VSMigrationSettingData.registration \ - schema/VirtualSystemSnapshotService.registration \ - schema/VirtualSystemSnapshotServiceCapabilities.registration \ - schema/ConcreteComponent.registration \ - schema/ConsoleRedirectionService.registration \ + schema/ComputerSystem.registration \ + schema/LogicalDisk.registration \ + schema/NetworkPort.registration \ + schema/Memory.registration \ + schema/Processor.registration \ + schema/SystemDevice.registration \ + schema/VSSD.registration \ + schema/HostSystem.registration \ + schema/HostedDependency.registration \ + schema/VirtualSystemManagementService.registration \ + schema/VirtualSystemManagementCapabilities.registration \ + schema/EnabledLogicalElementCapabilities.registration \ + schema/AllocationCapabilities.registration \ + schema/SettingsDefineCapabilities.registration \ + schema/MemoryPool.registration \ + schema/ElementCapabilities.registration \ + schema/ProcessorPool.registration \ + schema/DiskPool.registration \ + schema/HostedResourcePool.registration \ + schema/ComputerSystemIndication.registration \ + schema/ComputerSystemMigrationIndication.registration \ + schema/ResourceAllocationSettingData.registration \ + schema/ResourcePoolConfigurationService.registration \ + schema/ResourcePoolConfigurationCapabilities.registration \ + schema/VSSDComponent.registration \ + schema/SettingsDefineState.registration \ + schema/NetPool.registration \ + schema/ResourceAllocationFromPool.registration \ + schema/ElementAllocatedFromPool.registration \ + schema/HostedService.registration \ + schema/ElementSettingData.registration \ + schema/VSMigrationCapabilities.registration \ + schema/VSMigrationService.registration \ + schema/ElementConformsToProfile.registration \ + schema/VSMigrationSettingData.registration \ + schema/VirtualSystemSnapshotService.registration \ + schema/VirtualSystemSnapshotServiceCapabilities.registration \ + schema/ConcreteComponent.registration \ + schema/ConsoleRedirectionService.registration \ schema/ConsoleRedirectionServiceCapabilities.registration \ schema/ServiceAffectsElement.registration \ schema/KVMRedirectionSAP.registration \ @@ -123,20 +124,21 @@ schema/PointingDevice.registration \ schema/GraphicsPool.registration \ schema/InputPool.registration \ - schema/HostedAccessPoint.registration + schema/HostedAccessPoint.registration \ + schema/ServiceAccessBySAP.registration INTEROP_REGS = \ - schema/RegisteredProfile.registration \ - schema/ElementConformsToProfile.registration \ - schema/ReferencedProfile.registration + schema/RegisteredProfile.registration \ + schema/ElementConformsToProfile.registration \ + schema/ReferencedProfile.registration CIMV2_REGS = \ - schema/HostedResourcePool.registration \ - schema/ElementCapabilities.registration \ - schema/HostedService.registration \ - schema/HostedDependency.registration \ - schema/ElementConformsToProfile.registration \ - schema/HostedAccessPoint.registration + schema/HostedResourcePool.registration \ + schema/ElementCapabilities.registration \ + schema/HostedService.registration \ + schema/HostedDependency.registration \ + schema/ElementConformsToProfile.registration \ + schema/HostedAccessPoint.registration pkgdata_DATA = $(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS) pkgdata_SCRIPTS = provider-register.sh diff -r 21a9102b8eef -r d0e5e8ae4c24 schema/ServiceAccessBySAP.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/ServiceAccessBySAP.mof Tue Dec 02 18:08:26 2008 -0200 @@ -0,0 +1,22 @@ +// Copyright IBM Corp. 2007 + +[Association, + Provider("cmpi::Virt_ServiceAccessBySAP") +] +class Xen_ServiceAccessBySAP : CIM_ServiceAccessBySAP +{ +}; + +[Association, + Provider("cmpi::Virt_ServiceAccessBySAP") +] +class KVM_ServiceAccessBySAP : CIM_ServiceAccessBySAP +{ +}; + +[Association, + Provider("cmpi::Virt_ServiceAccessBySAP") +] +class LXC_ServiceAccessBySAP : CIM_ServiceAccessBySAP +{ +}; diff -r 21a9102b8eef -r d0e5e8ae4c24 schema/ServiceAccessBySAP.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/ServiceAccessBySAP.registration Tue Dec 02 18:08:26 2008 -0200 @@ -0,0 +1,6 @@ +# Copyright IBM Corp. 2007 +# Classname Namespace ProviderName ProviderModule ProviderTypes +Xen_ServiceAccessBySAP root/virt Virt_ServiceAccessBySAP Virt_ServiceAccessBySAP association +KVM_ServiceAccessBySAP root/virt Virt_ServiceAccessBySAP Virt_ServiceAccessBySAP association +LXC_ServiceAccessBySAP root/virt Virt_ServiceAccessBySAP Virt_ServiceAccessBySAP association +

# HG changeset patch # User Richard Maciel <richardm@br.ibm.com> # Date 1228248422 7200 # Node ID c7cf7c24d7d5008dae1bf4cdfdbc4d80d7286a17 # Parent d0e5e8ae4c243dd119f1d539c5cb258301891cee Added ServiceAccessBySAP association (ConsoleRedirectionService <-> KVMRedirectionSAP) * Created Virt_ServiceAccessBySAP.c file * Changed src/Makefile.am Changes for submission #2 * Removed un-needed checks from the handlers of the ServiceAccessBySAP.c file Changes for submission #3 * Removed more un-needed checks from the handlers of the ServiceAccessBySAP.c file Signed-off-by: Richard Maciel <richardm@br.ibm.com> diff -r d0e5e8ae4c24 -r c7cf7c24d7d5 src/Makefile.am --- a/src/Makefile.am Tue Dec 02 18:08:26 2008 -0200 +++ b/src/Makefile.am Tue Dec 02 18:07:02 2008 -0200 @@ -73,7 +73,8 @@ libVirt_ElementSettingData.la \ libVirt_ConcreteComponent.la \ libVirt_ServiceAffectsElement.la \ - libVirt_HostedAccessPoint.la + libVirt_HostedAccessPoint.la \ + libVirt_ServiceAccessBySAP.la libVirt_ComputerSystem_la_SOURCES = Virt_ComputerSystem.c libVirt_ComputerSystem_la_DEPENDENCIES = libVirt_VirtualSystemSnapshotService.la @@ -217,6 +218,10 @@ libVirt_KVMRedirectionSAP_la_SOURCES = Virt_KVMRedirectionSAP.c +libVirt_ServiceAccessBySAP_la_DEPENDENCIES = libVirt_ConsoleRedirectionService.la libVirt_KVMRedirectionSAP.la +libVirt_ServiceAccessBySAP_la_SOURCES = Virt_ServiceAccessBySAP.c +libVirt_ServiceAccessBySAP_la_LIBADD = -lVirt_ConsoleRedirectionService -lVirt_KVMRedirectionSAP + libVirt_HostedAccessPoint_la_DEPENDENCIES = libVirt_HostSystem.la libVirt_KVMRedirectionSAP.la libVirt_HostedAccessPoint_la_SOURCES = Virt_HostedAccessPoint.c libVirt_HostedAccessPoint_la_LIBADD = -lVirt_HostSystem -lVirt_KVMRedirectionSAP diff -r d0e5e8ae4c24 -r c7cf7c24d7d5 src/Virt_ServiceAccessBySAP.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Virt_ServiceAccessBySAP.c Tue Dec 02 18:07:02 2008 -0200 @@ -0,0 +1,155 @@ +/* + * Copyright IBM Corp. 2007 + * + * Authors: + * Richard Maciel <richardm@br.ibm.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> + +#include <libcmpiutil/libcmpiutil.h> +#include <libcmpiutil/std_association.h> +#include "misc_util.h" + +#include "Virt_ConsoleRedirectionService.h" +#include "Virt_KVMRedirectionSAP.h" + +const static CMPIBroker *_BROKER; + + +static CMPIStatus service_to_rsap(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance = NULL; + char* classname; + + if (!match_hypervisor_prefix(ref, info)) + goto out; + + classname = class_base_name(CLASSNAME(ref)); + + s = get_console_rs(ref, &instance, _BROKER, info->context, true); + if (s.rc != CMPI_RC_OK) + goto out; + + s = enum_console_sap(_BROKER, ref, list); + + out: + return s; +} + +static CMPIStatus rsap_to_service(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance = NULL; + + if (!match_hypervisor_prefix(ref, info)) + goto out; + + s = get_console_sap_by_ref(_BROKER, ref, &instance); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_console_rs(ref, &instance, _BROKER, info->context, false); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, instance); + + out: + return s; +} + +LIBVIRT_CIM_DEFAULT_MAKEREF() + +static char* antecedent[] = { + "Xen_ConsoleRedirectionService", + "KVM_ConsoleRedirectionService", + "LXC_ConsoleRedirectionService", + NULL +}; + +static char* dependent[] = { + "Xen_KVMRedirectionSAP", + "KVM_KVMRedirectionSAP", + "LXC_KVMRedirectionSAP", + NULL +}; + +static char* assoc_classname[] = { + "Xen_ServiceAccessBySAP", + "KVM_ServiceAccessBySAP", + "LXC_ServiceAccessBySAP", + NULL +}; + +static struct std_assoc _service_to_rsap = { + .source_class = (char**)&antecedent, + .source_prop = "Antecedent", + + .target_class = (char**)&dependent, + .target_prop = "Dependent", + + .assoc_class = (char**)&assoc_classname, + + .handler = service_to_rsap, + .make_ref = make_ref +}; + +static struct std_assoc _rsap_to_service = { + .source_class = (char**)&dependent, + .source_prop = "Dependent", + + .target_class = (char**)&antecedent, + .target_prop = "Antecedent", + + .assoc_class = (char**)&assoc_classname, + + .handler = rsap_to_service, + .make_ref = make_ref +}; + +static struct std_assoc *handlers[] = { + &_service_to_rsap, + &_rsap_to_service, + NULL +}; + +STDA_AssocMIStub(, + Virt_ServiceAccessBySAP, + _BROKER, + libvirt_cim_init(), + handlers); + +/* + * Local Variables: + * mode: C + * c-set-style: "K&R" + * tab-width: 8 + * c-basic-offset: 8 + * indent-tabs-mode: nil + * End: + */
participants (1)
-
Richard Maciel