[PATCH] Signed-off-by: Richard Maciel <richardm@br.ibm.com>

# HG changeset patch # User Richard Maciel <richardm@br.ibm.com> # Date 1224109379 25200 # Node ID e71c0941849da4338ed56d784a6c3966b73ffaf7 # Parent 5f835a32ab3aa0dc26718371c3f4a0a0abe879ae Signed-off-by: Richard Maciel <richardm@br.ibm.com> * Added association Console Redirections Service <-> Console Redirection Service Capabilities into the ElementCapabilities.c file * Added ConsoleRedirectionServiceCapabilities.h to export the get_console_rs_caps function * get_console_rs_caps is not static anymore diff -r 5f835a32ab3a -r e71c0941849d src/Makefile.am --- a/src/Makefile.am Wed Oct 15 14:14:09 2008 -0700 +++ b/src/Makefile.am Wed Oct 15 15:22:59 2008 -0700 @@ -21,7 +21,8 @@ Virt_VirtualSystemSnapshotService.h \ Virt_VirtualSystemSnapshotServiceCapabilities.h \ Virt_VSMigrationSettingData.h \ - Virt_ConsoleRedirectionService.h + Virt_ConsoleRedirectionService.h \ + Virt_ConsoleRedirectionServiceCapabilities.h XKUADD = $(top_builddir)/libxkutil/libxkutil.la @@ -119,7 +120,7 @@ libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c libVirt_AllocationCapabilities_la_LIBADD = -lVirt_DevicePool -libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_VSMigrationCapabilities.la libVirt_VirtualSystemManagementService.la libVirt_VSMigrationService.la libVirt_DevicePool.la +libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_VSMigrationCapabilities.la libVirt_VirtualSystemManagementService.la libVirt_VSMigrationService.la libVirt_DevicePool.la libVirt_ConsoleRedirectionService.la libVirt_ConsoleRedirectionServiceCapabilities.la libVirt_ElementCapabilities_la_SOURCES = Virt_ElementCapabilities.c libVirt_ElementCapabilities_la_LIBADD = -lVirt_VirtualSystemManagementCapabilities \ -lVirt_EnabledLogicalElementCapabilities \ @@ -129,7 +130,9 @@ -lVirt_AllocationCapabilities \ -lVirt_VirtualSystemManagementService \ -lVirt_VSMigrationService \ - -lVirt_DevicePool + -lVirt_DevicePool \ + -lVirt_ConsoleRedirectionService \ + -lVirt_ConsoleRedirectionServiceCapabilities libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la libVirt_DevicePool.la libVirt_VSMigrationCapabilities.la libVirt_VSMigrationSettingData.la libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c diff -r 5f835a32ab3a -r e71c0941849d src/Virt_ConsoleRedirectionServiceCapabilities.c --- a/src/Virt_ConsoleRedirectionServiceCapabilities.c Wed Oct 15 14:14:09 2008 -0700 +++ b/src/Virt_ConsoleRedirectionServiceCapabilities.c Wed Oct 15 15:22:59 2008 -0700 @@ -32,6 +32,7 @@ #include "svpc_types.h" #include "Virt_ConsoleRedirectionService.h" +#include "Virt_ConsoleRedirectionServiceCapabilities.h" const static CMPIBroker *_BROKER; @@ -69,7 +70,9 @@ return s; } -static CMPIStatus get_console_rs_caps(const CMPIBroker *broker, +/* Removed the static keyword from the function declaration to + * make it available for other modules */ +CMPIStatus get_console_rs_caps(const CMPIBroker *broker, const CMPIObjectPath *ref, CMPIInstance **_inst, bool is_get_inst) diff -r 5f835a32ab3a -r e71c0941849d src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Wed Oct 15 14:14:09 2008 -0700 +++ b/src/Virt_ElementCapabilities.c Wed Oct 15 15:22:59 2008 -0700 @@ -41,6 +41,8 @@ #include "Virt_VSMigrationCapabilities.h" #include "Virt_AllocationCapabilities.h" #include "Virt_DevicePool.h" +#include "Virt_ConsoleRedirectionService.h" +#include "Virt_ConsoleRedirectionServiceCapabilities.h" #include "svpc_types.h" @@ -75,7 +77,15 @@ goto out; s = get_migration_service(ref, &_inst, _BROKER, context, false); - } else + } else if (STREQC(classname, "ConsoleRedirectionServiceCapabilities")) { + s = get_console_rs_caps(_BROKER, ref, &_inst, true); + + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) + goto out; + + + s = get_console_rs(ref, &_inst, _BROKER, context, false); + } else cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, "Not found"); @@ -100,7 +110,7 @@ char* classname; classname = class_base_name(CLASSNAME(ref)); - + CU_DEBUG("After class_base_name\n: %s", classname); if (STREQC(classname, "VirtualSystemManagementService")) { s = get_vsms(ref, &_inst, _BROKER, context, true); if ((s.rc != CMPI_RC_OK) || (_inst == NULL)) @@ -113,7 +123,18 @@ goto out; s = get_migration_caps(ref, &_inst, _BROKER, false); - } else + } else if(STREQC(classname, "ConsoleRedirectionService")) { + CU_DEBUG("before console_rs\n"); + s = get_console_rs(ref, &_inst, _BROKER, context, true); + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) + goto out; + + CU_DEBUG("before console_rs_caps\n"); + s = get_console_rs_caps(_BROKER, ref, &_inst, false); + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) + goto out; + CU_DEBUG("after console_rs_Caps\n"); + } else cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, ""); @@ -190,6 +211,8 @@ { CMPIInstance *inst = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; + + CU_DEBUG("service_to_cap\n"); if (!match_hypervisor_prefix(ref, info)) goto out; @@ -382,22 +405,28 @@ "Xen_HostSystem", "Xen_VirtualSystemManagementService", "Xen_VirtualSystemMigrationService", + "Xen_ConsoleRedirectionService", "KVM_HostSystem", "KVM_VirtualSystemManagementService", "KVM_VirtualSystemMigrationService", + "KVM_ConsoleRedirectionService", "LXC_HostSystem", "LXC_VirtualSystemManagementService", "LXC_VirtualSystemMigrationService", + "LXC_ConsoleRedirectionService", NULL }; static char *host_caps[] = { "Xen_VirtualSystemManagementCapabilities", "Xen_VirtualSystemMigrationCapabilities", + "Xen_ConsoleRedirectionServiceCapabilities", "KVM_VirtualSystemManagementCapabilities", "KVM_VirtualSystemMigrationCapabilities", + "KVM_ConsoleRedirectionServiceCapabilities", "LXC_VirtualSystemManagementCapabilities", "LXC_VirtualSystemMigrationCapabilities", + "LXC_ConsoleRedirectionServiceCapabilities", NULL, }; @@ -434,6 +463,9 @@ "Xen_VirtualSystemMigrationService", "KVM_VirtualSystemMigrationService", "LXC_VirtualSystemMigrationService", + "Xen_ConsoleRedirectionService", + "KVM_ConsoleRedirectionService", + "LXC_ConsoleRedirectionService", NULL };

