[PATCH 0 of 2] Add VSMigrationSettingData support to SettingsDefineState

Per the VirtualSystemMigration Profile, there needs to be a SettingsDefineCapabilities association between VSMigrationCapabilities and VSMigrationSettingData.

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1202248164 28800 # Node ID 939ed8ed24f4842ddde6ca06bdcaaeab4168ff9b # Parent 4299c8dc5291bd6922e27dbd34e6ef6ecc67c49b Make get_migration_sd() of VSmigrationSettingData.c staitc. SettingsDefineCapabilities will need to call this function. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 4299c8dc5291 -r 939ed8ed24f4 src/Virt_VSMigrationSettingData.c --- a/src/Virt_VSMigrationSettingData.c Tue Feb 05 13:27:11 2008 -0800 +++ b/src/Virt_VSMigrationSettingData.c Tue Feb 05 13:49:24 2008 -0800 @@ -30,6 +30,7 @@ #include <libcmpiutil/std_instance.h> #include "misc_util.h" +#include "Virt_VSMigrationSettingData.h" const static CMPIBroker *_BROKER; @@ -52,10 +53,10 @@ static CMPIStatus set_properties(const C return s; } -static CMPIStatus get_migration_sd(const CMPIObjectPath *ref, - CMPIInstance **_inst, - const CMPIBroker *broker, - bool is_get_inst) +CMPIStatus get_migration_sd(const CMPIObjectPath *ref, + CMPIInstance **_inst, + const CMPIBroker *broker, + bool is_get_inst) { CMPIInstance *inst; CMPIStatus s; diff -r 4299c8dc5291 -r 939ed8ed24f4 src/Virt_VSMigrationSettingData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Virt_VSMigrationSettingData.h Tue Feb 05 13:49:24 2008 -0800 @@ -0,0 +1,35 @@ +/* + * Copyright IBM Corp. 2007 + * + * Authors: + * Kaitlin Rupert <karupert@us.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 + */ + +CMPIStatus get_migration_sd(const CMPIObjectPath *ref, + CMPIInstance **_inst, + const CMPIBroker *broker, + bool is_get_inst); +/* + * Local Variables: + * mode: C + * c-set-style: "K&R" + * tab-width: 8 + * c-basic-offset: 8 + * indent-tabs-mode: nil + * End: + */ +

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1202248173 28800 # Node ID 4a3c49398498fc69bf1063bfdec45fa6fb553f32 # Parent 939ed8ed24f4842ddde6ca06bdcaaeab4168ff9b Update SettingsDefineCapabilities so that it supports VSMigrationSettingData. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 939ed8ed24f4 -r 4a3c49398498 src/Makefile.am --- a/src/Makefile.am Tue Feb 05 13:49:24 2008 -0800 +++ b/src/Makefile.am Tue Feb 05 13:49:33 2008 -0800 @@ -103,9 +103,12 @@ libVirt_ElementCapabilities_la_LIBADD = -lVirt_VSMigrationCapabilities \ -lVirt_AllocationCapabilities -libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la libVirt_DevicePool.la +libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la libVirt_DevicePool.la libVirt_VSMigrationCapabilities.la libVirt_VSMigrationSettingData.la libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c -libVirt_SettingsDefineCapabilities_la_LIBADD = -lVirt_RASD -lVirt_DevicePool +libVirt_SettingsDefineCapabilities_la_LIBADD = -lVirt_RASD \ + -lVirt_DevicePool \ + -lVirt_VSMigrationCapabilities \ + -lVirt_VSMigrationSettingData libVirt_RegisteredProfile_la_SOURCES = Virt_RegisteredProfile.c diff -r 939ed8ed24f4 -r 4a3c49398498 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Tue Feb 05 13:49:24 2008 -0800 +++ b/src/Virt_SettingsDefineCapabilities.c Tue Feb 05 13:49:33 2008 -0800 @@ -43,6 +43,8 @@ #include "Virt_SettingsDefineCapabilities.h" #include "Virt_DevicePool.h" #include "Virt_RASD.h" +#include "Virt_VSMigrationCapabilities.h" +#include "Virt_VSMigrationSettingData.h" const static CMPIBroker *_BROKER; @@ -825,6 +827,50 @@ static CMPIStatus rasd_to_alloc_cap(cons RETURN_UNSUPPORTED(); } +static CMPIStatus migrate_cap_to_vsmvs(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK}; + CMPIInstance *inst; + + if (!match_hypervisor_prefix(ref, info)) + return s; + + s = get_migration_caps(ref, &inst, _BROKER); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_sd(ref, &inst, _BROKER, false); + if (s.rc == CMPI_RC_OK) + inst_list_add(list, inst); + + out: + return s; +} + +static CMPIStatus vsmvs_to_migrate_cap(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK}; + CMPIInstance *inst; + + if (!match_hypervisor_prefix(ref, info)) + return s; + + s = get_migration_sd(ref, &inst, _BROKER, true); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_caps(ref, &inst, _BROKER); + if (s.rc == CMPI_RC_OK) + inst_list_add(list, inst); + + out: + return s; +} + LIBVIRT_CIM_DEFAULT_MAKEREF() static char* group_component[] = { @@ -877,9 +923,49 @@ static struct std_assoc _rasd_to_alloc_c .make_ref = make_ref }; +static char* migrate_cap[] = { + "Xen_VirtualSystemMigrationCapabilities", + "KVM_VirtualSystemMigrationCapabilities", + NULL +}; + +static char* migrate_sd[] = { + "Xen_VirtualSystemMigrationSettingData", + "KVM_VirtualSystemMigrationSettingData", + NULL +}; + +static struct std_assoc _migrate_cap_to_vsmvs = { + .source_class = (char**)&migrate_cap, + .source_prop = "GroupComponent", + + .target_class = (char**)&migrate_sd, + .target_prop = "PartComponent", + + .assoc_class = (char**)&assoc_classname, + + .handler = migrate_cap_to_vsmvs, + .make_ref = make_ref +}; + +static struct std_assoc _vsmvs_to_migrate_cap = { + .source_class = (char**)&migrate_sd, + .source_prop = "PartComponent", + + .target_class = (char**)&migrate_cap, + .target_prop = "GroupComponent", + + .assoc_class = (char**)&assoc_classname, + + .handler = vsmvs_to_migrate_cap, + .make_ref = make_ref +}; + static struct std_assoc *assoc_handlers[] = { &_alloc_cap_to_rasd, &_rasd_to_alloc_cap, + &_migrate_cap_to_vsmvs, + &_vsmvs_to_migrate_cap, NULL };

Kaitlin Rupert wrote: }
+static CMPIStatus migrate_cap_to_vsmvs(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK}; + CMPIInstance *inst; + + if (!match_hypervisor_prefix(ref, info)) + return s; + + s = get_migration_caps(ref, &inst, _BROKER); + if (s.rc != CMPI_RC_OK) + goto out;
get_migration_cap() currently doesn't validate the keys of the reference. I've seen a lot of ref validation fixes from Heidi, and so I don't work up a colliding patch. If no one is working on this, I can look into it. Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
get_migration_cap() currently doesn't validate the keys of the reference. You are very attentive :).
I've seen a lot of ref validation fixes from Heidi, and so I don't work up a colliding patch. If no one is working on this, I can look into it. Sure, that would really help me. And its always good to spread knowledge all over the team ;). Please can you also rename the superclass from Virt_VirtualSystemMigrationCapabilities to CIM_... ? Dan agreed on this update some weeks ago, but I did not had the time to fix it yet.
Thanks!
I have to say Thanks ! -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor

Kaitlin Rupert wrote:
Per the VirtualSystemMigration Profile, there needs to be a SettingsDefineCapabilities association between VSMigrationCapabilities and VSMigrationSettingData.
Only one comment ... great work :) ... +1 -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor

Heidi Eckhart wrote:
Kaitlin Rupert wrote:
Per the VirtualSystemMigration Profile, there needs to be a SettingsDefineCapabilities association between VSMigrationCapabilities and VSMigrationSettingData.
Only one comment ... great work :) ... +1
The only comment was regarding the name change for the superclass Virt_VirtualSystemMigrationCapabilities to CIM_, right? If so, I'll fix that (and the VirtualSystemMigrationCapabilities reference checking) in a separate patch. Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
Heidi Eckhart wrote:
Kaitlin Rupert wrote:
Per the VirtualSystemMigration Profile, there needs to be a SettingsDefineCapabilities association between VSMigrationCapabilities and VSMigrationSettingData.
Only one comment ... great work :) ... +1
The only comment was regarding the name change for the superclass Virt_VirtualSystemMigrationCapabilities to CIM_, right?
If so, I'll fix that (and the VirtualSystemMigrationCapabilities reference checking) in a separate patch.
Thanks!
Yes, thank you :) ! -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor

Heidi Eckhart wrote:
Kaitlin Rupert wrote:
Heidi Eckhart wrote:
Kaitlin Rupert wrote:
Per the VirtualSystemMigration Profile, there needs to be a SettingsDefineCapabilities association between VSMigrationCapabilities and VSMigrationSettingData.
Only one comment ... great work :) ... +1
The only comment was regarding the name change for the superclass Virt_VirtualSystemMigrationCapabilities to CIM_, right?
If so, I'll fix that (and the VirtualSystemMigrationCapabilities reference checking) in a separate patch.
Thanks!
Yes, thank you :) !
I haven't forgotten about this fix. I'll send the fix out once the current reference validation patches are approved. =) -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Heidi Eckhart
-
Kaitlin Rupert