RM> # HG changeset patch RM> # User Richard Maciel <richardm@br.ibm.com> RM> # Date 1224109379 25200 RM> # Node ID e71c0941849da4338ed56d784a6c3966b73ffaf7 RM> # Parent 5f835a32ab3aa0dc26718371c3f4a0a0abe879ae RM> Signed-off-by: Richard Maciel <richardm@br.ibm.com> Your DCO is typically the last line of the commit log, otherwise it shows up as the short description (and subject line) of the patch. RM> * Added association Console Redirections Service <-> Console Redirection Service RM> Capabilities into the ElementCapabilities.c file RM> * Added ConsoleRedirectionServiceCapabilities.h to export the get_console_rs_caps function RM> * get_console_rs_caps is not static anymore If you could wrap your commit log at 80 characters, it would help readability. RM> - -lVirt_DevicePool RM> + -lVirt_DevicePool \ RM> + -lVirt_ConsoleRedirectionService \ RM> + -lVirt_ConsoleRedirectionServiceCapabilities Looks like you've got some mixed whitespace here. RM> -static CMPIStatus get_console_rs_caps(const CMPIBroker *broker, RM> +/* Removed the static keyword from the function declaration to RM> + * make it available for other modules */ RM> +CMPIStatus get_console_rs_caps(const CMPIBroker *broker, RM> const CMPIObjectPath *ref, RM> CMPIInstance **_inst, RM> bool is_get_inst) The comment is not necessary. Also, please realign the parameter list after removing the static. RM> - } else RM> + } else if (STREQC(classname, "ConsoleRedirectionServiceCapabilities")) { RM> + s = get_console_rs_caps(_BROKER, ref, &_inst, true); RM> + RM> + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) You're using tabs instead of spaces on these (and all) new lines. The coding standard for libvirt-cim is 8 spaces. You also need a space between your 'if' and '('. See doc/CodingStyle for this and other things. RM> - RM> + CU_DEBUG("After class_base_name\n: %s", classname); This debug statement is probably not generally useful. RM> + } else if(STREQC(classname, "ConsoleRedirectionService")) { RM> + CU_DEBUG("before console_rs\n"); This one can be removed as well. RM> + s = get_console_rs(ref, &_inst, _BROKER, context, true); RM> + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) RM> + goto out; RM> + RM> + CU_DEBUG("before console_rs_caps\n"); This one too. RM> + s = get_console_rs_caps(_BROKER, ref, &_inst, false); RM> + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) RM> + goto out; RM> + CU_DEBUG("after console_rs_Caps\n"); ...and this one. RM> + CU_DEBUG("service_to_cap\n"); ...and this one :) Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

s = get_migration_caps(ref, &_inst, _BROKER, false); - } else + } else if(STREQC(classname, "ConsoleRedirectionService")) { + CU_DEBUG("before console_rs\n"); + s = get_console_rs(ref, &_inst, _BROKER, context, true); + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) + goto out; + + CU_DEBUG("before console_rs_caps\n"); + s = get_console_rs_caps(_BROKER, ref, &_inst, false); + if((s.rc != CMPI_RC_OK) || (_inst == NULL)) + goto out;
These two lines above aren't needed. The status will be returned to service_to_cap(), and the status will be verified there. Plus, this makes the format match the other service_to_cap() calls. Also, this patch doesn't include the new Virt_ConsoleRedirectionServiceCapabilities.h. That will need to be added to the patch. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Dan Smith
-
Kaitlin Rupert
-
Richard Maciel