From heidieck at linux.vnet.ibm.com Mon Mar 3 10:26:33 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:26:33 +0100 Subject: [Libvirt-cim] [PATCH] Fix missing braces in HD In-Reply-To: <9ca3b9b245f8af8f960a.1204315317@elm3b41.beaverton.ibm.com> References: <9ca3b9b245f8af8f960a.1204315317@elm3b41.beaverton.ibm.com> Message-ID: <47CBD259.5040401@linux.vnet.ibm.com> Kaitlin Rupert wrote: > # HG changeset patch > # User Kaitlin Rupert > # Date 1204315089 28800 > # Node ID 9ca3b9b245f8af8f960a4d1e3557adf536daabee > # Parent b2f223ca9105b8f416ab768a1363df910d6815d4 > Fix missing braces in HD. > > Some missing braces cause host_to_vs() to exit before enumerating the instances. > > Signed-off-by: Kaitlin Rupert > > diff -r b2f223ca9105 -r 9ca3b9b245f8 src/Virt_HostedDependency.c > --- a/src/Virt_HostedDependency.c Fri Feb 29 13:04:15 2008 +0100 > +++ b/src/Virt_HostedDependency.c Fri Feb 29 11:58:09 2008 -0800 > @@ -75,11 +75,12 @@ static CMPIStatus host_to_vs(const CMPIO > goto out; > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); > - if (conn == NULL) > + if (conn == NULL) { > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_NOT_FOUND, > "No such instance"); > goto out; > + } > > ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list); > if (!ret) > Opps ... that's a bug that slipped in with my patch set "Update single instance interface on HostSystem and Adopt HostSystem interface to assocs". I will fix this right in the patch set. Thanks "eagle eye" :) ! -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 3 10:37:02 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:37:02 +0100 Subject: [Libvirt-cim] [PATCH 0 of 5] #2 - Update single instance interface on HostSystem and Adopt HostSystem interface to assocs Message-ID: This patch set update the HostSystem provider to follow the common look and feel of single instance providers. The interface changes on HostSystem have been adopted to the associations HD, HRP, EC and HS. diff to patch set 1: fixed HD - missing braces (thanks to eagle eye kaitlin From heidieck at linux.vnet.ibm.com Mon Mar 3 10:37:03 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:37:03 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] HostSystem: adopt interface of single instance providers In-Reply-To: Message-ID: <7957f5828b31c7d557f8.1204540623@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204534935 -3600 # Node ID 7957f5828b31c7d557f828e0d9b63eaaebd6db0f # Parent e61accae90e146b1eb57eade5d397a9fe2047a52 HostSystem: adopt interface of single instance providers During the last updates to single instance providers, a common interface look and feel has established. This patch adopts these changes to HostSystem. Signed-off-by: Heidi Eckhart diff -r e61accae90e1 -r 7957f5828b31 src/Virt_HostSystem.c --- a/src/Virt_HostSystem.c Fri Feb 29 06:55:11 2008 -0800 +++ b/src/Virt_HostSystem.c Mon Mar 03 10:02:15 2008 +0100 @@ -36,19 +36,6 @@ const static CMPIBroker *_BROKER; -CMPIStatus validate_host_ref(const CMPIBroker *broker, - const CMPIObjectPath *ref) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *inst; - - s = get_host_cs(broker, ref, &inst); - if (inst != NULL) - s = cu_validate_ref(broker, ref, inst); - - return s; -} - static int set_host_system_properties(CMPIInstance *instance) { CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -70,18 +57,23 @@ static int set_host_system_properties(CM return 1; } -CMPIStatus get_host_cs(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance) +CMPIStatus get_host(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **_inst, + bool is_get_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; virConnectPtr conn = NULL; - *instance = NULL; conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) - return s; + if (conn == NULL) { + if (is_get_inst) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } inst = get_typed_instance(broker, pfx_from_conn(conn), @@ -97,43 +89,36 @@ CMPIStatus get_host_cs(const CMPIBroker set_host_system_properties(inst); - out: - virConnectClose(conn); - *instance = inst; - - return s; -} - -static CMPIStatus return_host_cs(const CMPIObjectPath *reference, - const CMPIResult *results, - bool name_only, - bool is_get_inst) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; - - s = get_host_cs(_BROKER, reference, &instance); - if (s.rc != CMPI_RC_OK) - goto out; - - if (instance == NULL) { - if (is_get_inst) - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); - goto out; - } - if (is_get_inst) { - s = cu_validate_ref(_BROKER, reference, instance); + s = cu_validate_ref(broker, reference, inst); if (s.rc != CMPI_RC_OK) goto out; } + *_inst = inst; + + out: + virConnectClose(conn); + + return s; +} + +static CMPIStatus return_host(const CMPIObjectPath *reference, + const CMPIResult *results, + bool name_only, + bool is_get_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + + s = get_host(_BROKER, reference, &inst, is_get_inst); + if (s.rc != CMPI_RC_OK || inst == NULL) + goto out; + if (name_only) - cu_return_instance_name(results, instance); + cu_return_instance_name(results, inst); else - CMReturnInstance(results, instance); + CMReturnInstance(results, inst); out: return s; @@ -147,8 +132,8 @@ CMPIStatus get_host_system_properties(co CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *host = NULL; - s = get_host_cs(broker, ref, &host); - if (s.rc != CMPI_RC_OK) + s = get_host(broker, ref, &host, false); + if (s.rc != CMPI_RC_OK || host == NULL) goto out; if (cu_get_str_prop(host, "Name", name) != CMPI_RC_OK) { @@ -174,10 +159,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_host_cs(reference, - results, - true, - false); + return return_host(reference, results, true, false); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -187,10 +169,7 @@ static CMPIStatus EnumInstances(CMPIInst const char **properties) { - return return_host_cs(reference, - results, - false, - false); + return return_host(reference, results, false, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -199,10 +178,7 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - return return_host_cs(reference, - results, - false, - true); + return return_host(reference, results, false, true); } DEFAULT_CI(); diff -r e61accae90e1 -r 7957f5828b31 src/Virt_HostSystem.h --- a/src/Virt_HostSystem.h Fri Feb 29 06:55:11 2008 -0800 +++ b/src/Virt_HostSystem.h Mon Mar 03 10:02:15 2008 +0100 @@ -21,16 +21,14 @@ #ifndef __VIRT_HOSTSYSTEM_H #define __VIRT_HOSTSYSTEM_H -CMPIStatus get_host_cs(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance); +CMPIStatus get_host(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **_inst, + bool is_get_inst); CMPIStatus get_host_system_properties(const char **name, const char **ccname, const CMPIObjectPath *ref, const CMPIBroker *broker); -CMPIStatus validate_host_ref(const CMPIBroker *broker, - const CMPIObjectPath *ref); - #endif From heidieck at linux.vnet.ibm.com Mon Mar 3 10:37:04 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:37:04 +0100 Subject: [Libvirt-cim] [PATCH 2 of 5] HD: validate client given object path In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204540080 -3600 # Node ID d6992120c4edd5643f53edfe2255d5a1a657ba80 # Parent 7957f5828b31c7d557f828e0d9b63eaaebd6db0f HD: validate client given object path wbemain -ac KVM_HostedDependency 'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="wrong"' returns instances instead of NOT_FOUND wbemain -ac CIM_HostedDependency 'http://localhost/root/virt:KVM_ComputerSystem.CreationClassName="KVM_ComputerSystem",Name="wrong"' returns an instance instead of NOT_FOUND Signed-off-by: Heidi Eckhart diff -r 7957f5828b31 -r d6992120c4ed src/Virt_HostedDependency.c --- a/src/Virt_HostedDependency.c Mon Mar 03 10:02:15 2008 +0100 +++ b/src/Virt_HostedDependency.c Mon Mar 03 11:28:00 2008 +0100 @@ -41,15 +41,22 @@ static CMPIStatus vs_to_host(const CMPIO struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; + CMPIInstance *instance = NULL; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; - s = get_host_cs(_BROKER, ref, &instance); + s = get_domain(_BROKER, ref, &instance); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_host(_BROKER, ref, &instance, false); if (s.rc == CMPI_RC_OK) - inst_list_add(list, instance); + goto out; + inst_list_add(list, instance); + + out: return s; } @@ -60,29 +67,30 @@ static CMPIStatus host_to_vs(const CMPIO int ret; virConnectPtr conn; CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance = NULL; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; + + s = get_host(_BROKER, ref, &instance, true); + if (s.rc != CMPI_RC_OK) + goto out; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - return s; + if (conn == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list); - if (ret) { - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { + if (!ret) cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Failed to get domain list"); - } - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - + out: return s; } From heidieck at linux.vnet.ibm.com Mon Mar 3 10:37:05 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:37:05 +0100 Subject: [Libvirt-cim] [PATCH 3 of 5] HRP: adopt HostSystem interface changes In-Reply-To: Message-ID: <74515c28683ce659b54a.1204540625@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204540082 -3600 # Node ID 74515c28683ce659b54af726d7bc5cec62995df1 # Parent d6992120c4edd5643f53edfe2255d5a1a657ba80 HRP: adopt HostSystem interface changes Signed-off-by: Heidi Eckhart diff -r d6992120c4ed -r 74515c28683c src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Mon Mar 03 11:28:00 2008 +0100 +++ b/src/Virt_HostedResourcePool.c Mon Mar 03 11:28:02 2008 +0100 @@ -41,23 +41,23 @@ static CMPIStatus pool_to_sys(const CMPI struct std_assoc_info *info, struct inst_list *list) { - CMPIInstance *host; CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *inst; + CMPIInstance *inst = NULL; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; s = get_pool_inst(_BROKER, ref, &inst); if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - return s; + goto out; - s = get_host_cs(_BROKER, ref, &host); + s = get_host(_BROKER, ref, &inst, false); if (s.rc != CMPI_RC_OK) - return s; + goto out; - inst_list_add(list, host); + inst_list_add(list, inst); + out: return s; } @@ -66,19 +66,20 @@ static CMPIStatus sys_to_pool(const CMPI struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; int i; virConnectPtr conn; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; - s = validate_host_ref(_BROKER, ref); + s = get_host(_BROKER, ref, &inst, true); if (s.rc != CMPI_RC_OK) - return s; + goto out; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) - return s; + goto out; for (i = 0; device_pool_names[i]; i++) get_pool_by_type(_BROKER, @@ -87,10 +88,7 @@ static CMPIStatus sys_to_pool(const CMPI NAMESPACE(ref), list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - + out: return s; } From heidieck at linux.vnet.ibm.com Mon Mar 3 10:37:06 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:37:06 +0100 Subject: [Libvirt-cim] [PATCH 4 of 5] EC: adopt HostSystem interface changes In-Reply-To: Message-ID: <9b3626d6b286b7e7190b.1204540626@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204540491 -3600 # Node ID 9b3626d6b286b7e7190b4a760c349a45985ec5f2 # Parent 74515c28683ce659b54af726d7bc5cec62995df1 EC: adopt HostSystem interface changes Signed-off-by: Heidi Eckhart diff -r 74515c28683c -r 9b3626d6b286 src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Mon Mar 03 11:28:02 2008 +0100 +++ b/src/Virt_ElementCapabilities.c Mon Mar 03 11:34:51 2008 +0100 @@ -125,13 +125,13 @@ static CMPIStatus sys_to_cap(const CMPIO struct std_assoc_info *info, struct inst_list *list) { - CMPIInstance *inst; - CMPIStatus s = {CMPI_RC_OK, NULL}; - - if (!match_hypervisor_prefix(ref, info)) - goto out; - - s = validate_host_ref(_BROKER, ref); + CMPIInstance *inst = NULL; + CMPIStatus s = {CMPI_RC_OK, NULL}; + + if (!match_hypervisor_prefix(ref, info)) + goto out; + + s = get_host(_BROKER, ref, &inst, true); if (s.rc != CMPI_RC_OK) goto out; @@ -164,7 +164,7 @@ static CMPIStatus cap_to_sys_or_service( if (inst != NULL) inst_list_add(list, inst); - s = get_host_cs(_BROKER, ref, &inst); + s = get_host(_BROKER, ref, &inst, false); if (s.rc != CMPI_RC_OK) goto out; From heidieck at linux.vnet.ibm.com Mon Mar 3 10:37:07 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:37:07 +0100 Subject: [Libvirt-cim] [PATCH 5 of 5] HS: adopt HostSystem interface changes In-Reply-To: Message-ID: <27e78288c82426835126.1204540627@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204540492 -3600 # Node ID 27e78288c82426835126eaa07dba1e425c756f3f # Parent 9b3626d6b286b7e7190b4a760c349a45985ec5f2 HS: adopt HostSystem interface changes Signed-off-by: Heidi Eckhart diff -r 9b3626d6b286 -r 27e78288c824 src/Makefile.am --- a/src/Makefile.am Mon Mar 03 11:34:51 2008 +0100 +++ b/src/Makefile.am Mon Mar 03 11:34:52 2008 +0100 @@ -54,10 +54,10 @@ provider_LTLIBRARIES = libVirt_ComputerS libVirt_SettingsDefineState.la \ libVirt_ResourceAllocationFromPool.la \ libVirt_ElementAllocatedFromPool.la \ + libVirt_VSMigrationService.la \ libVirt_HostedService.la \ libVirt_ElementSettingData.la \ libVirt_VSMigrationCapabilities.la \ - libVirt_VSMigrationService.la \ libVirt_VSMigrationSettingData.la \ libVirt_VirtualSystemSnapshotService.la \ libVirt_VirtualSystemSnapshotServiceCapabilities.la diff -r 9b3626d6b286 -r 27e78288c824 src/Virt_HostedService.c --- a/src/Virt_HostedService.c Mon Mar 03 11:34:51 2008 +0100 +++ b/src/Virt_HostedService.c Mon Mar 03 11:34:52 2008 +0100 @@ -40,8 +40,7 @@ static CMPIStatus validate_service_ref(c static CMPIStatus validate_service_ref(const CMPIObjectPath *ref) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *inst; - const char *prop; + CMPIInstance *inst = NULL; char* classname; classname = class_base_name(CLASSNAME(ref)); @@ -54,17 +53,6 @@ static CMPIStatus validate_service_ref(c s = get_migration_service(ref, &inst, _BROKER, true); } - if (s.rc != CMPI_RC_OK) - goto out; - - prop = cu_compare_ref(ref, inst); - if (prop != NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", prop); - } - - out: free(classname); return s; @@ -75,7 +63,7 @@ static CMPIStatus service_to_host(const struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; + CMPIInstance *instance = NULL; if (!match_hypervisor_prefix(ref, info)) return s; @@ -84,7 +72,7 @@ static CMPIStatus service_to_host(const if (s.rc != CMPI_RC_OK) return s; - s = get_host_cs(_BROKER, ref, &instance); + s = get_host(_BROKER, ref, &instance, false); if (s.rc == CMPI_RC_OK) inst_list_add(list, instance); @@ -96,12 +84,12 @@ static CMPIStatus host_to_service(const struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *inst; + CMPIInstance *inst = NULL; if (!match_hypervisor_prefix(ref, info)) return s; - s = validate_host_ref(_BROKER, ref); + s = get_host(_BROKER, ref, &inst, true); if (s.rc != CMPI_RC_OK) return s; From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:25 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:25 +0100 Subject: [Libvirt-cim] [PATCH 0 of 6] Enhance ComputerSystem enum/get functions for use in assocs and Adopt interface changes to assocs Message-ID: This patch set first enhances the ComputerSystem's enum and get functions to prepare a straight access to domain instances out of associations. Aterwards the interface changes are adopted to the corresponing associations providers. From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:26 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:26 +0100 Subject: [Libvirt-cim] [PATCH 1 of 6] ComputerSystem: enhance enum functionality for use in assocs In-Reply-To: Message-ID: <7a93b0ab4de3663e75f4.1204541486@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204541457 -3600 # Node ID 7a93b0ab4de3663e75f43176cce67b70e2064fd7 # Parent 27e78288c82426835126eaa07dba1e425c756f3f ComputerSystem: enhance enum functionality for use in assocs Signed-off-by: Heidi Eckhart diff -r 27e78288c824 -r 7a93b0ab4de3 src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Mar 03 11:34:52 2008 +0100 +++ b/src/Virt_ComputerSystem.c Mon Mar 03 11:50:57 2008 +0100 @@ -302,184 +302,168 @@ static int set_other_id_info(const CMPIB } /* Populate an instance with information from a domain */ -static int instance_from_dom(const CMPIBroker *broker, - virDomainPtr dom, - const char *prefix, - CMPIInstance *instance) -{ +static CMPIStatus set_properties(const CMPIBroker *broker, + virDomainPtr dom, + const char *prefix, + CMPIInstance *instance) +{ + CMPIStatus s = {CMPI_RC_ERR_FAILED, NULL}; char *uuid = NULL; - int ret = 1; if (!set_name_from_dom(dom, instance)) { /* Print trace error */ - return 0; + goto out; } if (!set_uuid_from_dom(dom, instance, &uuid)) { /* Print trace error */ - ret = 0; goto out; } if (!set_capdesc_from_dom(dom, instance)) { /* Print trace error */ - ret = 0; goto out; } if (!set_state_from_dom(broker, dom, instance)) { /* Print trace error */ - ret = 0; goto out; } if (!set_creation_class(instance)) { /* Print trace error */ - ret = 0; goto out; } if (!set_other_id_info(broker, uuid, prefix, instance)) { /* Print trace error */ - ret = 0; goto out; } /* More attributes here, of course */ + cu_statusf(broker, &s, + CMPI_RC_OK, + ""); + out: free(uuid); - return ret; -} - -/* Given a hypervisor connection and a domain name, return an instance */ -CMPIInstance *instance_from_name(const CMPIBroker *broker, - virConnectPtr conn, - const char *name, - const CMPIObjectPath *op) -{ - virDomainPtr dom; - CMPIInstance *instance; - - dom = virDomainLookupByName(conn, name); - if (dom == NULL) - return NULL; - - instance = get_typed_instance(broker, - pfx_from_conn(conn), - "ComputerSystem", - NAMESPACE(op)); - if (instance == NULL) - goto out; - - if (!instance_from_dom(broker, - dom, - pfx_from_conn(conn), - instance)) - instance = NULL; - - out: - virDomainFree(dom); - - return instance; -} - -/* Enumerate domains on the given connection, return results */ -int enum_domains(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *instlist) -{ + return s; +} + +static CMPIStatus instance_from_dom(const CMPIBroker *broker, + const CMPIObjectPath *reference, + virConnectPtr conn, + virDomainPtr domain, + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + + inst = get_typed_instance(broker, + pfx_from_conn(conn), + "ComputerSystem", + NAMESPACE(reference)); + if (inst == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Unable to init ComputerSystem instance"); + goto out; + } + + s = set_properties(broker, + domain, + pfx_from_conn(conn), + inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + + out: + return s; +} + +CMPIStatus enum_domains(const CMPIBroker *broker, + const CMPIObjectPath *reference, + struct inst_list *instlist) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; virDomainPtr *list = NULL; + virConnectPtr conn = NULL; int count; int i; + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + count = get_domain_list(conn, &list); - if (count <= 0) - goto out; + if (count <= 0) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Failed to get domain list"); + goto out; + } for (i = 0; i < count; i++) { - CMPIInstance *inst; - - inst = get_typed_instance(broker, - pfx_from_conn(conn), - "ComputerSystem", - ns); - if (inst == NULL) + CMPIInstance *inst = NULL; + + s = instance_from_dom(broker, + reference, + conn, + list[i], + &inst); + if (s.rc != CMPI_RC_OK) goto end; - if (instance_from_dom(broker, - list[i], - pfx_from_conn(conn), - inst)) - inst_list_add(instlist, inst); - - end: + inst_list_add(instlist, inst); + + end: virDomainFree(list[i]); } - out: + + out: + virConnectClose(conn); free(list); - return 1; + return s; } static CMPIStatus return_enum_domains(const CMPIObjectPath *reference, const CMPIResult *results, - int names_only) + bool names_only) { struct inst_list list; - CMPIStatus s; - virConnectPtr conn = NULL; - int ret; - - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); - if (conn == NULL) - return s; + CMPIStatus s = {CMPI_RC_OK, NULL}; inst_list_init(&list); - ret = enum_domains(_BROKER, conn, NAMESPACE(reference), &list); - if (!ret) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to get domain list"); - goto out; - } + + s = enum_domains(_BROKER, reference, &list); + if (s.rc != CMPI_RC_OK) + goto out; if (names_only) cu_return_instance_names(results, &list); else cu_return_instances(results, &list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: inst_list_free(&list); - virConnectClose(conn); - - return s; -} - -CMPIStatus get_domain(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **inst) -{ - CMPIInstance *_inst; + return s; +} + +CMPIStatus get_domain_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *name, + CMPIInstance **_inst) +{ + CMPIInstance *inst = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; - const char *name; - - if (!provider_is_responsible(broker, reference, &s)) - return s; - - if (cu_get_str_path(reference, "Name", &name) != CMPI_RC_OK) { - cu_statusf(broker, &s, - CMPI_RC_ERR_FAILED, - "No domain name specified"); - return s; - } + virDomainPtr dom; conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) { @@ -489,35 +473,59 @@ CMPIStatus get_domain(const CMPIBroker * return s; } - _inst = instance_from_name(broker, conn, name, reference); - if (_inst == NULL) { + dom = virDomainLookupByName(conn, name); + if (dom == NULL) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", name); - goto out; - } - - s = cu_validate_ref(broker, reference, _inst); - - out: + "No such instance (%s).", + name); + goto out; + } + + s = instance_from_dom(broker, + reference, + conn, + dom, + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + + out: + virDomainFree(dom); virConnectClose(conn); - *inst = _inst; - - return s; -} - -static CMPIStatus return_domain(const CMPIObjectPath *reference, - const CMPIResult *results) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *inst; - - s = get_domain(_BROKER, reference, &inst); + + return s; +} + +CMPIStatus get_domain_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + const char *name = NULL; + + if (cu_get_str_path(reference, "Name", &name) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "No domain name specified"); + goto out; + } + + s = get_domain_by_name(broker, reference, name, &inst); if (s.rc != CMPI_RC_OK) - return s; - - CMReturnInstance(results, inst); - + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + + out: + return s; } @@ -526,7 +534,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_enum_domains(reference, results, 1); + return return_enum_domains(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -536,7 +544,7 @@ static CMPIStatus EnumInstances(CMPIInst const char **properties) { - return return_enum_domains(reference, results, 0); + return return_enum_domains(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -545,7 +553,17 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - return return_domain(reference, results); + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst; + + s = get_domain_by_ref(_BROKER, reference, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: + return s; } DEFAULT_CI(); diff -r 27e78288c824 -r 7a93b0ab4de3 src/Virt_ComputerSystem.h --- a/src/Virt_ComputerSystem.h Mon Mar 03 11:34:52 2008 +0100 +++ b/src/Virt_ComputerSystem.h Mon Mar 03 11:50:57 2008 +0100 @@ -24,33 +24,16 @@ #include "misc_util.h" /** - * Return an instance of a Virt_ComputerSystem, based on a name - * - * @param broker A pointer to the current broker - * @param conn The libvirt connection to use - * @param name The name of the desired domain instance - * @param ns The namespace to use - * @returns The instance or NULL on failure - */ -CMPIInstance *instance_from_name(const CMPIBroker *broker, - virConnectPtr conn, - const char *name, - const CMPIObjectPath *ns); - - -/** * Get a list of domain instances * * @param broker A pointer to the current broker - * @param conn The libvirt connection to use - * @param op The namespace to use + * @param reference The object path containing namespace and prefix info * @param instlist A pointer to an initialized inst_list to populate - * @returns nonzero on success + * @returns CMPIStatus */ -int enum_domains(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *instlist); +CMPIStatus enum_domains(const CMPIBroker *broker, + const CMPIObjectPath *reference, + struct inst_list *instlist); /** * Get domain instance specified by the client given domain @@ -58,13 +41,26 @@ int enum_domains(const CMPIBroker *broke * * @param broker A pointer to the current broker * @param ref The client given object path - * @param inst In case of success the pointer to the instance + * @param _inst In case of success the pointer to the instance * @returns CMPIStatus */ -CMPIStatus get_domain(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **inst); +CMPIStatus get_domain_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **_inst); +/** + * Get domain instance specified by the domain name + * + * @param broker A pointer to the current broker + * @param ref The object path containing namespace and prefix info + * @param name The domain name + * @param _inst In case of success the pointer to the instance + * @returns CMPIStatus + */ +CMPIStatus get_domain_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *name, + CMPIInstance **_inst); #endif From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:27 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:27 +0100 Subject: [Libvirt-cim] [PATCH 2 of 6] SD: adopt changes in ComputerSystem provider interface In-Reply-To: Message-ID: <15e12adf6218a512063f.1204541487@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204541458 -3600 # Node ID 15e12adf6218a512063fe87b836b87e8e3aed569 # Parent 7a93b0ab4de3663e75f43176cce67b70e2064fd7 SD: adopt changes in ComputerSystem provider interface Signed-off-by: Heidi Eckhart diff -r 7a93b0ab4de3 -r 15e12adf6218 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Mon Mar 03 11:50:57 2008 +0100 +++ b/src/Virt_SystemDevice.c Mon Mar 03 11:50:58 2008 +0100 @@ -97,37 +97,6 @@ static int get_all_devices(const char *n return i; } -static CMPIInstance *host_instance(char *name, - const CMPIObjectPath *ref) -{ - CMPIInstance *inst = NULL; - virConnectPtr conn = NULL; - CMPIStatus s; - CMPIObjectPath *op; - char *host_class; - - host_class = get_typed_class(CLASSNAME(ref), - "ComputerSystem"); - if (host_class == NULL) - goto out; - - op = CMNewObjectPath(_BROKER, NAMESPACE(ref), host_class, &s); - if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) - goto out; - - conn = connect_by_classname(_BROKER, host_class, &s); - if (conn == NULL) - goto out; - - inst = instance_from_name(_BROKER, conn, name, op); - - out: - free(host_class); - virConnectClose(conn); - - return inst; -} - static CMPIStatus sys_to_dev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -140,7 +109,7 @@ static CMPIStatus sys_to_dev(const CMPIO if (!match_hypervisor_prefix(ref, info)) return s; - s = get_domain(_BROKER, ref, &inst); + s = get_domain_by_ref(_BROKER, ref, &inst); if (s.rc != CMPI_RC_OK) goto out; @@ -177,7 +146,6 @@ static CMPIStatus dev_to_sys(const CMPIO const char *devid = NULL; char *host = NULL; char *dev = NULL; - CMPIInstance *sys; CMPIInstance *inst = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -202,18 +170,11 @@ static CMPIStatus dev_to_sys(const CMPIO goto out; } - sys = host_instance(host, ref); - - if (sys == NULL) - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find DeviceID `%s'", devid); - else { - inst_list_add(list, sys); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } + s = get_domain_by_name(_BROKER, ref, host, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, inst); out: free(dev); From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:29 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:29 +0100 Subject: [Libvirt-cim] [PATCH 4 of 6] HD: adopt ComputerSystem interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204541459 -3600 # Node ID a92cf052a7742789abbec11a463578fb4f8ae24d # Parent f6c14b91e8da58e79221b9e7ccb652419dffcc23 HD: adopt ComputerSystem interface changes Adopted interface changes to ComputerSystem. Fixed wrong return in vs_to_host(). Signed-off-by: Heidi Eckhart diff -r f6c14b91e8da -r a92cf052a774 src/Virt_HostedDependency.c --- a/src/Virt_HostedDependency.c Mon Mar 03 11:50:59 2008 +0100 +++ b/src/Virt_HostedDependency.c Mon Mar 03 11:50:59 2008 +0100 @@ -46,7 +46,7 @@ static CMPIStatus vs_to_host(const CMPIO if (!match_hypervisor_prefix(ref, info)) goto out; - s = get_domain(_BROKER, ref, &instance); + s = get_domain_by_ref(_BROKER, ref, &instance); if (s.rc != CMPI_RC_OK) goto out; @@ -64,8 +64,6 @@ static CMPIStatus host_to_vs(const CMPIO struct std_assoc_info *info, struct inst_list *list) { - int ret; - virConnectPtr conn; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *instance = NULL; @@ -76,19 +74,7 @@ static CMPIStatus host_to_vs(const CMPIO if (s.rc != CMPI_RC_OK) goto out; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); - goto out; - } - - ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list); - if (!ret) - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to get domain list"); + s = enum_domains(_BROKER, ref, list); out: return s; From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:30 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:30 +0100 Subject: [Libvirt-cim] [PATCH 5 of 6] EC: adopt ComputerSystem interface changes In-Reply-To: Message-ID: <5c6274463420e89bebcc.1204541490@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204541460 -3600 # Node ID 5c6274463420e89bebccb718d310b53c7f712909 # Parent a92cf052a7742789abbec11a463578fb4f8ae24d EC: adopt ComputerSystem interface changes Signed-off-by: Heidi Eckhart diff -r a92cf052a774 -r 5c6274463420 src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Mon Mar 03 11:50:59 2008 +0100 +++ b/src/Virt_ElementCapabilities.c Mon Mar 03 11:51:00 2008 +0100 @@ -205,7 +205,7 @@ static CMPIStatus cs_to_cap(const CMPIOb if (!match_hypervisor_prefix(ref, info)) goto out; - s = get_domain(_BROKER, ref, &inst); + s = get_domain_by_ref(_BROKER, ref, &inst); if (s.rc != CMPI_RC_OK) goto out; @@ -229,8 +229,7 @@ static CMPIStatus cap_to_cs(const CMPIOb struct inst_list *list) { const char *inst_id; - CMPIInstance *inst; - virConnectPtr conn; + CMPIInstance *inst = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; if (!match_hypervisor_prefix(ref, info)) @@ -247,19 +246,11 @@ static CMPIStatus cap_to_cs(const CMPIOb goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - inst = instance_from_name(_BROKER, conn, inst_id, ref); - if (inst) - inst_list_add(list, inst); - else - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", inst_id); - - virConnectClose(conn); + s = get_domain_by_name(_BROKER, ref, inst_id, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, inst); out: return s; From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:31 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:31 +0100 Subject: [Libvirt-cim] [PATCH 6 of 6] SDS: adopt ComputerSystem interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204541460 -3600 # Node ID eefe9c56b43c7ca0cad6f579fd88c5b89134bba0 # Parent 5c6274463420e89bebccb718d310b53c7f712909 SDS: adopt ComputerSystem interface changes Signed-off-by: Heidi Eckhart diff -r 5c6274463420 -r eefe9c56b43c src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Mar 03 11:51:00 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Mon Mar 03 11:51:00 2008 +0100 @@ -127,7 +127,7 @@ static CMPIStatus vs_to_vssd(const CMPIO if (!match_hypervisor_prefix(ref, info)) return s; - s = get_domain(_BROKER, ref, &inst); + s = get_domain_by_ref(_BROKER, ref, &inst); if (s.rc != CMPI_RC_OK) goto out; @@ -156,10 +156,8 @@ static CMPIStatus vssd_to_vs(const CMPIO char *pfx = NULL; char *name = NULL; int ret; - virConnectPtr conn = NULL; - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *cs; - CMPIInstance *inst; + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; if (!match_hypervisor_prefix(ref, info)) return s; @@ -183,25 +181,15 @@ static CMPIStatus vssd_to_vs(const CMPIO goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - cs = instance_from_name(_BROKER, - conn, - name, - ref); - if (cs != NULL) - inst_list_add(list, cs); - - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); + s = get_domain_by_name(_BROKER, ref, name, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, inst); + out: free(name); free(pfx); - - virConnectClose(conn); return s; } From heidieck at linux.vnet.ibm.com Mon Mar 3 10:51:28 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 11:51:28 +0100 Subject: [Libvirt-cim] [PATCH 3 of 6] VSMS: adopt ComputerSystem interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204541459 -3600 # Node ID f6c14b91e8da58e79221b9e7ccb652419dffcc23 # Parent 15e12adf6218a512063fe87b836b87e8e3aed569 VSMS: adopt ComputerSystem interface changes Adopt the interface changes of ComputerSystem to connect_and_create(). Also added missing virDomainFree(). Signed-off-by: Heidi Eckhart diff -r 15e12adf6218 -r f6c14b91e8da src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Mar 03 11:50:58 2008 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Mon Mar 03 11:50:59 2008 +0100 @@ -331,7 +331,7 @@ static CMPIInstance *connect_and_create( virConnectPtr conn; virDomainPtr dom; const char *name; - CMPIInstance *inst; + CMPIInstance *inst = NULL; conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); if (conn == NULL) { @@ -349,14 +349,16 @@ static CMPIInstance *connect_and_create( } name = virDomainGetName(dom); - inst = instance_from_name(_BROKER, conn, (char *)name, ref); - if (inst == NULL) { + + *s = get_domain_by_name(_BROKER, ref, name, &inst); + if (s->rc != CMPI_RC_OK) { CU_DEBUG("Failed to get new instance"); cu_statusf(_BROKER, s, CMPI_RC_ERR_FAILED, "Failed to lookup resulting system"); } + virDomainFree(dom); virConnectClose(conn); return inst; From heidieck at linux.vnet.ibm.com Mon Mar 3 13:02:15 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 14:02:15 +0100 Subject: [Libvirt-cim] [PATCH 5 of 5] EAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204547111 -3600 # Node ID e8d6ec769854a8b3276de24919e3f5a50382aaaa # Parent 0110c5e63a7f4ed7bc556dacb407dba8a0f1380d EAFP: adopt DevicePool interface changes Signed-off-by: Heidi Eckhart diff -r 0110c5e63a7f -r e8d6ec769854 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Mon Mar 03 13:19:38 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Mon Mar 03 13:25:11 2008 +0100 @@ -66,7 +66,6 @@ static CMPIStatus vdev_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; if (!match_hypervisor_prefix(ref, info)) @@ -95,25 +94,14 @@ static CMPIStatus vdev_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, conn, poolid, NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, ref, poolid, &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -199,6 +187,10 @@ static CMPIStatus pool_to_vdev(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -215,10 +207,6 @@ static CMPIStatus pool_to_vdev(const CMP "Invalid InstanceID or unsupported pool type"); goto out; } - - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; devs_from_pool(type, ref, poolid, list); From heidieck at linux.vnet.ibm.com Mon Mar 3 13:02:12 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 14:02:12 +0100 Subject: [Libvirt-cim] [PATCH 2 of 5] SDC: adopt DevicePool interface change In-Reply-To: Message-ID: <0d2ac636d4463d881b1e.1204549332@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204546145 -3600 # Node ID 0d2ac636d4463d881b1e200c44f1086411e5c074 # Parent 4748d0422f3891598680b74b3aa1bcb4acdcb9a1 SDC: adopt DevicePool interface change Signed-off-by: Heidi Eckhart diff -r 4748d0422f38 -r 0d2ac636d446 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Mon Mar 03 12:58:22 2008 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Mon Mar 03 13:09:05 2008 +0100 @@ -529,13 +529,9 @@ static struct sdc_rasd_prop *disk_max(co /* Getting the relevant resource pool directly finds the free space for us. It is in the Capacity field. */ - pool_inst = get_pool_by_id(_BROKER, conn, inst_id, NAMESPACE(ref)); - if (pool_inst == NULL) { - cu_statusf(_BROKER, s, - CMPI_RC_ERR_FAILED, - "Could not get pool instance"); - goto out; - } + *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst); + if (s->rc != CMPI_RC_OK) + goto out; prop_ret = cu_get_u64_prop(pool_inst, "Capacity", &free_64); if (prop_ret != CMPI_RC_OK) { From heidieck at linux.vnet.ibm.com Mon Mar 3 13:02:11 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 14:02:11 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] DevicePool: adopt get_ interface common look and feel In-Reply-To: Message-ID: <4748d0422f3891598680.1204549331@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204545502 -3600 # Node ID 4748d0422f3891598680b74b3aa1bcb4acdcb9a1 # Parent eefe9c56b43c7ca0cad6f579fd88c5b89134bba0 DevicePool: adopt get_ interface common look and feel Signed-off-by: Heidi Eckhart diff -r eefe9c56b43c -r 4748d0422f38 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Mon Mar 03 11:51:00 2008 +0100 +++ b/src/Virt_DevicePool.c Mon Mar 03 12:58:22 2008 +0100 @@ -701,13 +701,13 @@ CMPIStatus get_pool_by_type(const CMPIBr return _get_pool(broker, conn, type, NULL, ns, list); } -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns) -{ - CMPIInstance *inst = NULL; - CMPIStatus s; +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *id, + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; char *type = NULL; char *poolid = NULL; int ret; @@ -715,18 +715,34 @@ CMPIInstance *get_pool_by_id(const CMPIB inst_list_init(&list); + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance."); + goto out; + } + ret = sscanf(id, "%a[^/]/%as", &type, &poolid); - if (ret != 2) - goto out; - - s = _get_pool(broker, conn, type, poolid, ns, &list); + if (ret != 2) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s).", + id); + goto out; + } + + s = _get_pool(broker, conn, type, poolid, NAMESPACE(reference), &list); if ((s.rc == CMPI_RC_OK) && (list.cur > 0)) - inst = list.list[0]; + *_inst = list.list[0]; + + free(type); + free(poolid); out: inst_list_free(&list); - return inst; + return s; } CMPIStatus get_all_pools(const CMPIBroker *broker, @@ -763,8 +779,7 @@ static void __return_pool(const CMPIResu static CMPIStatus return_pool(const CMPIObjectPath *ref, const CMPIResult *results, - bool name_only, - bool single_only) + bool name_only) { CMPIStatus s; char *type; @@ -811,13 +826,12 @@ static CMPIStatus return_pool(const CMPI return s; } -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance) -{ - CMPIStatus s; +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance) +{ + CMPIStatus s = {CMPI_RC_OK}; CMPIInstance *inst = NULL; - virConnectPtr conn = NULL; const char *id = NULL; if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { @@ -827,24 +841,17 @@ CMPIStatus get_pool_inst(const CMPIBroke goto out; } - conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) { - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); - goto out; - } - - inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference)); - if (inst == NULL) - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", id); + s = get_pool_by_name(broker, reference, id, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *instance = inst; out: - virConnectClose(conn); - *instance = inst; - return s; } @@ -853,7 +860,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_pool(reference, results, true, false); + return return_pool(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -862,7 +869,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return return_pool(reference, results, false, false); + return return_pool(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -871,13 +878,16 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK}; CMPIInstance *inst = NULL; - s = get_pool_inst(_BROKER, reference, &inst); - if ((s.rc == CMPI_RC_OK) && (inst != NULL)) - CMReturnInstance(results, inst); - + s = get_pool_by_ref(_BROKER, reference, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: return s; } diff -r eefe9c56b43c -r 4748d0422f38 src/Virt_DevicePool.h --- a/src/Virt_DevicePool.h Mon Mar 03 11:51:00 2008 +0100 +++ b/src/Virt_DevicePool.h Mon Mar 03 12:58:22 2008 +0100 @@ -33,12 +33,6 @@ CMPIStatus get_pool_by_type(const CMPIBr const char *type, const char *ns, struct inst_list *list); - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns); - /** * Get the InstanceID of a pool that a given RASD id (for type) is in @@ -82,9 +76,23 @@ CMPIStatus get_all_pools(const CMPIBroke * @param reference The reference passed to the CIMOM * @param instance Return corresponding instance */ -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance); +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance); + +/** + * Get device pool instance specified by the id + * + * @param broker A pointer to the current broker + * @param ref The object path containing namespace and prefix info + * @param name The device pool id + * @param _inst In case of success the pointer to the instance + * @returns CMPIStatus + */ +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *id, + CMPIInstance **_inst); #endif From heidieck at linux.vnet.ibm.com Mon Mar 3 13:02:14 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 14:02:14 +0100 Subject: [Libvirt-cim] [PATCH 4 of 5] RAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: <0110c5e63a7f4ed7bc55.1204549334@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204546778 -3600 # Node ID 0110c5e63a7f4ed7bc556dacb407dba8a0f1380d # Parent 4166fe782224243c171c9dc8c08e95a447177736 RAFP: adopt DevicePool interface changes Signed-off-by: Heidi Eckhart diff -r 4166fe782224 -r 0110c5e63a7f src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Mon Mar 03 13:10:28 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Mon Mar 03 13:19:38 2008 +0100 @@ -45,7 +45,6 @@ static CMPIStatus rasd_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; CMPIInstance *inst = NULL; @@ -78,28 +77,17 @@ static CMPIStatus rasd_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, - conn, - poolid, - NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, + ref, + poolid, + &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -191,7 +179,11 @@ static CMPIStatus pool_to_rasd(const CMP CMPIInstance *inst; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; + + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -207,10 +199,6 @@ static CMPIStatus pool_to_rasd(const CMP "Invalid InstanceID or unsupported pool type"); goto out; } - - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; rasds_from_pool(type, ref, @@ -218,9 +206,6 @@ static CMPIStatus pool_to_rasd(const CMP info->properties, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Mon Mar 3 13:02:13 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 14:02:13 +0100 Subject: [Libvirt-cim] [PATCH 3 of 5] HRP: adopt DevicePool interface change In-Reply-To: Message-ID: <4166fe782224243c171c.1204549333@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204546228 -3600 # Node ID 4166fe782224243c171c9dc8c08e95a447177736 # Parent 0d2ac636d4463d881b1e200c44f1086411e5c074 HRP: adopt DevicePool interface change Signed-off-by: Heidi Eckhart diff -r 0d2ac636d446 -r 4166fe782224 src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Mon Mar 03 13:09:05 2008 +0100 +++ b/src/Virt_HostedResourcePool.c Mon Mar 03 13:10:28 2008 +0100 @@ -47,8 +47,8 @@ static CMPIStatus pool_to_sys(const CMPI if (!match_hypervisor_prefix(ref, info)) goto out; - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) goto out; s = get_host(_BROKER, ref, &inst, false); From heidieck at linux.vnet.ibm.com Mon Mar 3 13:02:10 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 03 Mar 2008 14:02:10 +0100 Subject: [Libvirt-cim] [PATCH 0 of 5] Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs Message-ID: Adopted the get_() function look and feel to the DevicePool provider. Updated the association providers that uses these functions. From danms at us.ibm.com Mon Mar 3 15:32:20 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 03 Mar 2008 07:32:20 -0800 Subject: [Libvirt-cim] [PATCH 0 of 5] #2 - Update single instance interface on HostSystem and Adopt HostSystem interface to assocs In-Reply-To: (Heidi Eckhart's message of "Mon, 03 Mar 2008 11:37:02 +0100") References: Message-ID: <87mypf962j.fsf@caffeine.beaverton.ibm.com> HE> fixed HD - missing braces (thanks to eagle eye kaitlin I had already applied your previous set to my tree along with Kaitlin's brace patch. I'm assuming this set is otherwise unchanged, right? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Mon Mar 3 15:45:41 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 03 Mar 2008 10:45:41 -0500 Subject: [Libvirt-cim] [PATCH] Couple of MigrationIndication schema fixes Message-ID: # HG changeset patch # User Jay Gagnon # Date 1204558449 18000 # Node ID c46cbe6df83682e9f1d762b4649f09a1daefe227 # Parent b5577ad78998fcf535b94ca0d2a1e8730720f3cf Couple of MigrationIndication schema fixes Turns out that pegasus needs things a bit more explicit than sfcb. Dan's changes are the first step to fixing it; this should be the rest. Also, the description has been listing the wrong provider for way too long, so that's fixed here too. Signed-off-by: Jay Gagnon diff -r b5577ad78998 -r c46cbe6df836 schema/ComputerSystemMigrationIndication.mof --- a/schema/ComputerSystemMigrationIndication.mof Thu Feb 28 10:30:05 2008 -0800 +++ b/schema/ComputerSystemMigrationIndication.mof Mon Mar 03 10:34:09 2008 -0500 @@ -1,15 +1,17 @@ // Copyright IBM Corp. 2007 [Description ("Xen_ComputerSystem migration status"), - Provider("cmpi::Virt_ComputerSystemModificationIndication") + Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] class Xen_ComputerSystemMigrationIndication : CIM_InstModification { + uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; [Description ("KVM_ComputerSystem migration status"), - Provider("cmpi::Virt_ComputerSystemModificationIndication") + Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] class KVM_ComputerSystemMigrationIndication : CIM_InstModification { + uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; From danms at us.ibm.com Mon Mar 3 16:03:23 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 03 Mar 2008 08:03:23 -0800 Subject: [Libvirt-cim] [PATCH 1 of 5] DevicePool: adopt get_ interface common look and feel In-Reply-To: <4748d0422f3891598680.1204549331@localhost.localdomain> (Heidi Eckhart's message of "Mon, 03 Mar 2008 14:02:11 +0100") References: <4748d0422f3891598680.1204549331@localhost.localdomain> Message-ID: <87ir0394ms.fsf@caffeine.beaverton.ibm.com> HE> +CMPIStatus get_pool_by_name(const CMPIBroker *broker, HE> + const CMPIObjectPath *reference, HE> + const char *id, HE> + CMPIInstance **_inst) HE> +{ HE> + CMPIStatus s = {CMPI_RC_OK, NULL}; HE> + virConnectPtr conn = NULL; You add a conn here... HE> out: HE> inst_list_free(&list); HE> - return inst; HE> + return s; HE> } ...but don't close it here. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Mon Mar 3 16:18:56 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 03 Mar 2008 11:18:56 -0500 Subject: [Libvirt-cim] [PATCH 0 of 6] Enhance ComputerSystem enum/get functions for use in assocs and Adopt interface changes to assocs In-Reply-To: References: Message-ID: <47CC24F0.3040108@linux.vnet.ibm.com> Heidi Eckhart wrote: > This patch set first enhances the ComputerSystem's enum and get functions to prepare a straight access to domain instances out of associations. > Aterwards the interface changes are adopted to the corresponing associations providers. > > This looks good. I noticed one thing, but it's more or less a style issue and not worth holding the patchset back, especially since it appears to have existed before the patch. I will note it in a reply to that patch, just to help us remember it. +1 -- -Jay From danms at us.ibm.com Mon Mar 3 16:25:21 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 03 Mar 2008 08:25:21 -0800 Subject: [Libvirt-cim] [PATCH] Add VSMigrationSettingData.h to headers to avoid breaking dist build Message-ID: <81d666eb81d9f63c5d06.1204561521@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1204561500 28800 # Node ID 81d666eb81d9f63c5d066db9f1e5fd4386c2e1ae # Parent c2b12ba77830a97f961e55869921ddc9c9ab35d5 Add VSMigrationSettingData.h to headers to avoid breaking dist build Signed-off-by: Dan Smith diff -r c2b12ba77830 -r 81d666eb81d9 src/Makefile.am --- a/src/Makefile.am Mon Mar 03 11:51:00 2008 +0100 +++ b/src/Makefile.am Mon Mar 03 08:25:00 2008 -0800 @@ -19,7 +19,8 @@ noinst_HEADERS = profiles.h svpc_types.h Virt_VSMigrationService.h \ Virt_AllocationCapabilities.h \ Virt_VirtualSystemSnapshotService.h \ - Virt_VirtualSystemSnapshotServiceCapabilities.h + Virt_VirtualSystemSnapshotServiceCapabilities.h \ + Virt_VSMigrationSettingData.h XKUADD = $(top_builddir)/libxkutil/libxkutil.la From grendel at linux.vnet.ibm.com Mon Mar 3 16:26:06 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 03 Mar 2008 11:26:06 -0500 Subject: [Libvirt-cim] [PATCH 1 of 6] ComputerSystem: enhance enum functionality for use in assocs In-Reply-To: <7a93b0ab4de3663e75f4.1204541486@localhost.localdomain> References: <7a93b0ab4de3663e75f4.1204541486@localhost.localdomain> Message-ID: <47CC269E.8010801@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1204541457 -3600 > # Node ID 7a93b0ab4de3663e75f43176cce67b70e2064fd7 > # Parent 27e78288c82426835126eaa07dba1e425c756f3f > ComputerSystem: enhance enum functionality for use in assocs > Signed-off-by: Heidi Eckhart > > > +CMPIStatus enum_domains(const CMPIBroker *broker, > + const CMPIObjectPath *reference, > + struct inst_list *instlist) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > virDomainPtr *list = NULL; > + virConnectPtr conn = NULL; > int count; > int i; > > + conn = connect_by_classname(broker, CLASSNAME(reference), &s); > + if (conn == NULL) > + goto out; > + > count = get_domain_list(conn, &list); > - if (count <= 0) > - goto out; > + if (count <= 0) { > + cu_statusf(broker, &s, > + CMPI_RC_ERR_FAILED, > + "Failed to get domain list"); > + goto out; > + } > > for (i = 0; i < count; i++) { > - CMPIInstance *inst; > - > - inst = get_typed_instance(broker, > - pfx_from_conn(conn), > - "ComputerSystem", > - ns); > - if (inst == NULL) > + CMPIInstance *inst = NULL; > + > + s = instance_from_dom(broker, > + reference, > + conn, > + list[i], > + &inst); > + if (s.rc != CMPI_RC_OK) > goto end; > > - if (instance_from_dom(broker, > - list[i], > - pfx_from_conn(conn), > - inst)) > - inst_list_add(instlist, inst); > - > - end: > + inst_list_add(instlist, inst); > + > + end: > virDomainFree(list[i]); > } > - out: > + > + out: > + virConnectClose(conn); > free(list); > > - return 1; > + return s; > } > > This isn't so much a problem with the patch as it is something brought to my attention by the patch, but I'm not a huge fan of the "goto end;" bit in the for loop. I know we use "goto out;" a ton for error cases, which I've gotten used to, but I'm still not a big fan of using goto and in this case I think we could avoid it without much trouble. Something like: if (s.rc != CMPI_RC_OK) { virDomainFree(list[i]); continue; } should achieve the same functionality but in what I would call a much cleaner way. Everyone, feel free to chime in here one way or the other. -- -Jay From danms at us.ibm.com Mon Mar 3 16:31:38 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 03 Mar 2008 08:31:38 -0800 Subject: [Libvirt-cim] [PATCH 1 of 6] ComputerSystem: enhance enum functionality for use in assocs References: <7a93b0ab4de3663e75f4.1204541486@localhost.localdomain> <47CC269E.8010801@linux.vnet.ibm.com> Message-ID: <877igj93bp.fsf@caffeine.beaverton.ibm.com> JG> if (s.rc != CMPI_RC_OK) { JG> virDomainFree(list[i]); JG> continue; JG> } JG> should achieve the same functionality but in what I would call a much JG> cleaner way. Everyone, feel free to chime in here one way or the JG> other. That's a valid point, although I would rather have one cleanup path to avoid leaks in the future. Why not just have the conditional be (s.rc == CMPI_RC_OK) and do the add there? Anyway, it's minor so I've applied this patch set. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Mon Mar 3 17:16:44 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 03 Mar 2008 09:16:44 -0800 Subject: [Libvirt-cim] [PATCH] Add VSMigrationSettingData.h to headers to avoid breaking dist build In-Reply-To: <81d666eb81d9f63c5d06.1204561521@caffeine.beaverton.ibm.com> References: <81d666eb81d9f63c5d06.1204561521@caffeine.beaverton.ibm.com> Message-ID: <47CC327C.207@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1204561500 28800 > # Node ID 81d666eb81d9f63c5d066db9f1e5fd4386c2e1ae > # Parent c2b12ba77830a97f961e55869921ddc9c9ab35d5 > Add VSMigrationSettingData.h to headers to avoid breaking dist build > > Signed-off-by: Dan Smith > > diff -r c2b12ba77830 -r 81d666eb81d9 src/Makefile.am Oops - I must have missed this when I added VSMSD. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Mon Mar 3 18:33:42 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 03 Mar 2008 10:33:42 -0800 Subject: [Libvirt-cim] [PATCH] Fix install of VSMigrationService Message-ID: <58da2f9d92e39567b75d.1204569222@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1204567099 28800 # Node ID 58da2f9d92e39567b75d8537a833aba0da994f92 # Parent 81d666eb81d9f63c5d066db9f1e5fd4386c2e1ae Fix install of VSMigrationService This moves VSMigrationService down in the list of providers, which seems to fix it for me, but I have no idea why. Signed-off-by: Dan Smith diff -r 81d666eb81d9 -r 58da2f9d92e3 src/Makefile.am --- a/src/Makefile.am Mon Mar 03 08:25:00 2008 -0800 +++ b/src/Makefile.am Mon Mar 03 09:58:19 2008 -0800 @@ -55,12 +55,12 @@ provider_LTLIBRARIES = libVirt_ComputerS libVirt_SettingsDefineState.la \ libVirt_ResourceAllocationFromPool.la \ libVirt_ElementAllocatedFromPool.la \ - libVirt_VSMigrationService.la \ libVirt_HostedService.la \ libVirt_ElementSettingData.la \ libVirt_VSMigrationCapabilities.la \ libVirt_VSMigrationSettingData.la \ libVirt_VirtualSystemSnapshotService.la \ + libVirt_VSMigrationService.la \ libVirt_VirtualSystemSnapshotServiceCapabilities.la libVirt_ComputerSystem_la_SOURCES = Virt_ComputerSystem.c From grendel at linux.vnet.ibm.com Mon Mar 3 18:40:44 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 03 Mar 2008 13:40:44 -0500 Subject: [Libvirt-cim] [PATCH] Fix install of VSMigrationService In-Reply-To: <58da2f9d92e39567b75d.1204569222@caffeine.beaverton.ibm.com> References: <58da2f9d92e39567b75d.1204569222@caffeine.beaverton.ibm.com> Message-ID: <47CC462C.2050109@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1204567099 28800 > # Node ID 58da2f9d92e39567b75d8537a833aba0da994f92 > # Parent 81d666eb81d9f63c5d066db9f1e5fd4386c2e1ae > Fix install of VSMigrationService > > This moves VSMigrationService down in the list of providers, which seems > to fix it for me, but I have no idea why. > > Signed-off-by: Dan Smith > > I just assumed I was crazy when I saw this bug. Good thing Kaitlin backed it up. automake is my favorite tool ever. +1 -- -Jay From heidieck at linux.vnet.ibm.com Tue Mar 4 08:30:25 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Tue, 04 Mar 2008 09:30:25 +0100 Subject: [Libvirt-cim] [PATCH 0 of 5] #2 - Update single instance interface on HostSystem and Adopt HostSystem interface to assocs In-Reply-To: <87mypf962j.fsf@caffeine.beaverton.ibm.com> References: <87mypf962j.fsf@caffeine.beaverton.ibm.com> Message-ID: <47CD08A1.8090603@linux.vnet.ibm.com> Dan Smith wrote: > HE> fixed HD - missing braces (thanks to eagle eye kaitlin > > I had already applied your previous set to my tree along with > Kaitlin's brace patch. I'm assuming this set is otherwise unchanged, > right? > Yes, no problem. The result is the same. Thanks :). -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Tue Mar 4 08:36:02 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Tue, 04 Mar 2008 09:36:02 +0100 Subject: [Libvirt-cim] [PATCH 1 of 6] ComputerSystem: enhance enum functionality for use in assocs In-Reply-To: <877igj93bp.fsf@caffeine.beaverton.ibm.com> References: <7a93b0ab4de3663e75f4.1204541486@localhost.localdomain> <47CC269E.8010801@linux.vnet.ibm.com> <877igj93bp.fsf@caffeine.beaverton.ibm.com> Message-ID: <47CD09F2.7000302@linux.vnet.ibm.com> Dan Smith wrote: > JG> if (s.rc != CMPI_RC_OK) { > JG> virDomainFree(list[i]); > JG> continue; > JG> } > > JG> should achieve the same functionality but in what I would call a much > JG> cleaner way. Everyone, feel free to chime in here one way or the > JG> other. > > That's a valid point, although I would rather have one cleanup path to > avoid leaks in the future. Why not just have the conditional be > (s.rc == CMPI_RC_OK) and do the add there? > > Anyway, it's minor so I've applied this patch set. > > Fine - for me both points are valid and I will take care of them in the future and apply where necessary and as possible :). -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From grendel at linux.vnet.ibm.com Tue Mar 4 20:27:54 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 04 Mar 2008 15:27:54 -0500 Subject: [Libvirt-cim] debugging providers with gdb Message-ID: <47CDB0CA.4000105@linux.vnet.ibm.com> So we all know that it's annoying when your provider is running in sfcb and it segfaults, because using gdb on a threaded app is not so fun. Well, I re-visited the debugging sfcb section of sfcb's README, and I guess something sunk in this time because I was able to put it into practice. This seemed like the kind of thing to mention here for posterity. Turns out it's pretty simple. (FYI, not sure how much of this requires you to be root, I just did the easy way out and was root for all of it.) The first step is to recompile sfcb with debugging symbols: CFLAGS=-g ./configure make clean && make && make install Then start up sfcbd and tell it which provider you want to debug: SFCB_PAUSE_PROVIDER=Virt_VSMigrationService sfcbd # (of course put your provider's name in here) Now do whatever it is you need to do to get your provider to run (wbemcli call, etc.), and you'll see something like this: -#- Pausing for provider: Virt_VSMigrationService -pid: 13943 Now you can attach gdb. Open up a new terminal and run: gdb sfcbd 13943 # whatever pid you just got You're now attached to the thread; I'll summarize what state everything is in. After gdb attaches, it pauses the thread. The thread itself is in a loop that checks if a local variable (debug_break) is zero. If it is zero, the thread sleeps for five seconds and checks again. We need to get out of that loop so our provider can actually run. So we set a breakpoint at the check. The check is in providerDrv.c; in sfcb-1.2.5, it is line 2577. To double-check, just do a grep: grep -n debug_break providerDrv.c 2569: int debug_break = 0; 2577: if (debug_break) break; That if statement is the one we need. So at the gdb prompt, set the breakpoint, then use "continue" to start the thread. You should hit the breakpoint very quickly: (gdb) break providerDrv.c:2577 Breakpoint 1 at 0x1c1c36: file providerDrv.c, line 2577. (gdb) continue Continuing. [Switching to Thread -1208785216 (LWP 13943)] Breakpoint 1, processProviderInvocationRequests (name=0x9e06300 "Virt_VSMigrationService") at providerDrv.c:2577 2577 if (debug_break) break; Now we can set debug_break to nonzero so it will break out of the sleep loop. This is also a convenient place to set breakpoints in your provider if you wanted to. If you're just waiting for a segfault to hit so you can do a backtrace, you shouldn't have to worry about that. For the example, we'll just get out of the loop: (gdb) set debug_break=1 (gdb) continue And now your provider is running in gdb. For a little help with what you can do with gdb, I found this to be a pretty good resource: http://www.delorie.com/gnu/docs/gdb/gdb_toc.html#SEC_Contents -- -Jay From danms at us.ibm.com Tue Mar 4 20:53:04 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 04 Mar 2008 12:53:04 -0800 Subject: [Libvirt-cim] debugging providers with gdb In-Reply-To: <47CDB0CA.4000105@linux.vnet.ibm.com> (Jay Gagnon's message of "Tue, 04 Mar 2008 15:27:54 -0500") References: <47CDB0CA.4000105@linux.vnet.ibm.com> Message-ID: <87lk4y6wjz.fsf@caffeine.beaverton.ibm.com> JG> This seemed like the kind of thing to mention here for posterity. This is great. Perhaps a quick addition to the web content is in order? Too bad Pegasus isn't as clever ... :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:09 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:09 +0100 Subject: [Libvirt-cim] [PATCH 2 of 7] DevicePool: reorganize get and enum functions In-Reply-To: Message-ID: <196480aa1c1b8358ae89.1204710549@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204709616 -3600 # Node ID 196480aa1c1b8358ae896782f831950c27ab232d # Parent 1626d88fa98b890ba251a450fca3d6c330bc27ad DevicePool: reorganize get and enum functions - the common look and feel of the get_..._by_name() and get_..._by_ref() is adopted - get_all_pools() is renamed to enum_pools and rewritten to be configurable dynamically - return either a specific or all resource pools. This also replaces get_pool_by_type(). - the device_pool_names array is removed and types are identified by the CIM_POOL_TYPE_..., as defined in svpc_types.h Signed-off-by: Heidi Eckhart diff -r 1626d88fa98b -r 196480aa1c1b src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Wed Mar 05 10:33:35 2008 +0100 +++ b/src/Virt_DevicePool.c Wed Mar 05 10:33:36 2008 +0100 @@ -45,12 +45,6 @@ static const CMPIBroker *_BROKER; -char *device_pool_names[] = {"ProcessorPool", - "MemoryPool", - "DiskPool", - "NetworkPool", - NULL}; - struct disk_pool { char *tag; char *path; @@ -332,18 +326,32 @@ char *pool_member_of(const CMPIBroker *b return poolid; } +uint16_t pool_type_from_classname(const char *classname) +{ + if (strstr(classname, "NetworkPool")) + return CIM_POOL_TYPE_NET; + else if (strstr(classname, "DiskPool")) + return CIM_POOL_TYPE_DISK; + else if (strstr(classname, "MemoryPool")) + return CIM_POOL_TYPE_MEM; + else if (strstr(classname, "ProcessorPool")) + return CIM_POOL_TYPE_PROC; + else + return CIM_POOL_TYPE_UNKNOWN; +} + uint16_t device_type_from_poolid(const char *id) { if (STARTS_WITH(id, "NetworkPool")) - return VIRT_DEV_NET; + return CIM_POOL_TYPE_NET; else if (STARTS_WITH(id, "DiskPool")) - return VIRT_DEV_DISK; + return CIM_POOL_TYPE_DISK; else if (STARTS_WITH(id, "MemoryPool")) - return VIRT_DEV_MEM; + return CIM_POOL_TYPE_MEM; else if (STARTS_WITH(id, "ProcessorPool")) - return VIRT_DEV_VCPU; + return CIM_POOL_TYPE_PROC; else - return VIRT_DEV_UNKNOWN; + return CIM_POOL_TYPE_UNKNOWN; } static bool mempool_set_total(CMPIInstance *inst, virConnectPtr conn) @@ -673,177 +681,190 @@ static CMPIStatus diskpool_instance(virC return s; } -static CMPIStatus _get_pool(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, +static CMPIStatus _get_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + const char *id, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if ((type == CIM_POOL_TYPE_PROC) || + (type == CIM_TYPE_ALL)) + s = procpool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if ((type == CIM_POOL_TYPE_MEM) || + (type == CIM_TYPE_ALL)) + s = mempool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if ((type == CIM_POOL_TYPE_NET) || + (type == CIM_TYPE_ALL)) + s = netpool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if ((type == CIM_POOL_TYPE_DISK) || + (type == CIM_TYPE_ALL)) + s = diskpool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if (type == CIM_POOL_TYPE_UNKNOWN) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance - resource pool type unknow."); + + if (id && list->cur == 0) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s).", id); + + out: + virConnectClose(conn); + return s; +} + +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, const char *id, - const char *ns, - struct inst_list *list) -{ - if (STARTS_WITH(type, "MemoryPool")) - return mempool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "ProcessorPool")) - return procpool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "NetworkPool")) - return netpool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "DiskPool")) - return diskpool_instance(conn, list, ns, id, broker); - - return (CMPIStatus){CMPI_RC_ERR_NOT_FOUND, NULL}; -} - -CMPIStatus get_pool_by_type(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, - const char *ns, - struct inst_list *list) -{ - return _get_pool(broker, conn, type, NULL, ns, list); -} - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns) -{ - CMPIInstance *inst = NULL; - CMPIStatus s; - char *type = NULL; + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + struct inst_list list; char *poolid = NULL; int ret; - struct inst_list list; + uint16_t type; inst_list_init(&list); - ret = sscanf(id, "%a[^/]/%as", &type, &poolid); - if (ret != 2) - goto out; - - s = _get_pool(broker, conn, type, poolid, ns, &list); - if ((s.rc == CMPI_RC_OK) && (list.cur > 0)) - inst = list.list[0]; - - out: + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance."); + goto out; + } + + type = device_type_from_poolid(id); + + if (type == CIM_POOL_TYPE_UNKNOWN) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s) - resource pool type mismatch.", + id); + goto out; + } + + ret = sscanf(id, "%*[^/]/%as", &poolid); + if (ret != 1) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s).", + id); + goto out; + } + + s = _get_pools(broker, reference, type, poolid, &list); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = list.list[0]; + + out: + free(poolid); + virConnectClose(conn); inst_list_free(&list); - return inst; -} - -CMPIStatus get_all_pools(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *list) -{ - int i; + return s; +} + +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance) +{ CMPIStatus s = {CMPI_RC_OK}; - - for (i = 0; device_pool_names[i]; i++) { - s = get_pool_by_type(broker, - conn, - device_pool_names[i], - ns, - list); - if (s.rc != CMPI_RC_OK) - goto out; - } - + CMPIInstance *inst = NULL; + const char *id = NULL; + uint16_t type_cls; + uint16_t type_id; + + if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Missing InstanceID"); + goto out; + } + + type_cls = pool_type_from_classname(CLASSNAME(reference)); + type_id = device_type_from_poolid(id); + + if ((type_cls != type_id) || + (type_cls == CIM_POOL_TYPE_UNKNOWN)) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s) - resource pool type mismatch.", + id); + goto out; + } + + s = get_pool_by_name(broker, reference, id, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *instance = inst; + out: return s; } -static void __return_pool(const CMPIResult *results, - struct inst_list *list, - bool name_only) -{ - if (name_only) - cu_return_instance_names(results, list); - else - cu_return_instances(results, list); +CMPIStatus enum_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + struct inst_list *list) +{ + return _get_pools(broker, reference, type, NULL, list); } static CMPIStatus return_pool(const CMPIObjectPath *ref, const CMPIResult *results, - bool name_only, - bool single_only) -{ - CMPIStatus s; - char *type; - virConnectPtr conn; + bool names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, ref, &s)) - return s; - - type = class_base_name(CLASSNAME(ref)); - if (type == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Invalid classname `%s'", CLASSNAME(ref)); - return s; - } + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - s = get_pool_by_type(_BROKER, - conn, - type, - NAMESPACE(ref), - &list); - if (s.rc == CMPI_RC_OK) { - __return_pool(results, &list, name_only); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Pool type %s not found", type); - } - - out: - free(type); + s = enum_pools(_BROKER, + ref, + pool_type_from_classname(CLASSNAME(ref)), + &list); + if (s.rc != CMPI_RC_OK) + goto out; + + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); + + out: inst_list_free(&list); - - return s; -} - -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance) -{ - CMPIStatus s; - CMPIInstance *inst = NULL; - virConnectPtr conn = NULL; - const char *id = NULL; - - if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { - cu_statusf(broker, &s, - CMPI_RC_ERR_FAILED, - "Missing InstanceID"); - goto out; - } - - conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) { - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); - goto out; - } - - inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference)); - if (inst == NULL) - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", id); - - out: - virConnectClose(conn); - *instance = inst; return s; } @@ -853,7 +874,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_pool(reference, results, true, false); + return return_pool(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -862,7 +883,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return return_pool(reference, results, false, false); + return return_pool(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -871,13 +892,16 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK}; CMPIInstance *inst = NULL; - s = get_pool_inst(_BROKER, reference, &inst); - if ((s.rc == CMPI_RC_OK) && (inst != NULL)) - CMReturnInstance(results, inst); - + s = get_pool_by_ref(_BROKER, reference, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: return s; } diff -r 1626d88fa98b -r 196480aa1c1b src/Virt_DevicePool.h --- a/src/Virt_DevicePool.h Wed Mar 05 10:33:35 2008 +0100 +++ b/src/Virt_DevicePool.h Wed Mar 05 10:33:36 2008 +0100 @@ -26,20 +26,6 @@ #include #include -extern char *device_pool_names[]; - -CMPIStatus get_pool_by_type(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, - const char *ns, - struct inst_list *list); - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns); - - /** * Get the InstanceID of a pool that a given RASD id (for type) is in * @@ -56,6 +42,13 @@ char *pool_member_of(const CMPIBroker *b const char *id); /** + * Get the device type of a given pool from the pool's classname + * + * @param id The InstanceID of the pool + */ +uint16_t pool_type_from_classname(const char *classname); + +/** * Get the device type of a given pool from the pool's InstanceID * * @param id The InstanceID of the pool @@ -63,17 +56,19 @@ uint16_t device_type_from_poolid(const c uint16_t device_type_from_poolid(const char *id); /** - * Get all device pools on the system for the given connection + * Get all device pools on the system for the given type + * * * @param broker The current Broker - * @param conn The libvirt connection to use - * @param ns Namespace for the pools - * @param list Return instances in this struct + * @param reference Defines the libvirt connection to use + * @param type The device pool type or CIM_POOL_TYPE_ALL + * to get all resource pools + * @param list The list of returned instances */ -CMPIStatus get_all_pools(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *list); +CMPIStatus enum_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + struct inst_list *list); /** * Get a device pools instance for the given reference @@ -82,9 +77,23 @@ CMPIStatus get_all_pools(const CMPIBroke * @param reference The reference passed to the CIMOM * @param instance Return corresponding instance */ -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance); +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance); + +/** + * Get device pool instance specified by the id + * + * @param broker A pointer to the current broker + * @param ref The object path containing namespace and prefix info + * @param name The device pool id + * @param _inst In case of success the pointer to the instance + * @returns CMPIStatus + */ +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *id, + CMPIInstance **_inst); #endif From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:14 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:14 +0100 Subject: [Libvirt-cim] [PATCH 7 of 7] AllocationCapabilities: adopt new DevicePool enum interface In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204710379 -3600 # Node ID eeb2c60ee909c70927f230735f8e1fc763d3eed3 # Parent 2e9dc85abc269153ec38d1970b3e706168711f6c AllocationCapabilities: adopt new DevicePool enum interface - adopted new DevicePool enum_pools() interface - updated NOT_FOUND error message to be consistent with others Signed-off-by: Heidi Eckhart diff -r 2e9dc85abc26 -r eeb2c60ee909 src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Wed Mar 05 10:46:17 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Wed Mar 05 10:46:19 2008 +0100 @@ -33,6 +33,7 @@ #include "Virt_AllocationCapabilities.h" #include "Virt_DevicePool.h" +#include "svpc_types.h" const static CMPIBroker *_BROKER; @@ -95,11 +96,11 @@ CMPIStatus enum_alloc_cap_instances(cons if (id) cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "Requested Object could not be found."); - goto out; - } - - s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); + "Instance not found."); + goto out; + } + + s = enum_pools(broker, ref, CIM_POOL_TYPE_ALL, &device_pool_list); if (s.rc != CMPI_RC_OK) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, @@ -135,7 +136,7 @@ CMPIStatus enum_alloc_cap_instances(cons if (id && !inst_id) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "Requested Object could not be found."); + "Instance not found."); goto out; } From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:13 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:13 +0100 Subject: [Libvirt-cim] [PATCH 6 of 7] EAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: <2e9dc85abc269153ec38.1204710553@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204710377 -3600 # Node ID 2e9dc85abc269153ec38d1970b3e706168711f6c # Parent dfd9e623fef6ec927b06ab546857765b47482f87 EAFP: adopt DevicePool interface changes - adopted changes to DevicePool interface - updated resource types Signed-off-by: Heidi Eckhart diff -r dfd9e623fef6 -r 2e9dc85abc26 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Wed Mar 05 10:33:38 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Wed Mar 05 10:46:17 2008 +0100 @@ -45,15 +45,15 @@ static uint16_t class_to_type(const CMPI uint16_t type; if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL)) - type = CIM_RASD_TYPE_DISK; + type = CIM_RES_TYPE_DISK; else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL)) - type = CIM_RASD_TYPE_NET; + type = CIM_RES_TYPE_NET; else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL)) - type = CIM_RASD_TYPE_MEM; + type = CIM_RES_TYPE_MEM; else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL)) - type = CIM_RASD_TYPE_PROC; + type = CIM_RES_TYPE_PROC; else - type = 0; + type = CIM_RES_TYPE_UNKNOWN; return type; } @@ -66,12 +66,16 @@ static CMPIStatus vdev_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; + CMPIInstance *inst = NULL; if (!match_hypervisor_prefix(ref, info)) return s; + s = get_device_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + type = class_to_type(ref); if (type == 0) { cu_statusf(_BROKER, &s, @@ -95,25 +99,14 @@ static CMPIStatus vdev_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, conn, poolid, NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, ref, poolid, &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -172,7 +165,6 @@ static int devs_from_pool(uint16_t type, name = virDomainGetName(doms[i]); - /* FIXME: Get VIRT_DEV_ type here */ dom_devices(_BROKER, doms[i], ns, type, &tmp); filter_by_pool(list, &tmp, type, poolid); @@ -199,6 +191,10 @@ static CMPIStatus pool_to_vdev(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -206,25 +202,16 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - CU_DEBUG("Got %s\n", poolid); - type = device_type_from_poolid(poolid); - if (type == VIRT_DEV_UNKNOWN) { + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid InstanceID or unsupported pool type"); goto out; } - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; - devs_from_pool(type, ref, poolid, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:07 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:07 +0100 Subject: [Libvirt-cim] [PATCH 0 of 7] #2 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs Message-ID: Adopted the get_() function look and feel to the DevicePool provider. Updated the association providers that uses these functions. Diff to patch set 1: - patch #1 (svpc_types) - add Resource Pool types to svpc_types.h and map existing types to base resource types - patch #2 (DevicePool) - implement configurable enum_pools() function; adopt resource types - patch #6 (EAFP) - adopt resource types; validate client given device ref - patch #7 (AC) - adopt DevicePool interface changes; updated NOT_FOUND error message to be consistent with others From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:08 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:08 +0100 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: Message-ID: <1626d88fa98b890ba251.1204710548@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204709615 -3600 # Node ID 1626d88fa98b890ba251a450fca3d6c330bc27ad # Parent 58da2f9d92e39567b75d8537a833aba0da994f92 Add Resource Pool types to svpc_types.h This patch reorganizes the resource types. It defines common resource types for: - ALL - PROC - MEM - NET - DISK - UNKNOWN and maps the corresponding class specific resource types to these base types. Signed-off-by: Heidi Eckhart diff -r 58da2f9d92e3 -r 1626d88fa98b libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Mar 03 09:58:19 2008 -0800 +++ b/libxkutil/device_parsing.h Wed Mar 05 10:33:35 2008 +0100 @@ -64,11 +64,11 @@ struct graphics_device { struct virt_device { enum { - VIRT_DEV_NET = CIM_RASD_TYPE_NET, - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, - VIRT_DEV_UNKNOWN = 1000, + VIRT_DEV_NET = CIM_RES_TYPE_NET, + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, VIRT_DEV_EMU, VIRT_DEV_GRAPHICS, } type; diff -r 58da2f9d92e3 -r 1626d88fa98b src/svpc_types.h --- a/src/svpc_types.h Mon Mar 03 09:58:19 2008 -0800 +++ b/src/svpc_types.h Wed Mar 05 10:33:35 2008 +0100 @@ -22,10 +22,24 @@ #ifndef __SVPC_TYPES_H #define __SVPC_TYPES_H -#define CIM_RASD_TYPE_PROC 3 -#define CIM_RASD_TYPE_MEM 4 -#define CIM_RASD_TYPE_NET 10 -#define CIM_RASD_TYPE_DISK 17 +#define CIM_TYPE_ALL 0 +#define CIM_RES_TYPE_PROC 3 +#define CIM_RES_TYPE_MEM 4 +#define CIM_RES_TYPE_NET 10 +#define CIM_RES_TYPE_DISK 17 +#define CIM_RES_TYPE_UNKNOWN 1000 + +#define CIM_RASD_TYPE_PROC CIM_RES_TYPE_PROC +#define CIM_RASD_TYPE_MEM CIM_RES_TYPE_MEM +#define CIM_RASD_TYPE_NET CIM_RES_TYPE_NET +#define CIM_RASD_TYPE_DISK CIM_RES_TYPE_DISK + +#define CIM_POOL_TYPE_ALL CIM_TYPE_ALL +#define CIM_POOL_TYPE_PROC CIM_RES_TYPE_PROC +#define CIM_POOL_TYPE_MEM CIM_RES_TYPE_MEM +#define CIM_POOL_TYPE_NET CIM_RES_TYPE_NET +#define CIM_POOL_TYPE_DISK CIM_RES_TYPE_DISK +#define CIM_POOL_TYPE_UNKNOWN CIM_RES_TYPE_UNKNOWN #define CIM_VSSD_RECOVERY_NONE 2 #define CIM_VSSD_RECOVERY_RESTART 3 From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:11 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:11 +0100 Subject: [Libvirt-cim] [PATCH 4 of 7] HRP: adopt DevicePool interface change In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204709617 -3600 # Node ID ee7aecb09ec486d4d47134fef328ae207b608e1d # Parent 6d0015c66c758a0d80fb6d70e310d2b020798ea6 HRP: adopt DevicePool interface change - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r 6d0015c66c75 -r ee7aecb09ec4 src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Wed Mar 05 10:33:37 2008 +0100 +++ b/src/Virt_HostedResourcePool.c Wed Mar 05 10:33:37 2008 +0100 @@ -34,6 +34,7 @@ #include "Virt_HostSystem.h" #include "Virt_DevicePool.h" +#include "svpc_types.h" static const CMPIBroker *_BROKER; @@ -47,8 +48,8 @@ static CMPIStatus pool_to_sys(const CMPI if (!match_hypervisor_prefix(ref, info)) goto out; - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) goto out; s = get_host(_BROKER, ref, &inst, false); @@ -67,26 +68,15 @@ static CMPIStatus sys_to_pool(const CMPI { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int i; - virConnectPtr conn; if (!match_hypervisor_prefix(ref, info)) goto out; - + s = get_host(_BROKER, ref, &inst, true); if (s.rc != CMPI_RC_OK) goto out; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - for (i = 0; device_pool_names[i]; i++) - get_pool_by_type(_BROKER, - conn, - device_pool_names[i], - NAMESPACE(ref), - list); + s = enum_pools(_BROKER, ref, CIM_POOL_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:12 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:12 +0100 Subject: [Libvirt-cim] [PATCH 5 of 7] RAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204709618 -3600 # Node ID dfd9e623fef6ec927b06ab546857765b47482f87 # Parent ee7aecb09ec486d4d47134fef328ae207b608e1d RAFP: adopt DevicePool interface changes - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r ee7aecb09ec4 -r dfd9e623fef6 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Wed Mar 05 10:33:37 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Wed Mar 05 10:33:38 2008 +0100 @@ -45,7 +45,6 @@ static CMPIStatus rasd_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; CMPIInstance *inst = NULL; @@ -78,28 +77,17 @@ static CMPIStatus rasd_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, - conn, - poolid, - NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, + ref, + poolid, + &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -191,7 +179,11 @@ static CMPIStatus pool_to_rasd(const CMP CMPIInstance *inst; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; + + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -207,10 +199,6 @@ static CMPIStatus pool_to_rasd(const CMP "Invalid InstanceID or unsupported pool type"); goto out; } - - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; rasds_from_pool(type, ref, @@ -218,9 +206,6 @@ static CMPIStatus pool_to_rasd(const CMP info->properties, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Wed Mar 5 09:49:10 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 10:49:10 +0100 Subject: [Libvirt-cim] [PATCH 3 of 7] SDC: adopt DevicePool interface change In-Reply-To: Message-ID: <6d0015c66c758a0d80fb.1204710550@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204709617 -3600 # Node ID 6d0015c66c758a0d80fb6d70e310d2b020798ea6 # Parent 196480aa1c1b8358ae896782f831950c27ab232d SDC: adopt DevicePool interface change - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r 196480aa1c1b -r 6d0015c66c75 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Wed Mar 05 10:33:36 2008 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Wed Mar 05 10:33:37 2008 +0100 @@ -529,13 +529,9 @@ static struct sdc_rasd_prop *disk_max(co /* Getting the relevant resource pool directly finds the free space for us. It is in the Capacity field. */ - pool_inst = get_pool_by_id(_BROKER, conn, inst_id, NAMESPACE(ref)); - if (pool_inst == NULL) { - cu_statusf(_BROKER, s, - CMPI_RC_ERR_FAILED, - "Could not get pool instance"); - goto out; - } + *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst); + if (s->rc != CMPI_RC_OK) + goto out; prop_ret = cu_get_u64_prop(pool_inst, "Capacity", &free_64); if (prop_ret != CMPI_RC_OK) { From heidieck at linux.vnet.ibm.com Wed Mar 5 12:43:29 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 13:43:29 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SD: adopt Device interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204720826 -3600 # Node ID d7dd02fed84faa2d851640208da564c4593c8ddb # Parent e486d9c03b54fb4bf491f7d94e02845279bec775 SD: adopt Device interface changes Signed-off-by: Heidi Eckhart diff -r e486d9c03b54 -r d7dd02fed84f src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Wed Mar 05 13:40:23 2008 +0100 +++ b/src/Virt_SystemDevice.c Wed Mar 05 13:40:26 2008 +0100 @@ -48,55 +48,6 @@ const static CMPIBroker *_BROKER; -#define DEV_TYPE_COUNT 4 -const static int device_types[DEV_TYPE_COUNT] = - {VIRT_DEV_NET, - VIRT_DEV_DISK, - VIRT_DEV_MEM, - VIRT_DEV_VCPU, - }; - -static int get_dom_devices(const char *name, - struct inst_list *list, - int type, - const char *host_cn, - const char *ns) -{ - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; - CMPIStatus s; - int ret = 0; - - conn = connect_by_classname(_BROKER, host_cn, &s); - if (conn == NULL) - goto out; - - dom = virDomainLookupByName(conn, name); - if (dom == NULL) - goto out; - - ret = dom_devices(_BROKER, dom, ns, type, list); - - virDomainFree(dom); - out: - virConnectClose(conn); - - return ret; -} - -static int get_all_devices(const char *name, - struct inst_list *list, - const char *host_cn, - const char *ns) -{ - int i; - - for (i = 0; i < DEV_TYPE_COUNT; i++) - get_dom_devices(name, list, device_types[i], host_cn, ns); - - return i; -} - static CMPIStatus sys_to_dev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -104,7 +55,6 @@ static CMPIStatus sys_to_dev(const CMPIO const char *host = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int ret; if (!match_hypervisor_prefix(ref, info)) return s; @@ -120,20 +70,7 @@ static CMPIStatus sys_to_dev(const CMPIO goto out; } - ret = get_all_devices(host, - list, - CLASSNAME(ref), - NAMESPACE(ref)); - - if (ret >= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get devices"); - } + s = enum_devices(_BROKER, ref, host, CIM_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Wed Mar 5 12:43:30 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 13:43:30 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes In-Reply-To: Message-ID: <65b9a1e504faa04a13cc.1204721010@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204720826 -3600 # Node ID 65b9a1e504faa04a13cc8900a7d5258592497acc # Parent d7dd02fed84faa2d851640208da564c4593c8ddb EAFP: adopt Device interface changes Signed-off-by: Heidi Eckhart diff -r d7dd02fed84f -r 65b9a1e504fa src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Wed Mar 05 13:40:26 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Wed Mar 05 13:40:26 2008 +0100 @@ -77,7 +77,7 @@ static CMPIStatus vdev_to_pool(const CMP goto out; type = class_to_type(ref); - if (type == 0) { + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unknown device type"); @@ -138,47 +138,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int devs_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - const char *ns = NAMESPACE(ref); - const char *cn = CLASSNAME(ref); - - conn = connect_by_classname(_BROKER, cn, &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - dom_devices(_BROKER, doms[i], ns, type, &tmp); - - filter_by_pool(list, &tmp, type, poolid); - - inst_list_free(&tmp); - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_vdev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -186,7 +145,8 @@ static CMPIStatus pool_to_vdev(const CMP const char *poolid; CMPIStatus s = {CMPI_RC_OK, NULL}; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp; if (!match_hypervisor_prefix(ref, info)) return s; @@ -210,7 +170,15 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - devs_from_pool(type, ref, poolid, list); + inst_list_init(&tmp); + + s = enum_devices(_BROKER, ref, NULL, type, &tmp); + if (s.rc != CMPI_RC_OK) + goto out; + + filter_by_pool(list, &tmp, type, poolid); + + inst_list_free(&tmp); out: return s; From heidieck at linux.vnet.ibm.com Wed Mar 5 12:43:28 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 13:43:28 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204720823 -3600 # Node ID e486d9c03b54fb4bf491f7d94e02845279bec775 # Parent eeb2c60ee909c70927f230735f8e1fc763d3eed3 Device: rename dom_device to enum_devices and make it configurable Signed-off-by: Heidi Eckhart diff -r eeb2c60ee909 -r e486d9c03b54 src/Virt_Device.c --- a/src/Virt_Device.c Wed Mar 05 10:46:19 2008 +0100 +++ b/src/Virt_Device.c Wed Mar 05 13:40:23 2008 +0100 @@ -282,83 +282,112 @@ uint16_t device_type_from_classname(cons return VIRT_DEV_UNKNOWN; } -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list) -{ +static CMPIStatus _get_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + struct virt_device *devs = NULL; int count; int i; - struct virt_device *devs = NULL; count = get_devices(dom, &devs, type); if (count <= 0) goto out; - + for (i = 0; i < count; i++) { CMPIInstance *dev = NULL; - - dev = device_instance(broker, &devs[i], dom, ns); + + dev = device_instance(broker, &devs[i], dom, NAMESPACE(reference)); if (dev) inst_list_add(list, dev); - + cleanup_virt_device(&devs[i]); } out: free(devs); - - return 1; -} - -static int dom_list_devices(virConnectPtr conn, - const CMPIObjectPath *ref, - struct inst_list *list) -{ - virDomainPtr *doms; - int ndom; + return s; +} + +static CMPIStatus _enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s; + + if (type == CIM_TYPE_ALL) { + s = _get_devices(broker, reference, dom, VIRT_DEV_VCPU, list); + s = _get_devices(broker, reference, dom, VIRT_DEV_MEM, list); + s = _get_devices(broker, reference, dom, VIRT_DEV_NET, list); + s = _get_devices(broker, reference, dom, VIRT_DEV_DISK, list); + } + else + s = _get_devices(broker, reference, dom, type, list); + + return s; +} + +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + virDomainPtr *doms = NULL; + int count = 1; int i; - int type; - - type = device_type_from_classname(CLASSNAME(ref)); - - ndom = get_domain_list(conn, &doms); - if (ndom == 0) - return 1; - else if (ndom < 0) - return 0; - - for (i = 0; i < ndom; i++) { - dom_devices(_BROKER, doms[i], NAMESPACE(ref), type, list); - } - - return 1; -} - -static CMPIStatus enum_devices(const CMPIObjectPath *reference, - const CMPIResult *results, - int names_only) -{ - CMPIStatus s; - virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if (domain) { + doms = calloc(1, sizeof(virDomainPtr)); + doms[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &doms); + + + CU_DEBUG("added doms"); + + for (i = 0; i < count; i++) { + s = _enum_devices(broker, reference, doms[i], type, list); + + virDomainFree(doms[i]); + } + + out: + virConnectClose(conn); + free(doms); + + return s; +} + +static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, + const CMPIResult *results, + int names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, reference, &s)) - return s; + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); - if (conn == NULL) - return s; - - if (!dom_list_devices(conn, reference, &list)) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to list domains"); - return s; - } + s = enum_devices(_BROKER, reference, NULL, + device_type_from_classname(CLASSNAME(reference)), + &list); + if (s.rc != CMPI_RC_OK) + goto out; if (list.cur == 0) goto out; @@ -371,11 +400,6 @@ static CMPIStatus enum_devices(const CMP inst_list_free(&list); out: - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - virConnectClose(conn); - return s; } @@ -524,7 +548,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return enum_devices(reference, results, 1); + return return_enum_devices(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -533,7 +557,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return enum_devices(reference, results, 0); + return return_enum_devices(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, diff -r eeb2c60ee909 -r e486d9c03b54 src/Virt_Device.h --- a/src/Virt_Device.h Wed Mar 05 10:46:19 2008 +0100 +++ b/src/Virt_Device.h Wed Mar 05 13:40:23 2008 +0100 @@ -27,19 +27,18 @@ * Return a list of devices for a given domain * * @param broker A pointer to the CIM broker - * @param dom The domain in question - * @param ref The namespace - * @param list A pointer to an array of CMPIInstance objects (should - * be NULL initially) - * @param cur The number of items in the list (0 initially) - * @param max The size of the list (0 initially) - * @returns Nonzero on success + * @param reference Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) + * @param type The device type or CIM_TYPE_ALL to get + * all devices + * @param list A pointer to an array of CMPIInstance objects + * (should be NULL initially) */ -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list); +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list); /** * Returns the device instance defined by the reference From heidieck at linux.vnet.ibm.com Wed Mar 5 12:43:27 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 13:43:27 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP Message-ID: This patch set implements the configurable enum_devices() interface to the Device provider. This slight interface change is adopted to the associations SystemDevice and ElementAllocatedFromPool. Both associations profit from the easy access to the device instances. From danms at us.ibm.com Wed Mar 5 17:07:11 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 05 Mar 2008 09:07:11 -0800 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: <1626d88fa98b890ba251.1204710548@localhost.localdomain> (Heidi Eckhart's message of "Wed, 05 Mar 2008 10:49:08 +0100") References: <1626d88fa98b890ba251.1204710548@localhost.localdomain> Message-ID: <871w6p5ccg.fsf@caffeine.beaverton.ibm.com> This has gotten a little messy and disjoint, so I'm definitely in favor of cleaning it up. HE> -#define CIM_RASD_TYPE_PROC 3 HE> -#define CIM_RASD_TYPE_MEM 4 HE> -#define CIM_RASD_TYPE_NET 10 HE> -#define CIM_RASD_TYPE_DISK 17 HE> +#define CIM_TYPE_ALL 0 HE> +#define CIM_RES_TYPE_PROC 3 HE> +#define CIM_RES_TYPE_MEM 4 HE> +#define CIM_RES_TYPE_NET 10 HE> +#define CIM_RES_TYPE_DISK 17 HE> +#define CIM_RES_TYPE_UNKNOWN 1000 HE> + HE> +#define CIM_RASD_TYPE_PROC CIM_RES_TYPE_PROC HE> +#define CIM_RASD_TYPE_MEM CIM_RES_TYPE_MEM HE> +#define CIM_RASD_TYPE_NET CIM_RES_TYPE_NET HE> +#define CIM_RASD_TYPE_DISK CIM_RES_TYPE_DISK HE> + HE> +#define CIM_POOL_TYPE_ALL CIM_TYPE_ALL HE> +#define CIM_POOL_TYPE_PROC CIM_RES_TYPE_PROC HE> +#define CIM_POOL_TYPE_MEM CIM_RES_TYPE_MEM HE> +#define CIM_POOL_TYPE_NET CIM_RES_TYPE_NET HE> +#define CIM_POOL_TYPE_DISK CIM_RES_TYPE_DISK HE> +#define CIM_POOL_TYPE_UNKNOWN CIM_RES_TYPE_UNKNOWN I know that in several places, we assume that a device type is the same as the CIM resource type. Above, you define CIM_RASD_TYPE_foo to CIM_RES_TYPE_foo, presumably to avoid having to touch all the places that use the former. I think to reduce ambiguity and to enforce the fact that these must remain the same, it would be better to just change CIM_RASD_TYPE_foo to CIM_RES_TYPE_foo everywhere. Thoughts? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Wed Mar 5 17:17:20 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 05 Mar 2008 09:17:20 -0800 Subject: [Libvirt-cim] [PATCH 2 of 7] DevicePool: reorganize get and enum functions In-Reply-To: <196480aa1c1b8358ae89.1204710549@localhost.localdomain> (Heidi Eckhart's message of "Wed, 05 Mar 2008 10:49:09 +0100") References: <196480aa1c1b8358ae89.1204710549@localhost.localdomain> Message-ID: <87wsoh3xb3.fsf@caffeine.beaverton.ibm.com> HE> @@ -673,177 +681,190 @@ static CMPIStatus diskpool_instance(virC HE> return s; HE> } HE> -static CMPIStatus _get_pool(const CMPIBroker *broker, HE> - virConnectPtr conn, HE> - const char *type, HE> +static CMPIStatus _get_pools(const CMPIBroker *broker, HE> + const CMPIObjectPath *reference, HE> + const uint16_t type, HE> + const char *id, HE> + struct inst_list *list) HE> +{ HE> + CMPIStatus s = {CMPI_RC_OK, NULL}; HE> + virConnectPtr conn; HE> + HE> + conn = connect_by_classname(broker, CLASSNAME(reference), &s); HE> + if (conn == NULL) HE> + goto out; HE> + HE> + if ((type == CIM_POOL_TYPE_PROC) || HE> + (type == CIM_TYPE_ALL)) HE> + s = procpool_instance(conn, list, HE> + NAMESPACE(reference), HE> + id, broker); HE> + HE> + if ((type == CIM_POOL_TYPE_MEM) || HE> + (type == CIM_TYPE_ALL)) HE> + s = mempool_instance(conn, list, HE> + NAMESPACE(reference), HE> + id, broker); HE> + HE> + if ((type == CIM_POOL_TYPE_NET) || HE> + (type == CIM_TYPE_ALL)) HE> + s = netpool_instance(conn, list, HE> + NAMESPACE(reference), HE> + id, broker); HE> + HE> + if ((type == CIM_POOL_TYPE_DISK) || HE> + (type == CIM_TYPE_ALL)) HE> + s = diskpool_instance(conn, list, HE> + NAMESPACE(reference), HE> + id, broker); HE> + HE> + if (type == CIM_POOL_TYPE_UNKNOWN) HE> + cu_statusf(broker, &s, HE> + CMPI_RC_ERR_NOT_FOUND, HE> + "No such instance - resource pool type unknow."); ^^^^^^^ You're missing an 'n' there, and the period should be removed. HE> + if (id && list->cur == 0) HE> + cu_statusf(broker, &s, HE> + CMPI_RC_ERR_NOT_FOUND, HE> + "No such instance (%s).", id); As well as this period. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Wed Mar 5 17:22:56 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 05 Mar 2008 09:22:56 -0800 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: (Heidi Eckhart's message of "Wed, 05 Mar 2008 13:43:28 +0100") References: Message-ID: <87skz53x1r.fsf@caffeine.beaverton.ibm.com> HE> +static CMPIStatus _get_devices(const CMPIBroker *broker, HE> + const CMPIObjectPath *reference, HE> + const virDomainPtr dom, HE> + const uint16_t type, HE> + struct inst_list *list) HE> +{ HE> + CMPIStatus s = {CMPI_RC_OK, NULL}; HE> + struct virt_device *devs = NULL; HE> int count; HE> int i; HE> - struct virt_device *devs = NULL; Please don't rearrange lines as part of a patch that does more than just cleanups. HE> count = get_devices(dom, &devs, type); HE> if (count <= 0) HE> goto out; HE> - HE> + You're adding leading whitespace here. HE> for (i = 0; i < count; i++) { HE> CMPIInstance *dev = NULL; HE> - HE> - dev = device_instance(broker, &devs[i], dom, ns); HE> + HE> + dev = device_instance(broker, &devs[i], dom, NAMESPACE(reference)); HE> if (dev) HE> inst_list_add(list, dev); HE> - HE> + ...and here. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From heidieck at linux.vnet.ibm.com Wed Mar 5 19:24:12 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 20:24:12 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: <87skz53x1r.fsf@caffeine.beaverton.ibm.com> References: <87skz53x1r.fsf@caffeine.beaverton.ibm.com> Message-ID: <47CEF35C.9020605@linux.vnet.ibm.com> Dan Smith wrote: > Please don't rearrange lines as part of a patch that does more than > just cleanups. > > ... > > You're adding leading whitespace here. > Thanks. I will fix this. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Wed Mar 5 19:29:19 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 05 Mar 2008 20:29:19 +0100 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: <871w6p5ccg.fsf@caffeine.beaverton.ibm.com> References: <1626d88fa98b890ba251.1204710548@localhost.localdomain> <871w6p5ccg.fsf@caffeine.beaverton.ibm.com> Message-ID: <47CEF48F.30302@linux.vnet.ibm.com> Dan Smith wrote: > I know that in several places, we assume that a device type is the > same as the CIM resource type. Above, you define CIM_RASD_TYPE_foo to > CIM_RES_TYPE_foo, presumably to avoid having to touch all the places > that use the former. I think to reduce ambiguity and to enforce the > fact that these must remain the same, it would be better to just > change CIM_RASD_TYPE_foo to CIM_RES_TYPE_foo everywhere. > > Thoughts? > I'm definitely supporting this opinion and will update all providers, if the others are fine with using CIM_RES_TYPE_foo in all cases (Device, DevicePool, RASD ...). -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From lizg at cn.ibm.com Thu Mar 6 01:59:50 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Thu, 06 Mar 2008 09:59:50 +0800 Subject: [Libvirt-cim] [PATCH] Add method provider registration for KVM_ComputerSystem Message-ID: <57d5360488f3f6b8d0e4.1204768790@localhost.localdomain> # HG changeset patch # User Zhengang Li # Date 1204768763 -28800 # Node ID 57d5360488f3f6b8d0e4d76b1fe8d9567580c7b5 # Parent 604bd97baadf924a706cdfc99ad8bc4eb2e2a6db Add method provider registration for KVM_ComputerSystem It's schema change. Please redo the preuninstall/uninstall/install/postinstall after applying this patch. Signed-off-by: Zhengang Li diff -r 604bd97baadf -r 57d5360488f3 schema/ComputerSystem.registration --- a/schema/ComputerSystem.registration Wed Mar 05 07:02:25 2008 -0800 +++ b/schema/ComputerSystem.registration Thu Mar 06 09:59:23 2008 +0800 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method -KVM_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance +KVM_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:42 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:42 +0100 Subject: [Libvirt-cim] [PATCH 01 of 10] Add Resource Pool types to svpc_types.h In-Reply-To: Message-ID: <4b2f3847b668b6394737.1204806702@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204794319 -3600 # Node ID 4b2f3847b668b639473777171ec78263a2471c40 # Parent 58da2f9d92e39567b75d8537a833aba0da994f92 Add Resource Pool types to svpc_types.h This patch reorganizes the resource types. It defines common resource types for: - ALL - PROC - MEM - NET - DISK - UNKNOWN and maps the corresponding class specific resource types to these base types. Signed-off-by: Heidi Eckhart diff -r 58da2f9d92e3 -r 4b2f3847b668 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Mar 03 09:58:19 2008 -0800 +++ b/libxkutil/device_parsing.h Thu Mar 06 10:05:19 2008 +0100 @@ -64,11 +64,11 @@ struct graphics_device { struct virt_device { enum { - VIRT_DEV_NET = CIM_RASD_TYPE_NET, - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, - VIRT_DEV_UNKNOWN = 1000, + VIRT_DEV_NET = CIM_RES_TYPE_NET, + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, VIRT_DEV_EMU, VIRT_DEV_GRAPHICS, } type; diff -r 58da2f9d92e3 -r 4b2f3847b668 src/svpc_types.h --- a/src/svpc_types.h Mon Mar 03 09:58:19 2008 -0800 +++ b/src/svpc_types.h Thu Mar 06 10:05:19 2008 +0100 @@ -22,10 +22,12 @@ #ifndef __SVPC_TYPES_H #define __SVPC_TYPES_H -#define CIM_RASD_TYPE_PROC 3 -#define CIM_RASD_TYPE_MEM 4 -#define CIM_RASD_TYPE_NET 10 -#define CIM_RASD_TYPE_DISK 17 +#define CIM_RES_TYPE_ALL 0 +#define CIM_RES_TYPE_PROC 3 +#define CIM_RES_TYPE_MEM 4 +#define CIM_RES_TYPE_NET 10 +#define CIM_RES_TYPE_DISK 17 +#define CIM_RES_TYPE_UNKNOWN 1000 #define CIM_VSSD_RECOVERY_NONE 2 #define CIM_VSSD_RECOVERY_RESTART 3 From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:43 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:43 +0100 Subject: [Libvirt-cim] [PATCH 02 of 10] RASD: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204797484 -3600 # Node ID f5794941df79b894318965b235cb0b7b54050d3d # Parent 4b2f3847b668b639473777171ec78263a2471c40 RASD: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 4b2f3847b668 -r f5794941df79 src/Virt_RASD.c --- a/src/Virt_RASD.c Thu Mar 06 10:05:19 2008 +0100 +++ b/src/Virt_RASD.c Thu Mar 06 10:58:04 2008 +0100 @@ -292,17 +292,17 @@ static CMPIInstance *rasd_from_vdev(cons char *base; char *id; - if (dev->type == VIRT_DEV_DISK) { - type = CIM_RASD_TYPE_DISK; + if (dev->type == CIM_RES_TYPE_DISK) { + type = CIM_RES_TYPE_DISK; base = "DiskResourceAllocationSettingData"; - } else if (dev->type == VIRT_DEV_NET) { - type = CIM_RASD_TYPE_NET; + } else if (dev->type == CIM_RES_TYPE_NET) { + type = CIM_RES_TYPE_NET; base = "NetResourceAllocationSettingData"; - } else if (dev->type == VIRT_DEV_VCPU) { - type = CIM_RASD_TYPE_PROC; + } else if (dev->type == CIM_RES_TYPE_PROC) { + type = CIM_RES_TYPE_PROC; base = "ProcResourceAllocationSettingData"; - } else if (dev->type == VIRT_DEV_MEM) { - type = CIM_RASD_TYPE_MEM; + } else if (dev->type == CIM_RES_TYPE_MEM) { + type = CIM_RES_TYPE_MEM; base = "MemResourceAllocationSettingData"; } else { return NULL; @@ -329,7 +329,7 @@ static CMPIInstance *rasd_from_vdev(cons CMSetProperty(inst, "ResourceType", (CMPIValue *)&type, CMPI_uint16); - if (dev->type == VIRT_DEV_DISK) { + if (dev->type == CIM_RES_TYPE_DISK) { CMSetProperty(inst, "VirtualDevice", (CMPIValue *)dev->dev.disk.virtual_dev, @@ -338,12 +338,12 @@ static CMPIInstance *rasd_from_vdev(cons "Address", (CMPIValue *)dev->dev.disk.source, CMPI_chars); - } else if (dev->type == VIRT_DEV_NET) { + } else if (dev->type == CIM_RES_TYPE_NET) { CMSetProperty(inst, "NetworkType", (CMPIValue *)dev->dev.disk.type, CMPI_chars); - } else if (dev->type == VIRT_DEV_MEM) { + } else if (dev->type == CIM_RES_TYPE_MEM) { const char *units = "MegaBytes"; CMSetProperty(inst, "AllocationUnits", @@ -354,7 +354,7 @@ static CMPIInstance *rasd_from_vdev(cons (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); CMSetProperty(inst, "Limit", (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64); - } else if (dev->type == VIRT_DEV_VCPU) { + } else if (dev->type == CIM_RES_TYPE_PROC) { proc_rasd_from_vdev(broker, dev, host, ref, inst); } @@ -470,13 +470,13 @@ CMPIrc rasd_type_from_classname(const ch goto out; if (STREQ(base, "DiskResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_DISK; + *type = CIM_RES_TYPE_DISK; else if (STREQ(base, "NetResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_NET; + *type = CIM_RES_TYPE_NET; else if (STREQ(base, "ProcResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_PROC; + *type = CIM_RES_TYPE_PROC; else if (STREQ(base, "MemResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_MEM; + *type = CIM_RES_TYPE_MEM; else goto out; @@ -493,16 +493,16 @@ CMPIrc rasd_classname_from_type(uint16_t CMPIrc rc = CMPI_RC_OK; switch(type) { - case CIM_RASD_TYPE_MEM: + case CIM_RES_TYPE_MEM: *classname = "MemResourceAllocationSettingData"; break; - case CIM_RASD_TYPE_PROC: + case CIM_RES_TYPE_PROC: *classname = "ProcResourceAllocationSettingData"; break; - case CIM_RASD_TYPE_NET: + case CIM_RES_TYPE_NET: *classname = "NetResourceAllocationSettingData"; break; - case CIM_RASD_TYPE_DISK: + case CIM_RES_TYPE_DISK: *classname = "DiskResourceAllocationSettingData"; break; default: @@ -522,10 +522,10 @@ static CMPIStatus _enum_rasds(const CMPI int i, j; uint16_t type; CMPIStatus s; - uint16_t types[] = {CIM_RASD_TYPE_PROC, - CIM_RASD_TYPE_DISK, - CIM_RASD_TYPE_NET, - CIM_RASD_TYPE_MEM, + uint16_t types[] = {CIM_RES_TYPE_PROC, + CIM_RES_TYPE_DISK, + CIM_RES_TYPE_NET, + CIM_RES_TYPE_MEM, 0}; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:41 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:41 +0100 Subject: [Libvirt-cim] [PATCH 00 of 10] #3 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs Message-ID: Adopted the get_() function look and feel to the DevicePool provider. Updated the association providers that uses these functions. Diff to patch set 1: - patch #1 (svpc_types) - add Resource Pool types to svpc_types.h and map existing types to base resource types - patch #2 (DevicePool) - implement configurable enum_pools() function; adopt resource types - patch #6 (EAFP) - adopt resource types; validate client given device ref - patch #7 (AC) - adopt DevicePool interface changes; updated NOT_FOUND error message to be consistent with others Diff to patch set 2: - unified resource types to CIM_RES_TYPE_foo and adopted these changes to the providers - fixed some style issues From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:45 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:45 +0100 Subject: [Libvirt-cim] [PATCH 04 of 10] DevicePool: reorganize get and enum functions In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204797486 -3600 # Node ID bcfdb432ac3a01af32dff70572a81e7c1823c038 # Parent fe35567bbbb9af8ce77dac9dbd1148389aee9e06 DevicePool: reorganize get and enum functions - the common look and feel of the get_..._by_name() and get_..._by_ref() is adopted - get_all_pools() is renamed to enum_pools and rewritten to be configurable dynamically - return either a specific or all resource pools. This also replaces get_pool_by_type(). - the device_pool_names array is removed and types are identified by the CIM_RES_TYPE_..., as defined in svpc_types.h - renamed device_type_by_poolid to res_type_by_pool_id Signed-off-by: Heidi Eckhart diff -r fe35567bbbb9 -r bcfdb432ac3a src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Thu Mar 06 10:58:04 2008 +0100 +++ b/src/Virt_DevicePool.c Thu Mar 06 10:58:06 2008 +0100 @@ -45,12 +45,6 @@ static const CMPIBroker *_BROKER; -char *device_pool_names[] = {"ProcessorPool", - "MemoryPool", - "DiskPool", - "NetworkPool", - NULL}; - struct disk_pool { char *tag; char *path; @@ -174,7 +168,7 @@ static char *diskpool_member_of(const CM if (dom == NULL) goto out; - count = get_devices(dom, &devs, VIRT_DEV_DISK); + count = get_devices(dom, &devs, CIM_RES_TYPE_DISK); for (i = 0; i < count; i++) { if (STREQ((devs[i].dev.disk.virtual_dev), dev)) { @@ -290,7 +284,7 @@ static char *netpool_member_of(const CMP if (dom == NULL) goto out; - count = get_devices(dom, &devs, VIRT_DEV_NET); + count = get_devices(dom, &devs, CIM_RES_TYPE_NET); for (i = 0; i < count; i++) { if (STREQ((devs[i].id), dev)) { @@ -318,13 +312,13 @@ char *pool_member_of(const CMPIBroker *b { char *poolid = NULL; - if (type == CIM_RASD_TYPE_PROC) + if (type == CIM_RES_TYPE_PROC) poolid = strdup("ProcessorPool/0"); - else if (type == CIM_RASD_TYPE_MEM) + else if (type == CIM_RES_TYPE_MEM) poolid = strdup("MemoryPool/0"); - else if (type == CIM_RASD_TYPE_NET) + else if (type == CIM_RES_TYPE_NET) poolid = netpool_member_of(broker, id, refcn); - else if (type == CIM_RASD_TYPE_DISK) + else if (type == CIM_RES_TYPE_DISK) poolid = diskpool_member_of(broker, id, refcn); else return NULL; @@ -332,18 +326,32 @@ char *pool_member_of(const CMPIBroker *b return poolid; } -uint16_t device_type_from_poolid(const char *id) +uint16_t res_type_from_pool_classname(const char *classname) +{ + if (strstr(classname, "NetworkPool")) + return CIM_RES_TYPE_NET; + else if (strstr(classname, "DiskPool")) + return CIM_RES_TYPE_DISK; + else if (strstr(classname, "MemoryPool")) + return CIM_RES_TYPE_MEM; + else if (strstr(classname, "ProcessorPool")) + return CIM_RES_TYPE_PROC; + else + return CIM_RES_TYPE_UNKNOWN; +} + +uint16_t res_type_from_pool_id(const char *id) { if (STARTS_WITH(id, "NetworkPool")) - return VIRT_DEV_NET; + return CIM_RES_TYPE_NET; else if (STARTS_WITH(id, "DiskPool")) - return VIRT_DEV_DISK; + return CIM_RES_TYPE_DISK; else if (STARTS_WITH(id, "MemoryPool")) - return VIRT_DEV_MEM; + return CIM_RES_TYPE_MEM; else if (STARTS_WITH(id, "ProcessorPool")) - return VIRT_DEV_VCPU; + return CIM_RES_TYPE_PROC; else - return VIRT_DEV_UNKNOWN; + return CIM_RES_TYPE_UNKNOWN; } static bool mempool_set_total(CMPIInstance *inst, virConnectPtr conn) @@ -412,7 +420,7 @@ static CMPIStatus mempool_instance(virCo const CMPIBroker *broker) { const char *id = "MemoryPool/0"; - uint16_t type = CIM_RASD_TYPE_MEM; + uint16_t type = CIM_RES_TYPE_MEM; CMPIInstance *inst; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -450,7 +458,7 @@ static CMPIStatus procpool_instance(virC const CMPIBroker *broker) { const char *id = "ProcessorPool/0"; - uint16_t type = CIM_RASD_TYPE_PROC; + uint16_t type = CIM_RES_TYPE_PROC; CMPIInstance *inst; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -489,7 +497,7 @@ static CMPIStatus _netpool_for_network(s { char *str = NULL; char *bridge = NULL; - uint16_t type = CIM_RASD_TYPE_NET; + uint16_t type = CIM_RES_TYPE_NET; CMPIInstance *inst; virNetworkPtr network = NULL; @@ -595,7 +603,7 @@ static CMPIInstance *diskpool_from_path( { CMPIInstance *inst; char *poolid = NULL; - const uint16_t type = CIM_RASD_TYPE_DISK; + const uint16_t type = CIM_RES_TYPE_DISK; struct statvfs vfs; uint64_t cap; uint64_t res; @@ -673,177 +681,190 @@ static CMPIStatus diskpool_instance(virC return s; } -static CMPIStatus _get_pool(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, +static CMPIStatus _get_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + const char *id, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if ((type == CIM_RES_TYPE_PROC) || + (type == CIM_RES_TYPE_ALL)) + s = procpool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if ((type == CIM_RES_TYPE_MEM) || + (type == CIM_RES_TYPE_ALL)) + s = mempool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if ((type == CIM_RES_TYPE_NET) || + (type == CIM_RES_TYPE_ALL)) + s = netpool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if ((type == CIM_RES_TYPE_DISK) || + (type == CIM_RES_TYPE_ALL)) + s = diskpool_instance(conn, list, + NAMESPACE(reference), + id, broker); + + if (type == CIM_RES_TYPE_UNKNOWN) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance - resource pool type unknown"); + + if (id && list->cur == 0) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s)", id); + + out: + virConnectClose(conn); + return s; +} + +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, const char *id, - const char *ns, - struct inst_list *list) -{ - if (STARTS_WITH(type, "MemoryPool")) - return mempool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "ProcessorPool")) - return procpool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "NetworkPool")) - return netpool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "DiskPool")) - return diskpool_instance(conn, list, ns, id, broker); - - return (CMPIStatus){CMPI_RC_ERR_NOT_FOUND, NULL}; -} - -CMPIStatus get_pool_by_type(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, - const char *ns, - struct inst_list *list) -{ - return _get_pool(broker, conn, type, NULL, ns, list); -} - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns) -{ - CMPIInstance *inst = NULL; - CMPIStatus s; - char *type = NULL; + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + struct inst_list list; char *poolid = NULL; int ret; - struct inst_list list; + uint16_t type; inst_list_init(&list); - ret = sscanf(id, "%a[^/]/%as", &type, &poolid); - if (ret != 2) - goto out; - - s = _get_pool(broker, conn, type, poolid, ns, &list); - if ((s.rc == CMPI_RC_OK) && (list.cur > 0)) - inst = list.list[0]; - - out: + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } + + type = res_type_from_pool_id(id); + + if (type == CIM_RES_TYPE_UNKNOWN) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s) - resource pool type mismatch", + id); + goto out; + } + + ret = sscanf(id, "%*[^/]/%as", &poolid); + if (ret != 1) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s)", + id); + goto out; + } + + s = _get_pools(broker, reference, type, poolid, &list); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = list.list[0]; + + out: + free(poolid); + virConnectClose(conn); inst_list_free(&list); - return inst; -} - -CMPIStatus get_all_pools(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *list) -{ - int i; + return s; +} + +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance) +{ CMPIStatus s = {CMPI_RC_OK}; - - for (i = 0; device_pool_names[i]; i++) { - s = get_pool_by_type(broker, - conn, - device_pool_names[i], - ns, - list); - if (s.rc != CMPI_RC_OK) - goto out; - } - + CMPIInstance *inst = NULL; + const char *id = NULL; + uint16_t type_cls; + uint16_t type_id; + + if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Missing InstanceID"); + goto out; + } + + type_cls = res_type_from_pool_classname(CLASSNAME(reference)); + type_id = res_type_from_pool_id(id); + + if ((type_cls != type_id) || + (type_cls == CIM_RES_TYPE_UNKNOWN)) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s) - resource pool type mismatch", + id); + goto out; + } + + s = get_pool_by_name(broker, reference, id, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *instance = inst; + out: return s; } -static void __return_pool(const CMPIResult *results, - struct inst_list *list, - bool name_only) -{ - if (name_only) - cu_return_instance_names(results, list); - else - cu_return_instances(results, list); +CMPIStatus enum_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + struct inst_list *list) +{ + return _get_pools(broker, reference, type, NULL, list); } static CMPIStatus return_pool(const CMPIObjectPath *ref, const CMPIResult *results, - bool name_only, - bool single_only) -{ - CMPIStatus s; - char *type; - virConnectPtr conn; + bool names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, ref, &s)) - return s; - - type = class_base_name(CLASSNAME(ref)); - if (type == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Invalid classname `%s'", CLASSNAME(ref)); - return s; - } + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - s = get_pool_by_type(_BROKER, - conn, - type, - NAMESPACE(ref), - &list); - if (s.rc == CMPI_RC_OK) { - __return_pool(results, &list, name_only); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Pool type %s not found", type); - } - - out: - free(type); + s = enum_pools(_BROKER, + ref, + res_type_from_pool_classname(CLASSNAME(ref)), + &list); + if (s.rc != CMPI_RC_OK) + goto out; + + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); + + out: inst_list_free(&list); - - return s; -} - -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance) -{ - CMPIStatus s; - CMPIInstance *inst = NULL; - virConnectPtr conn = NULL; - const char *id = NULL; - - if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { - cu_statusf(broker, &s, - CMPI_RC_ERR_FAILED, - "Missing InstanceID"); - goto out; - } - - conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) { - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); - goto out; - } - - inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference)); - if (inst == NULL) - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", id); - - out: - virConnectClose(conn); - *instance = inst; return s; } @@ -853,7 +874,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_pool(reference, results, true, false); + return return_pool(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -862,7 +883,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return return_pool(reference, results, false, false); + return return_pool(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -871,13 +892,16 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK}; CMPIInstance *inst = NULL; - s = get_pool_inst(_BROKER, reference, &inst); - if ((s.rc == CMPI_RC_OK) && (inst != NULL)) - CMReturnInstance(results, inst); - + s = get_pool_by_ref(_BROKER, reference, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: return s; } diff -r fe35567bbbb9 -r bcfdb432ac3a src/Virt_DevicePool.h --- a/src/Virt_DevicePool.h Thu Mar 06 10:58:04 2008 +0100 +++ b/src/Virt_DevicePool.h Thu Mar 06 10:58:06 2008 +0100 @@ -26,20 +26,6 @@ #include #include -extern char *device_pool_names[]; - -CMPIStatus get_pool_by_type(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, - const char *ns, - struct inst_list *list); - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns); - - /** * Get the InstanceID of a pool that a given RASD id (for type) is in * @@ -56,24 +42,35 @@ char *pool_member_of(const CMPIBroker *b const char *id); /** - * Get the device type of a given pool from the pool's InstanceID + * Get the resource type of a given pool from the pool's classname + * + * @param classname The classname of the pool + * Returns the resource type + */ +uint16_t res_type_from_pool_classname(const char *classname); + +/** + * Get the resource type of a given pool from the pool's InstanceID * * @param id The InstanceID of the pool + * Returns the resource type */ -uint16_t device_type_from_poolid(const char *id); +uint16_t res_type_from_pool_id(const char *id); /** - * Get all device pools on the system for the given connection + * Get all device pools on the system for the given type + * * * @param broker The current Broker - * @param conn The libvirt connection to use - * @param ns Namespace for the pools - * @param list Return instances in this struct + * @param reference Defines the libvirt connection to use + * @param type The device pool type or CIM_RES_TYPE_ALL + * to get all resource pools + * @param list The list of returned instances */ -CMPIStatus get_all_pools(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *list); +CMPIStatus enum_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + struct inst_list *list); /** * Get a device pools instance for the given reference @@ -82,9 +79,23 @@ CMPIStatus get_all_pools(const CMPIBroke * @param reference The reference passed to the CIMOM * @param instance Return corresponding instance */ -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance); +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance); + +/** + * Get device pool instance specified by the id + * + * @param broker A pointer to the current broker + * @param ref The object path containing namespace and prefix info + * @param name The device pool id + * @param _inst In case of success the pointer to the instance + * @returns CMPIStatus + */ +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *id, + CMPIInstance **_inst); #endif From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:44 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:44 +0100 Subject: [Libvirt-cim] [PATCH 03 of 10] VSMS: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204797484 -3600 # Node ID fe35567bbbb9af8ce77dac9dbd1148389aee9e06 # Parent f5794941df79b894318965b235cb0b7b54050d3d VSMS: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r f5794941df79 -r fe35567bbbb9 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Thu Mar 06 10:58:04 2008 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Thu Mar 06 10:58:04 2008 +0100 @@ -231,7 +231,7 @@ static int rasd_to_vdev(CMPIInstance *in if (!parse_fq_devid(id, &name, &devid)) goto err; - if (type == VIRT_DEV_DISK) { + if (type == CIM_RES_TYPE_DISK) { free(dev->dev.disk.virtual_dev); dev->dev.disk.virtual_dev = devid; @@ -241,7 +241,7 @@ static int rasd_to_vdev(CMPIInstance *in free(dev->dev.disk.source); dev->dev.disk.source = strdup(val); dev->dev.disk.disk_type = disk_type_from_file(val); - } else if (type == VIRT_DEV_NET) { + } else if (type == CIM_RES_TYPE_NET) { free(dev->dev.net.mac); dev->dev.net.mac = devid; @@ -253,7 +253,7 @@ static int rasd_to_vdev(CMPIInstance *in CU_DEBUG("Unknown class type for net device: %s", CLASSNAME(op)); - } else if (type == VIRT_DEV_MEM) { + } else if (type == CIM_RES_TYPE_MEM) { cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size); cu_get_u64_prop(inst, "Reservation", &dev->dev.mem.size); dev->dev.mem.maxsize = dev->dev.mem.size; @@ -307,16 +307,16 @@ static int classify_resources(CMPIArray CMPI_RC_OK) return 0; - if (type == CIM_RASD_TYPE_PROC) + if (type == CIM_RES_TYPE_PROC) rasd_to_vdev(item.value.inst, &domain->dev_vcpu[domain->dev_vcpu_ct++]); - else if (type == CIM_RASD_TYPE_MEM) + else if (type == CIM_RES_TYPE_MEM) rasd_to_vdev(item.value.inst, &domain->dev_mem[domain->dev_mem_ct++]); - else if (type == CIM_RASD_TYPE_DISK) + else if (type == CIM_RES_TYPE_DISK) rasd_to_vdev(item.value.inst, &domain->dev_disk[domain->dev_disk_ct++]); - else if (type == CIM_RASD_TYPE_NET) + else if (type == CIM_RES_TYPE_NET) rasd_to_vdev(item.value.inst, &domain->dev_net[domain->dev_net_ct++]); } @@ -613,16 +613,16 @@ static struct virt_device **find_list(st { struct virt_device **list = NULL; - if (type == VIRT_DEV_NET) { + if (type == CIM_RES_TYPE_NET) { list = &dominfo->dev_net; *count = &dominfo->dev_net_ct; - } else if (type == VIRT_DEV_DISK) { + } else if (type == CIM_RES_TYPE_DISK) { list = &dominfo->dev_disk; *count = &dominfo->dev_disk_ct; - } else if (type == VIRT_DEV_VCPU) { + } else if (type == CIM_RES_TYPE_PROC) { list = &dominfo->dev_vcpu; *count = &dominfo->dev_vcpu_ct; - } else if (type == VIRT_DEV_MEM) { + } else if (type == CIM_RES_TYPE_MEM) { list = &dominfo->dev_mem; *count = &dominfo->dev_mem_ct; } @@ -713,7 +713,7 @@ static CMPIStatus resource_del(struct do goto out; _list = find_list(dominfo, type, &count); - if ((type == CIM_RASD_TYPE_MEM) || (_list != NULL)) + if ((type == CIM_RES_TYPE_MEM) || (_list != NULL)) list = *_list; else { cu_statusf(_BROKER, &s, @@ -734,7 +734,7 @@ static CMPIStatus resource_del(struct do dev, RESOURCE_DEL, CLASSNAME(op)); - dev->type = VIRT_DEV_UNKNOWN; + dev->type = CIM_RES_TYPE_UNKNOWN; break; } } @@ -760,7 +760,7 @@ static CMPIStatus resource_add(struct do goto out; _list = find_list(dominfo, type, &count); - if ((type == CIM_RASD_TYPE_MEM) || (_list == NULL)) { + if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Cannot add resources of type %" PRIu16, type); From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:47 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:47 +0100 Subject: [Libvirt-cim] [PATCH 06 of 10] SDC: adopt DevicePool interface change In-Reply-To: Message-ID: <8eee311470e991e9ed8e.1204806707@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204797487 -3600 # Node ID 8eee311470e991e9ed8ebdef20e863c6f738ecf9 # Parent 7bf83e55471f88bf78472f79b926a0573f80729a SDC: adopt DevicePool interface change - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r 7bf83e55471f -r 8eee311470e9 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Thu Mar 06 10:58:06 2008 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Thu Mar 06 10:58:07 2008 +0100 @@ -529,13 +529,9 @@ static struct sdc_rasd_prop *disk_max(co /* Getting the relevant resource pool directly finds the free space for us. It is in the Capacity field. */ - pool_inst = get_pool_by_id(_BROKER, conn, inst_id, NAMESPACE(ref)); - if (pool_inst == NULL) { - cu_statusf(_BROKER, s, - CMPI_RC_ERR_FAILED, - "Could not get pool instance"); - goto out; - } + *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst); + if (s->rc != CMPI_RC_OK) + goto out; prop_ret = cu_get_u64_prop(pool_inst, "Capacity", &free_64); if (prop_ret != CMPI_RC_OK) { @@ -614,7 +610,7 @@ static struct sdc_rasd_prop *disk_inc(co } static struct sdc_rasd mem = { - .resource_type = CIM_RASD_TYPE_MEM, + .resource_type = CIM_RES_TYPE_MEM, .min = mem_min, .max = mem_max, .def = mem_def, @@ -622,7 +618,7 @@ static struct sdc_rasd mem = { }; static struct sdc_rasd processor = { - .resource_type = CIM_RASD_TYPE_PROC, + .resource_type = CIM_RES_TYPE_PROC, .min = proc_min, .max = proc_max, .def = proc_def, @@ -630,7 +626,7 @@ static struct sdc_rasd processor = { }; static struct sdc_rasd network = { - .resource_type = CIM_RASD_TYPE_NET, + .resource_type = CIM_RES_TYPE_NET, .min = net_min, .max = net_max, .def = net_def, @@ -638,7 +634,7 @@ static struct sdc_rasd network = { }; static struct sdc_rasd disk = { - .resource_type = CIM_RASD_TYPE_DISK, + .resource_type = CIM_RES_TYPE_DISK, .min = disk_min, .max = disk_max, .def = disk_def, @@ -794,8 +790,6 @@ static CMPIStatus alloc_cap_to_rasd(cons if (!match_hypervisor_prefix(ref, info)) return s; - CU_DEBUG("Getting ResourceType"); - if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -803,11 +797,9 @@ static CMPIStatus alloc_cap_to_rasd(cons goto out; } - type = device_type_from_poolid(id); - - CU_DEBUG("ResourceType: %hi", type); - - if (type == VIRT_DEV_UNKNOWN) { + type = res_type_from_pool_id(id); + + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine resource type"); From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:48 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:48 +0100 Subject: [Libvirt-cim] [PATCH 07 of 10] HRP: adopt DevicePool interface change In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204797487 -3600 # Node ID ea35090f8613c2a6af6993bd02cbfed709792110 # Parent 8eee311470e991e9ed8ebdef20e863c6f738ecf9 HRP: adopt DevicePool interface change - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r 8eee311470e9 -r ea35090f8613 src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Thu Mar 06 10:58:07 2008 +0100 +++ b/src/Virt_HostedResourcePool.c Thu Mar 06 10:58:07 2008 +0100 @@ -34,6 +34,7 @@ #include "Virt_HostSystem.h" #include "Virt_DevicePool.h" +#include "svpc_types.h" static const CMPIBroker *_BROKER; @@ -47,8 +48,8 @@ static CMPIStatus pool_to_sys(const CMPI if (!match_hypervisor_prefix(ref, info)) goto out; - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) goto out; s = get_host(_BROKER, ref, &inst, false); @@ -67,26 +68,15 @@ static CMPIStatus sys_to_pool(const CMPI { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int i; - virConnectPtr conn; if (!match_hypervisor_prefix(ref, info)) goto out; - + s = get_host(_BROKER, ref, &inst, true); if (s.rc != CMPI_RC_OK) goto out; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - for (i = 0; device_pool_names[i]; i++) - get_pool_by_type(_BROKER, - conn, - device_pool_names[i], - NAMESPACE(ref), - list); + s = enum_pools(_BROKER, ref, CIM_RES_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:46 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:46 +0100 Subject: [Libvirt-cim] [PATCH 05 of 10] AllocationCapabilities: adopt new DevicePool enum interface In-Reply-To: Message-ID: <7bf83e55471f88bf7847.1204806706@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204797486 -3600 # Node ID 7bf83e55471f88bf78472f79b926a0573f80729a # Parent bcfdb432ac3a01af32dff70572a81e7c1823c038 AllocationCapabilities: adopt new DevicePool enum interface - adopted new DevicePool enum_pools() interface - updated NOT_FOUND error message to be consistent with others - updated resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r bcfdb432ac3a -r 7bf83e55471f src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Thu Mar 06 10:58:06 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Thu Mar 06 10:58:06 2008 +0100 @@ -33,6 +33,7 @@ #include "Virt_AllocationCapabilities.h" #include "Virt_DevicePool.h" +#include "svpc_types.h" const static CMPIBroker *_BROKER; @@ -95,11 +96,11 @@ CMPIStatus enum_alloc_cap_instances(cons if (id) cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "Requested Object could not be found."); - goto out; - } - - s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); + "Instance not found."); + goto out; + } + + s = enum_pools(broker, ref, CIM_RES_TYPE_ALL, &device_pool_list); if (s.rc != CMPI_RC_OK) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, @@ -135,7 +136,7 @@ CMPIStatus enum_alloc_cap_instances(cons if (id && !inst_id) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "Requested Object could not be found."); + "Instance not found."); goto out; } From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:49 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:49 +0100 Subject: [Libvirt-cim] [PATCH 08 of 10] VSSDC: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: <91ac728ec7c9b5e68b73.1204806709@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204797488 -3600 # Node ID 91ac728ec7c9b5e68b73d90039aa75f293978dd3 # Parent ea35090f8613c2a6af6993bd02cbfed709792110 VSSDC: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r ea35090f8613 -r 91ac728ec7c9 src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Thu Mar 06 10:58:07 2008 +0100 +++ b/src/Virt_VSSDComponent.c Thu Mar 06 10:58:08 2008 +0100 @@ -45,10 +45,10 @@ static CMPIStatus vssd_to_rasd(const CMP char *name = NULL; int i = 0; int types[] = { - CIM_RASD_TYPE_PROC, - CIM_RASD_TYPE_NET, - CIM_RASD_TYPE_DISK, - CIM_RASD_TYPE_MEM, + CIM_RES_TYPE_PROC, + CIM_RES_TYPE_NET, + CIM_RES_TYPE_DISK, + CIM_RES_TYPE_MEM, -1 }; From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:51 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:51 +0100 Subject: [Libvirt-cim] [PATCH 10 of 10] EAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204797490 -3600 # Node ID c342fe8a021484ae95e2ab48ca974ae2e7ca5e8e # Parent 64e4b5f13878ff7b1ba59bea42709d0cac1c7bbc EAFP: adopt DevicePool interface changes - adopted changes to DevicePool interface - updated resource types - validate client given device ref Signed-off-by: Heidi Eckhart diff -r 64e4b5f13878 -r c342fe8a0214 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Thu Mar 06 10:58:09 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Thu Mar 06 10:58:10 2008 +0100 @@ -45,15 +45,15 @@ static uint16_t class_to_type(const CMPI uint16_t type; if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL)) - type = CIM_RASD_TYPE_DISK; + type = CIM_RES_TYPE_DISK; else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL)) - type = CIM_RASD_TYPE_NET; + type = CIM_RES_TYPE_NET; else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL)) - type = CIM_RASD_TYPE_MEM; + type = CIM_RES_TYPE_MEM; else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL)) - type = CIM_RASD_TYPE_PROC; + type = CIM_RES_TYPE_PROC; else - type = 0; + type = CIM_RES_TYPE_UNKNOWN; return type; } @@ -66,12 +66,16 @@ static CMPIStatus vdev_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; + CMPIInstance *inst = NULL; if (!match_hypervisor_prefix(ref, info)) return s; + s = get_device_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + type = class_to_type(ref); if (type == 0) { cu_statusf(_BROKER, &s, @@ -95,25 +99,14 @@ static CMPIStatus vdev_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, conn, poolid, NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, ref, poolid, &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -172,7 +165,6 @@ static int devs_from_pool(uint16_t type, name = virDomainGetName(doms[i]); - /* FIXME: Get VIRT_DEV_ type here */ dom_devices(_BROKER, doms[i], ns, type, &tmp); filter_by_pool(list, &tmp, type, poolid); @@ -199,6 +191,10 @@ static CMPIStatus pool_to_vdev(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -206,25 +202,16 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - CU_DEBUG("Got %s\n", poolid); - - type = device_type_from_poolid(poolid); - if (type == VIRT_DEV_UNKNOWN) { + type = res_type_from_pool_id(poolid); + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid InstanceID or unsupported pool type"); goto out; } - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; - devs_from_pool(type, ref, poolid, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Thu Mar 6 12:31:50 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:31:50 +0100 Subject: [Libvirt-cim] [PATCH 09 of 10] RAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: <64e4b5f13878ff7b1ba5.1204806710@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204797489 -3600 # Node ID 64e4b5f13878ff7b1ba59bea42709d0cac1c7bbc # Parent 91ac728ec7c9b5e68b73d90039aa75f293978dd3 RAFP: adopt DevicePool interface changes - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r 91ac728ec7c9 -r 64e4b5f13878 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Thu Mar 06 10:58:08 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Thu Mar 06 10:58:09 2008 +0100 @@ -45,7 +45,6 @@ static CMPIStatus rasd_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; CMPIInstance *inst = NULL; @@ -78,28 +77,17 @@ static CMPIStatus rasd_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, - conn, - poolid, - NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, + ref, + poolid, + &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -191,7 +179,11 @@ static CMPIStatus pool_to_rasd(const CMP CMPIInstance *inst; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; + + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -200,17 +192,13 @@ static CMPIStatus pool_to_rasd(const CMP goto out; } - type = device_type_from_poolid(poolid); - if (type == VIRT_DEV_UNKNOWN) { + type = res_type_from_pool_id(poolid); + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid InstanceID or unsupported pool type"); goto out; } - - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; rasds_from_pool(type, ref, @@ -218,9 +206,6 @@ static CMPIStatus pool_to_rasd(const CMP info->properties, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Thu Mar 6 12:35:45 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:35:45 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] #2 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP Message-ID: This patch set implements the configurable enum_devices() interface to the Device provider. This slight interface change is adopted to the associations SystemDevice and ElementAllocatedFromPool. Both associations profit from the easy access to the device instances. Diff to patch set 1: - fixed style issues From heidieck at linux.vnet.ibm.com Thu Mar 6 12:35:47 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:35:47 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SD: adopt Device interface changes In-Reply-To: Message-ID: <8bd960f2d01019ef7745.1204806947@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204798888 -3600 # Node ID 8bd960f2d01019ef77451322a11ee4c88ff12651 # Parent 94c638369596daedfb4876c9bac1efcaeefaff76 SD: adopt Device interface changes - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 94c638369596 -r 8bd960f2d010 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Thu Mar 06 11:21:26 2008 +0100 +++ b/src/Virt_SystemDevice.c Thu Mar 06 11:21:28 2008 +0100 @@ -48,55 +48,6 @@ const static CMPIBroker *_BROKER; -#define DEV_TYPE_COUNT 4 -const static int device_types[DEV_TYPE_COUNT] = - {VIRT_DEV_NET, - VIRT_DEV_DISK, - VIRT_DEV_MEM, - VIRT_DEV_VCPU, - }; - -static int get_dom_devices(const char *name, - struct inst_list *list, - int type, - const char *host_cn, - const char *ns) -{ - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; - CMPIStatus s; - int ret = 0; - - conn = connect_by_classname(_BROKER, host_cn, &s); - if (conn == NULL) - goto out; - - dom = virDomainLookupByName(conn, name); - if (dom == NULL) - goto out; - - ret = dom_devices(_BROKER, dom, ns, type, list); - - virDomainFree(dom); - out: - virConnectClose(conn); - - return ret; -} - -static int get_all_devices(const char *name, - struct inst_list *list, - const char *host_cn, - const char *ns) -{ - int i; - - for (i = 0; i < DEV_TYPE_COUNT; i++) - get_dom_devices(name, list, device_types[i], host_cn, ns); - - return i; -} - static CMPIStatus sys_to_dev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -104,7 +55,6 @@ static CMPIStatus sys_to_dev(const CMPIO const char *host = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int ret; if (!match_hypervisor_prefix(ref, info)) return s; @@ -120,20 +70,7 @@ static CMPIStatus sys_to_dev(const CMPIO goto out; } - ret = get_all_devices(host, - list, - CLASSNAME(ref), - NAMESPACE(ref)); - - if (ret >= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get devices"); - } + s = enum_devices(_BROKER, ref, host, CIM_RES_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Thu Mar 6 12:35:46 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:35:46 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: Message-ID: <94c638369596daedfb48.1204806946@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204798886 -3600 # Node ID 94c638369596daedfb4876c9bac1efcaeefaff76 # Parent c342fe8a021484ae95e2ab48ca974ae2e7ca5e8e Device: rename dom_device to enum_devices and make it configurable - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r c342fe8a0214 -r 94c638369596 src/Virt_Device.c --- a/src/Virt_Device.c Thu Mar 06 10:58:10 2008 +0100 +++ b/src/Virt_Device.c Thu Mar 06 11:21:26 2008 +0100 @@ -236,22 +236,22 @@ static CMPIInstance *device_instance(con { CMPIInstance *instance; - if (dev->type == VIRT_DEV_NET) + if (dev->type == CIM_RES_TYPE_NET) instance = net_instance(broker, &dev->dev.net, dom, ns); - else if (dev->type == VIRT_DEV_DISK) + else if (dev->type == CIM_RES_TYPE_DISK) instance = disk_instance(broker, &dev->dev.disk, dom, ns); - else if (dev->type == VIRT_DEV_MEM) + else if (dev->type == CIM_RES_TYPE_MEM) instance = mem_instance(broker, &dev->dev.mem, dom, ns); - else if (dev->type == VIRT_DEV_VCPU) + else if (dev->type == CIM_RES_TYPE_PROC) instance = vcpu_instance(broker, &dev->dev.vcpu, dom, @@ -271,23 +271,24 @@ uint16_t device_type_from_classname(cons uint16_t device_type_from_classname(const char *classname) { if (strstr(classname, "NetworkPort")) - return VIRT_DEV_NET; + return CIM_RES_TYPE_NET; else if (strstr(classname, "LogicalDisk")) - return VIRT_DEV_DISK; + return CIM_RES_TYPE_DISK; else if (strstr(classname, "Memory")) - return VIRT_DEV_MEM; + return CIM_RES_TYPE_MEM; else if (strstr(classname, "Processor")) - return VIRT_DEV_VCPU; - else - return VIRT_DEV_UNKNOWN; -} - -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list) -{ + return CIM_RES_TYPE_PROC; + else + return CIM_RES_TYPE_UNKNOWN; +} + +static CMPIStatus _get_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; int count; int i; struct virt_device *devs = NULL; @@ -299,7 +300,7 @@ int dom_devices(const CMPIBroker *broker for (i = 0; i < count; i++) { CMPIInstance *dev = NULL; - dev = device_instance(broker, &devs[i], dom, ns); + dev = device_instance(broker, &devs[i], dom, NAMESPACE(reference)); if (dev) inst_list_add(list, dev); @@ -308,57 +309,82 @@ int dom_devices(const CMPIBroker *broker out: free(devs); - - return 1; -} - -static int dom_list_devices(virConnectPtr conn, - const CMPIObjectPath *ref, - struct inst_list *list) -{ - virDomainPtr *doms; - int ndom; + return s; +} + +static CMPIStatus _enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s; + + if (type == CIM_RES_TYPE_ALL) { + s = _get_devices(broker, reference, dom, CIM_RES_TYPE_PROC, list); + s = _get_devices(broker, reference, dom, CIM_RES_TYPE_MEM, list); + s = _get_devices(broker, reference, dom, CIM_RES_TYPE_NET, list); + s = _get_devices(broker, reference, dom, CIM_RES_TYPE_DISK, list); + } + else + s = _get_devices(broker, reference, dom, type, list); + + return s; +} + +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + virDomainPtr *doms = NULL; + int count = 1; int i; - int type; - - type = device_type_from_classname(CLASSNAME(ref)); - - ndom = get_domain_list(conn, &doms); - if (ndom == 0) - return 1; - else if (ndom < 0) - return 0; - - for (i = 0; i < ndom; i++) { - dom_devices(_BROKER, doms[i], NAMESPACE(ref), type, list); - } - - return 1; -} - -static CMPIStatus enum_devices(const CMPIObjectPath *reference, - const CMPIResult *results, - int names_only) -{ - CMPIStatus s; - virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if (domain) { + doms = calloc(1, sizeof(virDomainPtr)); + doms[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &doms); + + for (i = 0; i < count; i++) { + s = _enum_devices(broker, reference, doms[i], type, list); + + virDomainFree(doms[i]); + } + + out: + virConnectClose(conn); + free(doms); + + return s; +} + +static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, + const CMPIResult *results, + int names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, reference, &s)) - return s; + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); - if (conn == NULL) - return s; - - if (!dom_list_devices(conn, reference, &list)) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to list domains"); - return s; - } + s = enum_devices(_BROKER, reference, NULL, + device_type_from_classname(CLASSNAME(reference)), + &list); + if (s.rc != CMPI_RC_OK) + goto out; if (list.cur == 0) goto out; @@ -371,11 +397,6 @@ static CMPIStatus enum_devices(const CMP inst_list_free(&list); out: - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - virConnectClose(conn); - return s; } @@ -524,7 +545,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return enum_devices(reference, results, 1); + return return_enum_devices(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -533,7 +554,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return enum_devices(reference, results, 0); + return return_enum_devices(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, diff -r c342fe8a0214 -r 94c638369596 src/Virt_Device.h --- a/src/Virt_Device.h Thu Mar 06 10:58:10 2008 +0100 +++ b/src/Virt_Device.h Thu Mar 06 11:21:26 2008 +0100 @@ -27,19 +27,18 @@ * Return a list of devices for a given domain * * @param broker A pointer to the CIM broker - * @param dom The domain in question - * @param ref The namespace - * @param list A pointer to an array of CMPIInstance objects (should - * be NULL initially) - * @param cur The number of items in the list (0 initially) - * @param max The size of the list (0 initially) - * @returns Nonzero on success + * @param reference Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) + * @param type The device type or CIM_RES_TYPE_ALL to get + * all devices + * @param list A pointer to an array of CMPIInstance objects + * (should be NULL initially) */ -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list); +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list); /** * Returns the device instance defined by the reference From heidieck at linux.vnet.ibm.com Thu Mar 6 12:35:48 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:35:48 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes In-Reply-To: Message-ID: <6b9530915893f8531c90.1204806948@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204798889 -3600 # Node ID 6b9530915893f8531c90cb18eca9bf9a7dd091b7 # Parent 8bd960f2d01019ef77451322a11ee4c88ff12651 EAFP: adopt Device interface changes Signed-off-by: Heidi Eckhart diff -r 8bd960f2d010 -r 6b9530915893 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Thu Mar 06 11:21:28 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Thu Mar 06 11:21:29 2008 +0100 @@ -77,7 +77,7 @@ static CMPIStatus vdev_to_pool(const CMP goto out; type = class_to_type(ref); - if (type == 0) { + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unknown device type"); @@ -138,47 +138,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int devs_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - const char *ns = NAMESPACE(ref); - const char *cn = CLASSNAME(ref); - - conn = connect_by_classname(_BROKER, cn, &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - dom_devices(_BROKER, doms[i], ns, type, &tmp); - - filter_by_pool(list, &tmp, type, poolid); - - inst_list_free(&tmp); - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_vdev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -186,7 +145,8 @@ static CMPIStatus pool_to_vdev(const CMP const char *poolid; CMPIStatus s = {CMPI_RC_OK, NULL}; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp; if (!match_hypervisor_prefix(ref, info)) return s; @@ -210,7 +170,15 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - devs_from_pool(type, ref, poolid, list); + inst_list_init(&tmp); + + s = enum_devices(_BROKER, ref, NULL, type, &tmp); + if (s.rc != CMPI_RC_OK) + goto out; + + filter_by_pool(list, &tmp, type, poolid); + + inst_list_free(&tmp); out: return s; From heidieck at linux.vnet.ibm.com Thu Mar 6 12:38:11 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:38:11 +0100 Subject: [Libvirt-cim] [PATCH 0 of 5] Add configurable enum_rasds interface to RASD and Adopt changes to assoc providers Message-ID: This patch set implements a configurable enum_rasds() interface to the RASD provider. This slight interface change is adopted to the affected associations. From heidieck at linux.vnet.ibm.com Thu Mar 6 12:38:12 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:38:12 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204806480 -3600 # Node ID cb86b8615183d98199f02c45df6aa07cfedf5bb2 # Parent 6b9530915893f8531c90cb18eca9bf9a7dd091b7 RASD: rename rasds_for_domain to enum_rasds and make it configurable Signed-off-by: Heidi Eckhart diff -r 6b9530915893 -r cb86b8615183 src/Virt_RASD.c --- a/src/Virt_RASD.c Thu Mar 06 11:21:29 2008 +0100 +++ b/src/Virt_RASD.c Thu Mar 06 13:28:00 2008 +0100 @@ -439,8 +439,8 @@ CMPIStatus get_rasd_by_ref(const CMPIBro goto out; } - if (rasd_type_from_classname(CLASSNAME(reference), &type) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, + if (res_type_from_rasd_classname(CLASSNAME(reference), &type) != CMPI_RC_OK) { + cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); goto out; @@ -460,7 +460,7 @@ CMPIStatus get_rasd_by_ref(const CMPIBro return s; } -CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type) +CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) { char *base = NULL; CMPIrc rc = CMPI_RC_ERR_FAILED; @@ -512,58 +512,103 @@ CMPIrc rasd_classname_from_type(uint16_t return rc; } -static CMPIStatus _enum_rasds(const CMPIObjectPath *ref, +static CMPIStatus _get_rasds(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + const char **properties, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int count; + int i; + struct virt_device *devs = NULL; + + count = get_devices(dom, &devs, type); + if (count <= 0) + goto out; + + for (i = 0; i < count; i++) { + CMPIInstance *dev = NULL; + const char *host = NULL; + + host = virDomainGetName(dom); + if (host == NULL) { + cleanup_virt_device(&devs[i]); + continue; + } + + dev = rasd_from_vdev(broker, &devs[i], host, + reference, properties); + if (dev) + inst_list_add(list, dev); + + cleanup_virt_device(&devs[i]); + } + + out: + free(devs); + return s; +} + +static CMPIStatus _enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, const char **properties, struct inst_list *list) { + CMPIStatus s; + + if (type == CIM_RES_TYPE_ALL) { + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_PROC, properties, list); + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_MEM, properties, list); + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_NET, properties, list); + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_DISK,properties, list); + } + else + s = _get_rasds(broker, reference, dom, + type, properties, list); + + return s; +} + +CMPIStatus enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const char *domain, + const uint16_t type, + const char **properties, + struct inst_list *list) +{ virConnectPtr conn = NULL; virDomainPtr *domains = NULL; - int count; - int i, j; - uint16_t type; - CMPIStatus s; - uint16_t types[] = {CIM_RES_TYPE_PROC, - CIM_RES_TYPE_DISK, - CIM_RES_TYPE_NET, - CIM_RES_TYPE_MEM, - 0}; + int count = 1; + int i; + CMPIStatus s = {CMPI_RC_OK, NULL}; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) - return s; - - count = get_domain_list(conn, &domains); - if (count <= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get domain list"); - goto out; - } - - if (rasd_type_from_classname(CLASSNAME(ref), &type) == CMPI_RC_OK) { - types[0] = type; - types[1] = 0; - } + goto out; + + if (domain) { + domains = calloc(1, sizeof(virDomainPtr)); + domains[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &domains); for (i = 0; i < count; i++) { - for (j = 0; types[j] != 0; j++) { - CU_DEBUG("Doing RASD type %i for %s", - type, virDomainGetName(domains[i])); - rasds_for_domain(_BROKER, - virDomainGetName(domains[i]), - types[j], - ref, - properties, - list); - } + _enum_rasds(broker, ref, domains[i], + type, properties, list); virDomainFree(domains[i]); } - s = (CMPIStatus){CMPI_RC_OK, NULL}; - out: virConnectClose(conn); - free(domains); return s; } @@ -575,17 +620,23 @@ static CMPIStatus return_enum_rasds(cons { struct inst_list list; CMPIStatus s; + uint16_t type; inst_list_init(&list); - s = _enum_rasds(ref, properties, &list); - if (s.rc == CMPI_RC_OK) { - if (names_only) - cu_return_instance_names(results, &list); - else - cu_return_instances(results, &list); - } - + res_type_from_rasd_classname(CLASSNAME(ref), &type); + + s = enum_rasds(_BROKER, ref, NULL, + type, properties, &list); + if (s.rc != CMPI_RC_OK) + goto out; + + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); + + out: inst_list_free(&list); return s; @@ -626,41 +677,6 @@ static CMPIStatus GetInstance(CMPIInstan out: return s; -} - -int rasds_for_domain(const CMPIBroker *broker, - const char *name, - const uint16_t type, - const CMPIObjectPath *ref, - const char **properties, - struct inst_list *_list) -{ - struct virt_device *list; - int count; - int i; - virConnectPtr conn; - CMPIStatus s; - - conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) - return 0; - - count = list_devs(conn, type, name, &list); - - for (i = 0; i < count; i++) { - CMPIInstance *inst; - - inst = rasd_from_vdev(broker, &list[i], name, ref, properties); - if (inst != NULL) - inst_list_add(_list, inst); - } - - if (count > 0) - cleanup_virt_devices(&list, count); - - virConnectClose(conn); - - return count; } DEFAULT_CI(); diff -r 6b9530915893 -r cb86b8615183 src/Virt_RASD.h --- a/src/Virt_RASD.h Thu Mar 06 11:21:29 2008 +0100 +++ b/src/Virt_RASD.h Thu Mar 06 13:28:00 2008 +0100 @@ -27,20 +27,20 @@ char *rasd_to_xml(CMPIInstance *rasd); * Get a list of RASDs for a given domain * * @param broker The current broker - * @param name The name of the domain in question + * @param ref Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) * @param type The ResourceType of the desired RASDs - * @param ref A reference used for hypervisor connection and namespace - * setting of the resulting instances + * @param properties The properties to filter for * @param _list The list of instances to populate */ -int rasds_for_domain(const CMPIBroker *broker, - const char *name, - const uint16_t type, - const CMPIObjectPath *ref, - const char **properties, - struct inst_list *_list); +CMPIStatus enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const char *domain, + const uint16_t type, + const char **properties, + struct inst_list *_list); -CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); +CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type); CMPIrc rasd_classname_from_type(uint16_t type, const char **cn); CMPIStatus get_rasd_by_name(const CMPIBroker *broker, From heidieck at linux.vnet.ibm.com Thu Mar 6 12:38:13 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:38:13 +0100 Subject: [Libvirt-cim] [PATCH 2 of 5] VSMS: adopt RASD interface change In-Reply-To: Message-ID: <7bb967966c0c44c4ab7b.1204807093@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204806483 -3600 # Node ID 7bb967966c0c44c4ab7b89a4f3bf7c82301a4711 # Parent cb86b8615183d98199f02c45df6aa07cfedf5bb2 VSMS: adopt RASD interface change Signed-off-by: Heidi Eckhart diff -r cb86b8615183 -r 7bb967966c0c src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Thu Mar 06 13:28:00 2008 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Thu Mar 06 13:28:03 2008 +0100 @@ -220,7 +220,7 @@ static int rasd_to_vdev(CMPIInstance *in if (op == NULL) goto err; - if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) goto err; dev->type = (int)type; @@ -303,7 +303,7 @@ static int classify_resources(CMPIArray if (op == NULL) return 0; - if (rasd_type_from_classname(CLASSNAME(op), &type) != + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) return 0; @@ -882,7 +882,7 @@ static CMPIStatus _update_resources_for( goto out; } - if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); @@ -1036,7 +1036,7 @@ static CMPIStatus rasd_refs_to_insts(con continue; } - if (rasd_type_from_classname(CLASSNAME(ref), &type) != + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CU_DEBUG("Unable to get type of `%s'", REF2STR(ref)); From heidieck at linux.vnet.ibm.com Thu Mar 6 12:38:14 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:38:14 +0100 Subject: [Libvirt-cim] [PATCH 3 of 5] VSSDC: adopt RASD interface changes In-Reply-To: Message-ID: <81c2aba96aff5c3177c8.1204807094@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204806483 -3600 # Node ID 81c2aba96aff5c3177c86cb1dc08d88b52c3897f # Parent 7bb967966c0c44c4ab7b89a4f3bf7c82301a4711 VSSDC: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 7bb967966c0c -r 81c2aba96aff src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Thu Mar 06 13:28:03 2008 +0100 +++ b/src/Virt_VSSDComponent.c Thu Mar 06 13:28:03 2008 +0100 @@ -43,14 +43,6 @@ static CMPIStatus vssd_to_rasd(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; char *name = NULL; - int i = 0; - int types[] = { - CIM_RES_TYPE_PROC, - CIM_RES_TYPE_NET, - CIM_RES_TYPE_DISK, - CIM_RES_TYPE_MEM, - -1 - }; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -66,14 +58,8 @@ static CMPIStatus vssd_to_rasd(const CMP goto out; } - for (i = 0; types[i] > 0; i++) { - rasds_for_domain(_BROKER, - name, - types[i], - ref, - info->properties, - list); - } + s = enum_rasds(_BROKER, ref, name, CIM_RES_TYPE_ALL, + info->properties, list); free(name); @@ -86,7 +72,7 @@ static CMPIStatus rasd_to_vssd(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *vssd = NULL; + CMPIInstance *inst = NULL; const char *id = NULL; char *host = NULL; char *devid = NULL; @@ -94,6 +80,10 @@ static CMPIStatus rasd_to_vssd(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + + s = get_rasd_by_ref(_BROKER, ref, info->properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -110,11 +100,11 @@ static CMPIStatus rasd_to_vssd(const CMP goto out; } - s = get_vssd_by_name(_BROKER, ref, host, &vssd); + s = get_vssd_by_name(_BROKER, ref, host, &inst); if (s.rc != CMPI_RC_OK) goto out; - inst_list_add(list, vssd); + inst_list_add(list, inst); out: free(host); From heidieck at linux.vnet.ibm.com Thu Mar 6 12:38:15 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:38:15 +0100 Subject: [Libvirt-cim] [PATCH 4 of 5] SDS: adopt RASD interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204806484 -3600 # Node ID c52aea6200a31e7f7dcb367124f036980f5beb36 # Parent 81c2aba96aff5c3177c86cb1dc08d88b52c3897f SDS: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 81c2aba96aff -r c52aea6200a3 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Thu Mar 06 13:28:03 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Thu Mar 06 13:28:04 2008 +0100 @@ -99,7 +99,7 @@ static CMPIStatus rasd_to_dev(const CMPI goto out; } - if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Missing ResourceType"); From heidieck at linux.vnet.ibm.com Thu Mar 6 12:38:16 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:38:16 +0100 Subject: [Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes In-Reply-To: Message-ID: <0b7289fc81a8965c8376.1204807096@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204806485 -3600 # Node ID 0b7289fc81a8965c8376d69f0b0d43ff37e76de0 # Parent c52aea6200a31e7f7dcb367124f036980f5beb36 RAFP: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r c52aea6200a3 -r 0b7289fc81a8 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Thu Mar 06 13:28:04 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Thu Mar 06 13:28:05 2008 +0100 @@ -51,7 +51,7 @@ static CMPIStatus rasd_to_pool(const CMP if (!match_hypervisor_prefix(ref, info)) return s; - if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); @@ -77,10 +77,7 @@ static CMPIStatus rasd_to_pool(const CMP goto out; } - s = get_pool_by_name(_BROKER, - ref, - poolid, - &pool); + s = get_pool_by_name(_BROKER, ref, poolid, &pool); if (s.rc != CMPI_RC_OK) goto out; @@ -109,7 +106,7 @@ static int filter_by_pool(struct inst_li if (op == NULL) continue; - if (rasd_type_from_classname(CLASSNAME(op), &type) != + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) continue; @@ -123,52 +120,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int rasds_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - const char **properties, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - rasds_for_domain(_BROKER, - name, - type, - ref, - properties, - &tmp); - - filter_by_pool(list, &tmp, poolid); - - inst_list_free(&tmp); - - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_rasd(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -176,7 +127,8 @@ static CMPIStatus pool_to_rasd(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; const char *poolid; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp_list; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -200,11 +152,12 @@ static CMPIStatus pool_to_rasd(const CMP goto out; } - rasds_from_pool(type, - ref, - poolid, - info->properties, - list); + inst_list_init(&tmp_list); + + s = enum_rasds(_BROKER, ref, NULL, type, + info->properties, &tmp_list); + + filter_by_pool(list, &tmp_list, poolid); out: return s; From heidieck at linux.vnet.ibm.com Thu Mar 6 12:40:57 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:40:57 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename device_type_from_classname to res_type_from_device_classname In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204806486 -3600 # Node ID dc2deb288f0077c92bc61fb27de3f8558712bae6 # Parent 0b7289fc81a8965c8376d69f0b0d43ff37e76de0 Device: rename device_type_from_classname to res_type_from_device_classname for consistency with the other providers. Signed-off-by: Heidi Eckhart diff -r 0b7289fc81a8 -r dc2deb288f00 src/Virt_Device.c --- a/src/Virt_Device.c Thu Mar 06 13:28:05 2008 +0100 +++ b/src/Virt_Device.c Thu Mar 06 13:28:06 2008 +0100 @@ -268,7 +268,7 @@ static CMPIInstance *device_instance(con return instance; } -uint16_t device_type_from_classname(const char *classname) +uint16_t res_type_from_device_classname(const char *classname) { if (strstr(classname, "NetworkPort")) return CIM_RES_TYPE_NET; @@ -381,7 +381,7 @@ static CMPIStatus return_enum_devices(co inst_list_init(&list); s = enum_devices(_BROKER, reference, NULL, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &list); if (s.rc != CMPI_RC_OK) goto out; @@ -525,7 +525,7 @@ CMPIStatus get_device_by_ref(const CMPIB s = get_device_by_name(broker, reference, name, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &inst); if (s.rc != CMPI_RC_OK) goto out; diff -r 0b7289fc81a8 -r dc2deb288f00 src/Virt_Device.h --- a/src/Virt_Device.h Thu Mar 06 13:28:05 2008 +0100 +++ b/src/Virt_Device.h Thu Mar 06 13:28:06 2008 +0100 @@ -69,7 +69,7 @@ CMPIStatus get_device_by_name(const CMPI const uint16_t type, CMPIInstance **_inst); -uint16_t device_type_from_classname(const char *classname); +uint16_t res_type_from_device_classname(const char *classname); #endif From heidieck at linux.vnet.ibm.com Thu Mar 6 12:40:56 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:40:56 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] Renamed device function for constistency with other providers Message-ID: Renamed the device_type_by_classname() to res_type_by_device_classname() for consistency with other interfaces. From heidieck at linux.vnet.ibm.com Thu Mar 6 12:40:58 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:40:58 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SDS: adopt renamed Device function In-Reply-To: Message-ID: <2e10c9124c322ff48c74.1204807258@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204806486 -3600 # Node ID 2e10c9124c322ff48c740db177a63a49eadf7164 # Parent dc2deb288f0077c92bc61fb27de3f8558712bae6 SDS: adopt renamed Device function Signed-off-by: Heidi Eckhart diff -r dc2deb288f00 -r 2e10c9124c32 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Thu Mar 06 13:28:06 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Thu Mar 06 13:28:06 2008 +0100 @@ -64,7 +64,7 @@ static CMPIStatus dev_to_rasd(const CMPI s = get_rasd_by_name(_BROKER, ref, name, - device_type_from_classname(CLASSNAME(ref)), + res_type_from_device_classname(CLASSNAME(ref)), NULL, &inst); if (s.rc != CMPI_RC_OK) From heidieck at linux.vnet.ibm.com Thu Mar 6 12:40:59 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 13:40:59 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt renamed Device function In-Reply-To: Message-ID: <151ba048e3353023aff0.1204807259@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204806487 -3600 # Node ID 151ba048e3353023aff00c63f23e34abdecd64d8 # Parent 2e10c9124c322ff48c740db177a63a49eadf7164 EAFP: adopt renamed Device function Signed-off-by: Heidi Eckhart diff -r 2e10c9124c32 -r 151ba048e335 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Thu Mar 06 13:28:06 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Thu Mar 06 13:28:07 2008 +0100 @@ -40,24 +40,6 @@ const static CMPIBroker *_BROKER; -static uint16_t class_to_type(const CMPIObjectPath *ref) -{ - uint16_t type; - - if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL)) - type = CIM_RES_TYPE_DISK; - else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL)) - type = CIM_RES_TYPE_NET; - else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL)) - type = CIM_RES_TYPE_MEM; - else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL)) - type = CIM_RES_TYPE_PROC; - else - type = CIM_RES_TYPE_UNKNOWN; - - return type; -} - static CMPIStatus vdev_to_pool(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -76,7 +58,7 @@ static CMPIStatus vdev_to_pool(const CMP if (s.rc != CMPI_RC_OK) goto out; - type = class_to_type(ref); + type = res_type_from_device_classname(CLASSNAME(ref)); if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, From heidieck at linux.vnet.ibm.com Thu Mar 6 13:29:53 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 06 Mar 2008 14:29:53 +0100 Subject: [Libvirt-cim] Patch set order Message-ID: <47CFF1D1.4000408@linux.vnet.ibm.com> Please apply in the following order: [PATCH 00 of 10] #3 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs [PATCH 0 of 3] #2 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP [PATCH 0 of 5] Add configurable enum_rasds interface to RASD and Adopt changes to assoc providers [PATCH 0 of 3] Renamed device function for constistency with other providers thanks ... Heidi -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From kaitlin at linux.vnet.ibm.com Thu Mar 6 15:28:55 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 07:28:55 -0800 Subject: [Libvirt-cim] [PATCH] Add method provider registration for KVM_ComputerSystem In-Reply-To: <57d5360488f3f6b8d0e4.1204768790@localhost.localdomain> References: <57d5360488f3f6b8d0e4.1204768790@localhost.localdomain> Message-ID: <47D00DB7.3010309@linux.vnet.ibm.com> lizg at cn.ibm.com wrote: > # HG changeset patch > # User Zhengang Li > # Date 1204768763 -28800 > # Node ID 57d5360488f3f6b8d0e4d76b1fe8d9567580c7b5 > # Parent 604bd97baadf924a706cdfc99ad8bc4eb2e2a6db > Add method provider registration for KVM_ComputerSystem > > It's schema change. Please redo the preuninstall/uninstall/install/postinstall after > applying this patch. > > Signed-off-by: Zhengang Li > > diff -r 604bd97baadf -r 57d5360488f3 schema/ComputerSystem.registration Thanks for catching this Zhengang. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Thu Mar 6 15:39:17 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 06 Mar 2008 07:39:17 -0800 Subject: [Libvirt-cim] [PATCH] Add method provider registration for KVM_ComputerSystem In-Reply-To: <57d5360488f3f6b8d0e4.1204768790@localhost.localdomain> (lizg@cn.ibm.com's message of "Thu, 06 Mar 2008 09:59:50 +0800") References: <57d5360488f3f6b8d0e4.1204768790@localhost.localdomain> Message-ID: <87tzjj3lqy.fsf@caffeine.beaverton.ibm.com> ZL> # HG changeset patch ZL> # User Zhengang Li ZL> # Date 1204768763 -28800 ZL> # Node ID 57d5360488f3f6b8d0e4d76b1fe8d9567580c7b5 ZL> # Parent 604bd97baadf924a706cdfc99ad8bc4eb2e2a6db ZL> Add method provider registration for KVM_ComputerSystem Yikes! This was quite a silly omission. I've applied this. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Thu Mar 6 16:18:53 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 08:18:53 -0800 Subject: [Libvirt-cim] [PATCH 00 of 10] #3 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs In-Reply-To: References: Message-ID: <47D0196D.8030101@linux.vnet.ibm.com> Heidi Eckhart wrote: > Adopted the get_() function look and feel to the DevicePool provider. > Updated the association providers that uses these functions. > > Diff to patch set 1: > - patch #1 (svpc_types) - add Resource Pool types to svpc_types.h and map existing types to > base resource types > - patch #2 (DevicePool) - implement configurable enum_pools() function; adopt resource types > - patch #6 (EAFP) - adopt resource types; validate client given device ref > - patch #7 (AC) - adopt DevicePool interface changes; updated NOT_FOUND error message to be > consistent with others > > Diff to patch set 2: > - unified resource types to CIM_RES_TYPE_foo and adopted these changes to the providers > - fixed some style issues > I've no complaints with this set. And it tested fine on my system. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Thu Mar 6 16:31:41 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 06 Mar 2008 08:31:41 -0800 Subject: [Libvirt-cim] [PATCH 01 of 10] Add Resource Pool types to svpc_types.h In-Reply-To: <4b2f3847b668b6394737.1204806702@localhost.localdomain> (Heidi Eckhart's message of "Thu, 06 Mar 2008 13:31:42 +0100") References: <4b2f3847b668b6394737.1204806702@localhost.localdomain> Message-ID: <87hcfj3jbm.fsf@caffeine.beaverton.ibm.com> HE> struct virt_device { HE> enum { HE> - VIRT_DEV_NET = CIM_RASD_TYPE_NET, HE> - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, HE> - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, HE> - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, HE> - VIRT_DEV_UNKNOWN = 1000, HE> + VIRT_DEV_NET = CIM_RES_TYPE_NET, HE> + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, HE> + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, HE> + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, HE> + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, HE> VIRT_DEV_EMU, HE> VIRT_DEV_GRAPHICS, HE> } type; Are the VIRT_DEV_foo constants used anywhere else? It looks to me that they are mostly stripped out, with the exception of maybe some of the device_parsing stuff. I don't think it's a good idea to set dev->type=A in device_parsing, but check for dev->type==B everywhere else, even though we know A==B. Do you mind if we try to make this a clean change instead of an incremental one? I think breaking out the first few patches into a separate set to do the switchover is appropriate. Anyone else have any thoughts about this? Sorry to drag this out, Heidi... :| -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Thu Mar 6 16:46:45 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 08:46:45 -0800 Subject: [Libvirt-cim] [PATCH 01 of 10] Add Resource Pool types to svpc_types.h In-Reply-To: <87hcfj3jbm.fsf@caffeine.beaverton.ibm.com> References: <4b2f3847b668b6394737.1204806702@localhost.localdomain> <87hcfj3jbm.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D01FF5.2000007@linux.vnet.ibm.com> Dan Smith wrote: > HE> struct virt_device { > HE> enum { > HE> - VIRT_DEV_NET = CIM_RASD_TYPE_NET, > HE> - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, > HE> - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, > HE> - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, > HE> - VIRT_DEV_UNKNOWN = 1000, > HE> + VIRT_DEV_NET = CIM_RES_TYPE_NET, > HE> + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, > HE> + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, > HE> + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, > HE> + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, > HE> VIRT_DEV_EMU, > HE> VIRT_DEV_GRAPHICS, > HE> } type; > > Are the VIRT_DEV_foo constants used anywhere else? It looks to me > that they are mostly stripped out, with the exception of maybe some of > the device_parsing stuff. > > I don't think it's a good idea to set dev->type=A in device_parsing, > but check for dev->type==B everywhere else, even though we know A==B. > Do you mind if we try to make this a clean change instead of an > incremental one? > > I think breaking out the first few patches into a separate set to do > the switchover is appropriate. It'll end up being one large set though, or several smaller sets all dependent on one another. The "#2 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP" also removes some of the VIRT_DEV_* types. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Thu Mar 6 17:24:42 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 06 Mar 2008 09:24:42 -0800 Subject: [Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes References: <0b7289fc81a8965c8376.1204807096@localhost.localdomain> Message-ID: <8763vz3gv9.fsf@caffeine.beaverton.ibm.com> HE> - s = get_pool_by_name(_BROKER, HE> - ref, HE> - poolid, HE> - &pool); HE> + s = get_pool_by_name(_BROKER, ref, poolid, &pool); Please don't needlessly reformat lines that are not part of the function changes of a patch. HE> + s = enum_rasds(_BROKER, ref, NULL, type, HE> + info->properties, &tmp_list); Everywhere else, we make multi-line function calls have one parameter per line (with a few pattern exceptions for cu_statusf(), etc). Otherwise I'm happy with this set :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Thu Mar 6 21:06:49 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 13:06:49 -0800 Subject: [Libvirt-cim] [PATCH 0 of 4] Add transport support to VSMigrationService. Message-ID: libvirt also allows extra parameters for some of these transport types, but this just providers the basic support. From kaitlin at linux.vnet.ibm.com Thu Mar 6 21:06:50 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 13:06:50 -0800 Subject: [Libvirt-cim] [PATCH 1 of 4] Reorganize VSMigrationService to prepare for URI support In-Reply-To: Message-ID: <1e01f52781b5499949f4.1204837610@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1204836824 28800 # Node ID 1e01f52781b5499949f498553b453f23af8feec2 # Parent 0a71dab025defa9d32488753ead9c47a582134df Reorganize VSMigrationService to prepare for URI support. Since both MigrateVirtualSystemToHost() and MigrateVirtualSystemToSystem() both need to get the values from MSD in the same way, might as well put the MSD calls in migrate_do (since both call this function). Signed-off-by: Kaitlin Rupert diff -r 0a71dab025de -r 1e01f52781b5 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 06 09:59:23 2008 +0800 +++ b/src/Virt_VSMigrationService.c Thu Mar 06 12:53:44 2008 -0800 @@ -674,11 +674,69 @@ static CMPIStatus migrate_create_job_ins return s; } +static CMPIStatus get_msd(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + CMPIInstance **msd) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_inst_arg(argsin, "MigrationSettingData", msd); + if ((ret == CMPI_RC_OK) && (*msd != NULL)) + goto out; + + s = get_migration_sd(ref, msd, _BROKER, false); + if ((s.rc != CMPI_RC_OK) || (*msd == NULL)) { + cu_statusf(_BROKER, &s, + s.rc, + "Unable to get default setting data values"); + goto out; + } + CU_DEBUG("Using default values for MigrationSettingData param"); + + out: + return s; +} + +static CMPIStatus get_migration_type(CMPIInstance *msd, + uint16_t *type) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "MigrationType", type); + if (ret != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + ret, + "Invalid MigrationType value"); + } + + return s; +} + +static CMPIStatus get_msd_values(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + struct migration_job *job) +{ + CMPIStatus s; + CMPIInstance *msd; + + s = get_msd(ref, argsin, &msd); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_type(msd, &job->type); + if (s.rc != CMPI_RC_OK) + goto out; + + out: + return s; +} + static struct migration_job *migrate_job_prepare(const CMPIContext *context, const CMPIObjectPath *ref, const char *domain, - const char *host, - uint16_t type) + const char *host) { struct migration_job *job; uuid_t uuid; @@ -691,7 +749,6 @@ static struct migration_job *migrate_job job->host = strdup(host); job->ref_cn = strdup(CLASSNAME(ref)); job->ref_ns = strdup(NAMESPACE(ref)); - job->type = type; uuid_generate(uuid); uuid_unparse(uuid, job->uuid); @@ -705,7 +762,7 @@ static CMPIStatus migrate_do(const CMPIO const CMPIContext *context, const char *domain, const char *host, - uint16_t type, + const CMPIArgs *argsin, const CMPIResult *results, CMPIArgs *argsout) { @@ -715,13 +772,17 @@ static CMPIStatus migrate_do(const CMPIO CMPI_THREAD_TYPE thread; uint32_t retcode = 1; - job = migrate_job_prepare(context, ref, domain, host, type); + job = migrate_job_prepare(context, ref, domain, host); if (job == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to prepare migration job"); goto out; } + + s = get_msd_values(ref, argsin, job); + if (s.rc != CMPI_RC_OK) + goto out; CU_DEBUG("Prepared migration job %s", job->uuid); @@ -737,36 +798,6 @@ static CMPIStatus migrate_do(const CMPIO out: CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); - - return s; -} - -static CMPIStatus get_migration_type(const CMPIObjectPath *ref, - const CMPIArgs *argsin, - uint16_t *type) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *msd; - int ret; - - ret = cu_get_inst_arg(argsin, "MigrationSettingData", &msd); - if ((ret != CMPI_RC_OK) || (msd == NULL)) { - CU_DEBUG("Using default values for MigrationSettingData param"); - s = get_migration_sd(ref, &msd, _BROKER, false); - if ((s.rc != CMPI_RC_OK) || (msd == NULL)) { - cu_statusf(_BROKER, &s, - s.rc, - "Unable to get default setting data values"); - return s; - } - } - - ret = cu_get_u16_prop(msd, "MigrationType", type); - if (ret != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - ret, - "Invalid MigrationType value"); - } return s; } @@ -782,7 +813,6 @@ static CMPIStatus migrate_vs_host(CMPIMe const char *dhost = NULL; CMPIObjectPath *system; const char *name = NULL; - uint16_t type; cu_get_str_arg(argsin, "DestinationHost", &dhost); cu_get_ref_arg(argsin, "ComputerSystem", &system); @@ -803,13 +833,7 @@ static CMPIStatus migrate_vs_host(CMPIMe return s; } - s = get_migration_type(ref, argsin, &type); - if (s.rc != CMPI_RC_OK) { - METHOD_RETURN(results, 1); - return s; - } - - return migrate_do(ref, ctx, name, dhost, type, results, argsout); + return migrate_do(ref, ctx, name, dhost, argsin, results, argsout); } static CMPIStatus migrate_vs_system(CMPIMethodMI *self, @@ -824,7 +848,6 @@ static CMPIStatus migrate_vs_system(CMPI CMPIObjectPath *sys; const char *dname; const char *name; - uint16_t type; cu_get_ref_arg(argsin, "DestinationSystem", &dsys); cu_get_ref_arg(argsin, "ComputerSystem", &sys); @@ -853,13 +876,7 @@ static CMPIStatus migrate_vs_system(CMPI return s; } - s = get_migration_type(ref, argsin, &type); - if (s.rc != CMPI_RC_OK) { - METHOD_RETURN(results, 1); - return s; - } - - return migrate_do(ref, ctx, name, dname, type, results, argsout); + return migrate_do(ref, ctx, name, dname, argsin, results, argsout); } static struct method_handler vsimth = { From kaitlin at linux.vnet.ibm.com Thu Mar 6 21:06:52 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 13:06:52 -0800 Subject: [Libvirt-cim] [PATCH 3 of 4] Specify default TransportType in VSMigrationSettingData instance In-Reply-To: Message-ID: <5419b7f856beb54c2f39.1204837612@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1204836759 28800 # Node ID 5419b7f856beb54c2f39a50f989a5faf702d4bef # Parent eb68bdbdf6ea6b596ceefd72a5547dfa65b27225 Specify default TransportType in VSMigrationSettingData instance. Signed-off-by: Kaitlin Rupert diff -r eb68bdbdf6ea -r 5419b7f856be src/Virt_VSMigrationSettingData.c --- a/src/Virt_VSMigrationSettingData.c Thu Mar 06 12:52:19 2008 -0800 +++ b/src/Virt_VSMigrationSettingData.c Thu Mar 06 12:52:39 2008 -0800 @@ -40,6 +40,7 @@ static CMPIStatus set_properties(const C CMPIStatus s; uint16_t type = CIM_MIGRATE_LIVE; uint16_t priority = 0; /* Use default priority */ + uint16_t transport = CIM_MIGRATE_URI_SSH; CMSetProperty(inst, "MigrationType", (CMPIValue *)&type, CMPI_uint16); @@ -47,6 +48,8 @@ static CMPIStatus set_properties(const C CMSetProperty(inst, "Priority", (CMPIValue *)&priority, CMPI_uint16); + CMSetProperty(inst, "TransportType", + (CMPIValue *)&transport, CMPI_uint16); cu_statusf(broker, &s, CMPI_RC_OK, diff -r eb68bdbdf6ea -r 5419b7f856be src/Virt_VSMigrationSettingData.h --- a/src/Virt_VSMigrationSettingData.h Thu Mar 06 12:52:19 2008 -0800 +++ b/src/Virt_VSMigrationSettingData.h Thu Mar 06 12:52:39 2008 -0800 @@ -25,6 +25,14 @@ enum {CIM_MIGRATE_OTHER = 1, CIM_MIGRATE_RESTART = 4, } migration_type; +enum {CIM_MIGRATE_URI_OTHER = 1, + CIM_MIGRATE_URI_SSH = 2, + CIM_MIGRATE_URI_TLS = 3, + CIM_MIGRATE_URI_TLS_STRICT = 4, + CIM_MIGRATE_URI_UNIX = 5, + CIM_MIGRATE_URI_TCP = 6, +} transport_type; + CMPIStatus get_migration_sd(const CMPIObjectPath *ref, CMPIInstance **_inst, const CMPIBroker *broker, From kaitlin at linux.vnet.ibm.com Thu Mar 6 21:06:51 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 13:06:51 -0800 Subject: [Libvirt-cim] [PATCH 2 of 4] Extend the VirtualSystemMigrationSettingData to include an attribute for transport method In-Reply-To: Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1204836739 28800 # Node ID eb68bdbdf6ea6b596ceefd72a5547dfa65b27225 # Parent 1e01f52781b5499949f498553b453f23af8feec2 Extend the VirtualSystemMigrationSettingData to include an attribute for transport method. Possible transport methods are those supported by libvirt: ssh, tls, unix sockets, and tcp. Signed-off-by: Kaitlin Rupert diff -r 1e01f52781b5 -r eb68bdbdf6ea schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Thu Mar 06 12:53:44 2008 -0800 +++ b/schema/VSMigrationSettingData.mof Thu Mar 06 12:52:19 2008 -0800 @@ -8,8 +8,34 @@ class CIM_VirtualSystemMigrationSettingD [Provider("cmpi::Virt_VSMigrationSettingData")] class Xen_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { + [ Description( + "TransportType describes a type of transport used during the migration " + "operation.\n" + "A value of 2 - Virtual System is to be migrated using SSH.\n" + "A value of 3 - Virtual System is to be migrated using TLS.\n" + "A value of 4 - Virtual System is to be migrated using TLS with strict" + "verifcation of the remote certificates.\n" + "A value of 5 - Virtual System is to be migrated using TCP.\n" + "A value of 6 - Virtual System is to be migrated using UNIX sockets" + "(localhost only).\n"), + ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + uint16 TransportType; }; [Provider("cmpi::Virt_VSMigrationSettingData")] class KVM_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { + [ Description( + "TransportType describes a type of transport used during the migration " + "operation.\n" + "A value of 2 - Virtual System is to be migrated using SSH.\n" + "A value of 3 - Virtual System is to be migrated using TLS.\n" + "A value of 4 - Virtual System is to be migrated using TLS with strict" + "verifcation of the remote certificates.\n" + "A value of 5 - Virtual System is to be migrated using TCP.\n" + "A value of 6 - Virtual System is to be migrated using UNIX sockets" + "(localhost only).\n"), + ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + uint16 TransportType; }; From kaitlin at linux.vnet.ibm.com Thu Mar 6 21:06:53 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 13:06:53 -0800 Subject: [Libvirt-cim] [PATCH 4 of 4] Add URI support to VSMigrationService In-Reply-To: Message-ID: <363b5dd996619f5a8492.1204837613@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1204836870 28800 # Node ID 363b5dd996619f5a84928fad42b88b263690b3b2 # Parent 5419b7f856beb54c2f39a50f989a5faf702d4bef Add URI support to VSMigrationService. Signed-off-by: Kaitlin Rupert diff -r 5419b7f856be -r 363b5dd99661 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 06 12:52:39 2008 -0800 +++ b/src/Virt_VSMigrationService.c Thu Mar 06 12:54:30 2008 -0800 @@ -58,33 +58,72 @@ struct migration_job { char *ref_cn; char *ref_ns; uint16_t type; + uint16_t transport; char uuid[33]; }; -static const char *transport_from_class(const char *cn) -{ +static char *transport_from_class(const char *cn, + uint16_t transport) +{ + const char *prefix; + const char *tport = NULL; + char *uri = NULL; + if (STARTS_WITH(cn, "Xen")) - return "xen+ssh"; + prefix = "xen"; else if (STARTS_WITH(cn, "KVM")) - return "qemu+ssh"; + prefix = "qemu"; else return NULL; + + switch (transport) { + case CIM_MIGRATE_URI_SSH: + tport = "ssh"; + break; + case CIM_MIGRATE_URI_TLS: + case CIM_MIGRATE_URI_TLS_STRICT: + tport = "tls"; + break; + case CIM_MIGRATE_URI_UNIX: + tport = "unix"; + break; + case CIM_MIGRATE_URI_TCP: + tport = "tcp"; + break; + default: + goto out; + } + + if (asprintf(&uri, "%s+%s", prefix, tport) == -1) + uri = NULL; + + out: + return uri; } static char *dest_uri(const char *cn, - const char *dest) + const char *dest, + uint16_t transport) { char *uri; - const char *tport = NULL; - - tport = transport_from_class(cn); + char *tport = NULL; + int rc; + + tport = transport_from_class(cn, transport); if (tport == NULL) { CU_DEBUG("Failed to get transport for %s", cn); return NULL; } - if (asprintf(&uri, "%s://%s/system", tport, dest) == -1) + if (transport == CIM_MIGRATE_URI_TLS_STRICT) + rc = asprintf(&uri, "%s://%s/system/?no_verify=1", tport, dest); + else + rc = asprintf(&uri, "%s://%s/system/", tport, dest); + + if (rc == -1) uri = NULL; + + free(tport); return uri; } @@ -147,7 +186,7 @@ static CMPIStatus vs_migratable(const CM uint32_t retcode = 1; CMPIBoolean isMigratable = 0; - uri = dest_uri(CLASSNAME(ref), destination); + uri = dest_uri(CLASSNAME(ref), destination, CIM_MIGRATE_URI_SSH); if (uri == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -482,7 +521,7 @@ static CMPIStatus migrate_vs(struct migr char *uri = NULL; char *xml = NULL; - uri = dest_uri(job->ref_cn, job->host); + uri = dest_uri(job->ref_cn, job->host, job->transport); if (uri == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -714,6 +753,23 @@ static CMPIStatus get_migration_type(CMP return s; } +static CMPIStatus get_migration_uri(CMPIInstance *msd, + uint16_t *uri) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "TransportType", uri); + if (ret == CMPI_RC_OK) + goto out; + + CU_DEBUG("Using default TransportType: %d", CIM_MIGRATE_URI_SSH); + uri = CIM_MIGRATE_URI_SSH; + + out: + return s; +} + static CMPIStatus get_msd_values(const CMPIObjectPath *ref, const CMPIArgs *argsin, struct migration_job *job) @@ -726,6 +782,10 @@ static CMPIStatus get_msd_values(const C goto out; s = get_migration_type(msd, &job->type); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_uri(msd, &job->transport); if (s.rc != CMPI_RC_OK) goto out; From kaitlin at linux.vnet.ibm.com Thu Mar 6 21:34:10 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 06 Mar 2008 13:34:10 -0800 Subject: [Libvirt-cim] [PATCH 0 of 4] Add transport support to VSMigrationService. In-Reply-To: References: Message-ID: <47D06352.60607@linux.vnet.ibm.com> Kaitlin Rupert wrote: > libvirt also allows extra parameters for some of these transport types, but this just providers the basic support. > I've tested this with ssh, tcp, and unix. Still trying to get the certs set up to test tls and tls_strict. I suspect this will need iterations though. ;) -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:28 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:28 +0100 Subject: [Libvirt-cim] [PATCH 5 of 7] SDC: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: <6940fcabd3325336a18a.1204892428@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204889706 -3600 # Node ID 6940fcabd3325336a18ae5d1b84af2954054b69e # Parent f5c3736d2a13c4fcd8bf09afb04e69efff4040f3 SDC: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r f5c3736d2a13 -r 6940fcabd332 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Fri Mar 07 12:33:21 2008 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Fri Mar 07 12:35:06 2008 +0100 @@ -614,7 +614,7 @@ static struct sdc_rasd_prop *disk_inc(co } static struct sdc_rasd mem = { - .resource_type = CIM_RASD_TYPE_MEM, + .resource_type = CIM_RES_TYPE_MEM, .min = mem_min, .max = mem_max, .def = mem_def, @@ -622,7 +622,7 @@ static struct sdc_rasd mem = { }; static struct sdc_rasd processor = { - .resource_type = CIM_RASD_TYPE_PROC, + .resource_type = CIM_RES_TYPE_PROC, .min = proc_min, .max = proc_max, .def = proc_def, @@ -630,7 +630,7 @@ static struct sdc_rasd processor = { }; static struct sdc_rasd network = { - .resource_type = CIM_RASD_TYPE_NET, + .resource_type = CIM_RES_TYPE_NET, .min = net_min, .max = net_max, .def = net_def, @@ -638,7 +638,7 @@ static struct sdc_rasd network = { }; static struct sdc_rasd disk = { - .resource_type = CIM_RASD_TYPE_DISK, + .resource_type = CIM_RES_TYPE_DISK, .min = disk_min, .max = disk_max, .def = disk_def, @@ -807,7 +807,7 @@ static CMPIStatus alloc_cap_to_rasd(cons CU_DEBUG("ResourceType: %hi", type); - if (type == VIRT_DEV_UNKNOWN) { + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine resource type"); From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:30 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:30 +0100 Subject: [Libvirt-cim] [PATCH 7 of 7] EAFP: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: <105355b94770df20100a.1204892430@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204889797 -3600 # Node ID 105355b94770df20100a25b6c1c7d9c9dc47aa14 # Parent 47492fa1262e7a6cb29d0b354c268ae85f608b3c EAFP: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 47492fa1262e -r 105355b94770 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 12:35:29 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 12:36:37 2008 +0100 @@ -45,13 +45,13 @@ static uint16_t class_to_type(const CMPI uint16_t type; if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL)) - type = CIM_RASD_TYPE_DISK; + type = CIM_RES_TYPE_DISK; else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL)) - type = CIM_RASD_TYPE_NET; + type = CIM_RES_TYPE_NET; else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL)) - type = CIM_RASD_TYPE_MEM; + type = CIM_RES_TYPE_MEM; else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL)) - type = CIM_RASD_TYPE_PROC; + type = CIM_RES_TYPE_PROC; else type = 0; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:25 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:25 +0100 Subject: [Libvirt-cim] [PATCH 2 of 7] RASD: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: <2e63d5e4b7ceaa42080e.1204892425@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204889425 -3600 # Node ID 2e63d5e4b7ceaa42080e83df97794099fcb5b682 # Parent f7afada7979c0d7e9a3c9084bc2a0f0f785e7ccc RASD: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r f7afada7979c -r 2e63d5e4b7ce src/Virt_RASD.c --- a/src/Virt_RASD.c Fri Mar 07 12:30:05 2008 +0100 +++ b/src/Virt_RASD.c Fri Mar 07 12:30:25 2008 +0100 @@ -292,17 +292,17 @@ static CMPIInstance *rasd_from_vdev(cons char *base; char *id; - if (dev->type == VIRT_DEV_DISK) { - type = CIM_RASD_TYPE_DISK; + if (dev->type == CIM_RES_TYPE_DISK) { + type = CIM_RES_TYPE_DISK; base = "DiskResourceAllocationSettingData"; - } else if (dev->type == VIRT_DEV_NET) { - type = CIM_RASD_TYPE_NET; + } else if (dev->type == CIM_RES_TYPE_NET) { + type = CIM_RES_TYPE_NET; base = "NetResourceAllocationSettingData"; - } else if (dev->type == VIRT_DEV_VCPU) { - type = CIM_RASD_TYPE_PROC; + } else if (dev->type == CIM_RES_TYPE_PROC) { + type = CIM_RES_TYPE_PROC; base = "ProcResourceAllocationSettingData"; - } else if (dev->type == VIRT_DEV_MEM) { - type = CIM_RASD_TYPE_MEM; + } else if (dev->type == CIM_RES_TYPE_MEM) { + type = CIM_RES_TYPE_MEM; base = "MemResourceAllocationSettingData"; } else { return NULL; @@ -329,7 +329,7 @@ static CMPIInstance *rasd_from_vdev(cons CMSetProperty(inst, "ResourceType", (CMPIValue *)&type, CMPI_uint16); - if (dev->type == VIRT_DEV_DISK) { + if (dev->type == CIM_RES_TYPE_DISK) { CMSetProperty(inst, "VirtualDevice", (CMPIValue *)dev->dev.disk.virtual_dev, @@ -338,12 +338,12 @@ static CMPIInstance *rasd_from_vdev(cons "Address", (CMPIValue *)dev->dev.disk.source, CMPI_chars); - } else if (dev->type == VIRT_DEV_NET) { + } else if (dev->type == CIM_RES_TYPE_NET) { CMSetProperty(inst, "NetworkType", (CMPIValue *)dev->dev.disk.type, CMPI_chars); - } else if (dev->type == VIRT_DEV_MEM) { + } else if (dev->type == CIM_RES_TYPE_MEM) { const char *units = "MegaBytes"; CMSetProperty(inst, "AllocationUnits", @@ -354,7 +354,7 @@ static CMPIInstance *rasd_from_vdev(cons (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); CMSetProperty(inst, "Limit", (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64); - } else if (dev->type == VIRT_DEV_VCPU) { + } else if (dev->type == CIM_RES_TYPE_PROC) { proc_rasd_from_vdev(broker, dev, host, ref, inst); } @@ -470,13 +470,13 @@ CMPIrc rasd_type_from_classname(const ch goto out; if (STREQ(base, "DiskResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_DISK; + *type = CIM_RES_TYPE_DISK; else if (STREQ(base, "NetResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_NET; + *type = CIM_RES_TYPE_NET; else if (STREQ(base, "ProcResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_PROC; + *type = CIM_RES_TYPE_PROC; else if (STREQ(base, "MemResourceAllocationSettingData")) - *type = CIM_RASD_TYPE_MEM; + *type = CIM_RES_TYPE_MEM; else goto out; @@ -493,16 +493,16 @@ CMPIrc rasd_classname_from_type(uint16_t CMPIrc rc = CMPI_RC_OK; switch(type) { - case CIM_RASD_TYPE_MEM: + case CIM_RES_TYPE_MEM: *classname = "MemResourceAllocationSettingData"; break; - case CIM_RASD_TYPE_PROC: + case CIM_RES_TYPE_PROC: *classname = "ProcResourceAllocationSettingData"; break; - case CIM_RASD_TYPE_NET: + case CIM_RES_TYPE_NET: *classname = "NetResourceAllocationSettingData"; break; - case CIM_RASD_TYPE_DISK: + case CIM_RES_TYPE_DISK: *classname = "DiskResourceAllocationSettingData"; break; default: @@ -522,10 +522,10 @@ static CMPIStatus _enum_rasds(const CMPI int i, j; uint16_t type; CMPIStatus s; - uint16_t types[] = {CIM_RASD_TYPE_PROC, - CIM_RASD_TYPE_DISK, - CIM_RASD_TYPE_NET, - CIM_RASD_TYPE_MEM, + uint16_t types[] = {CIM_RES_TYPE_PROC, + CIM_RES_TYPE_DISK, + CIM_RES_TYPE_NET, + CIM_RES_TYPE_MEM, 0}; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:26 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:26 +0100 Subject: [Libvirt-cim] [PATCH 3 of 7] VSMS: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: <2bdfefe566d0c6eb60a7.1204892426@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204889442 -3600 # Node ID 2bdfefe566d0c6eb60a70de3dd57caf75a9154d0 # Parent 2e63d5e4b7ceaa42080e83df97794099fcb5b682 VSMS: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 2e63d5e4b7ce -r 2bdfefe566d0 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Mar 07 12:30:25 2008 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Fri Mar 07 12:30:42 2008 +0100 @@ -231,7 +231,7 @@ static int rasd_to_vdev(CMPIInstance *in if (!parse_fq_devid(id, &name, &devid)) goto err; - if (type == VIRT_DEV_DISK) { + if (type == CIM_RES_TYPE_DISK) { free(dev->dev.disk.virtual_dev); dev->dev.disk.virtual_dev = devid; @@ -241,7 +241,7 @@ static int rasd_to_vdev(CMPIInstance *in free(dev->dev.disk.source); dev->dev.disk.source = strdup(val); dev->dev.disk.disk_type = disk_type_from_file(val); - } else if (type == VIRT_DEV_NET) { + } else if (type == CIM_RES_TYPE_NET) { free(dev->dev.net.mac); dev->dev.net.mac = devid; @@ -253,7 +253,7 @@ static int rasd_to_vdev(CMPIInstance *in CU_DEBUG("Unknown class type for net device: %s", CLASSNAME(op)); - } else if (type == VIRT_DEV_MEM) { + } else if (type == CIM_RES_TYPE_MEM) { cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size); cu_get_u64_prop(inst, "Reservation", &dev->dev.mem.size); dev->dev.mem.maxsize = dev->dev.mem.size; @@ -307,16 +307,16 @@ static int classify_resources(CMPIArray CMPI_RC_OK) return 0; - if (type == CIM_RASD_TYPE_PROC) + if (type == CIM_RES_TYPE_PROC) rasd_to_vdev(item.value.inst, &domain->dev_vcpu[domain->dev_vcpu_ct++]); - else if (type == CIM_RASD_TYPE_MEM) + else if (type == CIM_RES_TYPE_MEM) rasd_to_vdev(item.value.inst, &domain->dev_mem[domain->dev_mem_ct++]); - else if (type == CIM_RASD_TYPE_DISK) + else if (type == CIM_RES_TYPE_DISK) rasd_to_vdev(item.value.inst, &domain->dev_disk[domain->dev_disk_ct++]); - else if (type == CIM_RASD_TYPE_NET) + else if (type == CIM_RES_TYPE_NET) rasd_to_vdev(item.value.inst, &domain->dev_net[domain->dev_net_ct++]); } @@ -613,16 +613,16 @@ static struct virt_device **find_list(st { struct virt_device **list = NULL; - if (type == VIRT_DEV_NET) { + if (type == CIM_RES_TYPE_NET) { list = &dominfo->dev_net; *count = &dominfo->dev_net_ct; - } else if (type == VIRT_DEV_DISK) { + } else if (type == CIM_RES_TYPE_DISK) { list = &dominfo->dev_disk; *count = &dominfo->dev_disk_ct; - } else if (type == VIRT_DEV_VCPU) { + } else if (type == CIM_RES_TYPE_PROC) { list = &dominfo->dev_vcpu; *count = &dominfo->dev_vcpu_ct; - } else if (type == VIRT_DEV_MEM) { + } else if (type == CIM_RES_TYPE_MEM) { list = &dominfo->dev_mem; *count = &dominfo->dev_mem_ct; } @@ -713,7 +713,7 @@ static CMPIStatus resource_del(struct do goto out; _list = find_list(dominfo, type, &count); - if ((type == CIM_RASD_TYPE_MEM) || (_list != NULL)) + if ((type == CIM_RES_TYPE_MEM) || (_list != NULL)) list = *_list; else { cu_statusf(_BROKER, &s, @@ -734,7 +734,7 @@ static CMPIStatus resource_del(struct do dev, RESOURCE_DEL, CLASSNAME(op)); - dev->type = VIRT_DEV_UNKNOWN; + dev->type = CIM_RES_TYPE_UNKNOWN; break; } } @@ -760,7 +760,7 @@ static CMPIStatus resource_add(struct do goto out; _list = find_list(dominfo, type, &count); - if ((type == CIM_RASD_TYPE_MEM) || (_list == NULL)) { + if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Cannot add resources of type %" PRIu16, type); From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:27 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:27 +0100 Subject: [Libvirt-cim] [PATCH 4 of 7] DevicePool: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204889601 -3600 # Node ID f5c3736d2a13c4fcd8bf09afb04e69efff4040f3 # Parent 2bdfefe566d0c6eb60a70de3dd57caf75a9154d0 DevicePool: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 2bdfefe566d0 -r f5c3736d2a13 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Fri Mar 07 12:30:42 2008 +0100 +++ b/src/Virt_DevicePool.c Fri Mar 07 12:33:21 2008 +0100 @@ -318,13 +318,13 @@ char *pool_member_of(const CMPIBroker *b { char *poolid = NULL; - if (type == CIM_RASD_TYPE_PROC) + if (type == CIM_RES_TYPE_PROC) poolid = strdup("ProcessorPool/0"); - else if (type == CIM_RASD_TYPE_MEM) + else if (type == CIM_RES_TYPE_MEM) poolid = strdup("MemoryPool/0"); - else if (type == CIM_RASD_TYPE_NET) + else if (type == CIM_RES_TYPE_NET) poolid = netpool_member_of(broker, id, refcn); - else if (type == CIM_RASD_TYPE_DISK) + else if (type == CIM_RES_TYPE_DISK) poolid = diskpool_member_of(broker, id, refcn); else return NULL; @@ -335,15 +335,15 @@ uint16_t device_type_from_poolid(const c uint16_t device_type_from_poolid(const char *id) { if (STARTS_WITH(id, "NetworkPool")) - return VIRT_DEV_NET; + return CIM_RES_TYPE_NET; else if (STARTS_WITH(id, "DiskPool")) - return VIRT_DEV_DISK; + return CIM_RES_TYPE_DISK; else if (STARTS_WITH(id, "MemoryPool")) - return VIRT_DEV_MEM; + return CIM_RES_TYPE_MEM; else if (STARTS_WITH(id, "ProcessorPool")) - return VIRT_DEV_VCPU; + return CIM_RES_TYPE_PROC; else - return VIRT_DEV_UNKNOWN; + return CIM_RES_TYPE_UNKNOWN; } static bool mempool_set_total(CMPIInstance *inst, virConnectPtr conn) @@ -412,7 +412,7 @@ static CMPIStatus mempool_instance(virCo const CMPIBroker *broker) { const char *id = "MemoryPool/0"; - uint16_t type = CIM_RASD_TYPE_MEM; + uint16_t type = CIM_RES_TYPE_MEM; CMPIInstance *inst; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -450,7 +450,7 @@ static CMPIStatus procpool_instance(virC const CMPIBroker *broker) { const char *id = "ProcessorPool/0"; - uint16_t type = CIM_RASD_TYPE_PROC; + uint16_t type = CIM_RES_TYPE_PROC; CMPIInstance *inst; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -489,7 +489,7 @@ static CMPIStatus _netpool_for_network(s { char *str = NULL; char *bridge = NULL; - uint16_t type = CIM_RASD_TYPE_NET; + uint16_t type = CIM_RES_TYPE_NET; CMPIInstance *inst; virNetworkPtr network = NULL; @@ -595,7 +595,7 @@ static CMPIInstance *diskpool_from_path( { CMPIInstance *inst; char *poolid = NULL; - const uint16_t type = CIM_RASD_TYPE_DISK; + const uint16_t type = CIM_RES_TYPE_DISK; struct statvfs vfs; uint64_t cap; uint64_t res; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:29 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:29 +0100 Subject: [Libvirt-cim] [PATCH 6 of 7] VSSDC: update resource types to CIM_RES_TYPE_foo In-Reply-To: Message-ID: <47492fa1262e7a6cb29d.1204892429@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204889729 -3600 # Node ID 47492fa1262e7a6cb29d0b354c268ae85f608b3c # Parent 6940fcabd3325336a18ae5d1b84af2954054b69e VSSDC: update resource types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 6940fcabd332 -r 47492fa1262e src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Fri Mar 07 12:35:06 2008 +0100 +++ b/src/Virt_VSSDComponent.c Fri Mar 07 12:35:29 2008 +0100 @@ -45,10 +45,10 @@ static CMPIStatus vssd_to_rasd(const CMP char *name = NULL; int i = 0; int types[] = { - CIM_RASD_TYPE_PROC, - CIM_RASD_TYPE_NET, - CIM_RASD_TYPE_DISK, - CIM_RASD_TYPE_MEM, + CIM_RES_TYPE_PROC, + CIM_RES_TYPE_NET, + CIM_RES_TYPE_DISK, + CIM_RES_TYPE_MEM, -1 }; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:23 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:23 +0100 Subject: [Libvirt-cim] [PATCH 0 of 7] Update resource types to CIM_RES_TYPE_foo and Adopt changes to affected providers Message-ID: Created separate patch set for new resource types CIM_RES_TYPE_foo and affected providers. From heidieck at linux.vnet.ibm.com Fri Mar 7 12:20:24 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:20:24 +0100 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204889405 -3600 # Node ID f7afada7979c0d7e9a3c9084bc2a0f0f785e7ccc # Parent 0a71dab025defa9d32488753ead9c47a582134df Add Resource Pool types to svpc_types.h This patch reorganizes the resource types. It defines common resource types for: - ALL - PROC - MEM - NET - DISK - UNKNOWN and maps the corresponding class specific resource types to these base types. Signed-off-by: Heidi Eckhart diff -r 0a71dab025de -r f7afada7979c libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Thu Mar 06 09:59:23 2008 +0800 +++ b/libxkutil/device_parsing.h Fri Mar 07 12:30:05 2008 +0100 @@ -64,11 +64,11 @@ struct graphics_device { struct virt_device { enum { - VIRT_DEV_NET = CIM_RASD_TYPE_NET, - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, - VIRT_DEV_UNKNOWN = 1000, + VIRT_DEV_NET = CIM_RES_TYPE_NET, + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, VIRT_DEV_EMU, VIRT_DEV_GRAPHICS, } type; diff -r 0a71dab025de -r f7afada7979c src/svpc_types.h --- a/src/svpc_types.h Thu Mar 06 09:59:23 2008 +0800 +++ b/src/svpc_types.h Fri Mar 07 12:30:05 2008 +0100 @@ -22,10 +22,12 @@ #ifndef __SVPC_TYPES_H #define __SVPC_TYPES_H -#define CIM_RASD_TYPE_PROC 3 -#define CIM_RASD_TYPE_MEM 4 -#define CIM_RASD_TYPE_NET 10 -#define CIM_RASD_TYPE_DISK 17 +#define CIM_RES_TYPE_ALL 0 +#define CIM_RES_TYPE_PROC 3 +#define CIM_RES_TYPE_MEM 4 +#define CIM_RES_TYPE_NET 10 +#define CIM_RES_TYPE_DISK 17 +#define CIM_RES_TYPE_UNKNOWN 1000 #define CIM_VSSD_RECOVERY_NONE 2 #define CIM_VSSD_RECOVERY_RESTART 3 From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:00 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:00 +0100 Subject: [Libvirt-cim] [PATCH 0 of 6] #3 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs Message-ID: Adopted the get_() function look and feel to the DevicePool provider. Updated the association providers that uses these functions. Diff to patch set 1: - patch #1 (svpc_types) - add Resource Pool types to svpc_types.h and map existing types to base resource types - patch #2 (DevicePool) - implement configurable enum_pools() function; adopt resource types - patch #6 (EAFP) - adopt resource types; validate client given device ref - patch #7 (AC) - adopt DevicePool interface changes; updated NOT_FOUND error message to be consistent with others Diff to patch set 2: - unified resource types to CIM_RES_TYPE_foo and adopted these changes to the providers - fixed some style issues Diff to patch set 3: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:02 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:02 +0100 Subject: [Libvirt-cim] [PATCH 2 of 6] AllocationCapabilities: adopt new DevicePool enum interface In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204892338 -3600 # Node ID a8173158176010511273e25c70f4b9fec27ccfb2 # Parent 044facb1d4cf1b87bd73bd99963f4bf37b2d7ee3 AllocationCapabilities: adopt new DevicePool enum interface - adopted new DevicePool enum_pools() interface - updated NOT_FOUND error message to be consistent with others - updated resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 044facb1d4cf -r a81731581760 src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Fri Mar 07 13:18:56 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Fri Mar 07 13:18:58 2008 +0100 @@ -33,6 +33,7 @@ #include "Virt_AllocationCapabilities.h" #include "Virt_DevicePool.h" +#include "svpc_types.h" const static CMPIBroker *_BROKER; @@ -95,11 +96,11 @@ CMPIStatus enum_alloc_cap_instances(cons if (id) cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "Requested Object could not be found."); - goto out; - } - - s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); + "Instance not found."); + goto out; + } + + s = enum_pools(broker, ref, CIM_RES_TYPE_ALL, &device_pool_list); if (s.rc != CMPI_RC_OK) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, @@ -135,7 +136,7 @@ CMPIStatus enum_alloc_cap_instances(cons if (id && !inst_id) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, - "Requested Object could not be found."); + "Instance not found."); goto out; } From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:01 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:01 +0100 Subject: [Libvirt-cim] [PATCH 1 of 6] DevicePool: reorganize get and enum functions In-Reply-To: Message-ID: <044facb1d4cf1b87bd73.1204892641@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892336 -3600 # Node ID 044facb1d4cf1b87bd73bd99963f4bf37b2d7ee3 # Parent 105355b94770df20100a25b6c1c7d9c9dc47aa14 DevicePool: reorganize get and enum functions - the common look and feel of the get_..._by_name() and get_..._by_ref() is adopted - get_all_pools() is renamed to enum_pools and rewritten to be configurable dynamically - return either a specific or all resource pools. This also replaces get_pool_by_type(). - the device_pool_names array is removed and types are identified by the CIM_RES_TYPE_..., as defined in svpc_types.h - renamed device_type_by_poolid to res_type_by_pool_id Signed-off-by: Heidi Eckhart diff -r 105355b94770 -r 044facb1d4cf src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Fri Mar 07 12:36:37 2008 +0100 +++ b/src/Virt_DevicePool.c Fri Mar 07 13:18:56 2008 +0100 @@ -45,12 +45,6 @@ static const CMPIBroker *_BROKER; -char *device_pool_names[] = {"ProcessorPool", - "MemoryPool", - "DiskPool", - "NetworkPool", - NULL}; - struct disk_pool { char *tag; char *path; @@ -174,7 +168,7 @@ static char *diskpool_member_of(const CM if (dom == NULL) goto out; - count = get_devices(dom, &devs, VIRT_DEV_DISK); + count = get_devices(dom, &devs, CIM_RES_TYPE_DISK); for (i = 0; i < count; i++) { if (STREQ((devs[i].dev.disk.virtual_dev), dev)) { @@ -290,7 +284,7 @@ static char *netpool_member_of(const CMP if (dom == NULL) goto out; - count = get_devices(dom, &devs, VIRT_DEV_NET); + count = get_devices(dom, &devs, CIM_RES_TYPE_NET); for (i = 0; i < count; i++) { if (STREQ((devs[i].id), dev)) { @@ -332,7 +326,21 @@ char *pool_member_of(const CMPIBroker *b return poolid; } -uint16_t device_type_from_poolid(const char *id) +uint16_t res_type_from_pool_classname(const char *classname) +{ + if (strstr(classname, "NetworkPool")) + return CIM_RES_TYPE_NET; + else if (strstr(classname, "DiskPool")) + return CIM_RES_TYPE_DISK; + else if (strstr(classname, "MemoryPool")) + return CIM_RES_TYPE_MEM; + else if (strstr(classname, "ProcessorPool")) + return CIM_RES_TYPE_PROC; + else + return CIM_RES_TYPE_UNKNOWN; +} + +uint16_t res_type_from_pool_id(const char *id) { if (STARTS_WITH(id, "NetworkPool")) return CIM_RES_TYPE_NET; @@ -673,177 +681,198 @@ static CMPIStatus diskpool_instance(virC return s; } -static CMPIStatus _get_pool(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, +static CMPIStatus _get_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + const char *id, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if ((type == CIM_RES_TYPE_PROC) || + (type == CIM_RES_TYPE_ALL)) + s = procpool_instance(conn, + list, + NAMESPACE(reference), + id, + broker); + + if ((type == CIM_RES_TYPE_MEM) || + (type == CIM_RES_TYPE_ALL)) + s = mempool_instance(conn, + list, + NAMESPACE(reference), + id, + broker); + + if ((type == CIM_RES_TYPE_NET) || + (type == CIM_RES_TYPE_ALL)) + s = netpool_instance(conn, + list, + NAMESPACE(reference), + id, + broker); + + if ((type == CIM_RES_TYPE_DISK) || + (type == CIM_RES_TYPE_ALL)) + s = diskpool_instance(conn, + list, + NAMESPACE(reference), + id, + broker); + + if (type == CIM_RES_TYPE_UNKNOWN) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance - resource pool type unknown"); + + if (id && list->cur == 0) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s)", id); + + out: + virConnectClose(conn); + return s; +} + +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, const char *id, - const char *ns, - struct inst_list *list) -{ - if (STARTS_WITH(type, "MemoryPool")) - return mempool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "ProcessorPool")) - return procpool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "NetworkPool")) - return netpool_instance(conn, list, ns, id, broker); - else if (STARTS_WITH(type, "DiskPool")) - return diskpool_instance(conn, list, ns, id, broker); - - return (CMPIStatus){CMPI_RC_ERR_NOT_FOUND, NULL}; -} - -CMPIStatus get_pool_by_type(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, - const char *ns, - struct inst_list *list) -{ - return _get_pool(broker, conn, type, NULL, ns, list); -} - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns) -{ - CMPIInstance *inst = NULL; - CMPIStatus s; - char *type = NULL; + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + struct inst_list list; char *poolid = NULL; int ret; - struct inst_list list; + uint16_t type; inst_list_init(&list); - ret = sscanf(id, "%a[^/]/%as", &type, &poolid); - if (ret != 2) - goto out; - - s = _get_pool(broker, conn, type, poolid, ns, &list); - if ((s.rc == CMPI_RC_OK) && (list.cur > 0)) - inst = list.list[0]; - - out: + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } + + type = res_type_from_pool_id(id); + + if (type == CIM_RES_TYPE_UNKNOWN) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s) - resource pool type mismatch", + id); + goto out; + } + + ret = sscanf(id, "%*[^/]/%as", &poolid); + if (ret != 1) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s)", + id); + goto out; + } + + s = _get_pools(broker, reference, type, poolid, &list); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = list.list[0]; + + out: + free(poolid); + virConnectClose(conn); inst_list_free(&list); - return inst; -} - -CMPIStatus get_all_pools(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *list) -{ - int i; + return s; +} + +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance) +{ CMPIStatus s = {CMPI_RC_OK}; - - for (i = 0; device_pool_names[i]; i++) { - s = get_pool_by_type(broker, - conn, - device_pool_names[i], - ns, - list); - if (s.rc != CMPI_RC_OK) - goto out; - } - + CMPIInstance *inst = NULL; + const char *id = NULL; + uint16_t type_cls; + uint16_t type_id; + + if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Missing InstanceID"); + goto out; + } + + type_cls = res_type_from_pool_classname(CLASSNAME(reference)); + type_id = res_type_from_pool_id(id); + + if ((type_cls != type_id) || + (type_cls == CIM_RES_TYPE_UNKNOWN)) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s) - resource pool type mismatch", + id); + goto out; + } + + s = get_pool_by_name(broker, reference, id, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *instance = inst; + out: return s; } -static void __return_pool(const CMPIResult *results, - struct inst_list *list, - bool name_only) -{ - if (name_only) - cu_return_instance_names(results, list); - else - cu_return_instances(results, list); +CMPIStatus enum_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + struct inst_list *list) +{ + return _get_pools(broker, reference, type, NULL, list); } static CMPIStatus return_pool(const CMPIObjectPath *ref, const CMPIResult *results, - bool name_only, - bool single_only) -{ - CMPIStatus s; - char *type; - virConnectPtr conn; + bool names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, ref, &s)) - return s; - - type = class_base_name(CLASSNAME(ref)); - if (type == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Invalid classname `%s'", CLASSNAME(ref)); - return s; - } + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - s = get_pool_by_type(_BROKER, - conn, - type, - NAMESPACE(ref), - &list); - if (s.rc == CMPI_RC_OK) { - __return_pool(results, &list, name_only); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Pool type %s not found", type); - } - - out: - free(type); + s = enum_pools(_BROKER, + ref, + res_type_from_pool_classname(CLASSNAME(ref)), + &list); + if (s.rc != CMPI_RC_OK) + goto out; + + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); + + out: inst_list_free(&list); - - return s; -} - -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance) -{ - CMPIStatus s; - CMPIInstance *inst = NULL; - virConnectPtr conn = NULL; - const char *id = NULL; - - if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) { - cu_statusf(broker, &s, - CMPI_RC_ERR_FAILED, - "Missing InstanceID"); - goto out; - } - - conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) { - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); - goto out; - } - - inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference)); - if (inst == NULL) - cu_statusf(broker, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", id); - - out: - virConnectClose(conn); - *instance = inst; return s; } @@ -853,7 +882,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_pool(reference, results, true, false); + return return_pool(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -862,7 +891,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return return_pool(reference, results, false, false); + return return_pool(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -871,13 +900,16 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK}; CMPIInstance *inst = NULL; - s = get_pool_inst(_BROKER, reference, &inst); - if ((s.rc == CMPI_RC_OK) && (inst != NULL)) - CMReturnInstance(results, inst); - + s = get_pool_by_ref(_BROKER, reference, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: return s; } diff -r 105355b94770 -r 044facb1d4cf src/Virt_DevicePool.h --- a/src/Virt_DevicePool.h Fri Mar 07 12:36:37 2008 +0100 +++ b/src/Virt_DevicePool.h Fri Mar 07 13:18:56 2008 +0100 @@ -26,20 +26,6 @@ #include #include -extern char *device_pool_names[]; - -CMPIStatus get_pool_by_type(const CMPIBroker *broker, - virConnectPtr conn, - const char *type, - const char *ns, - struct inst_list *list); - -CMPIInstance *get_pool_by_id(const CMPIBroker *broker, - virConnectPtr conn, - const char *id, - const char *ns); - - /** * Get the InstanceID of a pool that a given RASD id (for type) is in * @@ -56,24 +42,35 @@ char *pool_member_of(const CMPIBroker *b const char *id); /** - * Get the device type of a given pool from the pool's InstanceID + * Get the resource type of a given pool from the pool's classname + * + * @param classname The classname of the pool + * Returns the resource type + */ +uint16_t res_type_from_pool_classname(const char *classname); + +/** + * Get the resource type of a given pool from the pool's InstanceID * * @param id The InstanceID of the pool + * Returns the resource type */ -uint16_t device_type_from_poolid(const char *id); +uint16_t res_type_from_pool_id(const char *id); /** - * Get all device pools on the system for the given connection + * Get all device pools on the system for the given type + * * * @param broker The current Broker - * @param conn The libvirt connection to use - * @param ns Namespace for the pools - * @param list Return instances in this struct + * @param reference Defines the libvirt connection to use + * @param type The device pool type or CIM_RES_TYPE_ALL + * to get all resource pools + * @param list The list of returned instances */ -CMPIStatus get_all_pools(const CMPIBroker *broker, - virConnectPtr conn, - const char *ns, - struct inst_list *list); +CMPIStatus enum_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, + struct inst_list *list); /** * Get a device pools instance for the given reference @@ -82,9 +79,23 @@ CMPIStatus get_all_pools(const CMPIBroke * @param reference The reference passed to the CIMOM * @param instance Return corresponding instance */ -CMPIStatus get_pool_inst(const CMPIBroker *broker, - const CMPIObjectPath *reference, - CMPIInstance **instance); +CMPIStatus get_pool_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + CMPIInstance **instance); + +/** + * Get device pool instance specified by the id + * + * @param broker A pointer to the current broker + * @param ref The object path containing namespace and prefix info + * @param name The device pool id + * @param _inst In case of success the pointer to the instance + * @returns CMPIStatus + */ +CMPIStatus get_pool_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *id, + CMPIInstance **_inst); #endif From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:03 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:03 +0100 Subject: [Libvirt-cim] [PATCH 3 of 6] SDC: adopt DevicePool interface change In-Reply-To: Message-ID: <4da19a424fba43ed9683.1204892643@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892339 -3600 # Node ID 4da19a424fba43ed9683fcb10721f3b9ac566f95 # Parent a8173158176010511273e25c70f4b9fec27ccfb2 SDC: adopt DevicePool interface change - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r a81731581760 -r 4da19a424fba src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Fri Mar 07 13:18:58 2008 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Fri Mar 07 13:18:59 2008 +0100 @@ -529,13 +529,9 @@ static struct sdc_rasd_prop *disk_max(co /* Getting the relevant resource pool directly finds the free space for us. It is in the Capacity field. */ - pool_inst = get_pool_by_id(_BROKER, conn, inst_id, NAMESPACE(ref)); - if (pool_inst == NULL) { - cu_statusf(_BROKER, s, - CMPI_RC_ERR_FAILED, - "Could not get pool instance"); - goto out; - } + *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst); + if (s->rc != CMPI_RC_OK) + goto out; prop_ret = cu_get_u64_prop(pool_inst, "Capacity", &free_64); if (prop_ret != CMPI_RC_OK) { @@ -794,8 +790,6 @@ static CMPIStatus alloc_cap_to_rasd(cons if (!match_hypervisor_prefix(ref, info)) return s; - CU_DEBUG("Getting ResourceType"); - if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -803,9 +797,7 @@ static CMPIStatus alloc_cap_to_rasd(cons goto out; } - type = device_type_from_poolid(id); - - CU_DEBUG("ResourceType: %hi", type); + type = res_type_from_pool_id(id); if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:04 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:04 +0100 Subject: [Libvirt-cim] [PATCH 4 of 6] HRP: adopt DevicePool interface change In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204892339 -3600 # Node ID c903f8ad74ff8484666ca965e03ec42b40ab15ce # Parent 4da19a424fba43ed9683fcb10721f3b9ac566f95 HRP: adopt DevicePool interface change - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r 4da19a424fba -r c903f8ad74ff src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Fri Mar 07 13:18:59 2008 +0100 +++ b/src/Virt_HostedResourcePool.c Fri Mar 07 13:18:59 2008 +0100 @@ -34,6 +34,7 @@ #include "Virt_HostSystem.h" #include "Virt_DevicePool.h" +#include "svpc_types.h" static const CMPIBroker *_BROKER; @@ -47,8 +48,8 @@ static CMPIStatus pool_to_sys(const CMPI if (!match_hypervisor_prefix(ref, info)) goto out; - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) goto out; s = get_host(_BROKER, ref, &inst, false); @@ -67,8 +68,6 @@ static CMPIStatus sys_to_pool(const CMPI { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int i; - virConnectPtr conn; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -77,16 +76,7 @@ static CMPIStatus sys_to_pool(const CMPI if (s.rc != CMPI_RC_OK) goto out; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - for (i = 0; device_pool_names[i]; i++) - get_pool_by_type(_BROKER, - conn, - device_pool_names[i], - NAMESPACE(ref), - list); + s = enum_pools(_BROKER, ref, CIM_RES_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:05 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:05 +0100 Subject: [Libvirt-cim] [PATCH 5 of 6] RAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: <1488fea7392b76963e08.1204892645@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892340 -3600 # Node ID 1488fea7392b76963e081ca5c638c8d89ce53860 # Parent c903f8ad74ff8484666ca965e03ec42b40ab15ce RAFP: adopt DevicePool interface changes - adopted changes to DevicePool interface Signed-off-by: Heidi Eckhart diff -r c903f8ad74ff -r 1488fea7392b src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:18:59 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:19:00 2008 +0100 @@ -45,7 +45,6 @@ static CMPIStatus rasd_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; CMPIInstance *inst = NULL; @@ -78,28 +77,17 @@ static CMPIStatus rasd_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, - conn, - poolid, - NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, + ref, + poolid, + &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -191,7 +179,11 @@ static CMPIStatus pool_to_rasd(const CMP CMPIInstance *inst; if (!match_hypervisor_prefix(ref, info)) - return s; + goto out; + + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -200,17 +192,13 @@ static CMPIStatus pool_to_rasd(const CMP goto out; } - type = device_type_from_poolid(poolid); - if (type == VIRT_DEV_UNKNOWN) { + type = res_type_from_pool_id(poolid); + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid InstanceID or unsupported pool type"); goto out; } - - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; rasds_from_pool(type, ref, @@ -218,9 +206,6 @@ static CMPIStatus pool_to_rasd(const CMP info->properties, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Fri Mar 7 12:24:06 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:24:06 +0100 Subject: [Libvirt-cim] [PATCH 6 of 6] EAFP: adopt DevicePool interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204892340 -3600 # Node ID d09896378f5dc5dfd70054a9c514682a23cd4fd3 # Parent 1488fea7392b76963e081ca5c638c8d89ce53860 EAFP: adopt DevicePool interface changes - adopted changes to DevicePool interface - updated resource types - validate client given device ref Signed-off-by: Heidi Eckhart diff -r 1488fea7392b -r d09896378f5d src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 13:19:00 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 13:19:00 2008 +0100 @@ -66,12 +66,16 @@ static CMPIStatus vdev_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; + CMPIInstance *inst = NULL; if (!match_hypervisor_prefix(ref, info)) return s; + s = get_device_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + type = class_to_type(ref); if (type == 0) { cu_statusf(_BROKER, &s, @@ -95,25 +99,14 @@ static CMPIStatus vdev_to_pool(const CMP goto out; } - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; - - pool = get_pool_by_id(_BROKER, conn, poolid, NAMESPACE(ref)); - if (pool != NULL) { - inst_list_add(list, pool); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to find pool `%s'", poolid); - } + s = get_pool_by_name(_BROKER, ref, poolid, &pool); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, pool); out: free(poolid); - virConnectClose(conn); return s; } @@ -172,7 +165,6 @@ static int devs_from_pool(uint16_t type, name = virDomainGetName(doms[i]); - /* FIXME: Get VIRT_DEV_ type here */ dom_devices(_BROKER, doms[i], ns, type, &tmp); filter_by_pool(list, &tmp, type, poolid); @@ -199,6 +191,10 @@ static CMPIStatus pool_to_vdev(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + s = get_pool_by_ref(_BROKER, ref, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -206,25 +202,16 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - CU_DEBUG("Got %s\n", poolid); - - type = device_type_from_poolid(poolid); - if (type == VIRT_DEV_UNKNOWN) { + type = res_type_from_pool_id(poolid); + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid InstanceID or unsupported pool type"); goto out; } - s = get_pool_inst(_BROKER, ref, &inst); - if ((s.rc != CMPI_RC_OK) || (inst == NULL)) - goto out; - devs_from_pool(type, ref, poolid, list); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); out: return s; } From heidieck at linux.vnet.ibm.com Fri Mar 7 12:26:43 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:26:43 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes In-Reply-To: Message-ID: <50f47a071fb1d4668a5e.1204892803@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892342 -3600 # Node ID 50f47a071fb1d4668a5eb1b3e0c649f87ce8f376 # Parent 366b317afbf382f85ed75b86b6df9eae30dd6c94 EAFP: adopt Device interface changes Signed-off-by: Heidi Eckhart diff -r 366b317afbf3 -r 50f47a071fb1 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 13:19:01 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 13:19:02 2008 +0100 @@ -77,7 +77,7 @@ static CMPIStatus vdev_to_pool(const CMP goto out; type = class_to_type(ref); - if (type == 0) { + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unknown device type"); @@ -138,47 +138,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int devs_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - const char *ns = NAMESPACE(ref); - const char *cn = CLASSNAME(ref); - - conn = connect_by_classname(_BROKER, cn, &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - dom_devices(_BROKER, doms[i], ns, type, &tmp); - - filter_by_pool(list, &tmp, type, poolid); - - inst_list_free(&tmp); - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_vdev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -186,7 +145,8 @@ static CMPIStatus pool_to_vdev(const CMP const char *poolid; CMPIStatus s = {CMPI_RC_OK, NULL}; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp; if (!match_hypervisor_prefix(ref, info)) return s; @@ -210,7 +170,15 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - devs_from_pool(type, ref, poolid, list); + inst_list_init(&tmp); + + s = enum_devices(_BROKER, ref, NULL, type, &tmp); + if (s.rc != CMPI_RC_OK) + goto out; + + filter_by_pool(list, &tmp, type, poolid); + + inst_list_free(&tmp); out: return s; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:26:42 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:26:42 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SD: adopt Device interface changes In-Reply-To: Message-ID: <366b317afbf382f85ed7.1204892802@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892341 -3600 # Node ID 366b317afbf382f85ed75b86b6df9eae30dd6c94 # Parent 3afbff37cc3946a1f584fff572717f75aa8facc2 SD: adopt Device interface changes - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 3afbff37cc39 -r 366b317afbf3 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Fri Mar 07 13:19:01 2008 +0100 +++ b/src/Virt_SystemDevice.c Fri Mar 07 13:19:01 2008 +0100 @@ -48,55 +48,6 @@ const static CMPIBroker *_BROKER; -#define DEV_TYPE_COUNT 4 -const static int device_types[DEV_TYPE_COUNT] = - {VIRT_DEV_NET, - VIRT_DEV_DISK, - VIRT_DEV_MEM, - VIRT_DEV_VCPU, - }; - -static int get_dom_devices(const char *name, - struct inst_list *list, - int type, - const char *host_cn, - const char *ns) -{ - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; - CMPIStatus s; - int ret = 0; - - conn = connect_by_classname(_BROKER, host_cn, &s); - if (conn == NULL) - goto out; - - dom = virDomainLookupByName(conn, name); - if (dom == NULL) - goto out; - - ret = dom_devices(_BROKER, dom, ns, type, list); - - virDomainFree(dom); - out: - virConnectClose(conn); - - return ret; -} - -static int get_all_devices(const char *name, - struct inst_list *list, - const char *host_cn, - const char *ns) -{ - int i; - - for (i = 0; i < DEV_TYPE_COUNT; i++) - get_dom_devices(name, list, device_types[i], host_cn, ns); - - return i; -} - static CMPIStatus sys_to_dev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -104,7 +55,6 @@ static CMPIStatus sys_to_dev(const CMPIO const char *host = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int ret; if (!match_hypervisor_prefix(ref, info)) return s; @@ -120,20 +70,7 @@ static CMPIStatus sys_to_dev(const CMPIO goto out; } - ret = get_all_devices(host, - list, - CLASSNAME(ref), - NAMESPACE(ref)); - - if (ret >= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get devices"); - } + s = enum_devices(_BROKER, ref, host, CIM_RES_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:26:41 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:26:41 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: Message-ID: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892341 -3600 # Node ID 3afbff37cc3946a1f584fff572717f75aa8facc2 # Parent d09896378f5dc5dfd70054a9c514682a23cd4fd3 Device: rename dom_device to enum_devices and make it configurable - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r d09896378f5d -r 3afbff37cc39 src/Virt_Device.c --- a/src/Virt_Device.c Fri Mar 07 13:19:00 2008 +0100 +++ b/src/Virt_Device.c Fri Mar 07 13:19:01 2008 +0100 @@ -236,22 +236,22 @@ static CMPIInstance *device_instance(con { CMPIInstance *instance; - if (dev->type == VIRT_DEV_NET) + if (dev->type == CIM_RES_TYPE_NET) instance = net_instance(broker, &dev->dev.net, dom, ns); - else if (dev->type == VIRT_DEV_DISK) + else if (dev->type == CIM_RES_TYPE_DISK) instance = disk_instance(broker, &dev->dev.disk, dom, ns); - else if (dev->type == VIRT_DEV_MEM) + else if (dev->type == CIM_RES_TYPE_MEM) instance = mem_instance(broker, &dev->dev.mem, dom, ns); - else if (dev->type == VIRT_DEV_VCPU) + else if (dev->type == CIM_RES_TYPE_PROC) instance = vcpu_instance(broker, &dev->dev.vcpu, dom, @@ -271,23 +271,24 @@ uint16_t device_type_from_classname(cons uint16_t device_type_from_classname(const char *classname) { if (strstr(classname, "NetworkPort")) - return VIRT_DEV_NET; + return CIM_RES_TYPE_NET; else if (strstr(classname, "LogicalDisk")) - return VIRT_DEV_DISK; + return CIM_RES_TYPE_DISK; else if (strstr(classname, "Memory")) - return VIRT_DEV_MEM; + return CIM_RES_TYPE_MEM; else if (strstr(classname, "Processor")) - return VIRT_DEV_VCPU; + return CIM_RES_TYPE_PROC; else - return VIRT_DEV_UNKNOWN; -} - -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list) -{ + return CIM_RES_TYPE_UNKNOWN; +} + +static CMPIStatus _get_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; int count; int i; struct virt_device *devs = NULL; @@ -299,7 +300,10 @@ int dom_devices(const CMPIBroker *broker for (i = 0; i < count; i++) { CMPIInstance *dev = NULL; - dev = device_instance(broker, &devs[i], dom, ns); + dev = device_instance(broker, + &devs[i], + dom, + NAMESPACE(reference)); if (dev) inst_list_add(list, dev); @@ -308,57 +312,106 @@ int dom_devices(const CMPIBroker *broker out: free(devs); - - return 1; -} - -static int dom_list_devices(virConnectPtr conn, - const CMPIObjectPath *ref, - struct inst_list *list) -{ - virDomainPtr *doms; - int ndom; + return s; +} + +static CMPIStatus _enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s; + + if (type == CIM_RES_TYPE_ALL) { + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_PROC, + list); + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_MEM, + list); + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_NET, + list); + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_DISK, + list); + } + else + s = _get_devices(broker, + reference, + dom, + type, + list); + + return s; +} + +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + virDomainPtr *doms = NULL; + int count = 1; int i; - int type; - - type = device_type_from_classname(CLASSNAME(ref)); - - ndom = get_domain_list(conn, &doms); - if (ndom == 0) - return 1; - else if (ndom < 0) - return 0; - - for (i = 0; i < ndom; i++) { - dom_devices(_BROKER, doms[i], NAMESPACE(ref), type, list); - } - - return 1; -} - -static CMPIStatus enum_devices(const CMPIObjectPath *reference, - const CMPIResult *results, - int names_only) -{ - CMPIStatus s; - virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if (domain) { + doms = calloc(1, sizeof(virDomainPtr)); + doms[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &doms); + + for (i = 0; i < count; i++) { + s = _enum_devices(broker, + reference, + doms[i], + type, + list); + + virDomainFree(doms[i]); + } + + out: + virConnectClose(conn); + free(doms); + + return s; +} + +static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, + const CMPIResult *results, + int names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, reference, &s)) - return s; + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); - if (conn == NULL) - return s; - - if (!dom_list_devices(conn, reference, &list)) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to list domains"); - return s; - } + s = enum_devices(_BROKER, reference, NULL, + device_type_from_classname(CLASSNAME(reference)), + &list); + if (s.rc != CMPI_RC_OK) + goto out; if (list.cur == 0) goto out; @@ -371,11 +424,6 @@ static CMPIStatus enum_devices(const CMP inst_list_free(&list); out: - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - virConnectClose(conn); - return s; } @@ -524,7 +572,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return enum_devices(reference, results, 1); + return return_enum_devices(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -533,7 +581,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return enum_devices(reference, results, 0); + return return_enum_devices(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, diff -r d09896378f5d -r 3afbff37cc39 src/Virt_Device.h --- a/src/Virt_Device.h Fri Mar 07 13:19:00 2008 +0100 +++ b/src/Virt_Device.h Fri Mar 07 13:19:01 2008 +0100 @@ -27,19 +27,18 @@ * Return a list of devices for a given domain * * @param broker A pointer to the CIM broker - * @param dom The domain in question - * @param ref The namespace - * @param list A pointer to an array of CMPIInstance objects (should - * be NULL initially) - * @param cur The number of items in the list (0 initially) - * @param max The size of the list (0 initially) - * @returns Nonzero on success + * @param reference Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) + * @param type The device type or CIM_RES_TYPE_ALL to get + * all devices + * @param list A pointer to an array of CMPIInstance objects + * (should be NULL initially) */ -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list); +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list); /** * Returns the device instance defined by the reference From heidieck at linux.vnet.ibm.com Fri Mar 7 12:26:40 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:26:40 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] #3 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP Message-ID: This patch set implements the configurable enum_devices() interface to the Device provider. This slight interface change is adopted to the associations SystemDevice and ElementAllocatedFromPool. Both associations profit from the easy access to the device instances. Diff to patch set 1: - fixed style issues Diff to patch set 2: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set From heidieck at linux.vnet.ibm.com Fri Mar 7 12:28:21 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:28:21 +0100 Subject: [Libvirt-cim] [PATCH 2 of 5] VSMS: adopt RASD interface change In-Reply-To: Message-ID: <5035a40ceb863e53e7b3.1204892901@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892343 -3600 # Node ID 5035a40ceb863e53e7b33dcc12e5a7571bbcc1d3 # Parent e50362c85943d1b567ad2c9d080d4d0767a85a99 VSMS: adopt RASD interface change Signed-off-by: Heidi Eckhart diff -r e50362c85943 -r 5035a40ceb86 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Mar 07 13:19:03 2008 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Fri Mar 07 13:19:03 2008 +0100 @@ -220,7 +220,7 @@ static int rasd_to_vdev(CMPIInstance *in if (op == NULL) goto err; - if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) goto err; dev->type = (int)type; @@ -303,7 +303,7 @@ static int classify_resources(CMPIArray if (op == NULL) return 0; - if (rasd_type_from_classname(CLASSNAME(op), &type) != + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) return 0; @@ -882,7 +882,7 @@ static CMPIStatus _update_resources_for( goto out; } - if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); @@ -1036,7 +1036,7 @@ static CMPIStatus rasd_refs_to_insts(con continue; } - if (rasd_type_from_classname(CLASSNAME(ref), &type) != + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CU_DEBUG("Unable to get type of `%s'", REF2STR(ref)); From heidieck at linux.vnet.ibm.com Fri Mar 7 12:28:20 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:28:20 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204892343 -3600 # Node ID e50362c85943d1b567ad2c9d080d4d0767a85a99 # Parent 50f47a071fb1d4668a5eb1b3e0c649f87ce8f376 RASD: rename rasds_for_domain to enum_rasds and make it configurable Signed-off-by: Heidi Eckhart diff -r 50f47a071fb1 -r e50362c85943 src/Virt_RASD.c --- a/src/Virt_RASD.c Fri Mar 07 13:19:02 2008 +0100 +++ b/src/Virt_RASD.c Fri Mar 07 13:19:03 2008 +0100 @@ -439,8 +439,8 @@ CMPIStatus get_rasd_by_ref(const CMPIBro goto out; } - if (rasd_type_from_classname(CLASSNAME(reference), &type) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, + if (res_type_from_rasd_classname(CLASSNAME(reference), &type) != CMPI_RC_OK) { + cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); goto out; @@ -460,7 +460,7 @@ CMPIStatus get_rasd_by_ref(const CMPIBro return s; } -CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type) +CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) { char *base = NULL; CMPIrc rc = CMPI_RC_ERR_FAILED; @@ -512,58 +512,114 @@ CMPIrc rasd_classname_from_type(uint16_t return rc; } -static CMPIStatus _enum_rasds(const CMPIObjectPath *ref, +static CMPIStatus _get_rasds(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + const char **properties, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int count; + int i; + struct virt_device *devs = NULL; + + count = get_devices(dom, &devs, type); + if (count <= 0) + goto out; + + for (i = 0; i < count; i++) { + CMPIInstance *dev = NULL; + const char *host = NULL; + + host = virDomainGetName(dom); + if (host == NULL) { + cleanup_virt_device(&devs[i]); + continue; + } + + dev = rasd_from_vdev(broker, + &devs[i], + host, + reference, + properties); + if (dev) + inst_list_add(list, dev); + + cleanup_virt_device(&devs[i]); + } + + out: + free(devs); + return s; +} + +static CMPIStatus _enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, const char **properties, struct inst_list *list) { + CMPIStatus s; + + if (type == CIM_RES_TYPE_ALL) { + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_PROC, + properties, list); + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_MEM, + properties, list); + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_NET, + properties, list); + s = _get_rasds(broker, reference, dom, + CIM_RES_TYPE_DISK, + properties, list); + } + else + s = _get_rasds(broker, reference, dom, + type, properties, list); + + return s; +} + +CMPIStatus enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const char *domain, + const uint16_t type, + const char **properties, + struct inst_list *list) +{ virConnectPtr conn = NULL; virDomainPtr *domains = NULL; - int count; - int i, j; - uint16_t type; - CMPIStatus s; - uint16_t types[] = {CIM_RES_TYPE_PROC, - CIM_RES_TYPE_DISK, - CIM_RES_TYPE_NET, - CIM_RES_TYPE_MEM, - 0}; + int count = 1; + int i; + CMPIStatus s = {CMPI_RC_OK, NULL}; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) - return s; - - count = get_domain_list(conn, &domains); - if (count <= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get domain list"); - goto out; - } - - if (rasd_type_from_classname(CLASSNAME(ref), &type) == CMPI_RC_OK) { - types[0] = type; - types[1] = 0; - } + goto out; + + if (domain) { + domains = calloc(1, sizeof(virDomainPtr)); + domains[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &domains); for (i = 0; i < count; i++) { - for (j = 0; types[j] != 0; j++) { - CU_DEBUG("Doing RASD type %i for %s", - type, virDomainGetName(domains[i])); - rasds_for_domain(_BROKER, - virDomainGetName(domains[i]), - types[j], - ref, - properties, - list); - } + _enum_rasds(broker, + ref, + domains[i], + type, + properties, + list); virDomainFree(domains[i]); } - s = (CMPIStatus){CMPI_RC_OK, NULL}; - out: virConnectClose(conn); - free(domains); return s; } @@ -575,17 +631,23 @@ static CMPIStatus return_enum_rasds(cons { struct inst_list list; CMPIStatus s; + uint16_t type; inst_list_init(&list); - s = _enum_rasds(ref, properties, &list); - if (s.rc == CMPI_RC_OK) { - if (names_only) - cu_return_instance_names(results, &list); - else - cu_return_instances(results, &list); - } - + res_type_from_rasd_classname(CLASSNAME(ref), &type); + + s = enum_rasds(_BROKER, ref, NULL, + type, properties, &list); + if (s.rc != CMPI_RC_OK) + goto out; + + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); + + out: inst_list_free(&list); return s; @@ -626,41 +688,6 @@ static CMPIStatus GetInstance(CMPIInstan out: return s; -} - -int rasds_for_domain(const CMPIBroker *broker, - const char *name, - const uint16_t type, - const CMPIObjectPath *ref, - const char **properties, - struct inst_list *_list) -{ - struct virt_device *list; - int count; - int i; - virConnectPtr conn; - CMPIStatus s; - - conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) - return 0; - - count = list_devs(conn, type, name, &list); - - for (i = 0; i < count; i++) { - CMPIInstance *inst; - - inst = rasd_from_vdev(broker, &list[i], name, ref, properties); - if (inst != NULL) - inst_list_add(_list, inst); - } - - if (count > 0) - cleanup_virt_devices(&list, count); - - virConnectClose(conn); - - return count; } DEFAULT_CI(); diff -r 50f47a071fb1 -r e50362c85943 src/Virt_RASD.h --- a/src/Virt_RASD.h Fri Mar 07 13:19:02 2008 +0100 +++ b/src/Virt_RASD.h Fri Mar 07 13:19:03 2008 +0100 @@ -27,20 +27,20 @@ char *rasd_to_xml(CMPIInstance *rasd); * Get a list of RASDs for a given domain * * @param broker The current broker - * @param name The name of the domain in question + * @param ref Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) * @param type The ResourceType of the desired RASDs - * @param ref A reference used for hypervisor connection and namespace - * setting of the resulting instances + * @param properties The properties to filter for * @param _list The list of instances to populate */ -int rasds_for_domain(const CMPIBroker *broker, - const char *name, - const uint16_t type, - const CMPIObjectPath *ref, - const char **properties, - struct inst_list *_list); +CMPIStatus enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const char *domain, + const uint16_t type, + const char **properties, + struct inst_list *_list); -CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); +CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type); CMPIrc rasd_classname_from_type(uint16_t type, const char **cn); CMPIStatus get_rasd_by_name(const CMPIBroker *broker, From heidieck at linux.vnet.ibm.com Fri Mar 7 12:28:22 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:28:22 +0100 Subject: [Libvirt-cim] [PATCH 3 of 5] VSSDC: adopt RASD interface changes In-Reply-To: Message-ID: <29a9dd30a48b19e26ede.1204892902@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892344 -3600 # Node ID 29a9dd30a48b19e26edeb2a1ed030e4244674f97 # Parent 5035a40ceb863e53e7b33dcc12e5a7571bbcc1d3 VSSDC: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 5035a40ceb86 -r 29a9dd30a48b src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Fri Mar 07 13:19:03 2008 +0100 +++ b/src/Virt_VSSDComponent.c Fri Mar 07 13:19:04 2008 +0100 @@ -43,14 +43,6 @@ static CMPIStatus vssd_to_rasd(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; char *name = NULL; - int i = 0; - int types[] = { - CIM_RES_TYPE_PROC, - CIM_RES_TYPE_NET, - CIM_RES_TYPE_DISK, - CIM_RES_TYPE_MEM, - -1 - }; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -66,14 +58,12 @@ static CMPIStatus vssd_to_rasd(const CMP goto out; } - for (i = 0; types[i] > 0; i++) { - rasds_for_domain(_BROKER, - name, - types[i], - ref, - info->properties, - list); - } + s = enum_rasds(_BROKER, + ref, + name, + CIM_RES_TYPE_ALL, + info->properties, + list); free(name); @@ -86,7 +76,7 @@ static CMPIStatus rasd_to_vssd(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *vssd = NULL; + CMPIInstance *inst = NULL; const char *id = NULL; char *host = NULL; char *devid = NULL; @@ -94,6 +84,10 @@ static CMPIStatus rasd_to_vssd(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + + s = get_rasd_by_ref(_BROKER, ref, info->properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -110,11 +104,11 @@ static CMPIStatus rasd_to_vssd(const CMP goto out; } - s = get_vssd_by_name(_BROKER, ref, host, &vssd); + s = get_vssd_by_name(_BROKER, ref, host, &inst); if (s.rc != CMPI_RC_OK) goto out; - inst_list_add(list, vssd); + inst_list_add(list, inst); out: free(host); From heidieck at linux.vnet.ibm.com Fri Mar 7 12:28:23 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:28:23 +0100 Subject: [Libvirt-cim] [PATCH 4 of 5] SDS: adopt RASD interface changes In-Reply-To: Message-ID: <5c46a8e9bf8962d48535.1204892903@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892344 -3600 # Node ID 5c46a8e9bf8962d48535fd3b1c1b486d92a9b5b7 # Parent 29a9dd30a48b19e26edeb2a1ed030e4244674f97 SDS: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 29a9dd30a48b -r 5c46a8e9bf89 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Fri Mar 07 13:19:04 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Fri Mar 07 13:19:04 2008 +0100 @@ -99,7 +99,7 @@ static CMPIStatus rasd_to_dev(const CMPI goto out; } - if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Missing ResourceType"); From heidieck at linux.vnet.ibm.com Fri Mar 7 12:28:24 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:28:24 +0100 Subject: [Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204892345 -3600 # Node ID d24e8fe2d358588a2d3a6484111806e1986d90fa # Parent 5c46a8e9bf8962d48535fd3b1c1b486d92a9b5b7 RAFP: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 5c46a8e9bf89 -r d24e8fe2d358 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:19:04 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:19:05 2008 +0100 @@ -51,7 +51,7 @@ static CMPIStatus rasd_to_pool(const CMP if (!match_hypervisor_prefix(ref, info)) return s; - if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); @@ -109,7 +109,7 @@ static int filter_by_pool(struct inst_li if (op == NULL) continue; - if (rasd_type_from_classname(CLASSNAME(op), &type) != + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) continue; @@ -123,52 +123,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int rasds_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - const char **properties, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - rasds_for_domain(_BROKER, - name, - type, - ref, - properties, - &tmp); - - filter_by_pool(list, &tmp, poolid); - - inst_list_free(&tmp); - - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_rasd(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -176,7 +130,8 @@ static CMPIStatus pool_to_rasd(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; const char *poolid; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp_list; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -200,11 +155,16 @@ static CMPIStatus pool_to_rasd(const CMP goto out; } - rasds_from_pool(type, - ref, - poolid, - info->properties, - list); + inst_list_init(&tmp_list); + + s = enum_rasds(_BROKER, + ref, + NULL, + type, + info->properties, + &tmp_list); + + filter_by_pool(list, &tmp_list, poolid); out: return s; From heidieck at linux.vnet.ibm.com Fri Mar 7 12:28:19 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:28:19 +0100 Subject: [Libvirt-cim] [PATCH 0 of 5] #2 - Add configurable enum_rasds interface to RASD and Adopt changes to assoc providers Message-ID: This patch set implements a configurable enum_rasds() interface to the RASD provider. This slight interface change is adopted to the affected associations. Diff to patch set 1: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set - fixed style issues From heidieck at linux.vnet.ibm.com Fri Mar 7 12:29:55 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:29:55 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename device_type_from_classname to res_type_from_device_classname In-Reply-To: Message-ID: <8254cdd50092090275d9.1204892995@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892346 -3600 # Node ID 8254cdd50092090275d925319e125651f6a133a8 # Parent d24e8fe2d358588a2d3a6484111806e1986d90fa Device: rename device_type_from_classname to res_type_from_device_classname for consistency with the other providers. Signed-off-by: Heidi Eckhart diff -r d24e8fe2d358 -r 8254cdd50092 src/Virt_Device.c --- a/src/Virt_Device.c Fri Mar 07 13:19:05 2008 +0100 +++ b/src/Virt_Device.c Fri Mar 07 13:19:06 2008 +0100 @@ -268,7 +268,7 @@ static CMPIInstance *device_instance(con return instance; } -uint16_t device_type_from_classname(const char *classname) +uint16_t res_type_from_device_classname(const char *classname) { if (strstr(classname, "NetworkPort")) return CIM_RES_TYPE_NET; @@ -408,7 +408,7 @@ static CMPIStatus return_enum_devices(co inst_list_init(&list); s = enum_devices(_BROKER, reference, NULL, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &list); if (s.rc != CMPI_RC_OK) goto out; @@ -552,7 +552,7 @@ CMPIStatus get_device_by_ref(const CMPIB s = get_device_by_name(broker, reference, name, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &inst); if (s.rc != CMPI_RC_OK) goto out; diff -r d24e8fe2d358 -r 8254cdd50092 src/Virt_Device.h --- a/src/Virt_Device.h Fri Mar 07 13:19:05 2008 +0100 +++ b/src/Virt_Device.h Fri Mar 07 13:19:06 2008 +0100 @@ -69,7 +69,7 @@ CMPIStatus get_device_by_name(const CMPI const uint16_t type, CMPIInstance **_inst); -uint16_t device_type_from_classname(const char *classname); +uint16_t res_type_from_device_classname(const char *classname); #endif From heidieck at linux.vnet.ibm.com Fri Mar 7 12:29:54 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:29:54 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] #2 - Renamed device function for constistency with other providers Message-ID: Renamed the device_type_by_classname() to res_type_by_device_classname() for consistency with other interfaces. Diff to patch set 1: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set From heidieck at linux.vnet.ibm.com Fri Mar 7 12:29:56 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:29:56 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SDS: adopt renamed Device function In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1204892347 -3600 # Node ID e0dc4edf60115ef41e5c093b4dc65c6ff0ac1faa # Parent 8254cdd50092090275d925319e125651f6a133a8 SDS: adopt renamed Device function Signed-off-by: Heidi Eckhart diff -r 8254cdd50092 -r e0dc4edf6011 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Fri Mar 07 13:19:06 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Fri Mar 07 13:19:07 2008 +0100 @@ -64,7 +64,7 @@ static CMPIStatus dev_to_rasd(const CMPI s = get_rasd_by_name(_BROKER, ref, name, - device_type_from_classname(CLASSNAME(ref)), + res_type_from_device_classname(CLASSNAME(ref)), NULL, &inst); if (s.rc != CMPI_RC_OK) From heidieck at linux.vnet.ibm.com Fri Mar 7 12:29:57 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 07 Mar 2008 13:29:57 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt renamed Device function In-Reply-To: Message-ID: <83f78e06e6495634dd8e.1204892997@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1204892347 -3600 # Node ID 83f78e06e6495634dd8e5a02cda2755e27cf654c # Parent e0dc4edf60115ef41e5c093b4dc65c6ff0ac1faa EAFP: adopt renamed Device function Signed-off-by: Heidi Eckhart diff -r e0dc4edf6011 -r 83f78e06e649 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 13:19:07 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Fri Mar 07 13:19:07 2008 +0100 @@ -40,24 +40,6 @@ const static CMPIBroker *_BROKER; -static uint16_t class_to_type(const CMPIObjectPath *ref) -{ - uint16_t type; - - if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL)) - type = CIM_RES_TYPE_DISK; - else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL)) - type = CIM_RES_TYPE_NET; - else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL)) - type = CIM_RES_TYPE_MEM; - else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL)) - type = CIM_RES_TYPE_PROC; - else - type = 0; - - return type; -} - static CMPIStatus vdev_to_pool(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -76,7 +58,7 @@ static CMPIStatus vdev_to_pool(const CMP if (s.rc != CMPI_RC_OK) goto out; - type = class_to_type(ref); + type = res_type_from_device_classname(CLASSNAME(ref)); if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, From danms at us.ibm.com Fri Mar 7 15:00:58 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 07:00:58 -0800 Subject: [Libvirt-cim] [PATCH 4 of 4] Add URI support to VSMigrationService In-Reply-To: <363b5dd996619f5a8492.1204837613@elm3b41.beaverton.ibm.com> (Kaitlin Rupert's message of "Thu, 06 Mar 2008 13:06:53 -0800") References: <363b5dd996619f5a8492.1204837613@elm3b41.beaverton.ibm.com> Message-ID: <877igea89h.fsf@caffeine.beaverton.ibm.com> KR> + if (transport == CIM_MIGRATE_URI_TLS_STRICT) KR> + rc = asprintf(&uri, "%s://%s/system/?no_verify=1", tport, dest); KR> + else KR> + rc = asprintf(&uri, "%s://%s/system/", tport, dest); KR> + KR> + if (rc == -1) KR> uri = NULL; KR> + KR> + free(tport); This seems a tad ugly, since it's just a special case for one of the transport types. Can we change the function to just construct a whole URI for us, and pass in the class and the destination host? KR> @@ -147,7 +186,7 @@ static CMPIStatus vs_migratable(const CM KR> uint32_t retcode = 1; KR> CMPIBoolean isMigratable = 0; KR> - uri = dest_uri(CLASSNAME(ref), destination); KR> + uri = dest_uri(CLASSNAME(ref), destination, CIM_MIGRATE_URI_SSH); Is this hardcoding the check function to SSH? Otherwise I'm really happy with this set, thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Fri Mar 7 15:00:53 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 10:00:53 -0500 Subject: [Libvirt-cim] [PATCH 1 of 3] MigrationJob schema changes In-Reply-To: Message-ID: <1990fcb31b29f8e5247b.1204902053@naegling> # HG changeset patch # User Jay Gagnon # Date 1204900469 18000 # Node ID 1990fcb31b29f8e5247bb42ae67e38131060d486 # Parent 604bd97baadf924a706cdfc99ad8bc4eb2e2a6db MigrationJob schema changes Instead of just ComputerSystemMigrationIndication, we need three ComputerSystemMigrationJobIndication classes, for Created, Modified, and Deleted. Signed-off-by: Jay Gagnon diff -r 604bd97baadf -r 1990fcb31b29 schema/ComputerSystemMigrationIndication.mof --- a/schema/ComputerSystemMigrationIndication.mof Wed Mar 05 07:02:25 2008 -0800 +++ b/schema/ComputerSystemMigrationIndication.mof Fri Mar 07 09:34:29 2008 -0500 @@ -3,7 +3,23 @@ [Description ("Xen_ComputerSystem migration status"), Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] -class Xen_ComputerSystemMigrationIndication : CIM_InstModification +class Xen_ComputerSystemMigrationJobCreatedIndication : CIM_InstCreation +{ + uint32 RaiseIndication([IN] CIM_InstCreation REF TheIndication); +}; + +[Description ("KVM_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class KVM_ComputerSystemMigrationJobCreatedIndication : CIM_InstCreation +{ + uint32 RaiseIndication([IN] CIM_InstCreation REF TheIndication); +}; + +[Description ("Xen_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class Xen_ComputerSystemMigrationJobModifiedIndication : CIM_InstModification { uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; @@ -11,7 +27,23 @@ class Xen_ComputerSystemMigrationIndicat [Description ("KVM_ComputerSystem migration status"), Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] -class KVM_ComputerSystemMigrationIndication : CIM_InstModification +class KVM_ComputerSystemMigrationJobModifiedIndication : CIM_InstModification { uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; + +[Description ("Xen_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class Xen_ComputerSystemMigrationJobDeletedIndication : CIM_InstDeletion +{ + uint32 RaiseIndication([IN] CIM_InstDeletion REF TheIndication); +}; + +[Description ("KVM_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class KVM_ComputerSystemMigrationJobDeletedIndication : CIM_InstDeletion +{ + uint32 RaiseIndication([IN] CIM_InstDeletion REF TheIndication); +}; diff -r 604bd97baadf -r 1990fcb31b29 schema/ComputerSystemMigrationIndication.registration --- a/schema/ComputerSystemMigrationIndication.registration Wed Mar 05 07:02:25 2008 -0800 +++ b/schema/ComputerSystemMigrationIndication.registration Fri Mar 07 09:34:29 2008 -0500 @@ -1,4 +1,8 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes -Xen_ComputerSystemMigrationIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method -KVM_ComputerSystemMigrationIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +Xen_ComputerSystemMigrationJobCreatedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +Xen_ComputerSystemMigrationJobModifiedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +Xen_ComputerSystemMigrationJobDeletedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +KVM_ComputerSystemMigrationJobCreatedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +KVM_ComputerSystemMigrationJobModifiedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +KVM_ComputerSystemMigrationJobDeletedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method From grendel at linux.vnet.ibm.com Fri Mar 7 15:00:52 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 10:00:52 -0500 Subject: [Libvirt-cim] [PATCH 0 of 3] MigrationJob Indications Message-ID: This set breaks CSMI into three indications that track the status of the migration job through its entire lifecycle. There might be a few rough spots in the main patch here, as a seemingly innocuous typo turned into two days of sfcb debugging. As a result, I'm a bit sick of looking at this thing, so if you see something that's not finished product quality, please point it out. I think the overall approach is fairly sound, since it's a pretty straightforward problem. From grendel at linux.vnet.ibm.com Fri Mar 7 15:00:54 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 10:00:54 -0500 Subject: [Libvirt-cim] [PATCH 2 of 3] Convert CSMI for MigrationJob In-Reply-To: Message-ID: <38cd28b072e341671405.1204902054@naegling> # HG changeset patch # User Jay Gagnon # Date 1204900472 18000 # Node ID 38cd28b072e3416714053bd049c91a55fca9c0c3 # Parent 1990fcb31b29f8e5247bb42ae67e38131060d486 Convert CSMI for MigrationJob Nothing fancy here, just some filter updates. Signed-off-by: Jay Gagnon diff -r 1990fcb31b29 -r 38cd28b072e3 src/Virt_ComputerSystemMigrationIndication.c --- a/src/Virt_ComputerSystemMigrationIndication.c Fri Mar 07 09:34:29 2008 -0500 +++ b/src/Virt_ComputerSystemMigrationIndication.c Fri Mar 07 09:34:32 2008 -0500 @@ -42,10 +42,14 @@ static const CMPIBroker *_BROKER; -DECLARE_FILTER(xen_migrate, "Xen_ComputerSystemMigrationIndication"); +DECLARE_FILTER(xen_created, "Xen_ComputerSystemMigrationJobCreatedIndication"); +DECLARE_FILTER(xen_mod, "Xen_ComputerSystemMigrationJobModifiedIndication"); +DECLARE_FILTER(xen_deleted, "Xen_ComputerSystemMigrationJobDeletedIndication"); static struct std_ind_filter *filters[] = { - &xen_migrate, + &xen_created, + &xen_mod, + &xen_deleted, NULL, }; From grendel at linux.vnet.ibm.com Fri Mar 7 15:00:55 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 10:00:55 -0500 Subject: [Libvirt-cim] [PATCH 3 of 3] Migration Job Indication In-Reply-To: Message-ID: <1ccab6e9470c08a4dd6f.1204902055@naegling> # HG changeset patch # User Jay Gagnon # Date 1204901289 18000 # Node ID 1ccab6e9470c08a4dd6f411078325d3574cd9abf # Parent 38cd28b072e3416714053bd049c91a55fca9c0c3 Migration Job Indication We need to add some more indication to VS_MigrationService. ComputerSystemMigrationIndication is getting broken up into ComputerSystemMigrationJob[Created|Modified|Deleted]Indication, so that we can give clients that did not initiate the migration a better idea of what's going on. Each migration will fire a couple additional indications now. Changes required to make this happen: Enumeration of supported indication types. A new function ind_type_to_name. Converts int from the enumeration to an indication name. A new function ref_from_job (migration_job struct -> objectpath). This is mainly existing functionality but is now needed in two places. A new function raise_deleted_ind. The work required to raise the Deleted indication was cluttering up migrate_vs so I broke it out. Changes to prepare_indication and raise_indication to accomodate the new indication types. Then of course a few lines to actually use the new stuff. Signed-off-by: Jay Gagnon diff -r 38cd28b072e3 -r 1ccab6e9470c src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Fri Mar 07 09:34:32 2008 -0500 +++ b/src/Virt_VSMigrationService.c Fri Mar 07 09:48:09 2008 -0500 @@ -51,6 +51,12 @@ const static CMPIBroker *_BROKER; +enum { + MIG_CREATED, + MIG_MODIFIED, + MIG_DELETED, +}; + struct migration_job { CMPIContext *context; char *domain; @@ -271,23 +277,49 @@ static CMPIStatus vs_migratable_system(C return vs_migratable(ref, name, dname, results, argsout); } +static char *ind_type_to_name(int ind_type) +{ + char *ind_name = NULL; + + switch (ind_type) { + case MIG_CREATED: + ind_name = "ComputerSystemMigrationJobCreatedIndication"; + break; + case MIG_DELETED: + ind_name = "ComputerSystemMigrationJobDeletedIndication"; + break; + case MIG_MODIFIED: + ind_name = "ComputerSystemMigrationJobModifiedIndication"; + break; + } + + return ind_name; +} + static bool raise_indication(const CMPIContext *context, - const char *base_type, + int ind_type, const char *ns, CMPIInstance *inst, CMPIInstance *ind) { char *type; CMPIStatus s; + char *ind_name = NULL; + + ind_name = ind_type_to_name(ind_type); CU_DEBUG("Setting SourceInstance"); CMSetProperty(ind, "SourceInstance", (CMPIValue *)&inst, CMPI_instance); /* Seems like this shouldn't be hardcoded. */ - type = get_typed_class("Xen", base_type); - + type = get_typed_class("Xen", ind_name); + + CU_DEBUG("stdi_raise"); + CU_DEBUG("broker %p, context %p, type %s, ns %s, ind %p", + _BROKER, context, type, ns, ind); s = stdi_raise_indication(_BROKER, context, type, ns, ind); + CU_DEBUG("raise done"); free(type); @@ -297,41 +329,95 @@ static CMPIInstance *prepare_indication( static CMPIInstance *prepare_indication(const CMPIBroker *broker, CMPIInstance *inst, char *ns, + int ind_type, CMPIStatus *s) { + char *ind_name = NULL; CMPIInstance *ind = NULL; CMPIInstance *prev_inst = NULL; - CU_DEBUG("Creating indication."); + ind_name = ind_type_to_name(ind_type); + + CU_DEBUG("Creating indication: '%s:%s_%s'", + ns, "Xen", ind_name); /* Prefix needs to be dynamic */ - ind = get_typed_instance(broker, - "Xen", - "ComputerSystemMigrationIndication", - ns); + ind = get_typed_instance(broker, "Xen", ind_name, ns); /* Prefix needs to be dynamic */ if (ind == NULL) { CU_DEBUG("Failed to create ind, type '%s:%s_%s'", - ns, - "Xen", - "ComputerSystemMigrationIndication"); - } - - /* Need to copy job inst before attaching as PreviousInstance because - otherwise the changes we are about to make to job inst are made - to PreviousInstance as well. */ - prev_inst = cu_dup_instance(_BROKER, inst, s); - if (s->rc != CMPI_RC_OK || prev_inst == NULL) { - CU_DEBUG("dup_instance failed (%i:%s)", s->rc, s->msg); - ind = NULL; - goto out; - } - - CU_DEBUG("Setting PreviousInstance"); - CMSetProperty(ind, "PreviousInstance", - (CMPIValue *)&prev_inst, CMPI_instance); + ns, "Xen", ind_name); + } + + if (ind_type == MIG_MODIFIED) { + /* Need to copy job inst before attaching as PreviousInstance because + otherwise the changes we are about to make to job inst are made + to PreviousInstance as well. */ + prev_inst = cu_dup_instance(_BROKER, inst, s); + if (s->rc != CMPI_RC_OK || prev_inst == NULL) { + CU_DEBUG("dup_instance failed (%i:%s)", s->rc, s->msg); + ind = NULL; + goto out; + } + CU_DEBUG("Setting PreviousInstance"); + CMSetProperty(ind, "PreviousInstance", + (CMPIValue *)&prev_inst, CMPI_instance); + } out: return ind; +} + +static CMPIObjectPath *ref_from_job(struct migration_job *job, + CMPIStatus *s) +{ + CMPIObjectPath *ref = NULL; + + ref = CMNewObjectPath(_BROKER, + job->ref_ns, + "Virt_MigrationJob", + s); + if (s->rc != CMPI_RC_OK) { + CU_DEBUG("Failed to create job ref for update"); + goto out; + } + + CMSetNameSpace(ref, job->ref_ns); + CMAddKey(ref, "InstanceID", (CMPIValue *)job->uuid, CMPI_chars); + + CU_DEBUG("Getting job instance %s", job->uuid); + CU_DEBUG(" REF: %s", CMGetCharPtr(CMObjectPathToString(ref, NULL))); + + out: + return ref; +} + +static void raise_deleted_ind(struct migration_job *job) +{ + CMPIInstance *ind = NULL; + CMPIInstance *inst = NULL; + CMPIObjectPath *ref = NULL; + CMPIStatus s = {CMPI_RC_OK, NULL}; + bool rc; + + ref = ref_from_job(job, &s); + if ((ref == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job ref for delete"); + return; + } + inst = CBGetInstance(_BROKER, job->context, ref, NULL, &s); + if ((inst == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job instance for delete (%i)", s.rc); + return; + } + + ind = prepare_indication(_BROKER, inst, job->ref_ns, MIG_DELETED, &s); + + rc = raise_indication(job->context, MIG_MODIFIED, job->ref_ns, + inst, ind); + if (!rc) + CU_DEBUG("Failed to raise indication"); + + return; } static void migrate_job_set_state(struct migration_job *job, @@ -344,27 +430,18 @@ static void migrate_job_set_state(struct CMPIStatus s; CMPIObjectPath *op; - op = CMNewObjectPath(_BROKER, - job->ref_ns, - "Virt_MigrationJob", - &s); - if (s.rc != CMPI_RC_OK) { - CU_DEBUG("Failed to create job path for update"); + op = ref_from_job(job, &s); + if ((op == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job ref for update"); return; } - - CMSetNameSpace(op, job->ref_ns); - CMAddKey(op, "InstanceID", (CMPIValue *)job->uuid, CMPI_chars); - - CU_DEBUG("Getting job instance %s", job->uuid); - CU_DEBUG(" OP: %s", CMGetCharPtr(CMObjectPathToString(op, NULL))); inst = CBGetInstance(_BROKER, job->context, op, NULL, &s); if ((inst == NULL) || (s.rc != CMPI_RC_OK)) { CU_DEBUG("Failed to get job instance for update (%i)", s.rc); return; } - ind = prepare_indication(_BROKER, inst, job->ref_ns, &s); + ind = prepare_indication(_BROKER, inst, job->ref_ns, MIG_MODIFIED, &s); CMSetProperty(inst, "JobState", (CMPIValue *)&state, CMPI_uint16); @@ -378,11 +455,8 @@ static void migrate_job_set_state(struct CU_DEBUG("Failed to update job instance: %s", CMGetCharPtr(s.msg)); - rc = raise_indication(job->context, - "ComputerSystemMigrationIndication", - job->ref_ns, - inst, - ind); + rc = raise_indication(job->context, MIG_MODIFIED, job->ref_ns, + inst, ind); if (!rc) CU_DEBUG("Failed to raise indication"); } @@ -549,6 +623,8 @@ static CMPIStatus migrate_vs(struct migr ""); out: + raise_deleted_ind(job); + free(uri); free(xml); virDomainFree(dom); @@ -714,6 +790,9 @@ static CMPIStatus migrate_do(const CMPIO struct migration_job *job; CMPI_THREAD_TYPE thread; uint32_t retcode = 1; + CMPIInstance *ind = NULL; + CMPIInstance *inst = NULL; + bool rc; job = migrate_job_prepare(context, ref, domain, host, type); if (job == NULL) { @@ -728,8 +807,20 @@ static CMPIStatus migrate_do(const CMPIO s = migrate_create_job_instance(context, job, &job_op); if (s.rc != CMPI_RC_OK) goto out; - + CMAddArg(argsout, "Job", (CMPIValue *)&job_op, CMPI_ref); + + inst = CBGetInstance(_BROKER, job->context, job_op, NULL, &s); + if ((inst == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job instance for create ind", s.rc); + goto out; + } + + ind = prepare_indication(_BROKER, inst, job->ref_ns, MIG_CREATED, &s); + rc = raise_indication(job->context, MIG_CREATED, job->ref_ns, + inst, ind); + if (!rc) + CU_DEBUG("Failed to raise indication"); thread = _BROKER->xft->newThread((void*)migration_thread, job, 0); From kaitlin at linux.vnet.ibm.com Fri Mar 7 15:22:28 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 07:22:28 -0800 Subject: [Libvirt-cim] [PATCH 4 of 4] Add URI support to VSMigrationService In-Reply-To: <877igea89h.fsf@caffeine.beaverton.ibm.com> References: <363b5dd996619f5a8492.1204837613@elm3b41.beaverton.ibm.com> <877igea89h.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D15DB4.7090008@linux.vnet.ibm.com> Dan Smith wrote: > KR> + if (transport == CIM_MIGRATE_URI_TLS_STRICT) > KR> + rc = asprintf(&uri, "%s://%s/system/?no_verify=1", tport, dest); > KR> + else > KR> + rc = asprintf(&uri, "%s://%s/system/", tport, dest); > KR> + > KR> + if (rc == -1) > KR> uri = NULL; > KR> + > KR> + free(tport); > > This seems a tad ugly, since it's just a special case for one of the > transport types. Can we change the function to just construct a whole > URI for us, and pass in the class and the destination host? Yeah, that'll be a lot cleaner. It might make the function a little long, but definitely cleaner. > > KR> @@ -147,7 +186,7 @@ static CMPIStatus vs_migratable(const CM > KR> uint32_t retcode = 1; > KR> CMPIBoolean isMigratable = 0; > > KR> - uri = dest_uri(CLASSNAME(ref), destination); > KR> + uri = dest_uri(CLASSNAME(ref), destination, CIM_MIGRATE_URI_SSH); > > Is this hardcoding the check function to SSH? Ah, I meant to note this it the commit log. Yes, currently because I haven't added the MSD support to the vs_migratable() call (the migrate_do() equivalent for the Check() functions). This will be changed in a future patch. I'll grab the transport from the MSD and use that. Or, I can just add the MSD support for the Check() calls to this patchset. I don't mind either way. =) > > Otherwise I'm really happy with this set, thanks! > > -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From grendel at linux.vnet.ibm.com Fri Mar 7 15:24:14 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 10:24:14 -0500 Subject: [Libvirt-cim] [PATCH 2 of 4] Extend the VirtualSystemMigrationSettingData to include an attribute for transport method In-Reply-To: References: Message-ID: <47D15E1E.8060905@linux.vnet.ibm.com> Kaitlin Rupert wrote: > # HG changeset patch > # User Kaitlin Rupert > # Date 1204836739 28800 > # Node ID eb68bdbdf6ea6b596ceefd72a5547dfa65b27225 > # Parent 1e01f52781b5499949f498553b453f23af8feec2 > Extend the VirtualSystemMigrationSettingData to include an attribute for transport method. > > Possible transport methods are those supported by libvirt: ssh, tls, unix sockets, and tcp. > > Signed-off-by: Kaitlin Rupert > > diff -r 1e01f52781b5 -r eb68bdbdf6ea schema/VSMigrationSettingData.mof > --- a/schema/VSMigrationSettingData.mof Thu Mar 06 12:53:44 2008 -0800 > +++ b/schema/VSMigrationSettingData.mof Thu Mar 06 12:52:19 2008 -0800 > @@ -8,8 +8,34 @@ class CIM_VirtualSystemMigrationSettingD > > [Provider("cmpi::Virt_VSMigrationSettingData")] > class Xen_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { > + [ Description( > + "TransportType describes a type of transport used during the migration " > + "operation.\n" > + "A value of 2 - Virtual System is to be migrated using SSH.\n" > + "A value of 3 - Virtual System is to be migrated using TLS.\n" > + "A value of 4 - Virtual System is to be migrated using TLS with strict" > + "verifcation of the remote certificates.\n" > + "A value of 5 - Virtual System is to be migrated using TCP.\n" > + "A value of 6 - Virtual System is to be migrated using UNIX sockets" > + "(localhost only).\n"), > + ValueMap {"0","1","2","3","4","5","6"}, > + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] > + uint16 TransportType; > }; > > [Provider("cmpi::Virt_VSMigrationSettingData")] > class KVM_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { > + [ Description( > + "TransportType describes a type of transport used during the migration " > + "operation.\n" > + "A value of 2 - Virtual System is to be migrated using SSH.\n" > + "A value of 3 - Virtual System is to be migrated using TLS.\n" > + "A value of 4 - Virtual System is to be migrated using TLS with strict" > + "verifcation of the remote certificates.\n" > + "A value of 5 - Virtual System is to be migrated using TCP.\n" > + "A value of 6 - Virtual System is to be migrated using UNIX sockets" > + "(localhost only).\n"), > + ValueMap {"0","1","2","3","4","5","6"}, > + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] > + uint16 TransportType; > }; > > I guess it speaks well for the quality of the set that I have to resort to picking on string literals in a mof file, but IMHO the description is a bit on the verbose side. I'm all for people actually giving descriptions, but really it doesn't seem like the per-value description offers any information that's not already pretty explicit in ValueMap/Values pair. Thoughts, anybody? -- -Jay From danms at us.ibm.com Fri Mar 7 15:45:25 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 07:45:25 -0800 Subject: [Libvirt-cim] [PATCH 3 of 3] Migration Job Indication In-Reply-To: <1ccab6e9470c08a4dd6f.1204902055@naegling> (Jay Gagnon's message of "Fri, 07 Mar 2008 10:00:55 -0500") References: <1ccab6e9470c08a4dd6f.1204902055@naegling> Message-ID: <87ve3y8rmy.fsf@caffeine.beaverton.ibm.com> JG> +static char *ind_type_to_name(int ind_type) const. JG> +{ JG> + char *ind_name = NULL; const. JG> + switch (ind_type) { JG> + case MIG_CREATED: JG> + ind_name = "ComputerSystemMigrationJobCreatedIndication"; JG> + break; JG> + case MIG_DELETED: JG> + ind_name = "ComputerSystemMigrationJobDeletedIndication"; JG> + break; JG> + case MIG_MODIFIED: JG> + ind_name = "ComputerSystemMigrationJobModifiedIndication"; JG> + break; JG> + } JG> + JG> + return ind_name; JG> +} JG> + JG> static bool raise_indication(const CMPIContext *context, JG> - const char *base_type, JG> + int ind_type, JG> const char *ns, JG> CMPIInstance *inst, JG> CMPIInstance *ind) JG> { JG> char *type; JG> CMPIStatus s; JG> + char *ind_name = NULL; const. JG> + JG> + ind_name = ind_type_to_name(ind_type); JG> CU_DEBUG("Setting SourceInstance"); JG> CMSetProperty(ind, "SourceInstance", JG> (CMPIValue *)&inst, CMPI_instance); JG> /* Seems like this shouldn't be hardcoded. */ JG> - type = get_typed_class("Xen", base_type); JG> - JG> + type = get_typed_class("Xen", ind_name); JG> + JG> + CU_DEBUG("stdi_raise"); JG> + CU_DEBUG("broker %p, context %p, type %s, ns %s, ind %p", JG> + _BROKER, context, type, ns, ind); JG> s = stdi_raise_indication(_BROKER, context, type, ns, ind); JG> + CU_DEBUG("raise done"); This debug looks a little overkill, likely related to your fight with sfcb. JG> +static CMPIObjectPath *ref_from_job(struct migration_job *job, JG> + CMPIStatus *s) JG> +{ JG> + CMPIObjectPath *ref = NULL; JG> + JG> + ref = CMNewObjectPath(_BROKER, JG> + job->ref_ns, JG> + "Virt_MigrationJob", JG> + s); JG> + if (s->rc != CMPI_RC_OK) { JG> + CU_DEBUG("Failed to create job ref for update"); JG> + goto out; JG> + } JG> + JG> + CMSetNameSpace(ref, job->ref_ns); JG> + CMAddKey(ref, "InstanceID", (CMPIValue *)job->uuid, CMPI_chars); JG> + JG> + CU_DEBUG("Getting job instance %s", job->uuid); JG> + CU_DEBUG(" REF: %s", CMGetCharPtr(CMObjectPathToString(ref, NULL))); This debug is a little misleading, isn't it? Doesn't look like you're about to do anything like "Getting job instance" right after this. JG> - rc = raise_indication(job->context, JG> - "ComputerSystemMigrationIndication", JG> - job->ref_ns, JG> - inst, JG> - ind); JG> + rc = raise_indication(job->context, MIG_MODIFIED, job->ref_ns, JG> + inst, ind); Bzzzt. I just called Heidi on this, so I'm not going to let you slide either... :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 7 15:46:36 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 07:46:36 -0800 Subject: [Libvirt-cim] [PATCH 2 of 4] Extend the VirtualSystemMigrationSettingData to include an attribute for transport method In-Reply-To: <47D15E1E.8060905@linux.vnet.ibm.com> (Jay Gagnon's message of "Fri, 07 Mar 2008 10:24:14 -0500") References: <47D15E1E.8060905@linux.vnet.ibm.com> Message-ID: <87r6em8rkz.fsf@caffeine.beaverton.ibm.com> JG> I guess it speaks well for the quality of the set that I have to JG> resort to picking on string literals in a mof file, but IMHO the JG> description is a bit on the verbose side. I'm all for people JG> actually giving descriptions, but really it doesn't seem like the JG> per-value description offers any information that's not already JG> pretty explicit in ValueMap/Values pair. Thoughts, anybody? Agreed. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 7 16:19:55 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 08:19:55 -0800 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: (Heidi Eckhart's message of "Fri, 07 Mar 2008 13:20:24 +0100") References: Message-ID: <87lk4u8q1g.fsf@caffeine.beaverton.ibm.com> HE> diff -r 0a71dab025de -r f7afada7979c libxkutil/device_parsing.h HE> --- a/libxkutil/device_parsing.h Thu Mar 06 09:59:23 2008 +0800 HE> +++ b/libxkutil/device_parsing.h Fri Mar 07 12:30:05 2008 +0100 HE> @@ -64,11 +64,11 @@ struct graphics_device { HE> struct virt_device { HE> enum { HE> - VIRT_DEV_NET = CIM_RASD_TYPE_NET, HE> - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, HE> - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, HE> - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, HE> - VIRT_DEV_UNKNOWN = 1000, HE> + VIRT_DEV_NET = CIM_RES_TYPE_NET, HE> + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, HE> + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, HE> + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, HE> + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, HE> VIRT_DEV_EMU, HE> VIRT_DEV_GRAPHICS, HE> } type; I have applied this set to avoid dragging this out any further, but I would like to see a follow-on set that removes all of the VIRT_DEV_foo types in favor of CIM_RES_TYPE_foo. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 7 16:32:03 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 08:32:03 -0800 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes References: <50f47a071fb1d4668a5e.1204892803@localhost.localdomain> Message-ID: <877ige8ph8.fsf@caffeine.beaverton.ibm.com> HE> # HG changeset patch HE> # User Heidi Eckhart HE> # Date 1204892342 -3600 HE> # Node ID 50f47a071fb1d4668a5eb1b3e0c649f87ce8f376 HE> # Parent 366b317afbf382f85ed75b86b6df9eae30dd6c94 HE> EAFP: adopt Device interface changes This patch is throwing a reject for me: src/Virt_ElementAllocatedFromPool.c Hunk #1 succeeded at 73 with fuzz 1 (offset -4 lines). Hunk #2 FAILED at 134. Hunk #4 succeeded at 168 with fuzz 2 (offset -2 lines). 1 out of 4 hunks FAILED -- saving rejects to file src/Virt_ElementAllocatedFromPool.c.rej The actual rejected hunk is: *************** *** 134,180 **** return dest->cur; } - static int devs_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - struct inst_list *list) - { - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - const char *ns = NAMESPACE(ref); - const char *cn = CLASSNAME(ref); - - conn = connect_by_classname(_BROKER, cn, &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - dom_devices(_BROKER, doms[i], ns, type, &tmp); - - filter_by_pool(list, &tmp, type, poolid); - - inst_list_free(&tmp); - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; - } - static CMPIStatus pool_to_vdev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) --- 134,139 ---- return dest->cur; } static CMPIStatus pool_to_vdev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) I applied this after this set: Update resource types to CIM_RES_TYPE_foo and Adopt changes to affected providers Did I mess up the order? Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Fri Mar 7 16:46:52 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 08:46:52 -0800 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: References: Message-ID: <47D1717C.4010109@linux.vnet.ibm.com> > diff -r 0a71dab025de -r f7afada7979c libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Thu Mar 06 09:59:23 2008 +0800 > +++ b/libxkutil/device_parsing.h Fri Mar 07 12:30:05 2008 +0100 > @@ -64,11 +64,11 @@ struct graphics_device { > > struct virt_device { > enum { > - VIRT_DEV_NET = CIM_RASD_TYPE_NET, > - VIRT_DEV_DISK = CIM_RASD_TYPE_DISK, > - VIRT_DEV_MEM = CIM_RASD_TYPE_MEM, > - VIRT_DEV_VCPU = CIM_RASD_TYPE_PROC, > - VIRT_DEV_UNKNOWN = 1000, > + VIRT_DEV_NET = CIM_RES_TYPE_NET, > + VIRT_DEV_DISK = CIM_RES_TYPE_DISK, > + VIRT_DEV_MEM = CIM_RES_TYPE_MEM, > + VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, > + VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, > VIRT_DEV_EMU, > VIRT_DEV_GRAPHICS, This set applied and test fine on my system. I'm guessing the VIRT_DEV_* pieces were left here so that this set could be applied without breaking providers that still use VIRT_DEV_*. I think this set is good to go as long as the VIRT_DEV_* enum is cleaned up once all the references to VIRT_DEV_* are removed. Thoughts? -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 17:20:33 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 09:20:33 -0800 Subject: [Libvirt-cim] [PATCH 0 of 6] #3 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs In-Reply-To: References: Message-ID: <47D17961.6030607@linux.vnet.ibm.com> Heidi Eckhart wrote: > Adopted the get_() function look and feel to the DevicePool provider. > Updated the association providers that uses these functions. > > Diff to patch set 1: > - patch #1 (svpc_types) - add Resource Pool types to svpc_types.h and map existing types to > base resource types > - patch #2 (DevicePool) - implement configurable enum_pools() function; adopt resource types > - patch #6 (EAFP) - adopt resource types; validate client given device ref > - patch #7 (AC) - adopt DevicePool interface changes; updated NOT_FOUND error message to be > consistent with others > > Diff to patch set 2: > - unified resource types to CIM_RES_TYPE_foo and adopted these changes to the providers > - fixed some style issues > > Diff to patch set 3: > - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set > This set applied and tested fine on my system. No complaints. =) +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 17:24:48 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 09:24:48 -0800 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes In-Reply-To: <877ige8ph8.fsf@caffeine.beaverton.ibm.com> References: <50f47a071fb1d4668a5e.1204892803@localhost.localdomain> <877ige8ph8.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D17A60.4020105@linux.vnet.ibm.com> > > I applied this after this set: > > Update resource types to CIM_RES_TYPE_foo and Adopt changes to > affected providers > > Did I mess up the order? Thanks! > This applied alright for me. Here's the order I applied in: [PATCH 0 of 7] Update resource types to CIM_RES_TYPE_foo and Adopt changes to affected providers [PATCH 0 of 6] #3 - Adopt get_() common look and feel to DevicePool and Adopted interface changes to assocs [PATCH 0 of 3] #3 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP Sounds like the same order though. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 17:54:46 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 09:54:46 -0800 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> References: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> Message-ID: <47D18166.5040504@linux.vnet.ibm.com> > +static CMPIStatus _enum_devices(const CMPIBroker *broker, > + const CMPIObjectPath *reference, > + const virDomainPtr dom, > + const uint16_t type, > + struct inst_list *list) > +{ > + CMPIStatus s; > + > + if (type == CIM_RES_TYPE_ALL) { > + s = _get_devices(broker, > + reference, > + dom, > + CIM_RES_TYPE_PROC, > + list); > + s = _get_devices(broker, > + reference, > + dom, > + CIM_RES_TYPE_MEM, > + list); > + s = _get_devices(broker, > + reference, > + dom, > + CIM_RES_TYPE_NET, > + list); > + s = _get_devices(broker, > + reference, > + dom, > + CIM_RES_TYPE_DISK, > + list); > + } Would it be better to have a list of all the resource types, and then call _get_devices() in a loop? This is probably fine as is, and I don't suspect we'll add more resource types in the future, so it's probably not worth worrying about. Thoughts? > + > +static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, > + const CMPIResult *results, > + int names_only) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > struct inst_list list; > > if (!provider_is_responsible(_BROKER, reference, &s)) > - return s; > + goto out; > > inst_list_init(&list); > > - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); > - if (conn == NULL) > - return s; > - > - if (!dom_list_devices(conn, reference, &list)) { > - cu_statusf(_BROKER, &s, > - CMPI_RC_ERR_FAILED, > - "Failed to list domains"); > - return s; > - } > + s = enum_devices(_BROKER, reference, NULL, > + device_type_from_classname(CLASSNAME(reference)), > + &list); > + if (s.rc != CMPI_RC_OK) > + goto out; > > if (list.cur == 0) > goto out; Should inst_list_free(&list); go after the out:? Even if list.cur == 0, we still probably want to set list->list = NULL to be sure. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 18:12:00 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 10:12:00 -0800 Subject: [Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes In-Reply-To: References: Message-ID: <47D18570.5070101@linux.vnet.ibm.com> > static CMPIStatus pool_to_rasd(const CMPIObjectPath *ref, > struct std_assoc_info *info, > struct inst_list *list) > @@ -176,7 +130,8 @@ static CMPIStatus pool_to_rasd(const CMP > CMPIStatus s = {CMPI_RC_OK, NULL}; > const char *poolid; > uint16_t type; > - CMPIInstance *inst; > + CMPIInstance *inst = NULL; > + struct inst_list tmp_list; > > if (!match_hypervisor_prefix(ref, info)) > goto out; > @@ -200,11 +155,16 @@ static CMPIStatus pool_to_rasd(const CMP > goto out; > } > > - rasds_from_pool(type, > - ref, > - poolid, > - info->properties, > - list); > + inst_list_init(&tmp_list); > + > + s = enum_rasds(_BROKER, > + ref, > + NULL, > + type, > + info->properties, > + &tmp_list); > + > + filter_by_pool(list, &tmp_list, poolid); > > out: > return s; > tmp_list doesn't get freed here. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 18:13:08 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 10:13:08 -0800 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: References: Message-ID: <47D185B4.1060000@linux.vnet.ibm.com> > +static CMPIStatus _enum_rasds(const CMPIBroker *broker, > + const CMPIObjectPath *reference, > + const virDomainPtr dom, > + const uint16_t type, > const char **properties, > struct inst_list *list) > { > + CMPIStatus s; > + > + if (type == CIM_RES_TYPE_ALL) { > + s = _get_rasds(broker, reference, dom, > + CIM_RES_TYPE_PROC, > + properties, list); > + s = _get_rasds(broker, reference, dom, > + CIM_RES_TYPE_MEM, > + properties, list); > + s = _get_rasds(broker, reference, dom, > + CIM_RES_TYPE_NET, > + properties, list); > + s = _get_rasds(broker, reference, dom, > + CIM_RES_TYPE_DISK, > + properties, list); > + } Probably not worth worrying about, but wondering if this could be condensed some.. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 18:16:55 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 10:16:55 -0800 Subject: [Libvirt-cim] [PATCH 0 of 3] #2 - Renamed device function for constistency with other providers In-Reply-To: References: Message-ID: <47D18697.4000502@linux.vnet.ibm.com> Heidi Eckhart wrote: > Renamed the device_type_by_classname() to res_type_by_device_classname() for consistency with other interfaces. > > Diff to patch set 1: > - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set > Looks good. +1 This is dependent on some of the other previous patchsets, but once those go in, I think this should be good too. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Fri Mar 7 18:47:41 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 10:47:41 -0800 Subject: [Libvirt-cim] [PATCH 4 of 4] Add URI support to VSMigrationService In-Reply-To: <47D15DB4.7090008@linux.vnet.ibm.com> (Kaitlin Rupert's message of "Fri, 07 Mar 2008 07:22:28 -0800") References: <363b5dd996619f5a8492.1204837613@elm3b41.beaverton.ibm.com> <877igea89h.fsf@caffeine.beaverton.ibm.com> <47D15DB4.7090008@linux.vnet.ibm.com> Message-ID: <87wsoe74mq.fsf@caffeine.beaverton.ibm.com> KR> This will be changed in a future patch. I'll grab the transport KR> from the MSD and use that. KR> Or, I can just add the MSD support for the Check() calls to this KR> patchset. I don't mind either way. =) Ah, okay, that's fine. Just wanted to point it out if it was an oversight. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Fri Mar 7 18:55:16 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 13:55:16 -0500 Subject: [Libvirt-cim] [PATCH 3 of 3] Migration Job Indication In-Reply-To: <87ve3y8rmy.fsf@caffeine.beaverton.ibm.com> References: <1ccab6e9470c08a4dd6f.1204902055@naegling> <87ve3y8rmy.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D18F94.70700@linux.vnet.ibm.com> Dan Smith wrote: > JG> +static char *ind_type_to_name(int ind_type) > > const. > > JG> +{ > JG> + char *ind_name = NULL; > > const. > > JG> + switch (ind_type) { > JG> + case MIG_CREATED: > JG> + ind_name = "ComputerSystemMigrationJobCreatedIndication"; > JG> + break; > JG> + case MIG_DELETED: > JG> + ind_name = "ComputerSystemMigrationJobDeletedIndication"; > JG> + break; > JG> + case MIG_MODIFIED: > JG> + ind_name = "ComputerSystemMigrationJobModifiedIndication"; > JG> + break; > JG> + } > JG> + > JG> + return ind_name; > JG> +} > JG> + > JG> static bool raise_indication(const CMPIContext *context, > JG> - const char *base_type, > JG> + int ind_type, > JG> const char *ns, > JG> CMPIInstance *inst, > JG> CMPIInstance *ind) > JG> { > JG> char *type; > JG> CMPIStatus s; > JG> + char *ind_name = NULL; > > const. > I'm never gonna figure that out, am I? > JG> + > JG> + ind_name = ind_type_to_name(ind_type); > > JG> CU_DEBUG("Setting SourceInstance"); > JG> CMSetProperty(ind, "SourceInstance", > JG> (CMPIValue *)&inst, CMPI_instance); > > JG> /* Seems like this shouldn't be hardcoded. */ > JG> - type = get_typed_class("Xen", base_type); > JG> - > JG> + type = get_typed_class("Xen", ind_name); > JG> + > JG> + CU_DEBUG("stdi_raise"); > JG> + CU_DEBUG("broker %p, context %p, type %s, ns %s, ind %p", > JG> + _BROKER, context, type, ns, ind); > JG> s = stdi_raise_indication(_BROKER, context, type, ns, ind); > JG> + CU_DEBUG("raise done"); > > This debug looks a little overkill, likely related to your fight with > sfcb. > Yea, that's a leftover. It can go. > JG> +static CMPIObjectPath *ref_from_job(struct migration_job *job, > JG> + CMPIStatus *s) > JG> +{ > JG> + CMPIObjectPath *ref = NULL; > JG> + > JG> + ref = CMNewObjectPath(_BROKER, > JG> + job->ref_ns, > JG> + "Virt_MigrationJob", > JG> + s); > JG> + if (s->rc != CMPI_RC_OK) { > JG> + CU_DEBUG("Failed to create job ref for update"); > JG> + goto out; > JG> + } > JG> + > JG> + CMSetNameSpace(ref, job->ref_ns); > JG> + CMAddKey(ref, "InstanceID", (CMPIValue *)job->uuid, CMPI_chars); > JG> + > JG> + CU_DEBUG("Getting job instance %s", job->uuid); > JG> + CU_DEBUG(" REF: %s", CMGetCharPtr(CMObjectPathToString(ref, NULL))); > > This debug is a little misleading, isn't it? Doesn't look like you're > about to do anything like "Getting job instance" right after this. > I'm the victim of a cut-paste there. That debug made sense when it was actually right before the code that got the instance, but when I separated the ref code from the inst code I totally missed it. I still like having the ref output there, though. It's a convenient double-check. > JG> - rc = raise_indication(job->context, > JG> - "ComputerSystemMigrationIndication", > JG> - job->ref_ns, > JG> - inst, > JG> - ind); > JG> + rc = raise_indication(job->context, MIG_MODIFIED, job->ref_ns, > JG> + inst, ind); > > Bzzzt. I just called Heidi on this, so I'm not going to let you slide > either... :) > Grumble, grumble... -- -Jay From danms at us.ibm.com Fri Mar 7 19:03:16 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 11:03:16 -0800 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> (Heidi Eckhart's message of "Fri, 07 Mar 2008 13:26:41 +0100") References: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> Message-ID: <87r6em73wr.fsf@caffeine.beaverton.ibm.com> HE> + s = enum_devices(_BROKER, reference, NULL, HE> + device_type_from_classname(CLASSNAME(reference)), HE> + &list); This should be one argument per line. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 7 19:05:18 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 11:05:18 -0800 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: (Heidi Eckhart's message of "Fri, 07 Mar 2008 13:28:20 +0100") References: Message-ID: <87mypa73td.fsf@caffeine.beaverton.ibm.com> HE> + if (type == CIM_RES_TYPE_ALL) { HE> + s = _get_rasds(broker, reference, dom, HE> + CIM_RES_TYPE_PROC, HE> + properties, list); HE> + s = _get_rasds(broker, reference, dom, HE> + CIM_RES_TYPE_MEM, HE> + properties, list); HE> + s = _get_rasds(broker, reference, dom, HE> + CIM_RES_TYPE_NET, HE> + properties, list); HE> + s = _get_rasds(broker, reference, dom, HE> + CIM_RES_TYPE_DISK, HE> + properties, list); HE> + } HE> + else HE> + s = _get_rasds(broker, reference, dom, HE> + type, properties, list); These function calls should be one parameter per line. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 7 19:09:47 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 11:09:47 -0800 Subject: [Libvirt-cim] [PATCH 3 of 3] Migration Job Indication In-Reply-To: <47D18F94.70700@linux.vnet.ibm.com> (Jay Gagnon's message of "Fri, 07 Mar 2008 13:55:16 -0500") References: <1ccab6e9470c08a4dd6f.1204902055@naegling> <87ve3y8rmy.fsf@caffeine.beaverton.ibm.com> <47D18F94.70700@linux.vnet.ibm.com> Message-ID: <87iqzy73lw.fsf@caffeine.beaverton.ibm.com> JG> I'm the victim of a cut-paste there. That debug made sense when JG> it was actually right before the code that got the instance, but JG> when I separated the ref code from the inst code I totally missed JG> it. I still like having the ref output there, though. It's a JG> convenient double-check. Indeed, just make the message a little more accurate, like "Here is my ref:" or something :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 7 19:10:21 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 07 Mar 2008 11:10:21 -0800 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes In-Reply-To: <47D17A60.4020105@linux.vnet.ibm.com> (Kaitlin Rupert's message of "Fri, 07 Mar 2008 09:24:48 -0800") References: <50f47a071fb1d4668a5e.1204892803@localhost.localdomain> <877ige8ph8.fsf@caffeine.beaverton.ibm.com> <47D17A60.4020105@linux.vnet.ibm.com> Message-ID: <87ejam73ky.fsf@caffeine.beaverton.ibm.com> KR> This applied alright for me. Here's the order I applied in: KR> [PATCH 0 of 7] Update resource types to CIM_RES_TYPE_foo and Adopt KR> changes to affected providers KR> [PATCH 0 of 6] #3 - Adopt get_() common look and feel to DevicePool KR> and Adopted interface changes to assocs KR> [PATCH 0 of 3] #3 - Add configurable enum_devices() to Device provider KR> and Adopt interface changes to SD & EAFP Okay, I was missing the 6-set in the middle, as it showed up much later in my mailer. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Fri Mar 7 21:18:33 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 16:18:33 -0500 Subject: [Libvirt-cim] [PATCH 0 of 3] Migration Job Indications Message-ID: Just a few changes, detailed per patch. I believe all changes are actually in the third patch. From grendel at linux.vnet.ibm.com Fri Mar 7 21:18:36 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 16:18:36 -0500 Subject: [Libvirt-cim] [PATCH 3 of 3] (#2) Migration Job Indication In-Reply-To: Message-ID: <83986db760d928d49ddf.1204924716@naegling> # HG changeset patch # User Jay Gagnon # Date 1204924688 18000 # Node ID 83986db760d928d49ddf7c5f5c8dfb38eb47e3e6 # Parent 93787c5830dee7da979937945c1e9437d4780f37 (#2) Migration Job Indication We need to add some more indication to VS_MigrationService. ComputerSystemMigrationIndication is getting broken up into ComputerSystemMigrationJob[Created|Modified|Deleted]Indication, so that we can give clients that did not initiate the migration a better idea of what's going on. Each migration will fire a couple additional indications now. Changes required to make this happen: Enumeration of supported indication types. A new function ind_type_to_name. Converts int from the enumeration to an indication name. A new function ref_from_job (migration_job struct -> objectpath). This is mainly existing functionality but is now needed in two places. A new function raise_deleted_ind. The work required to raise the Deleted indication was cluttering up migrate_vs so I broke it out. Changes to prepare_indication and raise_indication to accomodate the new indication types. Then of course a few lines to actually use the new stuff. Changes from 1 to 2: const keywords like woah. Maybe their right. I don't get any compile errors. Removed some extraneous and/or misleading debug. Made a few calls mult-line again. Added seemingly redundant CMSetNameSpace call to prop up Pegasus. Signed-off-by: Jay Gagnon diff -r 93787c5830de -r 83986db760d9 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Fri Mar 07 10:31:43 2008 -0500 +++ b/src/Virt_VSMigrationService.c Fri Mar 07 16:18:08 2008 -0500 @@ -51,6 +51,12 @@ const static CMPIBroker *_BROKER; +enum { + MIG_CREATED, + MIG_MODIFIED, + MIG_DELETED, +}; + struct migration_job { CMPIContext *context; char *domain; @@ -271,21 +277,43 @@ static CMPIStatus vs_migratable_system(C return vs_migratable(ref, name, dname, results, argsout); } +static const char *ind_type_to_name(int ind_type) +{ + const char *ind_name = NULL; + + switch (ind_type) { + case MIG_CREATED: + ind_name = "ComputerSystemMigrationJobCreatedIndication"; + break; + case MIG_DELETED: + ind_name = "ComputerSystemMigrationJobDeletedIndication"; + break; + case MIG_MODIFIED: + ind_name = "ComputerSystemMigrationJobModifiedIndication"; + break; + } + + return ind_name; +} + static bool raise_indication(const CMPIContext *context, - const char *base_type, + int ind_type, const char *ns, CMPIInstance *inst, CMPIInstance *ind) { char *type; CMPIStatus s; + const char *ind_name = NULL; + + ind_name = ind_type_to_name(ind_type); CU_DEBUG("Setting SourceInstance"); CMSetProperty(ind, "SourceInstance", (CMPIValue *)&inst, CMPI_instance); /* Seems like this shouldn't be hardcoded. */ - type = get_typed_class("Xen", base_type); + type = get_typed_class("Xen", ind_name); s = stdi_raise_indication(_BROKER, context, type, ns, ind); @@ -297,41 +325,97 @@ static CMPIInstance *prepare_indication( static CMPIInstance *prepare_indication(const CMPIBroker *broker, CMPIInstance *inst, char *ns, + int ind_type, CMPIStatus *s) { + const char *ind_name = NULL; CMPIInstance *ind = NULL; CMPIInstance *prev_inst = NULL; + ind_name = ind_type_to_name(ind_type); + CU_DEBUG("Creating indication."); /* Prefix needs to be dynamic */ - ind = get_typed_instance(broker, - "Xen", - "ComputerSystemMigrationIndication", + ind = get_typed_instance(broker, + "Xen", + ind_name, ns); /* Prefix needs to be dynamic */ if (ind == NULL) { CU_DEBUG("Failed to create ind, type '%s:%s_%s'", - ns, - "Xen", - "ComputerSystemMigrationIndication"); - } - - /* Need to copy job inst before attaching as PreviousInstance because - otherwise the changes we are about to make to job inst are made - to PreviousInstance as well. */ - prev_inst = cu_dup_instance(_BROKER, inst, s); - if (s->rc != CMPI_RC_OK || prev_inst == NULL) { - CU_DEBUG("dup_instance failed (%i:%s)", s->rc, s->msg); - ind = NULL; - goto out; - } - - CU_DEBUG("Setting PreviousInstance"); - CMSetProperty(ind, "PreviousInstance", - (CMPIValue *)&prev_inst, CMPI_instance); + ns, "Xen", ind_name); + } + + if (ind_type == MIG_MODIFIED) { + /* Need to copy job inst before attaching as PreviousInstance because + otherwise the changes we are about to make to job inst are made + to PreviousInstance as well. */ + prev_inst = cu_dup_instance(_BROKER, inst, s); + if (s->rc != CMPI_RC_OK || prev_inst == NULL) { + CU_DEBUG("dup_instance failed (%i:%s)", s->rc, s->msg); + ind = NULL; + goto out; + } + CU_DEBUG("Setting PreviousInstance"); + CMSetProperty(ind, "PreviousInstance", + (CMPIValue *)&prev_inst, CMPI_instance); + } out: return ind; +} + +static CMPIObjectPath *ref_from_job(struct migration_job *job, + CMPIStatus *s) +{ + CMPIObjectPath *ref = NULL; + + ref = CMNewObjectPath(_BROKER, + job->ref_ns, + "Virt_MigrationJob", + s); + if (s->rc != CMPI_RC_OK) { + CU_DEBUG("Failed to create job ref for update"); + goto out; + } + + CMSetNameSpace(ref, job->ref_ns); + CMAddKey(ref, "InstanceID", (CMPIValue *)job->uuid, CMPI_chars); + + CU_DEBUG(" MigrationJob ref: %s", + CMGetCharPtr(CMObjectPathToString(ref, NULL))); + + out: + return ref; +} + +static void raise_deleted_ind(struct migration_job *job) +{ + CMPIInstance *ind = NULL; + CMPIInstance *inst = NULL; + CMPIObjectPath *ref = NULL; + CMPIStatus s = {CMPI_RC_OK, NULL}; + bool rc; + + ref = ref_from_job(job, &s); + if ((ref == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job ref for delete"); + return; + } + inst = CBGetInstance(_BROKER, job->context, ref, NULL, &s); + if ((inst == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job instance for delete (%i)", s.rc); + return; + } + + ind = prepare_indication(_BROKER, inst, job->ref_ns, MIG_DELETED, &s); + + rc = raise_indication(job->context, MIG_MODIFIED, job->ref_ns, + inst, ind); + if (!rc) + CU_DEBUG("Failed to raise indication"); + + return; } static void migrate_job_set_state(struct migration_job *job, @@ -344,27 +428,18 @@ static void migrate_job_set_state(struct CMPIStatus s; CMPIObjectPath *op; - op = CMNewObjectPath(_BROKER, - job->ref_ns, - "Virt_MigrationJob", - &s); - if (s.rc != CMPI_RC_OK) { - CU_DEBUG("Failed to create job path for update"); + op = ref_from_job(job, &s); + if ((op == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job ref for update"); return; } - - CMSetNameSpace(op, job->ref_ns); - CMAddKey(op, "InstanceID", (CMPIValue *)job->uuid, CMPI_chars); - - CU_DEBUG("Getting job instance %s", job->uuid); - CU_DEBUG(" OP: %s", CMGetCharPtr(CMObjectPathToString(op, NULL))); inst = CBGetInstance(_BROKER, job->context, op, NULL, &s); if ((inst == NULL) || (s.rc != CMPI_RC_OK)) { CU_DEBUG("Failed to get job instance for update (%i)", s.rc); return; } - ind = prepare_indication(_BROKER, inst, job->ref_ns, &s); + ind = prepare_indication(_BROKER, inst, job->ref_ns, MIG_MODIFIED, &s); CMSetProperty(inst, "JobState", (CMPIValue *)&state, CMPI_uint16); @@ -378,10 +453,10 @@ static void migrate_job_set_state(struct CU_DEBUG("Failed to update job instance: %s", CMGetCharPtr(s.msg)); - rc = raise_indication(job->context, - "ComputerSystemMigrationIndication", - job->ref_ns, - inst, + rc = raise_indication(job->context, + MIG_MODIFIED, + job->ref_ns, + inst, ind); if (!rc) CU_DEBUG("Failed to raise indication"); @@ -549,6 +624,8 @@ static CMPIStatus migrate_vs(struct migr ""); out: + raise_deleted_ind(job); + free(uri); free(xml); virDomainFree(dom); @@ -665,6 +742,7 @@ static CMPIStatus migrate_create_job_ins CMGetCharPtr(CMObjectPathToString(*job_op, NULL))); *job_op = CBCreateInstance(_BROKER, context, *job_op, jobinst, &s); + CMSetNameSpace(*job_op, job->ref_ns); if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(*job_op))) { CU_DEBUG("Failed to create job instance: %i", s.rc); goto out; @@ -714,6 +792,9 @@ static CMPIStatus migrate_do(const CMPIO struct migration_job *job; CMPI_THREAD_TYPE thread; uint32_t retcode = 1; + CMPIInstance *ind = NULL; + CMPIInstance *inst = NULL; + bool rc; job = migrate_job_prepare(context, ref, domain, host, type); if (job == NULL) { @@ -728,8 +809,20 @@ static CMPIStatus migrate_do(const CMPIO s = migrate_create_job_instance(context, job, &job_op); if (s.rc != CMPI_RC_OK) goto out; - + CMAddArg(argsout, "Job", (CMPIValue *)&job_op, CMPI_ref); + + inst = CBGetInstance(_BROKER, job->context, job_op, NULL, &s); + if ((inst == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Failed to get job instance for create ind", s.rc); + goto out; + } + + ind = prepare_indication(_BROKER, inst, job->ref_ns, MIG_CREATED, &s); + rc = raise_indication(job->context, MIG_CREATED, job->ref_ns, + inst, ind); + if (!rc) + CU_DEBUG("Failed to raise indication"); thread = _BROKER->xft->newThread((void*)migration_thread, job, 0); From grendel at linux.vnet.ibm.com Fri Mar 7 21:18:35 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 16:18:35 -0500 Subject: [Libvirt-cim] [PATCH 2 of 3] Convert CSMI for MigrationJob In-Reply-To: Message-ID: <93787c5830dee7da9799.1204924715@naegling> # HG changeset patch # User Jay Gagnon # Date 1204903903 18000 # Node ID 93787c5830dee7da979937945c1e9437d4780f37 # Parent d5574570a60216eadfe3a641d7672b5e23e1d9eb Convert CSMI for MigrationJob Nothing fancy here, just some filter updates. Signed-off-by: Jay Gagnon diff -r d5574570a602 -r 93787c5830de src/Virt_ComputerSystemMigrationIndication.c --- a/src/Virt_ComputerSystemMigrationIndication.c Fri Mar 07 10:31:40 2008 -0500 +++ b/src/Virt_ComputerSystemMigrationIndication.c Fri Mar 07 10:31:43 2008 -0500 @@ -42,10 +42,14 @@ static const CMPIBroker *_BROKER; -DECLARE_FILTER(xen_migrate, "Xen_ComputerSystemMigrationIndication"); +DECLARE_FILTER(xen_created, "Xen_ComputerSystemMigrationJobCreatedIndication"); +DECLARE_FILTER(xen_mod, "Xen_ComputerSystemMigrationJobModifiedIndication"); +DECLARE_FILTER(xen_deleted, "Xen_ComputerSystemMigrationJobDeletedIndication"); static struct std_ind_filter *filters[] = { - &xen_migrate, + &xen_created, + &xen_mod, + &xen_deleted, NULL, }; From grendel at linux.vnet.ibm.com Fri Mar 7 21:18:34 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 07 Mar 2008 16:18:34 -0500 Subject: [Libvirt-cim] [PATCH 1 of 3] MigrationJob schema changes In-Reply-To: Message-ID: # HG changeset patch # User Jay Gagnon # Date 1204903900 18000 # Node ID d5574570a60216eadfe3a641d7672b5e23e1d9eb # Parent 604bd97baadf924a706cdfc99ad8bc4eb2e2a6db MigrationJob schema changes Instead of just ComputerSystemMigrationIndication, we need three ComputerSystemMigrationJobIndication classes, for Created, Modified, and Deleted. Signed-off-by: Jay Gagnon diff -r 604bd97baadf -r d5574570a602 schema/ComputerSystemMigrationIndication.mof --- a/schema/ComputerSystemMigrationIndication.mof Wed Mar 05 07:02:25 2008 -0800 +++ b/schema/ComputerSystemMigrationIndication.mof Fri Mar 07 10:31:40 2008 -0500 @@ -3,7 +3,23 @@ [Description ("Xen_ComputerSystem migration status"), Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] -class Xen_ComputerSystemMigrationIndication : CIM_InstModification +class Xen_ComputerSystemMigrationJobCreatedIndication : CIM_InstCreation +{ + uint32 RaiseIndication([IN] CIM_InstCreation REF TheIndication); +}; + +[Description ("KVM_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class KVM_ComputerSystemMigrationJobCreatedIndication : CIM_InstCreation +{ + uint32 RaiseIndication([IN] CIM_InstCreation REF TheIndication); +}; + +[Description ("Xen_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class Xen_ComputerSystemMigrationJobModifiedIndication : CIM_InstModification { uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; @@ -11,7 +27,23 @@ class Xen_ComputerSystemMigrationIndicat [Description ("KVM_ComputerSystem migration status"), Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] -class KVM_ComputerSystemMigrationIndication : CIM_InstModification +class KVM_ComputerSystemMigrationJobModifiedIndication : CIM_InstModification { uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; + +[Description ("Xen_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class Xen_ComputerSystemMigrationJobDeletedIndication : CIM_InstDeletion +{ + uint32 RaiseIndication([IN] CIM_InstDeletion REF TheIndication); +}; + +[Description ("KVM_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class KVM_ComputerSystemMigrationJobDeletedIndication : CIM_InstDeletion +{ + uint32 RaiseIndication([IN] CIM_InstDeletion REF TheIndication); +}; diff -r 604bd97baadf -r d5574570a602 schema/ComputerSystemMigrationIndication.registration --- a/schema/ComputerSystemMigrationIndication.registration Wed Mar 05 07:02:25 2008 -0800 +++ b/schema/ComputerSystemMigrationIndication.registration Fri Mar 07 10:31:40 2008 -0500 @@ -1,4 +1,8 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes -Xen_ComputerSystemMigrationIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method -KVM_ComputerSystemMigrationIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +Xen_ComputerSystemMigrationJobCreatedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +Xen_ComputerSystemMigrationJobModifiedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +Xen_ComputerSystemMigrationJobDeletedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +KVM_ComputerSystemMigrationJobCreatedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +KVM_ComputerSystemMigrationJobModifiedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +KVM_ComputerSystemMigrationJobDeletedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method From kaitlin at linux.vnet.ibm.com Fri Mar 7 21:26:33 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 13:26:33 -0800 Subject: [Libvirt-cim] [PATCH 1 of 4] Reorganize VSMigrationService to prepare for URI support In-Reply-To: Message-ID: <90115cb35a1a59c1aaa0.1204925193@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1204924923 28800 # Node ID 90115cb35a1a59c1aaa0a20caf75603ee3f25984 # Parent 1ca5240e2d3b659e70598f98fbb62191b0e04677 Reorganize VSMigrationService to prepare for URI support. Since both MigrateVirtualSystemToHost() and MigrateVirtualSystemToSystem() both need to get the values from MSD in the same way, might as well put the MSD calls in migrate_do (since both call this function). Signed-off-by: Kaitlin Rupert diff -r 1ca5240e2d3b -r 90115cb35a1a src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Fri Mar 07 16:18:08 2008 -0500 +++ b/src/Virt_VSMigrationService.c Fri Mar 07 13:22:03 2008 -0800 @@ -752,11 +752,69 @@ static CMPIStatus migrate_create_job_ins return s; } +static CMPIStatus get_msd(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + CMPIInstance **msd) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_inst_arg(argsin, "MigrationSettingData", msd); + if ((ret == CMPI_RC_OK) && (*msd != NULL)) + goto out; + + s = get_migration_sd(ref, msd, _BROKER, false); + if ((s.rc != CMPI_RC_OK) || (*msd == NULL)) { + cu_statusf(_BROKER, &s, + s.rc, + "Unable to get default setting data values"); + goto out; + } + CU_DEBUG("Using default values for MigrationSettingData param"); + + out: + return s; +} + +static CMPIStatus get_migration_type(CMPIInstance *msd, + uint16_t *type) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "MigrationType", type); + if (ret != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + ret, + "Invalid MigrationType value"); + } + + return s; +} + +static CMPIStatus get_msd_values(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + struct migration_job *job) +{ + CMPIStatus s; + CMPIInstance *msd; + + s = get_msd(ref, argsin, &msd); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_type(msd, &job->type); + if (s.rc != CMPI_RC_OK) + goto out; + + out: + return s; +} + static struct migration_job *migrate_job_prepare(const CMPIContext *context, const CMPIObjectPath *ref, const char *domain, - const char *host, - uint16_t type) + const char *host) { struct migration_job *job; uuid_t uuid; @@ -769,7 +827,6 @@ static struct migration_job *migrate_job job->host = strdup(host); job->ref_cn = strdup(CLASSNAME(ref)); job->ref_ns = strdup(NAMESPACE(ref)); - job->type = type; uuid_generate(uuid); uuid_unparse(uuid, job->uuid); @@ -783,7 +840,7 @@ static CMPIStatus migrate_do(const CMPIO const CMPIContext *context, const char *domain, const char *host, - uint16_t type, + const CMPIArgs *argsin, const CMPIResult *results, CMPIArgs *argsout) { @@ -796,13 +853,17 @@ static CMPIStatus migrate_do(const CMPIO CMPIInstance *inst = NULL; bool rc; - job = migrate_job_prepare(context, ref, domain, host, type); + job = migrate_job_prepare(context, ref, domain, host); if (job == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to prepare migration job"); goto out; } + + s = get_msd_values(ref, argsin, job); + if (s.rc != CMPI_RC_OK) + goto out; CU_DEBUG("Prepared migration job %s", job->uuid); @@ -830,36 +891,6 @@ static CMPIStatus migrate_do(const CMPIO out: CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); - - return s; -} - -static CMPIStatus get_migration_type(const CMPIObjectPath *ref, - const CMPIArgs *argsin, - uint16_t *type) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *msd; - int ret; - - ret = cu_get_inst_arg(argsin, "MigrationSettingData", &msd); - if ((ret != CMPI_RC_OK) || (msd == NULL)) { - CU_DEBUG("Using default values for MigrationSettingData param"); - s = get_migration_sd(ref, &msd, _BROKER, false); - if ((s.rc != CMPI_RC_OK) || (msd == NULL)) { - cu_statusf(_BROKER, &s, - s.rc, - "Unable to get default setting data values"); - return s; - } - } - - ret = cu_get_u16_prop(msd, "MigrationType", type); - if (ret != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - ret, - "Invalid MigrationType value"); - } return s; } @@ -875,7 +906,6 @@ static CMPIStatus migrate_vs_host(CMPIMe const char *dhost = NULL; CMPIObjectPath *system; const char *name = NULL; - uint16_t type; cu_get_str_arg(argsin, "DestinationHost", &dhost); cu_get_ref_arg(argsin, "ComputerSystem", &system); @@ -896,13 +926,7 @@ static CMPIStatus migrate_vs_host(CMPIMe return s; } - s = get_migration_type(ref, argsin, &type); - if (s.rc != CMPI_RC_OK) { - METHOD_RETURN(results, 1); - return s; - } - - return migrate_do(ref, ctx, name, dhost, type, results, argsout); + return migrate_do(ref, ctx, name, dhost, argsin, results, argsout); } static CMPIStatus migrate_vs_system(CMPIMethodMI *self, @@ -917,7 +941,6 @@ static CMPIStatus migrate_vs_system(CMPI CMPIObjectPath *sys; const char *dname; const char *name; - uint16_t type; cu_get_ref_arg(argsin, "DestinationSystem", &dsys); cu_get_ref_arg(argsin, "ComputerSystem", &sys); @@ -946,13 +969,7 @@ static CMPIStatus migrate_vs_system(CMPI return s; } - s = get_migration_type(ref, argsin, &type); - if (s.rc != CMPI_RC_OK) { - METHOD_RETURN(results, 1); - return s; - } - - return migrate_do(ref, ctx, name, dname, type, results, argsout); + return migrate_do(ref, ctx, name, dname, argsin, results, argsout); } static struct method_handler vsimth = { From kaitlin at linux.vnet.ibm.com Fri Mar 7 21:26:34 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 13:26:34 -0800 Subject: [Libvirt-cim] [PATCH 2 of 4] Extend the VirtualSystemMigrationSettingData to include an attribute for transport method In-Reply-To: Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1204836739 28800 # Node ID f0ec7a80ad470f7232b675c6e0c72adcfb4445f3 # Parent 90115cb35a1a59c1aaa0a20caf75603ee3f25984 Extend the VirtualSystemMigrationSettingData to include an attribute for transport method. Possible transport methods are those supported by libvirt: ssh, tls, unix sockets, and tcp. Updates from set 1 to set 2: -Remove verbose description. Signed-off-by: Kaitlin Rupert diff -r 90115cb35a1a -r f0ec7a80ad47 schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Fri Mar 07 13:22:03 2008 -0800 +++ b/schema/VSMigrationSettingData.mof Thu Mar 06 12:52:19 2008 -0800 @@ -8,8 +8,16 @@ class CIM_VirtualSystemMigrationSettingD [Provider("cmpi::Virt_VSMigrationSettingData")] class Xen_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { + [ Description( + ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + uint16 TransportType; }; [Provider("cmpi::Virt_VSMigrationSettingData")] class KVM_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { + [ Description( + ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + uint16 TransportType; }; From kaitlin at linux.vnet.ibm.com Fri Mar 7 21:26:32 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 13:26:32 -0800 Subject: [Libvirt-cim] [PATCH 0 of 4] #2 Add transport support to VSMigrationService. Message-ID: libvirt also allows extra parameters for some of these transport types, but this just providers the basic support. Updates from set 1 to set 2: -See patch Extend the VirtualSystemMigrationSettingData to include an attribute for transport method) -See patch Add URI support to VSMigrationService From kaitlin at linux.vnet.ibm.com Fri Mar 7 21:26:35 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 13:26:35 -0800 Subject: [Libvirt-cim] [PATCH 3 of 4] Specify default TransportType in VSMigrationSettingData instance In-Reply-To: Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1204836759 28800 # Node ID d7d6fb7facb7d6ca113cb1a43a225f1f12754713 # Parent f0ec7a80ad470f7232b675c6e0c72adcfb4445f3 Specify default TransportType in VSMigrationSettingData instance. Signed-off-by: Kaitlin Rupert diff -r f0ec7a80ad47 -r d7d6fb7facb7 src/Virt_VSMigrationSettingData.c --- a/src/Virt_VSMigrationSettingData.c Thu Mar 06 12:52:19 2008 -0800 +++ b/src/Virt_VSMigrationSettingData.c Thu Mar 06 12:52:39 2008 -0800 @@ -40,6 +40,7 @@ static CMPIStatus set_properties(const C CMPIStatus s; uint16_t type = CIM_MIGRATE_LIVE; uint16_t priority = 0; /* Use default priority */ + uint16_t transport = CIM_MIGRATE_URI_SSH; CMSetProperty(inst, "MigrationType", (CMPIValue *)&type, CMPI_uint16); @@ -47,6 +48,8 @@ static CMPIStatus set_properties(const C CMSetProperty(inst, "Priority", (CMPIValue *)&priority, CMPI_uint16); + CMSetProperty(inst, "TransportType", + (CMPIValue *)&transport, CMPI_uint16); cu_statusf(broker, &s, CMPI_RC_OK, diff -r f0ec7a80ad47 -r d7d6fb7facb7 src/Virt_VSMigrationSettingData.h --- a/src/Virt_VSMigrationSettingData.h Thu Mar 06 12:52:19 2008 -0800 +++ b/src/Virt_VSMigrationSettingData.h Thu Mar 06 12:52:39 2008 -0800 @@ -25,6 +25,14 @@ enum {CIM_MIGRATE_OTHER = 1, CIM_MIGRATE_RESTART = 4, } migration_type; +enum {CIM_MIGRATE_URI_OTHER = 1, + CIM_MIGRATE_URI_SSH = 2, + CIM_MIGRATE_URI_TLS = 3, + CIM_MIGRATE_URI_TLS_STRICT = 4, + CIM_MIGRATE_URI_TCP = 5, + CIM_MIGRATE_URI_UNIX = 6, +} transport_type; + CMPIStatus get_migration_sd(const CMPIObjectPath *ref, CMPIInstance **_inst, const CMPIBroker *broker, From kaitlin at linux.vnet.ibm.com Fri Mar 7 21:26:36 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 13:26:36 -0800 Subject: [Libvirt-cim] [PATCH 4 of 4] Add URI support to VSMigrationService In-Reply-To: Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1204836870 28800 # Node ID ad69029c321f91f17469d0ff97e2a39d3806349e # Parent d7d6fb7facb7d6ca113cb1a43a225f1f12754713 Add URI support to VSMigrationService. For the vs_migratable() call, the destination uri is hardcoded to SSH. This will call will be updated in a later patch so that it pulls the proper transport value from teh MSD. Update from set 1 to set 2: -Consolidate dest_uri() and transport_from_class() -Fix missing dereference for the uri variable in get_migration_uri(). Signed-off-by: Kaitlin Rupert diff -r d7d6fb7facb7 -r ad69029c321f src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 06 12:52:39 2008 -0800 +++ b/src/Virt_VSMigrationService.c Thu Mar 06 12:54:30 2008 -0800 @@ -64,34 +64,53 @@ struct migration_job { char *ref_cn; char *ref_ns; uint16_t type; + uint16_t transport; char uuid[33]; }; -static const char *transport_from_class(const char *cn) -{ +static char *dest_uri(const char *cn, + const char *dest, + uint16_t transport) +{ + const char *prefix; + const char *tport = NULL; + const char *param = ""; + char *uri = NULL; + int rc; + if (STARTS_WITH(cn, "Xen")) - return "xen+ssh"; + prefix = "xen"; else if (STARTS_WITH(cn, "KVM")) - return "qemu+ssh"; + prefix = "qemu"; else return NULL; -} - -static char *dest_uri(const char *cn, - const char *dest) -{ - char *uri; - const char *tport = NULL; - - tport = transport_from_class(cn); - if (tport == NULL) { - CU_DEBUG("Failed to get transport for %s", cn); - return NULL; - } - - if (asprintf(&uri, "%s://%s/system", tport, dest) == -1) + + switch (transport) { + case CIM_MIGRATE_URI_SSH: + tport = "ssh"; + break; + case CIM_MIGRATE_URI_TLS: + tport = "tls"; + param = "?no_verify=1"; + break; + case CIM_MIGRATE_URI_TLS_STRICT: + tport = "tls"; + break; + case CIM_MIGRATE_URI_UNIX: + tport = "unix"; + break; + case CIM_MIGRATE_URI_TCP: + tport = "tcp"; + break; + default: + goto out; + } + + rc = asprintf(&uri, "%s+%s://%s/system/%s", prefix, tport, dest, param); + if (rc == -1) uri = NULL; + out: return uri; } @@ -153,7 +172,7 @@ static CMPIStatus vs_migratable(const CM uint32_t retcode = 1; CMPIBoolean isMigratable = 0; - uri = dest_uri(CLASSNAME(ref), destination); + uri = dest_uri(CLASSNAME(ref), destination, CIM_MIGRATE_URI_SSH); if (uri == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -557,7 +576,7 @@ static CMPIStatus migrate_vs(struct migr char *uri = NULL; char *xml = NULL; - uri = dest_uri(job->ref_cn, job->host); + uri = dest_uri(job->ref_cn, job->host, job->transport); if (uri == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -792,6 +811,23 @@ static CMPIStatus get_migration_type(CMP return s; } +static CMPIStatus get_migration_uri(CMPIInstance *msd, + uint16_t *uri) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "TransportType", uri); + if (ret == CMPI_RC_OK) + goto out; + + CU_DEBUG("Using default TransportType: %d", CIM_MIGRATE_URI_SSH); + *uri = CIM_MIGRATE_URI_SSH; + + out: + return s; +} + static CMPIStatus get_msd_values(const CMPIObjectPath *ref, const CMPIArgs *argsin, struct migration_job *job) @@ -804,6 +840,10 @@ static CMPIStatus get_msd_values(const C goto out; s = get_migration_type(msd, &job->type); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_uri(msd, &job->transport); if (s.rc != CMPI_RC_OK) goto out; From kaitlin at linux.vnet.ibm.com Fri Mar 7 22:23:20 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 14:23:20 -0800 Subject: [Libvirt-cim] [PATCH 0 of 3] Migration Job Indications In-Reply-To: References: Message-ID: <47D1C058.3090508@linux.vnet.ibm.com> Jay Gagnon wrote: > Just a few changes, detailed per patch. I believe all changes are actually in the third patch. > Nice set of changes Jay +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 7 23:28:52 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 07 Mar 2008 15:28:52 -0800 Subject: [Libvirt-cim] [PATCH] Fix a bug in MSD schema Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1204932278 28800 # Node ID e7c2e8fca9d4dac6477e1c3aafc36bd68e7fca1f # Parent 79a937040287f70b36e35e2a0c397894d6473ac5 Fix a bug in MSD schema. The last patach for the VSMigrationSettingData introduced a bug. Pegasus failed to clean up my repository properly when the previous patchset was tested. Signed-off-by: Kaitlin Rupert diff -r 79a937040287 -r e7c2e8fca9d4 schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Fri Mar 07 14:57:35 2008 -0800 +++ b/schema/VSMigrationSettingData.mof Fri Mar 07 15:24:38 2008 -0800 @@ -8,16 +8,14 @@ class CIM_VirtualSystemMigrationSettingD [Provider("cmpi::Virt_VSMigrationSettingData")] class Xen_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { - [ Description( - ValueMap {"0","1","2","3","4","5","6"}, - Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + [ ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; }; [Provider("cmpi::Virt_VSMigrationSettingData")] class KVM_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { - [ Description( - ValueMap {"0","1","2","3","4","5","6"}, - Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + [ ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; }; From heidieck at linux.vnet.ibm.com Mon Mar 10 08:58:42 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 09:58:42 +0100 Subject: [Libvirt-cim] [PATCH 1 of 7] Add Resource Pool types to svpc_types.h In-Reply-To: <87lk4u8q1g.fsf@caffeine.beaverton.ibm.com> References: <87lk4u8q1g.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D4F842.9050200@linux.vnet.ibm.com> Dan Smith wrote: > I have applied this set to avoid dragging this out any further, but I > would like to see a follow-on set that removes all of the VIRT_DEV_foo > types in favor of CIM_RES_TYPE_foo. > Thanks. I will send out this follow on patch soon. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 10:28:19 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 11:28:19 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: <87r6em73wr.fsf@caffeine.beaverton.ibm.com> References: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> <87r6em73wr.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D50D43.9040607@linux.vnet.ibm.com> Dan Smith wrote: > This should be one argument per line. > ok -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 10:30:38 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 11:30:38 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: <47D18166.5040504@linux.vnet.ibm.com> References: <3afbff37cc3946a1f584.1204892801@localhost.localdomain> <47D18166.5040504@linux.vnet.ibm.com> Message-ID: <47D50DCE.5030104@linux.vnet.ibm.com> Kaitlin Rupert wrote: > Would it be better to have a list of all the resource types, and then > call _get_devices() in a loop? This is probably fine as is, and I > don't suspect we'll add more resource types in the future, so it's > probably not worth worrying about. > > Thoughts? Good idea. I will update svpc_types with an array for all resource types and use this one to loop over here. I will send this out as a separate patch set. > > > Should inst_list_free(&list); go after the out:? > > Even if list.cur == 0, we still probably want to set list->list = NULL > to be sure. I had a look into libcmpiutil and its possible to remove this check (list.cur==0) as cu_return_instance_names() and cu_return_instances() take care of this case. Thanks for making me aware of this. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 10:33:07 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 11:33:07 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] #4 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP Message-ID: This patch set implements the configurable enum_devices() interface to the Device provider. This slight interface change is adopted to the associations SystemDevice and ElementAllocatedFromPool. Both associations profit from the easy access to the device instances. Diff to patch set 1: - fixed style issues Diff to patch set 2: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set Diff to patch set 3: - fixed style issue - removed unneccsary check with the potential to leak memory From heidieck at linux.vnet.ibm.com Mon Mar 10 10:33:10 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 11:33:10 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt Device interface changes In-Reply-To: Message-ID: <3d8334f3c78c378b8b59.1205145190@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205144855 -3600 # Node ID 3d8334f3c78c378b8b592fef23944a647132527a # Parent 44dbfd6d4a6577815fb8522a3a874e0149aaaff1 EAFP: adopt Device interface changes Signed-off-by: Heidi Eckhart diff -r 44dbfd6d4a65 -r 3d8334f3c78c src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Mon Mar 10 11:27:21 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Mon Mar 10 11:27:35 2008 +0100 @@ -77,7 +77,7 @@ static CMPIStatus vdev_to_pool(const CMP goto out; type = class_to_type(ref); - if (type == 0) { + if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unknown device type"); @@ -138,47 +138,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int devs_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - const char *ns = NAMESPACE(ref); - const char *cn = CLASSNAME(ref); - - conn = connect_by_classname(_BROKER, cn, &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - dom_devices(_BROKER, doms[i], ns, type, &tmp); - - filter_by_pool(list, &tmp, type, poolid); - - inst_list_free(&tmp); - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_vdev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -186,7 +145,8 @@ static CMPIStatus pool_to_vdev(const CMP const char *poolid; CMPIStatus s = {CMPI_RC_OK, NULL}; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp; if (!match_hypervisor_prefix(ref, info)) return s; @@ -210,7 +170,15 @@ static CMPIStatus pool_to_vdev(const CMP goto out; } - devs_from_pool(type, ref, poolid, list); + inst_list_init(&tmp); + + s = enum_devices(_BROKER, ref, NULL, type, &tmp); + if (s.rc != CMPI_RC_OK) + goto out; + + filter_by_pool(list, &tmp, type, poolid); + + inst_list_free(&tmp); out: return s; From heidieck at linux.vnet.ibm.com Mon Mar 10 10:33:09 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 11:33:09 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SD: adopt Device interface changes In-Reply-To: Message-ID: <44dbfd6d4a6577815fb8.1205145189@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205144841 -3600 # Node ID 44dbfd6d4a6577815fb8522a3a874e0149aaaff1 # Parent e44c304b5c6c81e82b55841988ffbe31d9e643b9 SD: adopt Device interface changes - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r e44c304b5c6c -r 44dbfd6d4a65 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Mon Mar 10 11:26:42 2008 +0100 +++ b/src/Virt_SystemDevice.c Mon Mar 10 11:27:21 2008 +0100 @@ -48,55 +48,6 @@ const static CMPIBroker *_BROKER; -#define DEV_TYPE_COUNT 4 -const static int device_types[DEV_TYPE_COUNT] = - {VIRT_DEV_NET, - VIRT_DEV_DISK, - VIRT_DEV_MEM, - VIRT_DEV_VCPU, - }; - -static int get_dom_devices(const char *name, - struct inst_list *list, - int type, - const char *host_cn, - const char *ns) -{ - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; - CMPIStatus s; - int ret = 0; - - conn = connect_by_classname(_BROKER, host_cn, &s); - if (conn == NULL) - goto out; - - dom = virDomainLookupByName(conn, name); - if (dom == NULL) - goto out; - - ret = dom_devices(_BROKER, dom, ns, type, list); - - virDomainFree(dom); - out: - virConnectClose(conn); - - return ret; -} - -static int get_all_devices(const char *name, - struct inst_list *list, - const char *host_cn, - const char *ns) -{ - int i; - - for (i = 0; i < DEV_TYPE_COUNT; i++) - get_dom_devices(name, list, device_types[i], host_cn, ns); - - return i; -} - static CMPIStatus sys_to_dev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -104,7 +55,6 @@ static CMPIStatus sys_to_dev(const CMPIO const char *host = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int ret; if (!match_hypervisor_prefix(ref, info)) return s; @@ -120,20 +70,7 @@ static CMPIStatus sys_to_dev(const CMPIO goto out; } - ret = get_all_devices(host, - list, - CLASSNAME(ref), - NAMESPACE(ref)); - - if (ret >= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get devices"); - } + s = enum_devices(_BROKER, ref, host, CIM_RES_TYPE_ALL, list); out: return s; From heidieck at linux.vnet.ibm.com Mon Mar 10 10:33:08 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 11:33:08 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename dom_device to enum_devices and make it configurable In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205144802 -3600 # Node ID e44c304b5c6c81e82b55841988ffbe31d9e643b9 # Parent b10f68ff5531c51ca4a8e722e8ecf0255f2fe1eb Device: rename dom_device to enum_devices and make it configurable - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r b10f68ff5531 -r e44c304b5c6c src/Virt_Device.c --- a/src/Virt_Device.c Thu Mar 06 12:54:30 2008 -0800 +++ b/src/Virt_Device.c Mon Mar 10 11:26:42 2008 +0100 @@ -236,22 +236,22 @@ static CMPIInstance *device_instance(con { CMPIInstance *instance; - if (dev->type == VIRT_DEV_NET) + if (dev->type == CIM_RES_TYPE_NET) instance = net_instance(broker, &dev->dev.net, dom, ns); - else if (dev->type == VIRT_DEV_DISK) + else if (dev->type == CIM_RES_TYPE_DISK) instance = disk_instance(broker, &dev->dev.disk, dom, ns); - else if (dev->type == VIRT_DEV_MEM) + else if (dev->type == CIM_RES_TYPE_MEM) instance = mem_instance(broker, &dev->dev.mem, dom, ns); - else if (dev->type == VIRT_DEV_VCPU) + else if (dev->type == CIM_RES_TYPE_PROC) instance = vcpu_instance(broker, &dev->dev.vcpu, dom, @@ -271,23 +271,24 @@ uint16_t device_type_from_classname(cons uint16_t device_type_from_classname(const char *classname) { if (strstr(classname, "NetworkPort")) - return VIRT_DEV_NET; + return CIM_RES_TYPE_NET; else if (strstr(classname, "LogicalDisk")) - return VIRT_DEV_DISK; + return CIM_RES_TYPE_DISK; else if (strstr(classname, "Memory")) - return VIRT_DEV_MEM; + return CIM_RES_TYPE_MEM; else if (strstr(classname, "Processor")) - return VIRT_DEV_VCPU; + return CIM_RES_TYPE_PROC; else - return VIRT_DEV_UNKNOWN; -} - -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list) -{ + return CIM_RES_TYPE_UNKNOWN; +} + +static CMPIStatus _get_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; int count; int i; struct virt_device *devs = NULL; @@ -299,7 +300,10 @@ int dom_devices(const CMPIBroker *broker for (i = 0; i < count; i++) { CMPIInstance *dev = NULL; - dev = device_instance(broker, &devs[i], dom, ns); + dev = device_instance(broker, + &devs[i], + dom, + NAMESPACE(reference)); if (dev) inst_list_add(list, dev); @@ -308,59 +312,107 @@ int dom_devices(const CMPIBroker *broker out: free(devs); - - return 1; -} - -static int dom_list_devices(virConnectPtr conn, - const CMPIObjectPath *ref, - struct inst_list *list) -{ - virDomainPtr *doms; - int ndom; + return s; +} + +static CMPIStatus _enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s; + + if (type == CIM_RES_TYPE_ALL) { + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_PROC, + list); + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_NET, + list); + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_MEM, + list); + s = _get_devices(broker, + reference, + dom, + CIM_RES_TYPE_DISK, + list); + } + else + s = _get_devices(broker, + reference, + dom, + type, + list); + + return s; +} + +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + virDomainPtr *doms = NULL; + int count = 1; int i; - int type; - - type = device_type_from_classname(CLASSNAME(ref)); - - ndom = get_domain_list(conn, &doms); - if (ndom == 0) - return 1; - else if (ndom < 0) - return 0; - - for (i = 0; i < ndom; i++) { - dom_devices(_BROKER, doms[i], NAMESPACE(ref), type, list); - } - - return 1; -} - -static CMPIStatus enum_devices(const CMPIObjectPath *reference, - const CMPIResult *results, - int names_only) -{ - CMPIStatus s; - virConnectPtr conn; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + + if (domain) { + doms = calloc(1, sizeof(virDomainPtr)); + doms[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &doms); + + for (i = 0; i < count; i++) { + s = _enum_devices(broker, + reference, + doms[i], + type, + list); + + virDomainFree(doms[i]); + } + + out: + virConnectClose(conn); + free(doms); + + return s; +} + +static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, + const CMPIResult *results, + int names_only) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; struct inst_list list; if (!provider_is_responsible(_BROKER, reference, &s)) - return s; + goto out; inst_list_init(&list); - conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); - if (conn == NULL) - return s; - - if (!dom_list_devices(conn, reference, &list)) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to list domains"); - return s; - } - - if (list.cur == 0) + s = enum_devices(_BROKER, + reference, + NULL, + device_type_from_classname(CLASSNAME(reference)), + &list); + if (s.rc != CMPI_RC_OK) goto out; if (names_only) @@ -371,11 +423,6 @@ static CMPIStatus enum_devices(const CMP inst_list_free(&list); out: - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - virConnectClose(conn); - return s; } @@ -524,7 +571,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return enum_devices(reference, results, 1); + return return_enum_devices(reference, results, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -533,7 +580,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return enum_devices(reference, results, 0); + return return_enum_devices(reference, results, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, diff -r b10f68ff5531 -r e44c304b5c6c src/Virt_Device.h --- a/src/Virt_Device.h Thu Mar 06 12:54:30 2008 -0800 +++ b/src/Virt_Device.h Mon Mar 10 11:26:42 2008 +0100 @@ -27,19 +27,18 @@ * Return a list of devices for a given domain * * @param broker A pointer to the CIM broker - * @param dom The domain in question - * @param ref The namespace - * @param list A pointer to an array of CMPIInstance objects (should - * be NULL initially) - * @param cur The number of items in the list (0 initially) - * @param max The size of the list (0 initially) - * @returns Nonzero on success + * @param reference Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) + * @param type The device type or CIM_RES_TYPE_ALL to get + * all devices + * @param list A pointer to an array of CMPIInstance objects + * (should be NULL initially) */ -int dom_devices(const CMPIBroker *broker, - virDomainPtr dom, - const char *ns, - int type, - struct inst_list *list); +CMPIStatus enum_devices(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *domain, + const uint16_t type, + struct inst_list *list); /** * Returns the device instance defined by the reference From heidieck at linux.vnet.ibm.com Mon Mar 10 12:00:04 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:00:04 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: <47D185B4.1060000@linux.vnet.ibm.com> References: <47D185B4.1060000@linux.vnet.ibm.com> Message-ID: <47D522C4.4090605@linux.vnet.ibm.com> Kaitlin Rupert wrote: > Probably not worth worrying about, but wondering if this could be > condensed some.. Will do so in a follow on patch. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 12:00:33 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:00:33 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: <87mypa73td.fsf@caffeine.beaverton.ibm.com> References: <87mypa73td.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D522E1.80206@linux.vnet.ibm.com> Dan Smith wrote: > These function calls should be one parameter per line. > thanks -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 12:02:53 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:02:53 +0100 Subject: [Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes In-Reply-To: <47D18570.5070101@linux.vnet.ibm.com> References: <47D18570.5070101@linux.vnet.ibm.com> Message-ID: <47D5236D.7000309@linux.vnet.ibm.com> Kaitlin Rupert wrote: > tmp_list doesn't get freed here. A very good catch ... thanks. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 12:03:46 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:03:46 +0100 Subject: [Libvirt-cim] [PATCH 2 of 5] VSMS: adopt RASD interface change In-Reply-To: Message-ID: <77c124f394ea3f03df79.1205150626@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205150455 -3600 # Node ID 77c124f394ea3f03df79edb3e7934d5dbf119833 # Parent e32460a4d31d11a8e77d2038d6c49a388f3f4ca3 VSMS: adopt RASD interface change Signed-off-by: Heidi Eckhart diff -r e32460a4d31d -r 77c124f394ea src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Mar 10 12:59:34 2008 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Mon Mar 10 13:00:55 2008 +0100 @@ -220,7 +220,7 @@ static int rasd_to_vdev(CMPIInstance *in if (op == NULL) goto err; - if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) goto err; dev->type = (int)type; @@ -303,7 +303,7 @@ static int classify_resources(CMPIArray if (op == NULL) return 0; - if (rasd_type_from_classname(CLASSNAME(op), &type) != + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) return 0; @@ -882,7 +882,7 @@ static CMPIStatus _update_resources_for( goto out; } - if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); @@ -1036,7 +1036,7 @@ static CMPIStatus rasd_refs_to_insts(con continue; } - if (rasd_type_from_classname(CLASSNAME(ref), &type) != + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CU_DEBUG("Unable to get type of `%s'", REF2STR(ref)); From heidieck at linux.vnet.ibm.com Mon Mar 10 12:03:45 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:03:45 +0100 Subject: [Libvirt-cim] [PATCH 1 of 5] RASD: rename rasds_for_domain to enum_rasds and make it configurable In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205150374 -3600 # Node ID e32460a4d31d11a8e77d2038d6c49a388f3f4ca3 # Parent 3d8334f3c78c378b8b592fef23944a647132527a RASD: rename rasds_for_domain to enum_rasds and make it configurable Signed-off-by: Heidi Eckhart diff -r 3d8334f3c78c -r e32460a4d31d src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Mar 10 11:27:35 2008 +0100 +++ b/src/Virt_RASD.c Mon Mar 10 12:59:34 2008 +0100 @@ -439,8 +439,8 @@ CMPIStatus get_rasd_by_ref(const CMPIBro goto out; } - if (rasd_type_from_classname(CLASSNAME(reference), &type) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, + if (res_type_from_rasd_classname(CLASSNAME(reference), &type) != CMPI_RC_OK) { + cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); goto out; @@ -460,7 +460,7 @@ CMPIStatus get_rasd_by_ref(const CMPIBro return s; } -CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type) +CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) { char *base = NULL; CMPIrc rc = CMPI_RC_ERR_FAILED; @@ -512,58 +512,130 @@ CMPIrc rasd_classname_from_type(uint16_t return rc; } -static CMPIStatus _enum_rasds(const CMPIObjectPath *ref, +static CMPIStatus _get_rasds(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, + const char **properties, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int count; + int i; + struct virt_device *devs = NULL; + + count = get_devices(dom, &devs, type); + if (count <= 0) + goto out; + + for (i = 0; i < count; i++) { + CMPIInstance *dev = NULL; + const char *host = NULL; + + host = virDomainGetName(dom); + if (host == NULL) { + cleanup_virt_device(&devs[i]); + continue; + } + + dev = rasd_from_vdev(broker, + &devs[i], + host, + reference, + properties); + if (dev) + inst_list_add(list, dev); + + cleanup_virt_device(&devs[i]); + } + + out: + free(devs); + return s; +} + +static CMPIStatus _enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const virDomainPtr dom, + const uint16_t type, const char **properties, struct inst_list *list) { + CMPIStatus s; + + if (type == CIM_RES_TYPE_ALL) { + s = _get_rasds(broker, + reference, + dom, + CIM_RES_TYPE_PROC, + properties, + list); + s = _get_rasds(broker, + reference, + dom, + CIM_RES_TYPE_MEM, + properties, + list); + s = _get_rasds(broker, + reference, + dom, + CIM_RES_TYPE_NET, + properties, + list); + s = _get_rasds(broker, + reference, + dom, + CIM_RES_TYPE_DISK, + properties, + list); + } + else + s = _get_rasds(broker, + reference, + dom, + type, + properties, + list); + + return s; +} + +CMPIStatus enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const char *domain, + const uint16_t type, + const char **properties, + struct inst_list *list) +{ virConnectPtr conn = NULL; virDomainPtr *domains = NULL; - int count; - int i, j; - uint16_t type; - CMPIStatus s; - uint16_t types[] = {CIM_RES_TYPE_PROC, - CIM_RES_TYPE_DISK, - CIM_RES_TYPE_NET, - CIM_RES_TYPE_MEM, - 0}; + int count = 1; + int i; + CMPIStatus s = {CMPI_RC_OK, NULL}; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) - return s; - - count = get_domain_list(conn, &domains); - if (count <= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get domain list"); - goto out; - } - - if (rasd_type_from_classname(CLASSNAME(ref), &type) == CMPI_RC_OK) { - types[0] = type; - types[1] = 0; - } + goto out; + + if (domain) { + domains = calloc(1, sizeof(virDomainPtr)); + domains[0] = virDomainLookupByName(conn, domain); + } + else + count = get_domain_list(conn, &domains); for (i = 0; i < count; i++) { - for (j = 0; types[j] != 0; j++) { - CU_DEBUG("Doing RASD type %i for %s", - type, virDomainGetName(domains[i])); - rasds_for_domain(_BROKER, - virDomainGetName(domains[i]), - types[j], - ref, - properties, - list); - } + _enum_rasds(broker, + ref, + domains[i], + type, + properties, + list); virDomainFree(domains[i]); } - s = (CMPIStatus){CMPI_RC_OK, NULL}; - out: virConnectClose(conn); - free(domains); return s; } @@ -575,17 +647,23 @@ static CMPIStatus return_enum_rasds(cons { struct inst_list list; CMPIStatus s; + uint16_t type; inst_list_init(&list); - s = _enum_rasds(ref, properties, &list); - if (s.rc == CMPI_RC_OK) { - if (names_only) - cu_return_instance_names(results, &list); - else - cu_return_instances(results, &list); - } - + res_type_from_rasd_classname(CLASSNAME(ref), &type); + + s = enum_rasds(_BROKER, ref, NULL, + type, properties, &list); + if (s.rc != CMPI_RC_OK) + goto out; + + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); + + out: inst_list_free(&list); return s; @@ -626,41 +704,6 @@ static CMPIStatus GetInstance(CMPIInstan out: return s; -} - -int rasds_for_domain(const CMPIBroker *broker, - const char *name, - const uint16_t type, - const CMPIObjectPath *ref, - const char **properties, - struct inst_list *_list) -{ - struct virt_device *list; - int count; - int i; - virConnectPtr conn; - CMPIStatus s; - - conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) - return 0; - - count = list_devs(conn, type, name, &list); - - for (i = 0; i < count; i++) { - CMPIInstance *inst; - - inst = rasd_from_vdev(broker, &list[i], name, ref, properties); - if (inst != NULL) - inst_list_add(_list, inst); - } - - if (count > 0) - cleanup_virt_devices(&list, count); - - virConnectClose(conn); - - return count; } DEFAULT_CI(); diff -r 3d8334f3c78c -r e32460a4d31d src/Virt_RASD.h --- a/src/Virt_RASD.h Mon Mar 10 11:27:35 2008 +0100 +++ b/src/Virt_RASD.h Mon Mar 10 12:59:34 2008 +0100 @@ -27,20 +27,20 @@ char *rasd_to_xml(CMPIInstance *rasd); * Get a list of RASDs for a given domain * * @param broker The current broker - * @param name The name of the domain in question + * @param ref Defines the libvirt connection to use + * @param domain The domain id (NULL means for all domains) * @param type The ResourceType of the desired RASDs - * @param ref A reference used for hypervisor connection and namespace - * setting of the resulting instances + * @param properties The properties to filter for * @param _list The list of instances to populate */ -int rasds_for_domain(const CMPIBroker *broker, - const char *name, - const uint16_t type, - const CMPIObjectPath *ref, - const char **properties, - struct inst_list *_list); +CMPIStatus enum_rasds(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const char *domain, + const uint16_t type, + const char **properties, + struct inst_list *_list); -CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); +CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type); CMPIrc rasd_classname_from_type(uint16_t type, const char **cn); CMPIStatus get_rasd_by_name(const CMPIBroker *broker, From heidieck at linux.vnet.ibm.com Mon Mar 10 12:03:49 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:03:49 +0100 Subject: [Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes In-Reply-To: Message-ID: <33213e77e6f58b3614cc.1205150629@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205150547 -3600 # Node ID 33213e77e6f58b3614ccc1ddb58db19e0112d034 # Parent 1af3393262f9dfdcd5cd786abe825cc740db3bda RAFP: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 1af3393262f9 -r 33213e77e6f5 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Mon Mar 10 13:01:22 2008 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Mon Mar 10 13:02:27 2008 +0100 @@ -51,7 +51,7 @@ static CMPIStatus rasd_to_pool(const CMP if (!match_hypervisor_prefix(ref, info)) return s; - if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to determine RASD type"); @@ -109,7 +109,7 @@ static int filter_by_pool(struct inst_li if (op == NULL) continue; - if (rasd_type_from_classname(CLASSNAME(op), &type) != + if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) continue; @@ -123,52 +123,6 @@ static int filter_by_pool(struct inst_li return dest->cur; } -static int rasds_from_pool(uint16_t type, - const CMPIObjectPath *ref, - const char *poolid, - const char **properties, - struct inst_list *list) -{ - CMPIStatus s; - virConnectPtr conn = NULL; - virDomainPtr *doms = NULL; - int count; - int i; - - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) - return 0; - - count = get_domain_list(conn, &doms); - - for (i = 0; i < count; i++) { - const char *name; - struct inst_list tmp; - - inst_list_init(&tmp); - - name = virDomainGetName(doms[i]); - - rasds_for_domain(_BROKER, - name, - type, - ref, - properties, - &tmp); - - filter_by_pool(list, &tmp, poolid); - - inst_list_free(&tmp); - - virDomainFree(doms[i]); - } - - free(doms); - virConnectClose(conn); - - return count; -} - static CMPIStatus pool_to_rasd(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -176,7 +130,8 @@ static CMPIStatus pool_to_rasd(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; const char *poolid; uint16_t type; - CMPIInstance *inst; + CMPIInstance *inst = NULL; + struct inst_list tmp_list; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -200,11 +155,18 @@ static CMPIStatus pool_to_rasd(const CMP goto out; } - rasds_from_pool(type, - ref, - poolid, - info->properties, - list); + inst_list_init(&tmp_list); + + s = enum_rasds(_BROKER, + ref, + NULL, + type, + info->properties, + &tmp_list); + + filter_by_pool(list, &tmp_list, poolid); + + inst_list_free(&tmp_list); out: return s; From heidieck at linux.vnet.ibm.com Mon Mar 10 12:03:44 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:03:44 +0100 Subject: [Libvirt-cim] [PATCH 0 of 5] #3 - Add configurable enum_rasds interface to RASD and Adopt changes to assoc providers Message-ID: This patch set implements a configurable enum_rasds() interface to the RASD provider. This slight interface change is adopted to the affected associations. Diff to patch set 1: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set - fixed style issues Diff to patch set 2: - RASD: fix stlye issues - RAFP: free tmp_list From heidieck at linux.vnet.ibm.com Mon Mar 10 12:03:48 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:03:48 +0100 Subject: [Libvirt-cim] [PATCH 4 of 5] SDS: adopt RASD interface changes In-Reply-To: Message-ID: <1af3393262f9dfdcd5cd.1205150628@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205150482 -3600 # Node ID 1af3393262f9dfdcd5cd786abe825cc740db3bda # Parent fdd9fe95af76f8d209da04848f530e7a10a16eab SDS: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r fdd9fe95af76 -r 1af3393262f9 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Mar 10 13:01:08 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Mon Mar 10 13:01:22 2008 +0100 @@ -99,7 +99,7 @@ static CMPIStatus rasd_to_dev(const CMPI goto out; } - if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Missing ResourceType"); From heidieck at linux.vnet.ibm.com Mon Mar 10 12:03:47 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:03:47 +0100 Subject: [Libvirt-cim] [PATCH 3 of 5] VSSDC: adopt RASD interface changes In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205150468 -3600 # Node ID fdd9fe95af76f8d209da04848f530e7a10a16eab # Parent 77c124f394ea3f03df79edb3e7934d5dbf119833 VSSDC: adopt RASD interface changes Signed-off-by: Heidi Eckhart diff -r 77c124f394ea -r fdd9fe95af76 src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Mon Mar 10 13:00:55 2008 +0100 +++ b/src/Virt_VSSDComponent.c Mon Mar 10 13:01:08 2008 +0100 @@ -43,14 +43,6 @@ static CMPIStatus vssd_to_rasd(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; char *name = NULL; - int i = 0; - int types[] = { - CIM_RES_TYPE_PROC, - CIM_RES_TYPE_NET, - CIM_RES_TYPE_DISK, - CIM_RES_TYPE_MEM, - -1 - }; if (!match_hypervisor_prefix(ref, info)) goto out; @@ -66,14 +58,12 @@ static CMPIStatus vssd_to_rasd(const CMP goto out; } - for (i = 0; types[i] > 0; i++) { - rasds_for_domain(_BROKER, - name, - types[i], - ref, - info->properties, - list); - } + s = enum_rasds(_BROKER, + ref, + name, + CIM_RES_TYPE_ALL, + info->properties, + list); free(name); @@ -86,7 +76,7 @@ static CMPIStatus rasd_to_vssd(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *vssd = NULL; + CMPIInstance *inst = NULL; const char *id = NULL; char *host = NULL; char *devid = NULL; @@ -94,6 +84,10 @@ static CMPIStatus rasd_to_vssd(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + + s = get_rasd_by_ref(_BROKER, ref, info->properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -110,11 +104,11 @@ static CMPIStatus rasd_to_vssd(const CMP goto out; } - s = get_vssd_by_name(_BROKER, ref, host, &vssd); + s = get_vssd_by_name(_BROKER, ref, host, &inst); if (s.rc != CMPI_RC_OK) goto out; - inst_list_add(list, vssd); + inst_list_add(list, inst); out: free(host); From heidieck at linux.vnet.ibm.com Mon Mar 10 12:09:37 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:09:37 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] Device: rename device_type_from_classname to res_type_from_device_classname In-Reply-To: Message-ID: <8a864207add28f66b1b7.1205150977@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205150870 -3600 # Node ID 8a864207add28f66b1b749aa0a01722aae8f88a4 # Parent 33213e77e6f58b3614ccc1ddb58db19e0112d034 Device: rename device_type_from_classname to res_type_from_device_classname for consistency with the other providers. Signed-off-by: Heidi Eckhart diff -r 33213e77e6f5 -r 8a864207add2 src/Virt_Device.c --- a/src/Virt_Device.c Mon Mar 10 13:02:27 2008 +0100 +++ b/src/Virt_Device.c Mon Mar 10 13:07:50 2008 +0100 @@ -268,7 +268,7 @@ static CMPIInstance *device_instance(con return instance; } -uint16_t device_type_from_classname(const char *classname) +uint16_t res_type_from_device_classname(const char *classname) { if (strstr(classname, "NetworkPort")) return CIM_RES_TYPE_NET; @@ -410,7 +410,7 @@ static CMPIStatus return_enum_devices(co s = enum_devices(_BROKER, reference, NULL, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &list); if (s.rc != CMPI_RC_OK) goto out; @@ -551,7 +551,7 @@ CMPIStatus get_device_by_ref(const CMPIB s = get_device_by_name(broker, reference, name, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &inst); if (s.rc != CMPI_RC_OK) goto out; diff -r 33213e77e6f5 -r 8a864207add2 src/Virt_Device.h --- a/src/Virt_Device.h Mon Mar 10 13:02:27 2008 +0100 +++ b/src/Virt_Device.h Mon Mar 10 13:07:50 2008 +0100 @@ -69,7 +69,7 @@ CMPIStatus get_device_by_name(const CMPI const uint16_t type, CMPIInstance **_inst); -uint16_t device_type_from_classname(const char *classname); +uint16_t res_type_from_device_classname(const char *classname); #endif From heidieck at linux.vnet.ibm.com Mon Mar 10 12:09:36 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:09:36 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] #3 - Renamed device function for constistency with other providers Message-ID: Renamed the device_type_by_classname() to res_type_by_device_classname() for consistency with other interfaces. Diff to patch set 1: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set Diff to patch set 2: - Device patch was rejected because of patch set "#4 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP" From heidieck at linux.vnet.ibm.com Mon Mar 10 12:09:38 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:09:38 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] SDS: adopt renamed Device function In-Reply-To: Message-ID: <9a1a83db8e12f4c4881a.1205150978@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205150945 -3600 # Node ID 9a1a83db8e12f4c4881ad7818a669fc8b1394108 # Parent 8a864207add28f66b1b749aa0a01722aae8f88a4 SDS: adopt renamed Device function Signed-off-by: Heidi Eckhart diff -r 8a864207add2 -r 9a1a83db8e12 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Mar 10 13:07:50 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Mon Mar 10 13:09:05 2008 +0100 @@ -64,7 +64,7 @@ static CMPIStatus dev_to_rasd(const CMPI s = get_rasd_by_name(_BROKER, ref, name, - device_type_from_classname(CLASSNAME(ref)), + res_type_from_device_classname(CLASSNAME(ref)), NULL, &inst); if (s.rc != CMPI_RC_OK) From heidieck at linux.vnet.ibm.com Mon Mar 10 12:09:39 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:09:39 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] EAFP: adopt renamed Device function In-Reply-To: Message-ID: <1aaf26015bb83a1b2433.1205150979@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205150954 -3600 # Node ID 1aaf26015bb83a1b2433073c2ec5886cf828d9e6 # Parent 9a1a83db8e12f4c4881ad7818a669fc8b1394108 EAFP: adopt renamed Device function Signed-off-by: Heidi Eckhart diff -r 9a1a83db8e12 -r 1aaf26015bb8 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Mon Mar 10 13:09:05 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Mon Mar 10 13:09:14 2008 +0100 @@ -40,24 +40,6 @@ const static CMPIBroker *_BROKER; -static uint16_t class_to_type(const CMPIObjectPath *ref) -{ - uint16_t type; - - if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL)) - type = CIM_RES_TYPE_DISK; - else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL)) - type = CIM_RES_TYPE_NET; - else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL)) - type = CIM_RES_TYPE_MEM; - else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL)) - type = CIM_RES_TYPE_PROC; - else - type = 0; - - return type; -} - static CMPIStatus vdev_to_pool(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -76,7 +58,7 @@ static CMPIStatus vdev_to_pool(const CMP if (s.rc != CMPI_RC_OK) goto out; - type = class_to_type(ref); + type = res_type_from_device_classname(CLASSNAME(ref)); if (type == CIM_RES_TYPE_UNKNOWN) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, From heidieck at linux.vnet.ibm.com Mon Mar 10 12:44:37 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 13:44:37 +0100 Subject: [Libvirt-cim] [PATCH] Fix a bug in MSD schema In-Reply-To: References: Message-ID: <47D52D35.5080404@linux.vnet.ibm.com> Kaitlin Rupert wrote: > # HG changeset patch > # User Kaitlin Rupert > # Date 1204932278 28800 > # Node ID e7c2e8fca9d4dac6477e1c3aafc36bd68e7fca1f > # Parent 79a937040287f70b36e35e2a0c397894d6473ac5 > Fix a bug in MSD schema. > > The last patach for the VSMigrationSettingData introduced a bug. Pegasus failed to clean up my repository properly when the previous patchset was tested. > > Also sfcb was complaining. Good catch ... +1. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Mon Mar 10 13:03:21 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 14:03:21 +0100 Subject: [Libvirt-cim] [PATCH] move VIRT_DEV_foo types to CIM_RES_TYPE_foo Message-ID: <581efd4f29eb6a9aa321.1205154201@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205154179 -3600 # Node ID 581efd4f29eb6a9aa321cf54dbcf6f35f59055f9 # Parent 1aaf26015bb83a1b2433073c2ec5886cf828d9e6 move VIRT_DEV_foo types to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Mar 10 13:09:14 2008 +0100 +++ b/libxkutil/device_parsing.c Mon Mar 10 14:02:59 2008 +0100 @@ -81,13 +81,13 @@ void cleanup_virt_device(struct virt_dev if (dev == NULL) return; /* free()-like semantics */ - if (dev->type == VIRT_DEV_DISK) + if (dev->type == CIM_RES_TYPE_DISK) cleanup_disk_device(&dev->dev.disk); - else if (dev->type == VIRT_DEV_NET) + else if (dev->type == CIM_RES_TYPE_NET) cleanup_net_device(&dev->dev.net); - else if (dev->type == VIRT_DEV_EMU) + else if (dev->type == CIM_RES_TYPE_EMU) cleanup_emu_device(&dev->dev.emu); - else if (dev->type == VIRT_DEV_GRAPHICS) + else if (dev->type == CIM_RES_TYPE_GRAPHICS) cleanup_graphics_device(&dev->dev.graphics); free(dev->id); @@ -181,7 +181,7 @@ static int parse_disk_device(xmlNode *dn if ((ddev->source == NULL) || (ddev->virtual_dev == NULL)) goto err; - vdev->type = VIRT_DEV_DISK; + vdev->type = CIM_RES_TYPE_DISK; vdev->id = strdup(ddev->virtual_dev); *vdevs = vdev; @@ -248,7 +248,7 @@ static int parse_net_device(xmlNode *ino } } - vdev->type = VIRT_DEV_NET; + vdev->type = CIM_RES_TYPE_NET; vdev->id = strdup(ndev->mac); *vdevs = vdev; @@ -286,7 +286,7 @@ static int parse_vcpu_device(xmlNode *no cdev->number = i; - vdev->type = VIRT_DEV_VCPU; + vdev->type = CIM_RES_TYPE_PROC; if (asprintf(&vdev->id, "%i", i) == -1) vdev->id = NULL; } @@ -315,7 +315,7 @@ static int parse_emu_device(xmlNode *nod if (edev->path != NULL) goto err; - vdev->type = VIRT_DEV_EMU; + vdev->type = CIM_RES_TYPE_EMU; *vdevs = vdev; @@ -376,7 +376,7 @@ static int parse_graphics_device(xmlNode if ((gdev->type == NULL) || (gdev->port == NULL)) goto err; - vdev->type = VIRT_DEV_GRAPHICS; + vdev->type = CIM_RES_TYPE_GRAPHICS; *vdevs = vdev; @@ -411,17 +411,17 @@ static int do_parse(xmlNodeSet *nsv, int int (*do_real_parse)(xmlNode *, struct virt_device **) = NULL; /* point to correct parser function according to type */ - if (type == VIRT_DEV_NET) + if (type == CIM_RES_TYPE_NET) do_real_parse = &parse_net_device; - else if (type == VIRT_DEV_DISK) + else if (type == CIM_RES_TYPE_DISK) do_real_parse = &parse_disk_device; - else if (type == VIRT_DEV_VCPU) + else if (type == CIM_RES_TYPE_PROC) do_real_parse = parse_vcpu_device; - else if (type == VIRT_DEV_EMU) + else if (type == CIM_RES_TYPE_EMU) do_real_parse = parse_emu_device; - else if (type == VIRT_DEV_MEM) + else if (type == CIM_RES_TYPE_MEM) do_real_parse = parse_mem_device; - else if (type == VIRT_DEV_GRAPHICS) + else if (type == CIM_RES_TYPE_GRAPHICS) do_real_parse = parse_graphics_device; else goto out; @@ -479,17 +479,17 @@ static int parse_devices(const char *xml xmlXPathObject *xpathObj; xmlChar *xpathstr; - if (type == VIRT_DEV_NET) + if (type == CIM_RES_TYPE_NET) xpathstr = NET_XPATH; - else if (type == VIRT_DEV_DISK) + else if (type == CIM_RES_TYPE_DISK) xpathstr = DISK_XPATH; - else if (type == VIRT_DEV_VCPU) + else if (type == CIM_RES_TYPE_PROC) xpathstr = VCPU_XPATH; - else if (type == VIRT_DEV_EMU) + else if (type == CIM_RES_TYPE_EMU) xpathstr = EMU_XPATH; - else if (type == VIRT_DEV_MEM) + else if (type == CIM_RES_TYPE_MEM) xpathstr = MEM_XPATH; - else if (type == VIRT_DEV_GRAPHICS) + else if (type == CIM_RES_TYPE_GRAPHICS) xpathstr = GRAPHICS_XPATH; else goto err1; @@ -535,24 +535,24 @@ struct virt_device *virt_device_dup(stru dev->type = _dev->type; dev->id = strdup(_dev->id); - if (dev->type == VIRT_DEV_NET) { + if (dev->type == CIM_RES_TYPE_NET) { DUP_FIELD(dev, _dev, dev.net.mac); DUP_FIELD(dev, _dev, dev.net.type); DUP_FIELD(dev, _dev, dev.net.source); - } else if (dev->type == VIRT_DEV_DISK) { + } else if (dev->type == CIM_RES_TYPE_DISK) { DUP_FIELD(dev, _dev, dev.disk.type); DUP_FIELD(dev, _dev, dev.disk.device); DUP_FIELD(dev, _dev, dev.disk.driver); DUP_FIELD(dev, _dev, dev.disk.source); DUP_FIELD(dev, _dev, dev.disk.virtual_dev); - } else if (dev->type == VIRT_DEV_MEM) { + } else if (dev->type == CIM_RES_TYPE_MEM) { dev->dev.mem.size = _dev->dev.mem.size; dev->dev.mem.maxsize = _dev->dev.mem.maxsize; - } else if (dev->type == VIRT_DEV_VCPU) { + } else if (dev->type == CIM_RES_TYPE_PROC) { dev->dev.vcpu.number = _dev->dev.vcpu.number; - } else if (dev->type == VIRT_DEV_EMU) { + } else if (dev->type == CIM_RES_TYPE_EMU) { DUP_FIELD(dev, _dev, dev.emu.path); - } else if (dev->type == VIRT_DEV_GRAPHICS) { + } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { DUP_FIELD(dev, _dev, dev.graphics.type); DUP_FIELD(dev, _dev, dev.graphics.port); } @@ -566,7 +566,7 @@ static int _get_mem_device(const char *x struct virt_device *mdev = NULL; int ret; - ret = parse_devices(xml, &mdevs, VIRT_DEV_MEM); + ret = parse_devices(xml, &mdevs, CIM_RES_TYPE_MEM); if (ret <= 0) return ret; @@ -592,7 +592,7 @@ static int _get_mem_device(const char *x mdev->dev.mem.maxsize = mdev->dev.mem.size; } - mdev->type = VIRT_DEV_MEM; + mdev->type = CIM_RES_TYPE_MEM; mdev->id = strdup("mem"); *list = mdev; @@ -610,7 +610,7 @@ int get_devices(virDomainPtr dom, struct if (xml == NULL) return 0; - if (type == VIRT_DEV_MEM) + if (type == CIM_RES_TYPE_MEM) ret = _get_mem_device(xml, list); else ret = parse_devices(xml, list, type); @@ -775,19 +775,19 @@ int get_dominfo_from_xml(const char *xml if (ret == 0) goto err; - parse_devices(xml, &(*dominfo)->dev_emu, VIRT_DEV_EMU); - parse_devices(xml, &(*dominfo)->dev_graphics, VIRT_DEV_GRAPHICS); + parse_devices(xml, &(*dominfo)->dev_emu, CIM_RES_TYPE_EMU); + parse_devices(xml, &(*dominfo)->dev_graphics, CIM_RES_TYPE_GRAPHICS); (*dominfo)->dev_mem_ct = _get_mem_device(xml, &(*dominfo)->dev_mem); (*dominfo)->dev_net_ct = parse_devices(xml, &(*dominfo)->dev_net, - VIRT_DEV_NET); + CIM_RES_TYPE_NET); (*dominfo)->dev_disk_ct = parse_devices(xml, &(*dominfo)->dev_disk, - VIRT_DEV_DISK); + CIM_RES_TYPE_DISK); (*dominfo)->dev_vcpu_ct = parse_devices(xml, &(*dominfo)->dev_vcpu, - VIRT_DEV_VCPU); + CIM_RES_TYPE_PROC); return ret; @@ -933,10 +933,10 @@ static int change_vcpus(virDomainPtr dom int attach_device(virDomainPtr dom, struct virt_device *dev) { - if ((dev->type == VIRT_DEV_NET) || - (dev->type == VIRT_DEV_DISK)) + if ((dev->type == CIM_RES_TYPE_NET) || + (dev->type == CIM_RES_TYPE_DISK)) return _change_device(dom, dev, true); - else if (dev->type == VIRT_DEV_VCPU) + else if (dev->type == CIM_RES_TYPE_PROC) return change_vcpus(dom, 1); CU_DEBUG("Unhandled device type %i", dev->type); @@ -946,10 +946,10 @@ int attach_device(virDomainPtr dom, stru int detach_device(virDomainPtr dom, struct virt_device *dev) { - if ((dev->type == VIRT_DEV_NET) || - (dev->type == VIRT_DEV_DISK)) + if ((dev->type == CIM_RES_TYPE_NET) || + (dev->type == CIM_RES_TYPE_DISK)) return _change_device(dom, dev, false); - else if (dev->type == VIRT_DEV_VCPU) + else if (dev->type == CIM_RES_TYPE_PROC) return change_vcpus(dom, -1); CU_DEBUG("Unhandled device type %i", dev->type); @@ -959,7 +959,7 @@ int detach_device(virDomainPtr dom, stru int change_device(virDomainPtr dom, struct virt_device *dev) { - if (dev->type == VIRT_DEV_MEM) + if (dev->type == CIM_RES_TYPE_MEM) return change_memory(dom, dev); CU_DEBUG("Unhandled device type %i", dev->type); diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Mar 10 13:09:14 2008 +0100 +++ b/libxkutil/device_parsing.h Mon Mar 10 14:02:59 2008 +0100 @@ -63,15 +63,7 @@ struct graphics_device { }; struct virt_device { - enum { - VIRT_DEV_NET = CIM_RES_TYPE_NET, - VIRT_DEV_DISK = CIM_RES_TYPE_DISK, - VIRT_DEV_MEM = CIM_RES_TYPE_MEM, - VIRT_DEV_VCPU = CIM_RES_TYPE_PROC, - VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN, - VIRT_DEV_EMU, - VIRT_DEV_GRAPHICS, - } type; + uint16_t type; union { struct disk_device disk; struct net_device net; diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Mar 10 13:09:14 2008 +0100 +++ b/libxkutil/xmlgen.c Mon Mar 10 14:02:59 2008 +0100 @@ -322,10 +322,10 @@ static bool concat_devxml(char **xml, int i; for (i = 0; i < count; i++) { - /* Deleted devices are marked as VIRT_DEV_UNKNOWN + /* Deleted devices are marked as CIM_RES_TYPE_UNKNOWN * and should be skipped */ - if (list[i].type != VIRT_DEV_UNKNOWN) + if (list[i].type != CIM_RES_TYPE_UNKNOWN) func(&_xml, &list[i]); } @@ -342,22 +342,22 @@ char *device_to_xml(struct virt_device * bool (*func)(char **, struct virt_device *); switch (type) { - case VIRT_DEV_DISK: + case CIM_RES_TYPE_DISK: func = disk_to_xml; break; - case VIRT_DEV_VCPU: + case CIM_RES_TYPE_PROC: func = vcpu_to_xml; break; - case VIRT_DEV_NET: + case CIM_RES_TYPE_NET: func = net_to_xml; break; - case VIRT_DEV_MEM: + case CIM_RES_TYPE_MEM: func = mem_to_xml; break; - case VIRT_DEV_EMU: + case CIM_RES_TYPE_EMU: func = emu_to_xml; break; - case VIRT_DEV_GRAPHICS: + case CIM_RES_TYPE_GRAPHICS: func = graphics_to_xml; break; default: diff -r 1aaf26015bb8 -r 581efd4f29eb src/svpc_types.h --- a/src/svpc_types.h Mon Mar 10 13:09:14 2008 +0100 +++ b/src/svpc_types.h Mon Mar 10 14:02:59 2008 +0100 @@ -27,6 +27,8 @@ #define CIM_RES_TYPE_MEM 4 #define CIM_RES_TYPE_NET 10 #define CIM_RES_TYPE_DISK 17 +#define CIM_RES_TYPE_EMU 1 +#define CIM_RES_TYPE_GRAPHICS 24 #define CIM_RES_TYPE_UNKNOWN 1000 #define CIM_VSSD_RECOVERY_NONE 2 From heidieck at linux.vnet.ibm.com Mon Mar 10 13:42:38 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Mon, 10 Mar 2008 14:42:38 +0100 Subject: [Libvirt-cim] [PATCH] Add iteration functionality for CIM_RES_TYPE_ALL Message-ID: <1325969aff7f736a9b17.1205156558@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205156447 -3600 # Node ID 1325969aff7f736a9b17b4cd259f9608890d11bf # Parent f82efd4364f1f27c1ec7ceaedafc281379007b38 Add iteration functionality for CIM_RES_TYPE_ALL Signed-off-by: Heidi Eckhart diff -r f82efd4364f1 -r 1325969aff7f src/Virt_Device.c --- a/src/Virt_Device.c Fri Mar 07 15:24:38 2008 -0800 +++ b/src/Virt_Device.c Mon Mar 10 14:40:47 2008 +0100 @@ -322,28 +322,15 @@ static CMPIStatus _enum_devices(const CM struct inst_list *list) { CMPIStatus s; + int i; if (type == CIM_RES_TYPE_ALL) { - s = _get_devices(broker, - reference, - dom, - CIM_RES_TYPE_PROC, - list); - s = _get_devices(broker, - reference, - dom, - CIM_RES_TYPE_NET, - list); - s = _get_devices(broker, - reference, - dom, - CIM_RES_TYPE_MEM, - list); - s = _get_devices(broker, - reference, - dom, - CIM_RES_TYPE_DISK, - list); + for (i=0; i References: <581efd4f29eb6a9aa321.1205154201@dyn-9-152-210-82.boeblingen.de.ibm.com> Message-ID: <47D554F8.90209@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1205154179 -3600 > # Node ID 581efd4f29eb6a9aa321cf54dbcf6f35f59055f9 > # Parent 1aaf26015bb83a1b2433073c2ec5886cf828d9e6 > move VIRT_DEV_foo types to CIM_RES_TYPE_foo > Signed-off-by: Heidi Eckhart > > diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/device_parsing.c Looks good. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Mon Mar 10 15:34:39 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 08:34:39 -0700 Subject: [Libvirt-cim] [PATCH] Add iteration functionality for CIM_RES_TYPE_ALL In-Reply-To: <1325969aff7f736a9b17.1205156558@dyn-9-152-210-82.boeblingen.de.ibm.com> References: <1325969aff7f736a9b17.1205156558@dyn-9-152-210-82.boeblingen.de.ibm.com> Message-ID: <47D5550F.5040500@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1205156447 -3600 > # Node ID 1325969aff7f736a9b17b4cd259f9608890d11bf > # Parent f82efd4364f1f27c1ec7ceaedafc281379007b38 > Add iteration functionality for CIM_RES_TYPE_ALL > Signed-off-by: Heidi Eckhart > > diff -r f82efd4364f1 -r 1325969aff7f src/Virt_Device.c This looks good as well. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From grendel at linux.vnet.ibm.com Mon Mar 10 16:49:18 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 10 Mar 2008 12:49:18 -0400 Subject: [Libvirt-cim] [PATCH] Fix indication_tester's filter deletion issue Message-ID: <4b34c7474e59f939200c.1205167758@naegling> # HG changeset patch # User Jay Gagnon # Date 1205167743 14400 # Node ID 4b34c7474e59f939200cdfeaa7d3414cfc6f7c13 # Parent d93bb8c00423a88f1c9475a8e6076b1945e1dd01 Fix indication_tester's filter deletion issue A while ago we discovered that giving the same name to various tests in indication_tester doesn't work, even when the first test's filter, handler, and subscription should have been deleted once it was done running. It turns out that indication_tester wasn't deleting the filter, due to some bad xml. This fixes the xml and eliminates the need to use the -n switch unless you want multiple simultaneous tests. Signed-off-by: Jay Gagnon diff -r d93bb8c00423 -r 4b34c7474e59 tools/indication_tester.py --- a/tools/indication_tester.py Mon Mar 03 06:48:26 2008 -0800 +++ b/tools/indication_tester.py Mon Mar 10 12:49:03 2008 -0400 @@ -181,7 +181,7 @@ def delete_inst_xml(name, type, sysname) - + CIM_ComputerSystem @@ -189,7 +189,7 @@ def delete_inst_xml(name, type, sysname) %s - CIM_Indication%sCIMXML + CIM_Indication%s %s%s From danms at us.ibm.com Mon Mar 10 17:08:56 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 10:08:56 -0700 Subject: [Libvirt-cim] [PATCH] Fix indication_tester's filter deletion issue In-Reply-To: <4b34c7474e59f939200c.1205167758@naegling> (Jay Gagnon's message of "Mon, 10 Mar 2008 12:49:18 -0400") References: <4b34c7474e59f939200c.1205167758@naegling> Message-ID: <87d4q24ic7.fsf@caffeine.beaverton.ibm.com> JG> diff -r d93bb8c00423 -r 4b34c7474e59 tools/indication_tester.py JG> --- a/tools/indication_tester.py Mon Mar 03 06:48:26 2008 -0800 JG> +++ b/tools/indication_tester.py Mon Mar 10 12:49:03 2008 -0400 JG> @@ -181,7 +181,7 @@ def delete_inst_xml(name, type, sysname) JG> JG> JG> JG> - JG> + JG> JG> CIM_ComputerSystem JG> JG> @@ -189,7 +189,7 @@ def delete_inst_xml(name, type, sysname) JG> %s JG> JG> JG> - CIM_Indication%sCIMXML JG> + CIM_Indication%s JG> JG> JG> %s%s Can you explain why the XML was wrong and why this fixes it? Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Mon Mar 10 18:12:10 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 10 Mar 2008 14:12:10 -0400 Subject: [Libvirt-cim] [PATCH] Fix indication_tester's filter deletion issue In-Reply-To: <87d4q24ic7.fsf@caffeine.beaverton.ibm.com> References: <4b34c7474e59f939200c.1205167758@naegling> <87d4q24ic7.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D579FA.7030308@linux.vnet.ibm.com> Dan Smith wrote: > > Can you explain why the XML was wrong and why this fixes it? > > Sure. I used -d to see what xml was actually going across for the filter. The create xml started off like this: And then the corresponding delete xml started off like this: The classnames don't match up, so when we make the delete request the CIMOM can't find the right instance to delete. Both handler and subscription have the classnames properly matched, so they get created and deleted properly. Now the one other thing I noticed is that handler and subscription have the CIMXML suffix on both create and delete, so maybe the more correct solution is to add it to the filter create, not remove it from the filter delete. Do we have anything official that can answer that for us? -- -Jay From danms at us.ibm.com Mon Mar 10 18:22:40 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:22:40 -0700 Subject: [Libvirt-cim] [PATCH] [CU] Add cu_get_array_prop() Message-ID: # HG changeset patch # User Dan Smith # Date 1205173351 25200 # Node ID e7d4d1f30118bbc0e484fd4f4fd80747b63435d5 # Parent d93bb8c00423a88f1c9475a8e6076b1945e1dd01 [CU] Add cu_get_array_prop() Signed-off-by: Dan Smith diff -r d93bb8c00423 -r e7d4d1f30118 args_util.c --- a/args_util.c Mon Mar 03 06:48:26 2008 -0800 +++ b/args_util.c Mon Mar 10 11:22:31 2008 -0700 @@ -192,6 +192,27 @@ CMPIrc cu_get_u16_arg(const CMPIArgs *ar pv = CMGetProperty(i, p, s); \ if ((s)->rc != CMPI_RC_OK || CMIsNullValue(pv)) \ return CMPI_RC_ERR_NO_SUCH_PROPERTY; + +CMPIrc cu_get_array_prop(const CMPIInstance *inst, + const char *prop, + CMPIArray **array) +{ + CMPIData value; + CMPIStatus s; + + REQUIRE_PROPERTY_DEFINED(inst, prop, value, &s); + + value = CMGetProperty(inst, prop, &s); + if ((s.rc != CMPI_RC_OK) || CMIsNullValue(value)) + return s.rc; + + if (!CMIsArray(value) || CMIsNullObject(value.value.array)) + return CMPI_RC_ERR_TYPE_MISMATCH; + + *array = value.value.array; + + return CMPI_RC_OK; +} CMPIrc cu_get_str_prop(const CMPIInstance *inst, const char *prop, diff -r d93bb8c00423 -r e7d4d1f30118 libcmpiutil.h --- a/libcmpiutil.h Mon Mar 03 06:48:26 2008 -0800 +++ b/libcmpiutil.h Mon Mar 10 11:22:31 2008 -0700 @@ -211,6 +211,23 @@ bool cu_return_instance_name(const CMPIR */ unsigned int cu_return_instance_names(const CMPIResult *results, const struct inst_list *list); + +/** + * Get an array property of an instance + * + * @param inst The instance + * @param prop The property name + * @param target A pointer to a CMPIarray that will be set + * if successful + * @returns + * - CMPI_RC_OK on success, + * - CMPI_RC_ERR_NO_SUCH_PROPERTY if prop is not present, + * - CMPI_RC_ERR_TYPE_MISMATCH if prop is not an array, + * - CMPI_RC_ERROR otherwise + */ +CMPIrc cu_get_array_prop(const CMPIInstance *inst, + const char *prop, + CMPIArray **array); /** * Get a string property of an instance From danms at us.ibm.com Mon Mar 10 18:24:53 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:24:53 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Make the migration check functions aware of MSD In-Reply-To: Message-ID: <05cbd18bf3644b6e1b32.1205173493@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205171774 25200 # Node ID 05cbd18bf3644b6e1b32b37c30310fb1b1e23a44 # Parent 1d2157cd04e4d46b50d9e6115e0927d8b0a33b8c Make the migration check functions aware of MSD Signed-off-by: Dan Smith diff -r 1d2157cd04e4 -r 05cbd18bf364 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 10 14:40:47 2008 +0100 +++ b/src/Virt_VSMigrationService.c Mon Mar 10 10:56:14 2008 -0700 @@ -68,6 +68,63 @@ struct migration_job { char uuid[33]; }; +static CMPIStatus get_msd(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + CMPIInstance **msd) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_inst_arg(argsin, "MigrationSettingData", msd); + if ((ret == CMPI_RC_OK) && (*msd != NULL)) + goto out; + + s = get_migration_sd(ref, msd, _BROKER, false); + if ((s.rc != CMPI_RC_OK) || (*msd == NULL)) { + cu_statusf(_BROKER, &s, + s.rc, + "Unable to get default setting data values"); + goto out; + } + CU_DEBUG("Using default values for MigrationSettingData param"); + + out: + return s; +} + +static CMPIStatus get_migration_type(CMPIInstance *msd, + uint16_t *type) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "MigrationType", type); + if (ret != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + ret, + "Invalid MigrationType value"); + } + + return s; +} + +static CMPIStatus get_migration_uri(CMPIInstance *msd, + uint16_t *uri) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "TransportType", uri); + if (ret == CMPI_RC_OK) + goto out; + + CU_DEBUG("Using default TransportType: %d", CIM_MIGRATE_URI_SSH); + *uri = CIM_MIGRATE_URI_SSH; + + out: + return s; +} + static char *dest_uri(const char *cn, const char *dest, uint16_t transport) @@ -159,39 +216,67 @@ static CMPIStatus check_hver(virConnectP return s; } +static CMPIStatus get_msd_check_values(const CMPIObjectPath *ref, + const char *destination, + const CMPIArgs *argsin, + virConnectPtr *conn) +{ + CMPIStatus s; + CMPIInstance *msd; + uint16_t uri_type; + char *uri = NULL; + + s = get_msd(ref, argsin, &msd); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_uri(msd, &uri_type); + if (s.rc != CMPI_RC_OK) + goto out; + + uri = dest_uri(CLASSNAME(ref), destination, uri_type); + if (uri == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to construct a valid libvirt URI"); + goto out; + } + + *conn = virConnectOpen(uri); + if (*conn == NULL) { + CU_DEBUG("Failed to connect to remote host (%s)", uri); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to connect to remote host (%s)", uri); + goto out; + } + + out: + free(uri); + + return s; +} + static CMPIStatus vs_migratable(const CMPIObjectPath *ref, const char *domain, const char *destination, const CMPIResult *results, + const CMPIArgs *argsin, CMPIArgs *argsout) { CMPIStatus s; - char *uri = NULL; virConnectPtr conn = NULL; virConnectPtr dconn = NULL; uint32_t retcode = 1; CMPIBoolean isMigratable = 0; - uri = dest_uri(CLASSNAME(ref), destination, CIM_MIGRATE_URI_SSH); - if (uri == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to construct a valid libvirt URI"); - goto out; - } + s = get_msd_check_values(ref, destination, argsin, &dconn); + if (s.rc != CMPI_RC_OK) + goto out; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) goto out; - - dconn = virConnectOpen(uri); - if (dconn == NULL) { - CU_DEBUG("Failed to connect to remote host (%s)", uri); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to connect to remote host (%s)", uri); - goto out; - } s = check_hver(conn, dconn); if (s.rc != CMPI_RC_OK) @@ -212,7 +297,6 @@ static CMPIStatus vs_migratable(const CM CMAddArg(argsout, "IsMigratable", (CMPIValue *)&isMigratable, CMPI_boolean); - free(uri); virConnectClose(conn); virConnectClose(dconn); @@ -250,7 +334,7 @@ static CMPIStatus vs_migratable_host(CMP return s; } - return vs_migratable(ref, name, dhost, results, argsout); + return vs_migratable(ref, name, dhost, results, argsin, argsout); } static CMPIStatus vs_migratable_system(CMPIMethodMI *self, @@ -293,7 +377,7 @@ static CMPIStatus vs_migratable_system(C return s; } - return vs_migratable(ref, name, dname, results, argsout); + return vs_migratable(ref, name, dname, results, argsin, argsout); } static const char *ind_type_to_name(int ind_type) @@ -771,66 +855,9 @@ static CMPIStatus migrate_create_job_ins return s; } -static CMPIStatus get_msd(const CMPIObjectPath *ref, - const CMPIArgs *argsin, - CMPIInstance **msd) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - int ret; - - ret = cu_get_inst_arg(argsin, "MigrationSettingData", msd); - if ((ret == CMPI_RC_OK) && (*msd != NULL)) - goto out; - - s = get_migration_sd(ref, msd, _BROKER, false); - if ((s.rc != CMPI_RC_OK) || (*msd == NULL)) { - cu_statusf(_BROKER, &s, - s.rc, - "Unable to get default setting data values"); - goto out; - } - CU_DEBUG("Using default values for MigrationSettingData param"); - - out: - return s; -} - -static CMPIStatus get_migration_type(CMPIInstance *msd, - uint16_t *type) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - int ret; - - ret = cu_get_u16_prop(msd, "MigrationType", type); - if (ret != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - ret, - "Invalid MigrationType value"); - } - - return s; -} - -static CMPIStatus get_migration_uri(CMPIInstance *msd, - uint16_t *uri) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - int ret; - - ret = cu_get_u16_prop(msd, "TransportType", uri); - if (ret == CMPI_RC_OK) - goto out; - - CU_DEBUG("Using default TransportType: %d", CIM_MIGRATE_URI_SSH); - *uri = CIM_MIGRATE_URI_SSH; - - out: - return s; -} - -static CMPIStatus get_msd_values(const CMPIObjectPath *ref, - const CMPIArgs *argsin, - struct migration_job *job) +static CMPIStatus get_msd_job_values(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + struct migration_job *job) { CMPIStatus s; CMPIInstance *msd; @@ -901,7 +928,7 @@ static CMPIStatus migrate_do(const CMPIO goto out; } - s = get_msd_values(ref, argsin, job); + s = get_msd_job_values(ref, argsin, job); if (s.rc != CMPI_RC_OK) goto out; From danms at us.ibm.com Mon Mar 10 18:24:54 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:24:54 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add lookup of domain to make sure it exists as part of the check In-Reply-To: Message-ID: <29e665fff096426ced0f.1205173494@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205171774 25200 # Node ID 29e665fff096426ced0f3c7c9ddc7c0924927a07 # Parent 05cbd18bf3644b6e1b32b37c30310fb1b1e23a44 Add lookup of domain to make sure it exists as part of the check Signed-off-by: Dan Smith diff -r 05cbd18bf364 -r 29e665fff096 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 10 10:56:14 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 10 10:56:14 2008 -0700 @@ -269,6 +269,7 @@ static CMPIStatus vs_migratable(const CM virConnectPtr dconn = NULL; uint32_t retcode = 1; CMPIBoolean isMigratable = 0; + virDomainPtr dom = NULL; s = get_msd_check_values(ref, destination, argsin, &dconn); if (s.rc != CMPI_RC_OK) @@ -281,6 +282,14 @@ static CMPIStatus vs_migratable(const CM s = check_hver(conn, dconn); if (s.rc != CMPI_RC_OK) goto out; + + dom = virDomainLookupByName(conn, domain); + if (dom == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such domain"); + goto out; + } s = check_caps(conn, dconn); if (s.rc != CMPI_RC_OK) @@ -297,6 +306,7 @@ static CMPIStatus vs_migratable(const CM CMAddArg(argsout, "IsMigratable", (CMPIValue *)&isMigratable, CMPI_boolean); + virDomainFree(dom); virConnectClose(conn); virConnectClose(dconn); From danms at us.ibm.com Mon Mar 10 18:24:52 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:24:52 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Add MSD support to CheckVSIsMigratable() Message-ID: This adds MSD support to the check functions, as well as adding a check to make sure the domain in question actually exists on the source system. From danms at us.ibm.com Mon Mar 10 18:25:51 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:25:51 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [RFC] Add optional check parameter field to migration schema In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205173462 25200 # Node ID bdfe49f4387203f179d52f4e2e3bd8c2416e4629 # Parent 29e665fff096426ced0f3c7c9ddc7c0924927a07 [RFC] Add optional check parameter field to migration schema Signed-off-by: Dan Smith diff -r 29e665fff096 -r bdfe49f43872 schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Mon Mar 10 10:56:14 2008 -0700 +++ b/schema/VSMigrationSettingData.mof Mon Mar 10 11:24:22 2008 -0700 @@ -11,6 +11,7 @@ class Xen_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; [Provider("cmpi::Virt_VSMigrationSettingData")] @@ -18,4 +19,5 @@ class KVM_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; From danms at us.ibm.com Mon Mar 10 18:25:52 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:25:52 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: Message-ID: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205173468 25200 # Node ID 35861307381c7f9bd604c0080e24453d85e75f96 # Parent bdfe49f4387203f179d52f4e2e3bd8c2416e4629 [RFC] Add configure support for migration check settings Signed-off-by: Dan Smith diff -r bdfe49f43872 -r 35861307381c configure.ac --- a/configure.ac Mon Mar 10 11:24:22 2008 -0700 +++ b/configure.ac Mon Mar 10 11:24:28 2008 -0700 @@ -72,6 +72,20 @@ AC_ARG_WITH(html-dir, [test "x$withval" != "x" && HTML_DIR="$withval"], [HTML_DIR='$(datadir)/doc/$(PACKAGE)-$(VERSION)/html']) AC_SUBST(HTML_DIR) + +AC_ARG_WITH([migrate_check_timeout], + [ --with-migrate_check_timeout=SECS Max runtime allowed for external migration checks], + [test "x$withval" != "x" && MIG_CHECKS_TIMEOUT="$withval"], + [MIG_CHECKS_TIMEOUT=10]) +AC_SUBST(MIG_CHECKS_TIMEOUT) +AC_DEFINE_UNQUOTED(MIG_CHECKS_TIMEOUT, $MIG_CHECKS_TIMEOUT, [External migration check timeout]) + +AC_ARG_WITH([migrate_check_dir], + [ --with-migrate_check_dir=dir Location of external migration checks], + [test "x$withval" != "x" && MIG_CHECKS_DIR="$withval"], + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) +AC_SUBST(MIG_CHECKS_DIR) +AC_DEFINE_UNQUOTED(MIG_CHECKS_DIR, "$MIG_CHECKS_DIR", [External migration check timeout]) # Autogenerate the autoconf header file to store build settings AC_CONFIG_HEADER([config.h]) From danms at us.ibm.com Mon Mar 10 18:25:50 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:25:50 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] [RFC] Add external migration checks Message-ID: This set adds external check support to VSMigration service Any executable in the MIG_CHECK_DIR is executed during the CheckVSIsMigratable() method. If it returns 0, the check continues, nonzero and an error is reported to the client. If the client puts anything in the CheckParams[] field, the method writes these out to a temporary file and passes the filename on the command-line to the check programs. Migration checks are given MIG_CHECK_TIMEOUT (=10 sec by default) to get their business done, otherwise they are killed and we report failure. This avoids letting the checks block the CIMOM for too long. Comments appreciated. From danms at us.ibm.com Mon Mar 10 18:25:53 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:25:53 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205173468 25200 # Node ID bc3883ff55307b2e1836cb5083adbd1c26e4cadf # Parent 35861307381c7f9bd604c0080e24453d85e75f96 [RFC] Add external check functionality to CheckIsVSMigratable() Signed-off-by: Dan Smith diff -r 35861307381c -r bc3883ff5530 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 10 11:24:28 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 10 11:24:28 2008 -0700 @@ -21,6 +21,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -39,6 +46,8 @@ #include "Virt_VSMigrationService.h" #include "Virt_HostSystem.h" #include "Virt_VSMigrationSettingData.h" + +#include "config.h" #define CIM_JOBSTATE_STARTING 3 #define CIM_JOBSTATE_RUNNING 4 @@ -216,15 +225,254 @@ static CMPIStatus check_hver(virConnectP return s; } +static bool is_valid_check(const char *path) +{ + struct stat s; + + if (stat(path, &s) != 0) + return false; + + if (!S_ISREG(s.st_mode)) + return false; + + if ((s.st_mode & S_IXUSR) || + (s.st_mode & S_IXGRP) || + (s.st_mode & S_IXOTH)) + return true; + else + return false; +} + +static void free_list(char **list, int count) +{ + int i; + + if (list == NULL) + return; + + for (i = 0; i < count; i++) + free(list[i]); + + free(list); +} + +static char **list_migration_checks(int *count) +{ + DIR *dir; + struct dirent *de; + char **list = NULL; + int len = 0; + + *count = 0; + + dir = opendir(MIG_CHECKS_DIR); + if (dir == NULL) { + CU_DEBUG("Unable to open migration checks dir: %s (%s)", + MIG_CHECKS_DIR, + strerror(errno)); + *count = -1; + return NULL; + } + + while ((de = readdir(dir)) != NULL) { + int ret; + char *path = NULL; + + if (de->d_name[0] == '.') + continue; + + if (*count == len) { + char **tmp; + + len = (len * 2) + 1; + tmp = realloc(list, sizeof(char *) * len); + if (tmp == NULL) { + CU_DEBUG("Failed to alloc check list"); + goto error; + } + + list = tmp; + } + + ret = asprintf(&path, + "%s/%s", + MIG_CHECKS_DIR, + de->d_name); + if (ret == -1) { + CU_DEBUG("Failed to alloc path for check"); + goto error; + } + + if (is_valid_check(path)) { + list[*count] = path; + (*count) += 1; + } else { + CU_DEBUG("Invalid check program: %s", path); + free(path); + } + } + + closedir(dir); + + return list; + error: + closedir(dir); + + free_list(list, *count); + *count = 0; + + return NULL; +} + +static CMPIStatus _call_check(virDomainPtr dom, + const char *prog, + const char *param_path) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + pid_t pid; + int i; + int rc = -1; + + pid = fork(); + if (pid == 0) { + virConnectPtr conn = virDomainGetConnect(dom); + const char *name = virDomainGetName(dom); + const char *uri = virConnectGetURI(conn); + + if (setpgrp() == -1) + perror("setpgrp"); + + execl(prog, prog, name, uri, param_path, NULL); + CU_DEBUG("exec(%s) failed: %s", prog, strerror(errno)); + _exit(1); + } + + for (i = 0; i < (MIG_CHECKS_TIMEOUT * 4); i++) { + int status; + if (waitpid(pid, &status, WNOHANG) != pid) { + usleep(250000); + } else { + rc = WEXITSTATUS(status); + break; + } + } + + if (rc == -1) { + CU_DEBUG("Killing off stale child %i", pid); + killpg(pid, SIGKILL); + waitpid(pid, NULL, WNOHANG); + } + + if (rc != 0) { + char *name = strdup(prog); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Migration check `%s' failed", + basename(name)); + free(name); + } + + return s; +} + +static CMPIStatus call_external_checks(virDomainPtr dom, + const char *param_path) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + char **list = NULL; + int count = 0; + int i; + + list = list_migration_checks(&count); + if (count < 0) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to execute migration checks"); + goto out; + } else if (list == NULL) { + goto out; + } + + for (i = 0; i < count; i++) { + CU_DEBUG("Calling migration check: %s", list[i]); + s = _call_check(dom, list[i], param_path); + if (s.rc != CMPI_RC_OK) { + CU_DEBUG("...Failed"); + break; + } else + CU_DEBUG("...OK"); + } + out: + free_list(list, count); + + return s; +} + +static char *write_params(CMPIArray *array) +{ + int i; + int fd; + char *filename = strdup("/tmp/libvirtcim_mig.XXXXXX"); + FILE *file = NULL; + + if (filename == NULL) { + CU_DEBUG("Unable to get temporary file"); + return NULL; + } + + fd = mkstemp(filename); + if (fd < 0) { + CU_DEBUG("Unable to get temporary file: %s", strerror(errno)); + free(filename); + filename = NULL; + goto out; + } + + file = fdopen(fd, "w"); + if (file == NULL) { + CU_DEBUG("Unable to open temporary file: %s", strerror(errno)); + free(filename); + filename = NULL; + goto out; + } + + for (i = 0; i < CMGetArrayCount(array, NULL); i++) { + CMPIData d; + CMPIStatus s; + + d = CMGetArrayElementAt(array, i, &s); + if ((s.rc != CMPI_RC_OK) || CMIsNullValue(d)) { + CU_DEBUG("Unable to get array[%i]: %s", + i, + CMGetCharPtr(s.msg)); + continue; + } + + fprintf(file, "%s\n", CMGetCharPtr(d.value.string)); + } + + out: + if (file != NULL) + fclose(file); + + close(fd); + + return filename; +} + static CMPIStatus get_msd_check_values(const CMPIObjectPath *ref, const char *destination, const CMPIArgs *argsin, - virConnectPtr *conn) + virConnectPtr *conn, + char **path_to_params) { CMPIStatus s; CMPIInstance *msd; uint16_t uri_type; char *uri = NULL; + CMPIArray *array; + + *path_to_params = NULL; s = get_msd(ref, argsin, &msd); if (s.rc != CMPI_RC_OK) @@ -251,6 +499,8 @@ static CMPIStatus get_msd_check_values(c goto out; } + if (cu_get_array_prop(msd, "CheckParameters", &array) == CMPI_RC_OK) + *path_to_params = write_params(array); out: free(uri); @@ -270,8 +520,9 @@ static CMPIStatus vs_migratable(const CM uint32_t retcode = 1; CMPIBoolean isMigratable = 0; virDomainPtr dom = NULL; - - s = get_msd_check_values(ref, destination, argsin, &dconn); + char *path = NULL; + + s = get_msd_check_values(ref, destination, argsin, &dconn, &path); if (s.rc != CMPI_RC_OK) goto out; @@ -292,6 +543,10 @@ static CMPIStatus vs_migratable(const CM } s = check_caps(conn, dconn); + if (s.rc != CMPI_RC_OK) + goto out; + + s = call_external_checks(dom, path); if (s.rc != CMPI_RC_OK) goto out; @@ -309,6 +564,10 @@ static CMPIStatus vs_migratable(const CM virDomainFree(dom); virConnectClose(conn); virConnectClose(dconn); + + if (path != NULL) + unlink(path); + free(path); return s; } From danms at us.ibm.com Mon Mar 10 18:30:22 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 11:30:22 -0700 Subject: [Libvirt-cim] [PATCH] Fix indication_tester's filter deletion issue In-Reply-To: <47D579FA.7030308@linux.vnet.ibm.com> (Jay Gagnon's message of "Mon, 10 Mar 2008 14:12:10 -0400") References: <4b34c7474e59f939200c.1205167758@naegling> <87d4q24ic7.fsf@caffeine.beaverton.ibm.com> <47D579FA.7030308@linux.vnet.ibm.com> Message-ID: <878x0q4ekh.fsf@caffeine.beaverton.ibm.com> JG> The classnames don't match up, so when we make the delete request JG> the CIMOM can't find the right instance to delete. Ah, excellent. JG> Both handler and subscription have the classnames properly JG> matched, so they get created and deleted properly. Now the one JG> other thing I noticed is that handler and subscription have the JG> CIMXML suffix on both create and delete, so maybe the more correct JG> solution is to add it to the filter create, not remove it from the JG> filter delete. Do we have anything official that can answer that JG> for us? The create is obviously working, so making the delete use the same classname is the proper approach. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Mon Mar 10 19:51:27 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 12:51:27 -0700 Subject: [Libvirt-cim] [PATCH] [CU] Add cu_get_array_prop() In-Reply-To: References: Message-ID: <47D5913F.6060305@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205173351 25200 > # Node ID e7d4d1f30118bbc0e484fd4f4fd80747b63435d5 > # Parent d93bb8c00423a88f1c9475a8e6076b1945e1dd01 > [CU] Add cu_get_array_prop() > > Signed-off-by: Dan Smith > > diff -r d93bb8c00423 -r e7d4d1f30118 args_util.c +1 - no complaints from me. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Mon Mar 10 19:58:28 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 12:58:28 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Make the migration check functions aware of MSD In-Reply-To: <05cbd18bf3644b6e1b32.1205173493@caffeine.beaverton.ibm.com> References: <05cbd18bf3644b6e1b32.1205173493@caffeine.beaverton.ibm.com> Message-ID: <47D592E4.40904@linux.vnet.ibm.com> > +static CMPIStatus get_msd_check_values(const CMPIObjectPath *ref, > - > -static CMPIStatus get_msd_values(const CMPIObjectPath *ref, > - const CMPIArgs *argsin, > - struct migration_job *job) > +static CMPIStatus get_msd_job_values(const CMPIObjectPath *ref, > + const CMPIArgs *argsin, > + struct migration_job *job) > { I was thinking maybe you could condense these functions some. Instead of having a transport field in the job struct, you could have a uri field. So, you could have a function that is called get_msd_values() that has everything from get_msd_check_values() except the virConnectPtr / connect_by_classname() part. get_msd_check_values() would just call get_msd_values() plus the connect_by_classname() bit. Then the check functions could call get_msd_check_values() and the migrate functions could call get_msd_values(). Probably not worth the reordering and work though. Otherwise, I have no issues here. This set tested fine on my system. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Mon Mar 10 20:50:14 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 13:50:14 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Make the migration check functions aware of MSD In-Reply-To: <47D592E4.40904@linux.vnet.ibm.com> (Kaitlin Rupert's message of "Mon, 10 Mar 2008 12:58:28 -0700") References: <05cbd18bf3644b6e1b32.1205173493@caffeine.beaverton.ibm.com> <47D592E4.40904@linux.vnet.ibm.com> Message-ID: <87r6ei2tix.fsf@caffeine.beaverton.ibm.com> KR> So, you could have a function that is called get_msd_values() that has KR> everything from get_msd_check_values() except the virConnectPtr / KR> connect_by_classname() part. get_msd_check_values() would just call KR> get_msd_values() plus the connect_by_classname() bit. There is also the array processing that the check version does. I experimented with this a little and we ended up having a little overlap and then a special case for both. Given the rather small size and the possibility for more special cases later, it didn't seem worth the mess of combining them. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 10 21:21:54 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:21:54 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] (#2) Add MSD support to CheckVSIsMigratable() Message-ID: Changes per Kaitlin's *demand* that the MSD value functions be consolidated From danms at us.ibm.com Mon Mar 10 21:21:55 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:21:55 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] Make the migration check functions aware of MSD In-Reply-To: Message-ID: <4ed1813a93d4a45af23c.1205184115@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205184037 25200 # Node ID 4ed1813a93d4a45af23cec8619f96fce22b12ed5 # Parent 1d2157cd04e4d46b50d9e6115e0927d8b0a33b8c Make the migration check functions aware of MSD Changes: - Consolidate the MSD value-fetching functions Signed-off-by: Dan Smith diff -r 1d2157cd04e4 -r 4ed1813a93d4 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 10 14:40:47 2008 +0100 +++ b/src/Virt_VSMigrationService.c Mon Mar 10 14:20:37 2008 -0700 @@ -60,13 +60,70 @@ struct migration_job { struct migration_job { CMPIContext *context; char *domain; - char *host; + virConnectPtr conn; char *ref_cn; char *ref_ns; uint16_t type; uint16_t transport; char uuid[33]; }; + +static CMPIStatus get_msd(const CMPIObjectPath *ref, + const CMPIArgs *argsin, + CMPIInstance **msd) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_inst_arg(argsin, "MigrationSettingData", msd); + if ((ret == CMPI_RC_OK) && (*msd != NULL)) + goto out; + + s = get_migration_sd(ref, msd, _BROKER, false); + if ((s.rc != CMPI_RC_OK) || (*msd == NULL)) { + cu_statusf(_BROKER, &s, + s.rc, + "Unable to get default setting data values"); + goto out; + } + CU_DEBUG("Using default values for MigrationSettingData param"); + + out: + return s; +} + +static CMPIStatus get_migration_type(CMPIInstance *msd, + uint16_t *type) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "MigrationType", type); + if (ret != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + ret, + "Invalid MigrationType value"); + } + + return s; +} + +static CMPIStatus get_migration_uri(CMPIInstance *msd, + uint16_t *uri) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + + ret = cu_get_u16_prop(msd, "TransportType", uri); + if (ret == CMPI_RC_OK) + goto out; + + CU_DEBUG("Using default TransportType: %d", CIM_MIGRATE_URI_SSH); + *uri = CIM_MIGRATE_URI_SSH; + + out: + return s; +} static char *dest_uri(const char *cn, const char *dest, @@ -114,6 +171,52 @@ static char *dest_uri(const char *cn, return uri; } +static CMPIStatus get_msd_values(const CMPIObjectPath *ref, + const char *destination, + const CMPIArgs *argsin, + uint16_t *type, + virConnectPtr *conn) +{ + CMPIStatus s; + CMPIInstance *msd; + uint16_t uri_type; + char *uri = NULL; + + s = get_msd(ref, argsin, &msd); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_type(msd, type); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_migration_uri(msd, &uri_type); + if (s.rc != CMPI_RC_OK) + goto out; + + uri = dest_uri(CLASSNAME(ref), destination, uri_type); + if (uri == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to construct a valid libvirt URI"); + goto out; + } + + *conn = virConnectOpen(uri); + if (*conn == NULL) { + CU_DEBUG("Failed to connect to remote host (%s)", uri); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to connect to remote host (%s)", uri); + goto out; + } + + out: + free(uri); + + return s; +} + static CMPIStatus check_caps(virConnectPtr conn, virConnectPtr dconn) { return (CMPIStatus){CMPI_RC_OK, NULL}; @@ -163,35 +266,23 @@ static CMPIStatus vs_migratable(const CM const char *domain, const char *destination, const CMPIResult *results, + const CMPIArgs *argsin, CMPIArgs *argsout) { CMPIStatus s; - char *uri = NULL; virConnectPtr conn = NULL; virConnectPtr dconn = NULL; uint32_t retcode = 1; CMPIBoolean isMigratable = 0; - - uri = dest_uri(CLASSNAME(ref), destination, CIM_MIGRATE_URI_SSH); - if (uri == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to construct a valid libvirt URI"); - goto out; - } + uint16_t type; + + s = get_msd_values(ref, destination, argsin, &type, &dconn); + if (s.rc != CMPI_RC_OK) + goto out; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) goto out; - - dconn = virConnectOpen(uri); - if (dconn == NULL) { - CU_DEBUG("Failed to connect to remote host (%s)", uri); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to connect to remote host (%s)", uri); - goto out; - } s = check_hver(conn, dconn); if (s.rc != CMPI_RC_OK) @@ -212,7 +303,6 @@ static CMPIStatus vs_migratable(const CM CMAddArg(argsout, "IsMigratable", (CMPIValue *)&isMigratable, CMPI_boolean); - free(uri); virConnectClose(conn); virConnectClose(dconn); @@ -250,7 +340,7 @@ static CMPIStatus vs_migratable_host(CMP return s; } - return vs_migratable(ref, name, dhost, results, argsout); + return vs_migratable(ref, name, dhost, results, argsin, argsout); } static CMPIStatus vs_migratable_system(CMPIMethodMI *self, @@ -293,7 +383,7 @@ static CMPIStatus vs_migratable_system(C return s; } - return vs_migratable(ref, name, dname, results, argsout); + return vs_migratable(ref, name, dname, results, argsin, argsout); } static const char *ind_type_to_name(int ind_type) @@ -571,18 +661,9 @@ static CMPIStatus migrate_vs(struct migr { CMPIStatus s; virConnectPtr conn = NULL; - virConnectPtr dconn = NULL; virDomainPtr dom = NULL; char *uri = NULL; char *xml = NULL; - - uri = dest_uri(job->ref_cn, job->host, job->transport); - if (uri == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to construct a valid libvirt URI"); - goto out; - } conn = connect_by_classname(_BROKER, job->ref_cn, &s); if (conn == NULL) @@ -603,28 +684,19 @@ static CMPIStatus migrate_vs(struct migr goto out; } - dconn = virConnectOpen(uri); - if (dconn == NULL) { - CU_DEBUG("Failed to connect to remote host (%s)", uri); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to connect to remote host (%s)", uri); - goto out; - } - switch(job->type) { case CIM_MIGRATE_OTHER: CU_DEBUG("Preparing for offline migration"); - s = handle_offline_migrate(dconn, dom, uri, xml, job); + s = handle_offline_migrate(job->conn, dom, uri, xml, job); break; case CIM_MIGRATE_LIVE: CU_DEBUG("Preparing for live migration"); - s = handle_migrate(dconn, dom, uri, VIR_MIGRATE_LIVE, job); + s = handle_migrate(job->conn, dom, uri, VIR_MIGRATE_LIVE, job); break; case CIM_MIGRATE_RESUME: case CIM_MIGRATE_RESTART: CU_DEBUG("Preparing for static migration"); - s = handle_migrate(dconn, dom, uri, 0, job); + s = handle_migrate(job->conn, dom, uri, 0, job); break; default: CU_DEBUG("Unsupported migration type (%d)", job->type); @@ -649,7 +721,6 @@ static CMPIStatus migrate_vs(struct migr free(xml); virDomainFree(dom); virConnectClose(conn); - virConnectClose(dconn); return s; } @@ -675,8 +746,8 @@ static CMPI_THREAD_RETURN migration_thre CIM_JOBSTATE_COMPLETE, "Completed"); + virConnectClose(job->conn); free(job->domain); - free(job->host); free(job->ref_cn); free(job->ref_ns); free(job); @@ -771,86 +842,6 @@ static CMPIStatus migrate_create_job_ins return s; } -static CMPIStatus get_msd(const CMPIObjectPath *ref, - const CMPIArgs *argsin, - CMPIInstance **msd) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - int ret; - - ret = cu_get_inst_arg(argsin, "MigrationSettingData", msd); - if ((ret == CMPI_RC_OK) && (*msd != NULL)) - goto out; - - s = get_migration_sd(ref, msd, _BROKER, false); - if ((s.rc != CMPI_RC_OK) || (*msd == NULL)) { - cu_statusf(_BROKER, &s, - s.rc, - "Unable to get default setting data values"); - goto out; - } - CU_DEBUG("Using default values for MigrationSettingData param"); - - out: - return s; -} - -static CMPIStatus get_migration_type(CMPIInstance *msd, - uint16_t *type) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - int ret; - - ret = cu_get_u16_prop(msd, "MigrationType", type); - if (ret != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - ret, - "Invalid MigrationType value"); - } - - return s; -} - -static CMPIStatus get_migration_uri(CMPIInstance *msd, - uint16_t *uri) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - int ret; - - ret = cu_get_u16_prop(msd, "TransportType", uri); - if (ret == CMPI_RC_OK) - goto out; - - CU_DEBUG("Using default TransportType: %d", CIM_MIGRATE_URI_SSH); - *uri = CIM_MIGRATE_URI_SSH; - - out: - return s; -} - -static CMPIStatus get_msd_values(const CMPIObjectPath *ref, - const CMPIArgs *argsin, - struct migration_job *job) -{ - CMPIStatus s; - CMPIInstance *msd; - - s = get_msd(ref, argsin, &msd); - if (s.rc != CMPI_RC_OK) - goto out; - - s = get_migration_type(msd, &job->type); - if (s.rc != CMPI_RC_OK) - goto out; - - s = get_migration_uri(msd, &job->transport); - if (s.rc != CMPI_RC_OK) - goto out; - - out: - return s; -} - static struct migration_job *migrate_job_prepare(const CMPIContext *context, const CMPIObjectPath *ref, const char *domain, @@ -864,7 +855,6 @@ static struct migration_job *migrate_job return NULL; job->domain = strdup(domain); - job->host = strdup(host); job->ref_cn = strdup(CLASSNAME(ref)); job->ref_ns = strdup(NAMESPACE(ref)); @@ -901,7 +891,7 @@ static CMPIStatus migrate_do(const CMPIO goto out; } - s = get_msd_values(ref, argsin, job); + s = get_msd_values(ref, host, argsin, &job->type, &job->conn); if (s.rc != CMPI_RC_OK) goto out; From danms at us.ibm.com Mon Mar 10 21:21:57 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:21:57 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add optional check parameter field to migration schema In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205184040 25200 # Node ID c097aab08ff886ac32a6f4a09b05c7880570704a # Parent 991f50b2c972bf02ab61f5696c25f5194bc4d640 [RFC] Add optional check parameter field to migration schema Signed-off-by: Dan Smith diff -r 991f50b2c972 -r c097aab08ff8 schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Mon Mar 10 14:20:38 2008 -0700 +++ b/schema/VSMigrationSettingData.mof Mon Mar 10 14:20:40 2008 -0700 @@ -11,6 +11,7 @@ class Xen_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; [Provider("cmpi::Virt_VSMigrationSettingData")] @@ -18,4 +19,5 @@ class KVM_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; From danms at us.ibm.com Mon Mar 10 21:21:56 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:21:56 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] Add lookup of domain to make sure it exists as part of the check In-Reply-To: Message-ID: <991f50b2c972bf02ab61.1205184116@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205184038 25200 # Node ID 991f50b2c972bf02ab61f5696c25f5194bc4d640 # Parent 4ed1813a93d4a45af23cec8619f96fce22b12ed5 Add lookup of domain to make sure it exists as part of the check Signed-off-by: Dan Smith diff -r 4ed1813a93d4 -r 991f50b2c972 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 10 14:20:37 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 10 14:20:38 2008 -0700 @@ -275,6 +275,7 @@ static CMPIStatus vs_migratable(const CM uint32_t retcode = 1; CMPIBoolean isMigratable = 0; uint16_t type; + virDomainPtr dom = NULL; s = get_msd_values(ref, destination, argsin, &type, &dconn); if (s.rc != CMPI_RC_OK) @@ -287,6 +288,14 @@ static CMPIStatus vs_migratable(const CM s = check_hver(conn, dconn); if (s.rc != CMPI_RC_OK) goto out; + + dom = virDomainLookupByName(conn, domain); + if (dom == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such domain"); + goto out; + } s = check_caps(conn, dconn); if (s.rc != CMPI_RC_OK) @@ -303,6 +312,7 @@ static CMPIStatus vs_migratable(const CM CMAddArg(argsout, "IsMigratable", (CMPIValue *)&isMigratable, CMPI_boolean); + virDomainFree(dom); virConnectClose(conn); virConnectClose(dconn); From danms at us.ibm.com Mon Mar 10 21:22:36 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:22:36 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [RFC] Add optional check parameter field to migration schema In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205184040 25200 # Node ID c097aab08ff886ac32a6f4a09b05c7880570704a # Parent 991f50b2c972bf02ab61f5696c25f5194bc4d640 [RFC] Add optional check parameter field to migration schema Signed-off-by: Dan Smith diff -r 991f50b2c972 -r c097aab08ff8 schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Mon Mar 10 14:20:38 2008 -0700 +++ b/schema/VSMigrationSettingData.mof Mon Mar 10 14:20:40 2008 -0700 @@ -11,6 +11,7 @@ class Xen_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; [Provider("cmpi::Virt_VSMigrationSettingData")] @@ -18,4 +19,5 @@ class KVM_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; From danms at us.ibm.com Mon Mar 10 21:22:35 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:22:35 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] (#2) [RFC] Add external migration checks Message-ID: Changes to reflect change to base VSMigrationService MSD change From danms at us.ibm.com Mon Mar 10 21:22:37 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:22:37 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: Message-ID: <8eb16f25ec12565c54e5.1205184157@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205184041 25200 # Node ID 8eb16f25ec12565c54e553972299fdbdda12533f # Parent c097aab08ff886ac32a6f4a09b05c7880570704a [RFC] Add configure support for migration check settings Signed-off-by: Dan Smith diff -r c097aab08ff8 -r 8eb16f25ec12 configure.ac --- a/configure.ac Mon Mar 10 14:20:40 2008 -0700 +++ b/configure.ac Mon Mar 10 14:20:41 2008 -0700 @@ -72,6 +72,20 @@ AC_ARG_WITH(html-dir, [test "x$withval" != "x" && HTML_DIR="$withval"], [HTML_DIR='$(datadir)/doc/$(PACKAGE)-$(VERSION)/html']) AC_SUBST(HTML_DIR) + +AC_ARG_WITH([migrate_check_timeout], + [ --with-migrate_check_timeout=SECS Max runtime allowed for external migration checks], + [test "x$withval" != "x" && MIG_CHECKS_TIMEOUT="$withval"], + [MIG_CHECKS_TIMEOUT=10]) +AC_SUBST(MIG_CHECKS_TIMEOUT) +AC_DEFINE_UNQUOTED(MIG_CHECKS_TIMEOUT, $MIG_CHECKS_TIMEOUT, [External migration check timeout]) + +AC_ARG_WITH([migrate_check_dir], + [ --with-migrate_check_dir=dir Location of external migration checks], + [test "x$withval" != "x" && MIG_CHECKS_DIR="$withval"], + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) +AC_SUBST(MIG_CHECKS_DIR) +AC_DEFINE_UNQUOTED(MIG_CHECKS_DIR, "$MIG_CHECKS_DIR", [External migration check timeout]) # Autogenerate the autoconf header file to store build settings AC_CONFIG_HEADER([config.h]) From danms at us.ibm.com Mon Mar 10 21:22:38 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:22:38 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205184074 25200 # Node ID a9134d48bc71c419c78b7e58a71f873281fe84ac # Parent 8eb16f25ec12565c54e553972299fdbdda12533f [RFC] Add external check functionality to CheckIsVSMigratable() Changes: - Fetch the array out of the MSD ourselves to avoid adding a special case to get_msd_values() Signed-off-by: Dan Smith diff -r 8eb16f25ec12 -r a9134d48bc71 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 10 14:20:41 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 10 14:21:14 2008 -0700 @@ -21,6 +21,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -39,6 +46,8 @@ #include "Virt_VSMigrationService.h" #include "Virt_HostSystem.h" #include "Virt_VSMigrationSettingData.h" + +#include "config.h" #define CIM_JOBSTATE_STARTING 3 #define CIM_JOBSTATE_RUNNING 4 @@ -210,7 +219,6 @@ static CMPIStatus get_msd_values(const C "Failed to connect to remote host (%s)", uri); goto out; } - out: free(uri); @@ -260,6 +268,258 @@ static CMPIStatus check_hver(virConnectP ""); out: return s; +} + +static bool is_valid_check(const char *path) +{ + struct stat s; + + if (stat(path, &s) != 0) + return false; + + if (!S_ISREG(s.st_mode)) + return false; + + if ((s.st_mode & S_IXUSR) || + (s.st_mode & S_IXGRP) || + (s.st_mode & S_IXOTH)) + return true; + else + return false; +} + +static void free_list(char **list, int count) +{ + int i; + + if (list == NULL) + return; + + for (i = 0; i < count; i++) + free(list[i]); + + free(list); +} + +static char **list_migration_checks(int *count) +{ + DIR *dir; + struct dirent *de; + char **list = NULL; + int len = 0; + + *count = 0; + + dir = opendir(MIG_CHECKS_DIR); + if (dir == NULL) { + CU_DEBUG("Unable to open migration checks dir: %s (%s)", + MIG_CHECKS_DIR, + strerror(errno)); + *count = -1; + return NULL; + } + + while ((de = readdir(dir)) != NULL) { + int ret; + char *path = NULL; + + if (de->d_name[0] == '.') + continue; + + if (*count == len) { + char **tmp; + + len = (len * 2) + 1; + tmp = realloc(list, sizeof(char *) * len); + if (tmp == NULL) { + CU_DEBUG("Failed to alloc check list"); + goto error; + } + + list = tmp; + } + + ret = asprintf(&path, + "%s/%s", + MIG_CHECKS_DIR, + de->d_name); + if (ret == -1) { + CU_DEBUG("Failed to alloc path for check"); + goto error; + } + + if (is_valid_check(path)) { + list[*count] = path; + (*count) += 1; + } else { + CU_DEBUG("Invalid check program: %s", path); + free(path); + } + } + + closedir(dir); + + return list; + error: + closedir(dir); + + free_list(list, *count); + *count = 0; + + return NULL; +} + +static CMPIStatus _call_check(virDomainPtr dom, + const char *prog, + const char *param_path) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + pid_t pid; + int i; + int rc = -1; + + pid = fork(); + if (pid == 0) { + virConnectPtr conn = virDomainGetConnect(dom); + const char *name = virDomainGetName(dom); + const char *uri = virConnectGetURI(conn); + + if (setpgrp() == -1) + perror("setpgrp"); + + execl(prog, prog, name, uri, param_path, NULL); + CU_DEBUG("exec(%s) failed: %s", prog, strerror(errno)); + _exit(1); + } + + for (i = 0; i < (MIG_CHECKS_TIMEOUT * 4); i++) { + int status; + if (waitpid(pid, &status, WNOHANG) != pid) { + usleep(250000); + } else { + rc = WEXITSTATUS(status); + break; + } + } + + if (rc == -1) { + CU_DEBUG("Killing off stale child %i", pid); + killpg(pid, SIGKILL); + waitpid(pid, NULL, WNOHANG); + } + + if (rc != 0) { + char *name = strdup(prog); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Migration check `%s' failed", + basename(name)); + free(name); + } + + return s; +} + +static CMPIStatus call_external_checks(virDomainPtr dom, + const char *param_path) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + char **list = NULL; + int count = 0; + int i; + + list = list_migration_checks(&count); + if (count < 0) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to execute migration checks"); + goto out; + } else if (list == NULL) { + goto out; + } + + for (i = 0; i < count; i++) { + CU_DEBUG("Calling migration check: %s", list[i]); + s = _call_check(dom, list[i], param_path); + if (s.rc != CMPI_RC_OK) { + CU_DEBUG("...Failed"); + break; + } else + CU_DEBUG("...OK"); + } + out: + free_list(list, count); + + return s; +} + +static char *write_params(CMPIArray *array) +{ + int i; + int fd; + char *filename = strdup("/tmp/libvirtcim_mig.XXXXXX"); + FILE *file = NULL; + + if (filename == NULL) { + CU_DEBUG("Unable to get temporary file"); + return NULL; + } + + fd = mkstemp(filename); + if (fd < 0) { + CU_DEBUG("Unable to get temporary file: %s", strerror(errno)); + free(filename); + filename = NULL; + goto out; + } + + file = fdopen(fd, "w"); + if (file == NULL) { + CU_DEBUG("Unable to open temporary file: %s", strerror(errno)); + free(filename); + filename = NULL; + goto out; + } + + for (i = 0; i < CMGetArrayCount(array, NULL); i++) { + CMPIData d; + CMPIStatus s; + + d = CMGetArrayElementAt(array, i, &s); + if ((s.rc != CMPI_RC_OK) || CMIsNullValue(d)) { + CU_DEBUG("Unable to get array[%i]: %s", + i, + CMGetCharPtr(s.msg)); + continue; + } + + fprintf(file, "%s\n", CMGetCharPtr(d.value.string)); + } + + out: + if (file != NULL) + fclose(file); + + close(fd); + + return filename; +} + +static char *get_parms_file(const CMPIObjectPath *ref, + const CMPIArgs *argsin) +{ + CMPIStatus s; + CMPIArray *array; + CMPIInstance *msd; + + s = get_msd(ref, argsin, &msd); + if (s.rc != CMPI_RC_OK) + return NULL; + + if (cu_get_array_prop(msd, "CheckParameters", &array) == CMPI_RC_OK) + return write_params(array); + else + return NULL; } static CMPIStatus vs_migratable(const CMPIObjectPath *ref, @@ -276,6 +536,7 @@ static CMPIStatus vs_migratable(const CM CMPIBoolean isMigratable = 0; uint16_t type; virDomainPtr dom = NULL; + char *path = NULL; s = get_msd_values(ref, destination, argsin, &type, &dconn); if (s.rc != CMPI_RC_OK) @@ -298,6 +559,11 @@ static CMPIStatus vs_migratable(const CM } s = check_caps(conn, dconn); + if (s.rc != CMPI_RC_OK) + goto out; + + path = get_parms_file(ref, argsin); + s = call_external_checks(dom, path); if (s.rc != CMPI_RC_OK) goto out; @@ -315,6 +581,10 @@ static CMPIStatus vs_migratable(const CM virDomainFree(dom); virConnectClose(conn); virConnectClose(dconn); + + if (path != NULL) + unlink(path); + free(path); return s; } From danms at us.ibm.com Mon Mar 10 21:26:15 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:26:15 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> (Dan Smith's message of "Mon, 10 Mar 2008 11:25:52 -0700") References: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> Message-ID: <87myp62ruw.fsf@caffeine.beaverton.ibm.com> DS> + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) I should point out that this was just thrown in there to have something in place. I'm not sure what a good location would be. Perhaps $prefix/libexec/libvirt-cim/extchecks ? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 10 21:43:12 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 14:43:12 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add optional check parameter field to migration schema In-Reply-To: (Dan Smith's message of "Mon, 10 Mar 2008 14:21:57 -0700") References: Message-ID: <87iqzu2r2n.fsf@caffeine.beaverton.ibm.com> DS> # HG changeset patch DS> # User Dan Smith DS> # Date 1205184040 25200 DS> # Node ID c097aab08ff886ac32a6f4a09b05c7880570704a DS> # Parent 991f50b2c972bf02ab61f5696c25f5194bc4d640 DS> [RFC] Add optional check parameter field to migration schema Looks like I overran my array bounds here. This is part of the second set, not the first :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Mon Mar 10 21:55:47 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 14:55:47 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] (#2) Add MSD support to CheckVSIsMigratable() In-Reply-To: References: Message-ID: <47D5AE63.2010900@linux.vnet.ibm.com> Dan Smith wrote: > Changes per Kaitlin's *demand* that the MSD value functions be consolidated > *laugh* That's right ;) Thanks for the change. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Mon Mar 10 22:00:25 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 15:00:25 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: <87myp62ruw.fsf@caffeine.beaverton.ibm.com> References: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> <87myp62ruw.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D5AF79.2040903@linux.vnet.ibm.com> Dan Smith wrote: > DS> + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) > > I should point out that this was just thrown in there to have > something in place. I'm not sure what a good location would be. > Perhaps $prefix/libexec/libvirt-cim/extchecks ? > > I think having libvirt-cim in the path is a good way to go. It's more descriptive that way. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Mon Mar 10 22:26:37 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 15:26:37 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: References: Message-ID: <47D5B59D.9000104@linux.vnet.ibm.com> > +static CMPIStatus call_external_checks(virDomainPtr dom, > + const char *param_path) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > + char **list = NULL; > + int count = 0; > + int i; > + > + list = list_migration_checks(&count); > + if (count < 0) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Unable to execute migration checks"); > + goto out; > + } else if (list == NULL) { > + goto out; > + } Shouldn't you include an error in the list == NULL case as well? -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Mon Mar 10 22:53:11 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 10 Mar 2008 15:53:11 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() References: <47D5B59D.9000104@linux.vnet.ibm.com> Message-ID: <877iga2nu0.fsf@caffeine.beaverton.ibm.com> KR> Shouldn't you include an error in the list == NULL case as well? No, I'd like the provider to continue to run even if there are no checks in that directory :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Mon Mar 10 23:09:29 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Mon, 10 Mar 2008 16:09:29 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: <877iga2nu0.fsf@caffeine.beaverton.ibm.com> References: <47D5B59D.9000104@linux.vnet.ibm.com> <877iga2nu0.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D5BFA9.4050805@linux.vnet.ibm.com> Dan Smith wrote: > KR> Shouldn't you include an error in the list == NULL case as well? > > No, I'd like the provider to continue to run even if there are no > checks in that directory :) > Oh, yep - good call. My mistake. =) -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Tue Mar 11 18:09:22 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Tue, 11 Mar 2008 11:09:22 -0700 Subject: [Libvirt-cim] [PATCH] Fix cu_statusf() call in RASD Message-ID: <4f17d756b6c3551d1ae0.1205258962@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1205258941 25200 # Node ID 4f17d756b6c3551d1ae0a3aee1939a5ad6963c67 # Parent 1429af47e9413d5f0bcf51e5a58988177bc32bbf Fix cu_statusf() call in RASD. It's not easy to tell from the diff, but get_rasd_by_ref() takes a const CMPIBroker *broker argument. So when we fail, we need to use the broker, not the _BROKER that is local to the provider. Signed-off-by: Kaitlin Rupert diff -r 1429af47e941 -r 4f17d756b6c3 src/Virt_RASD.c --- a/src/Virt_RASD.c Tue Mar 11 10:18:05 2008 -0700 +++ b/src/Virt_RASD.c Tue Mar 11 11:09:01 2008 -0700 @@ -433,7 +433,7 @@ CMPIStatus get_rasd_by_ref(const CMPIBro uint16_t type; if (cu_get_str_path(reference, "InstanceID", &name) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, + cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "Missing InstanceID"); goto out; From danms at us.ibm.com Tue Mar 11 20:33:32 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 11 Mar 2008 13:33:32 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Allow DiskPool to use libvirt's integrated storage management, if available In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205267597 25200 # Node ID b2c0c49037cd5927e110c3956c6162c429c4b415 # Parent eba6a48fcf9a1cec9c5e21e6c06984a3b1716803 Allow DiskPool to use libvirt's integrated storage management, if available Signed-off-by: Dan Smith diff -r eba6a48fcf9a -r b2c0c49037cd src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Tue Mar 11 13:28:41 2008 -0700 +++ b/src/Virt_DevicePool.c Tue Mar 11 13:33:17 2008 -0700 @@ -50,6 +50,110 @@ struct disk_pool { char *path; }; +/* + * Right now, detect support and use it, if available. + * Later, this can be a configure option if needed + */ +#if LIBVIR_VERSION_NUMBER > 4000 +# define VIR_USE_LIBVIRT_STORAGE 1 +#else +# define VIR_USE_LIBVIRT_STORAGE 0 +#endif + +#if VIR_USE_LIBVIRT_STORAGE +static int get_diskpool_config(virConnectPtr conn, + struct disk_pool **_pools) +{ + int count = 0; + int i; + char ** names = NULL; + struct disk_pool *pools; + + count = virConnectNumOfStoragePools(conn); + if (count <= 0) + goto out; + + names = calloc(count, sizeof(char *)); + if (names == NULL) { + CU_DEBUG("Failed to alloc space for %i pool names", count); + goto out; + } + + pools = calloc(count, sizeof(*pools)); + if (pools == NULL) { + CU_DEBUG("Failed to alloc space for %i pool structs", count); + goto out; + } + + if (virConnectListStoragePools(conn, names, count) == -1) { + CU_DEBUG("Failed to get storage pools"); + free(pools); + goto out; + } + + for (i = 0; i < count; i++) + pools[i].tag = names[i]; + + *_pools = pools; + out: + free(names); + + return count; +} + +static bool diskpool_set_capacity(virConnectPtr conn, + CMPIInstance *inst, + struct disk_pool *_pool) +{ + bool result = false; + virStoragePoolPtr pool; + virStoragePoolInfo info; + + pool = virStoragePoolLookupByName(conn, _pool->tag); + if (pool == NULL) { + CU_DEBUG("Failed to lookup storage pool `%s'", _pool->tag); + goto out; + } + + if (virStoragePoolGetInfo(pool, &info) == -1) { + CU_DEBUG("Failed to get info for pool `%s'", _pool->tag); + goto out; + } + + CMSetProperty(inst, "Capacity", + (CMPIValue *)&info.capacity, CMPI_uint64); + + CMSetProperty(inst, "Reserved", + (CMPIValue *)&info.allocation, CMPI_uint64); + + result = true; + out: + virStoragePoolFree(pool); + + return result; +} + +static bool _diskpool_is_member(virConnectPtr conn, + const struct disk_pool *pool, + const char *file) +{ + virStorageVolPtr vol = NULL; + bool result = false; + + vol = virStorageVolLookupByPath(conn, file); + if (vol != NULL) + result = true; + + CU_DEBUG("Image %s in pool %s: %s", + file, + pool->tag, + result ? "YES": "NO"); + + virStorageVolFree(vol); + + return result; +} +#else static int parse_diskpool_line(struct disk_pool *pool, const char *line) { @@ -64,7 +168,8 @@ static int parse_diskpool_line(struct di return (ret == 2); } -static int get_diskpool_config(struct disk_pool **_pools) +static int get_diskpool_config(virConnectPtr conn, + struct disk_pool **_pools) { const char *path = DISK_POOL_CONFIG; FILE *config; @@ -99,6 +204,45 @@ static int get_diskpool_config(struct di return count; } +static bool diskpool_set_capacity(virConnectPtr conn, + CMPIInstance *inst, + struct disk_pool *pool) +{ + bool result = false; + struct statvfs vfs; + uint64_t cap; + uint64_t res; + + if (statvfs(pool->path, &vfs) != 0) { + CU_DEBUG("Failed to statvfs(%s): %m", pool->path); + goto out; + } + + cap = (uint64_t) vfs.f_frsize * vfs.f_blocks; + res = cap - (uint64_t)(vfs.f_frsize * vfs.f_bfree); + + cap >>= 20; + res >>= 20; + + CMSetProperty(inst, "Capacity", + (CMPIValue *)&cap, CMPI_uint64); + + CMSetProperty(inst, "Reserved", + (CMPIValue *)&res, CMPI_uint64); + + result = true; + out: + return result; +} + +static bool _diskpool_is_member(virConnectPtr conn, + const struct disk_pool *pool, + const char *file) +{ + return STARTS_WITH(file, pool->path); +} +#endif + static void free_diskpool(struct disk_pool *pools, int count) { int i; @@ -114,19 +258,20 @@ static void free_diskpool(struct disk_po free(pools); } -static char *_diskpool_member_of(const char *file) +static char *_diskpool_member_of(virConnectPtr conn, + const char *file) { struct disk_pool *pools = NULL; int count; int i; char *pool = NULL; - count = get_diskpool_config(&pools); + count = get_diskpool_config(conn, &pools); if (count == 0) return NULL; for (i = 0; i < count; i++) { - if (STARTS_WITH(file, pools[i].path)) { + if (_diskpool_is_member(conn, &pools[i], file)) { int ret; ret = asprintf(&pool, "DiskPool/%s", pools[i].tag); @@ -172,7 +317,8 @@ static char *diskpool_member_of(const CM for (i = 0; i < count; i++) { if (STREQ((devs[i].dev.disk.virtual_dev), dev)) { - pool = _diskpool_member_of(devs[i].dev.disk.source); + pool = _diskpool_member_of(conn, + devs[i].dev.disk.source); break; } } @@ -595,8 +741,8 @@ static CMPIStatus netpool_instance(virCo return s; } -static CMPIInstance *diskpool_from_path(const char *path, - const char *id, +static CMPIInstance *diskpool_from_path(struct disk_pool *pool, + virConnectPtr conn, const char *ns, const char *refcn, const CMPIBroker *broker) @@ -604,13 +750,10 @@ static CMPIInstance *diskpool_from_path( CMPIInstance *inst; char *poolid = NULL; const uint16_t type = CIM_RES_TYPE_DISK; - struct statvfs vfs; - uint64_t cap; - uint64_t res; inst = get_typed_instance(broker, refcn, "DiskPool", ns); - if (asprintf(&poolid, "DiskPool/%s", id) == -1) + if (asprintf(&poolid, "DiskPool/%s", pool->tag) == -1) return NULL; CMSetProperty(inst, "InstanceID", @@ -622,24 +765,10 @@ static CMPIInstance *diskpool_from_path( CMSetProperty(inst, "AllocationUnits", (CMPIValue *)"Megabytes", CMPI_chars); - if (statvfs(path, &vfs) != 0) { - CU_DEBUG("Failed to statvfs(%s): %m", path); - goto out; - } - - cap = (uint64_t) vfs.f_frsize * vfs.f_blocks; - res = cap - (uint64_t)(vfs.f_frsize * vfs.f_bfree); - - cap >>= 20; - res >>= 20; - - CMSetProperty(inst, "Capacity", - (CMPIValue *)&cap, CMPI_uint64); - - CMSetProperty(inst, "Reserved", - (CMPIValue *)&res, CMPI_uint64); - - out: + if (!diskpool_set_capacity(conn, inst, pool)) + CU_DEBUG("Failed to set capacity for disk pool: %s", + pool->tag); + free(poolid); return inst; @@ -656,9 +785,13 @@ static CMPIStatus diskpool_instance(virC int count = 0; int i; - count = get_diskpool_config(&pools); - if ((id == NULL) && (count == 0)) + count = get_diskpool_config(conn, &pools); + if ((id == NULL) && (count == 0)) { + CU_DEBUG("No defined DiskPools"); return s; + } + + CU_DEBUG("%i DiskPools", count); for (i = 0; i < count; i++) { CMPIInstance *pool; @@ -667,8 +800,8 @@ static CMPIStatus diskpool_instance(virC continue; /* Either this matches id, or we're matching all */ - pool = diskpool_from_path(pools[i].path, - pools[i].tag, + pool = diskpool_from_path(&pools[i], + conn, ns, pfx_from_conn(conn), broker); From danms at us.ibm.com Tue Mar 11 20:33:30 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 11 Mar 2008 13:33:30 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Use libvirt's storage management Message-ID: Subject says it all. Some reasonable testing of this to make sure it still: (a) works as it did before on <=0.4.0, and (b) works with the storage stuff if you have 0.4.1 From danms at us.ibm.com Tue Mar 11 20:33:31 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 11 Mar 2008 13:33:31 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Fix potential crash in RAFP if a pool is not found In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205267321 25200 # Node ID eba6a48fcf9a1cec9c5e21e6c06984a3b1716803 # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 Fix potential crash in RAFP if a pool is not found Signed-off-by: Dan Smith diff -r b739fc9b1332 -r eba6a48fcf9a src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_ResourceAllocationFromPool.c Tue Mar 11 13:28:41 2008 -0700 @@ -116,7 +116,7 @@ static int filter_by_pool(struct inst_li cu_get_str_prop(inst, "InstanceID", &rasd_id); poolid = pool_member_of(_BROKER, CLASSNAME(op), type, rasd_id); - if (STREQ(poolid, _poolid)) + if ((poolid != NULL) && STREQ(poolid, _poolid)) inst_list_add(dest, inst); } From heidieck at linux.vnet.ibm.com Wed Mar 12 09:58:47 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 10:58:47 +0100 Subject: [Libvirt-cim] [PATCH] Fix cu_statusf() call in RASD In-Reply-To: <4f17d756b6c3551d1ae0.1205258962@elm3b41.beaverton.ibm.com> References: <4f17d756b6c3551d1ae0.1205258962@elm3b41.beaverton.ibm.com> Message-ID: <47D7A957.9020700@linux.vnet.ibm.com> Kaitlin Rupert wrote: > # HG changeset patch > # User Kaitlin Rupert > # Date 1205258941 25200 > # Node ID 4f17d756b6c3551d1ae0a3aee1939a5ad6963c67 > # Parent 1429af47e9413d5f0bcf51e5a58988177bc32bbf > Fix cu_statusf() call in RASD. > > It's not easy to tell from the diff, but get_rasd_by_ref() takes a const CMPIBroker *broker argument. So when we fail, we need to use the broker, not the _BROKER that is local to the provider. > An excellent catch - because this would cause a seg fault ! Great, eagle eye :). -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Wed Mar 12 10:20:01 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 11:20:01 +0100 Subject: [Libvirt-cim] [PATCH 2 of 2] Add lookup of domain to make sure it exists as part of the check In-Reply-To: <29e665fff096426ced0f.1205173494@caffeine.beaverton.ibm.com> References: <29e665fff096426ced0f.1205173494@caffeine.beaverton.ibm.com> Message-ID: <47D7AE51.2030102@linux.vnet.ibm.com> Dan Smith wrote: > @@ -281,6 +282,14 @@ static CMPIStatus vs_migratable(const CM > s = check_hver(conn, dconn); > if (s.rc != CMPI_RC_OK) > goto out; > + > + dom = virDomainLookupByName(conn, domain); > + if (dom == NULL) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_NOT_FOUND, > + "No such domain"); > + goto out; > + } > Sorry, I know my comment comes a bit late, as the patch is already checked in. I think this check is not enough. To check if a certain Xen/KVM_ComputerSystem or the Xen/KVM_HostSystem object path is correct specified by the client, you should use the corresponding (new ;)) interfaces (get_domain_by_ref, get_host), as they check the complete object path for correctness. It raises the number of cycles a bit, but makes the behavior of all providers consistent. Thanks. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Wed Mar 12 10:25:25 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 11:25:25 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: <47D5AF79.2040903@linux.vnet.ibm.com> References: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> <87myp62ruw.fsf@caffeine.beaverton.ibm.com> <47D5AF79.2040903@linux.vnet.ibm.com> Message-ID: <47D7AF95.3040804@linux.vnet.ibm.com> Kaitlin Rupert wrote: > Dan Smith wrote: >> DS> + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) >> >> I should point out that this was just thrown in there to have >> something in place. I'm not sure what a good location would be. >> Perhaps $prefix/libexec/libvirt-cim/extchecks ? >> >> > > I think having libvirt-cim in the path is a good way to go. It's more > descriptive that way. I agree. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Wed Mar 12 12:44:41 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 13:44:41 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] (#2) [RFC] Add external migration checks In-Reply-To: References: Message-ID: <47D7D039.1020905@linux.vnet.ibm.com> Dan Smith wrote: > Changes to reflect change to base VSMigrationService MSD change > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > Sorry, I'm not able to apply this patch set to the latest tree. Did I miss a patch set ? -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Wed Mar 12 12:50:43 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 13:50:43 +0100 Subject: [Libvirt-cim] [PATCH 0 of 2] Use libvirt's storage management In-Reply-To: References: Message-ID: <47D7D1A3.2080007@linux.vnet.ibm.com> Dan Smith wrote: > Subject says it all. > > Some reasonable testing of this to make sure it still: > (a) works as it did before on <=0.4.0, and > (b) works with the storage stuff if you have 0.4.1 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > Sorry, I can also not apply this patch set. All hunks are failing. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From danms at us.ibm.com Wed Mar 12 13:54:42 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 06:54:42 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add lookup of domain to make sure it exists as part of the check In-Reply-To: <47D7AE51.2030102@linux.vnet.ibm.com> (Heidi Eckhart's message of "Wed, 12 Mar 2008 11:20:01 +0100") References: <29e665fff096426ced0f.1205173494@caffeine.beaverton.ibm.com> <47D7AE51.2030102@linux.vnet.ibm.com> Message-ID: <87pru0yrml.fsf@caffeine.beaverton.ibm.com> HE> Sorry, I know my comment comes a bit late, as the patch is already HE> checked in. That's okay :) HE> I think this check is not enough. To check if a certain HE> Xen/KVM_ComputerSystem or the Xen/KVM_HostSystem object path is HE> correct specified by the client, you should use the corresponding HE> (new ;)) interfaces (get_domain_by_ref, get_host), as they check HE> the complete object path for correctness. It raises the number of HE> cycles a bit, but makes the behavior of all providers HE> consistent. Well, the reason I added this is twofold: (1) because of the fact that we would fail late if the domain doesn't exist, and (2) because I use the dom pointer later for the external check code. So, I'm more than happy to add in the more rigorous checks, but we need this part as well :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From stefanb at us.ibm.com Wed Mar 12 14:08:46 2008 From: stefanb at us.ibm.com (Stefan Berger) Date: Wed, 12 Mar 2008 10:08:46 -0400 Subject: [Libvirt-cim] Migration check patches Message-ID: Hello Dan, thanks for providing the external migration check patches. They were very helpful and work well. Thanks Stefan -------------- next part -------------- An HTML attachment was scrubbed... URL: From danms at us.ibm.com Wed Mar 12 14:39:40 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 07:39:40 -0700 Subject: [Libvirt-cim] Migration check patches In-Reply-To: (Stefan Berger's message of "Wed, 12 Mar 2008 10:08:46 -0400") References: Message-ID: <87lk4oypjn.fsf@caffeine.beaverton.ibm.com> SB> thanks for providing the external migration check patches. They SB> were very helpful and work well. Excellent! Good to know that they work in a real-world situation. I'm just waiting for a little more review activity before I commit them. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From heidieck at linux.vnet.ibm.com Wed Mar 12 14:54:59 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 15:54:59 +0100 Subject: [Libvirt-cim] [PATCH 2 of 2] Add lookup of domain to make sure it exists as part of the check In-Reply-To: <87pru0yrml.fsf@caffeine.beaverton.ibm.com> References: <29e665fff096426ced0f.1205173494@caffeine.beaverton.ibm.com> <47D7AE51.2030102@linux.vnet.ibm.com> <87pru0yrml.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D7EEC3.3000106@linux.vnet.ibm.com> Dan Smith wrote: > HE> Sorry, I know my comment comes a bit late, as the patch is already > HE> checked in. > > That's okay :) > > HE> I think this check is not enough. To check if a certain > HE> Xen/KVM_ComputerSystem or the Xen/KVM_HostSystem object path is > HE> correct specified by the client, you should use the corresponding > HE> (new ;)) interfaces (get_domain_by_ref, get_host), as they check > HE> the complete object path for correctness. It raises the number of > HE> cycles a bit, but makes the behavior of all providers > HE> consistent. > > Well, the reason I added this is twofold: (1) because of the fact that > we would fail late if the domain doesn't exist, and (2) because I use > the dom pointer later for the external check code. > > So, I'm more than happy to add in the more rigorous checks, but we > need this part as well :) > > ok, fine for me :) -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From danms at us.ibm.com Wed Mar 12 15:09:41 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 08:09:41 -0700 Subject: [Libvirt-cim] [PATCH] Make migration return proper value for "Job Started" Message-ID: <82b18a386bda9c09e6f4.1205334581@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205331569 25200 # Node ID 82b18a386bda9c09e6f4f41a0b3acbeeba7f0ea9 # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 Make migration return proper value for "Job Started" Signed-off-by: Dan Smith diff -r b739fc9b1332 -r 82b18a386bda src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 07:19:29 2008 -0700 @@ -927,7 +927,7 @@ static CMPIStatus migrate_do(const CMPIO thread = _BROKER->xft->newThread((void*)migration_thread, job, 0); - retcode = 0; + retcode = 4096; /* Job Started */ out: CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); From heidieck at linux.vnet.ibm.com Wed Mar 12 15:24:06 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 16:24:06 +0100 Subject: [Libvirt-cim] [PATCH 0 of 2] Use libvirt's storage management In-Reply-To: <47D7D1A3.2080007@linux.vnet.ibm.com> References: <47D7D1A3.2080007@linux.vnet.ibm.com> Message-ID: <47D7F596.2060108@linux.vnet.ibm.com> Heidi Eckhart wrote: > Sorry, I can also not apply this patch set. All hunks are failing. > Seem to be a local issue on my machine. Sorry. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From grendel at linux.vnet.ibm.com Wed Mar 12 15:30:15 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 12 Mar 2008 11:30:15 -0400 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: References: Message-ID: <47D7F707.1080306@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205184074 25200 > # Node ID a9134d48bc71c419c78b7e58a71f873281fe84ac > # Parent 8eb16f25ec12565c54e553972299fdbdda12533f > [RFC] Add external check functionality to CheckIsVSMigratable() > > Changes: > - Fetch the array out of the MSD ourselves to avoid adding a special > case to get_msd_values() > > Signed-off-by: Dan Smith > > diff -r 8eb16f25ec12 -r a9134d48bc71 src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c Mon Mar 10 14:20:41 2008 -0700 > +++ b/src/Virt_VSMigrationService.c Mon Mar 10 14:21:14 2008 -0700 > @@ -21,6 +21,13 @@ > #include > #include > #include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > > #include > > @@ -39,6 +46,8 @@ > #include "Virt_VSMigrationService.h" > #include "Virt_HostSystem.h" > #include "Virt_VSMigrationSettingData.h" > + > +#include "config.h" > > #define CIM_JOBSTATE_STARTING 3 > #define CIM_JOBSTATE_RUNNING 4 > @@ -210,7 +219,6 @@ static CMPIStatus get_msd_values(const C > "Failed to connect to remote host (%s)", uri); > goto out; > } > - > out: > free(uri); > Now what did that blank line do to you to deserve that? Who knows how many compile cycles it's mutely stood witness as all the other lines get to become things like control structures and keywords. And what is its reward for a near eternity of silent service? A summary deletion, with a mere one-character obituary buried in a diff on a mailing list, read by few and noticed by fewer. Well, I noticed, and I won't stand for it! > > +static char **list_migration_checks(int *count) > +{ > + DIR *dir; > + struct dirent *de; > + char **list = NULL; > + int len = 0; > + > + *count = 0; > + > + dir = opendir(MIG_CHECKS_DIR); > + if (dir == NULL) { > + CU_DEBUG("Unable to open migration checks dir: %s (%s)", > + MIG_CHECKS_DIR, > + strerror(errno)); > + *count = -1; > + return NULL; > + } > + > + while ((de = readdir(dir)) != NULL) { > + int ret; > + char *path = NULL; > + > + if (de->d_name[0] == '.') > + continue; > On top of killing the "." and ".." listings, this will also skip all hidden (.foo) files. This is of course fine by me, but just checking that this is the intended behavior. > +static CMPIStatus _call_check(virDomainPtr dom, > + const char *prog, > + const char *param_path) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > + pid_t pid; > + int i; > + int rc = -1; > + > + pid = fork(); > + if (pid == 0) { > + virConnectPtr conn = virDomainGetConnect(dom); > + const char *name = virDomainGetName(dom); > + const char *uri = virConnectGetURI(conn); > + > + if (setpgrp() == -1) > + perror("setpgrp"); > + > + execl(prog, prog, name, uri, param_path, NULL); > + CU_DEBUG("exec(%s) failed: %s", prog, strerror(errno)); > + _exit(1); > + } > + > + for (i = 0; i < (MIG_CHECKS_TIMEOUT * 4); i++) { > + int status; > + if (waitpid(pid, &status, WNOHANG) != pid) { > + usleep(250000); > + } else { > + rc = WEXITSTATUS(status); > + break; > + } > + } > + > + if (rc == -1) { > + CU_DEBUG("Killing off stale child %i", pid); > One would think the passing of a child would garner a little more emotion, but given the treatment that blank line got, I suppose we should be thankful for what we can get. The rest seems to be typically free of errors, and equally free of heart. -- -Jay From heidieck at linux.vnet.ibm.com Wed Mar 12 15:52:33 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 12 Mar 2008 16:52:33 +0100 Subject: [Libvirt-cim] [PATCH] Fix indication_tester's filter deletion issue In-Reply-To: <47D579FA.7030308@linux.vnet.ibm.com> References: <4b34c7474e59f939200c.1205167758@naegling> <87d4q24ic7.fsf@caffeine.beaverton.ibm.com> <47D579FA.7030308@linux.vnet.ibm.com> Message-ID: <47D7FC41.2010908@linux.vnet.ibm.com> Jay Gagnon wrote: > Dan Smith wrote: >> >> Can you explain why the XML was wrong and why this fixes it? >> >> > Sure. I used -d to see what xml was actually going across for the > filter. The create xml started off like this: > > > > > > > > > > > > > And then the corresponding delete xml started off like this: > > > > > > > > > > > > > The classnames don't match up, so when we make the delete request the > CIMOM can't find the right instance to delete. Both handler and > subscription have the classnames properly matched, so they get created > and deleted properly. Now the one other thing I noticed is that > handler and subscription have the CIMXML suffix on both create and > delete, so maybe the more correct solution is to add it to the filter > create, not remove it from the filter delete. Do we have anything > official that can answer that for us? > The reason is defined within the CIM model: There exists only the one class CIM_IndicationHandlerCIMXML with the CIMXML suffix. CIM_IndicationHandler is the parent of this class and abstract, which means that no instances of this class are allowed. So instances of the Handler are CIM_IndicationHandlerCIMXML. For CIM_IndicationFilter and CIM_IndicationSubscription no class with the CIMXML suffix exists. In this cases the CIMXML suffix is a typo. ls /var/lib/Pegasus/repository/root#PG_InterOp/classes ... -rw-r----- 1 root pegasus 2599 2008-01-10 12:07 CIM_Indication.# -rw-r----- 1 root pegasus 5699 2008-01-10 12:07 CIM_IndicationFilter.CIM_ManagedElement -rw-r----- 1 root pegasus 6679 2008-01-10 12:07 CIM_IndicationHandler.CIM_ListenerDestination -rw-r----- 1 root pegasus 7045 2008-01-10 12:07 CIM_IndicationHandlerCIMXML.CIM_IndicationHandler -rw-r----- 1 root pegasus 11290 2008-01-10 12:07 CIM_IndicationSubscription.# ... -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From danms at us.ibm.com Wed Mar 12 16:03:19 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 09:03:19 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: <47D7F707.1080306@linux.vnet.ibm.com> (Jay Gagnon's message of "Wed, 12 Mar 2008 11:30:15 -0400") References: <47D7F707.1080306@linux.vnet.ibm.com> Message-ID: <87hcfcylo8.fsf@caffeine.beaverton.ibm.com> JG> Now what did that blank line do to you to deserve that? Who knows JG> how many compile cycles it's mutely stood witness as all the other JG> lines get to become things like control structures and JG> keywords. And what is its reward for a near eternity of silent JG> service? A summary deletion, with a mere one-character obituary JG> buried in a diff on a mailing list, read by few and noticed by JG> fewer. Well, I noticed, and I won't stand for it! /me stares at the screen in amazement JG> On top of killing the "." and ".." listings, this will also skip JG> all hidden (.foo) files. This is of course fine by me, but just JG> checking that this is the intended behavior. Yes, I think that's a good thing. If someone goes to look in, or clear out that directory to be "safe", hidden files could cause confusion and risk. It's also a reasonable way for people to disable a check temporarily, by making it hidden. A new set without the senseless killing of a blank line is on the way. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Wed Mar 12 16:03:35 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 09:03:35 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [RFC] Add optional check parameter field to migration schema In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1205337335 25200 # Node ID b2355adc325da20f0a613341fa2877a939b1afd5 # Parent 25d3e0aa63f04a2e0231a7b0c7b93ddb5dca6b6e [RFC] Add optional check parameter field to migration schema Signed-off-by: Dan Smith diff -r 25d3e0aa63f0 -r b2355adc325d schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Wed Mar 12 08:55:33 2008 -0700 +++ b/schema/VSMigrationSettingData.mof Wed Mar 12 08:55:35 2008 -0700 @@ -11,6 +11,7 @@ class Xen_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; [Provider("cmpi::Virt_VSMigrationSettingData")] @@ -18,4 +19,5 @@ class KVM_VirtualSystemMigrationSettingD [ ValueMap {"0","1","2","3","4","5","6"}, Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] uint16 TransportType; + string CheckParameters[]; }; From danms at us.ibm.com Wed Mar 12 16:03:36 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 09:03:36 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: Message-ID: <79615aba657b1860f175.1205337816@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205337336 25200 # Node ID 79615aba657b1860f17573d1cac1729a63eb835e # Parent b2355adc325da20f0a613341fa2877a939b1afd5 [RFC] Add configure support for migration check settings Signed-off-by: Dan Smith diff -r b2355adc325d -r 79615aba657b configure.ac --- a/configure.ac Wed Mar 12 08:55:35 2008 -0700 +++ b/configure.ac Wed Mar 12 08:55:36 2008 -0700 @@ -72,6 +72,20 @@ AC_ARG_WITH(html-dir, [test "x$withval" != "x" && HTML_DIR="$withval"], [HTML_DIR='$(datadir)/doc/$(PACKAGE)-$(VERSION)/html']) AC_SUBST(HTML_DIR) + +AC_ARG_WITH([migrate_check_timeout], + [ --with-migrate_check_timeout=SECS Max runtime allowed for external migration checks], + [test "x$withval" != "x" && MIG_CHECKS_TIMEOUT="$withval"], + [MIG_CHECKS_TIMEOUT=10]) +AC_SUBST(MIG_CHECKS_TIMEOUT) +AC_DEFINE_UNQUOTED(MIG_CHECKS_TIMEOUT, $MIG_CHECKS_TIMEOUT, [External migration check timeout]) + +AC_ARG_WITH([migrate_check_dir], + [ --with-migrate_check_dir=dir Location of external migration checks], + [test "x$withval" != "x" && MIG_CHECKS_DIR="$withval"], + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) +AC_SUBST(MIG_CHECKS_DIR) +AC_DEFINE_UNQUOTED(MIG_CHECKS_DIR, "$MIG_CHECKS_DIR", [External migration check timeout]) # Autogenerate the autoconf header file to store build settings AC_CONFIG_HEADER([config.h]) From danms at us.ibm.com Wed Mar 12 16:03:34 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 09:03:34 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] (#3) [RFC] Add external migration checks Message-ID: Removed the blank line removal From danms at us.ibm.com Wed Mar 12 16:03:37 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 09:03:37 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [RFC] Add external check functionality to CheckIsVSMigratable() In-Reply-To: Message-ID: <39a6d63d6c89d887b68a.1205337817@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205337366 25200 # Node ID 39a6d63d6c89d887b68a529a6d7f369c65e6e38b # Parent 79615aba657b1860f17573d1cac1729a63eb835e [RFC] Add external check functionality to CheckIsVSMigratable() Changes: - Fetch the array out of the MSD ourselves to avoid adding a special case to get_msd_values() Signed-off-by: Dan Smith diff -r 79615aba657b -r 39a6d63d6c89 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Wed Mar 12 08:55:36 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 08:56:06 2008 -0700 @@ -21,6 +21,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -39,6 +46,8 @@ #include "Virt_VSMigrationService.h" #include "Virt_HostSystem.h" #include "Virt_VSMigrationSettingData.h" + +#include "config.h" #define CIM_JOBSTATE_STARTING 3 #define CIM_JOBSTATE_RUNNING 4 @@ -262,6 +271,258 @@ static CMPIStatus check_hver(virConnectP return s; } +static bool is_valid_check(const char *path) +{ + struct stat s; + + if (stat(path, &s) != 0) + return false; + + if (!S_ISREG(s.st_mode)) + return false; + + if ((s.st_mode & S_IXUSR) || + (s.st_mode & S_IXGRP) || + (s.st_mode & S_IXOTH)) + return true; + else + return false; +} + +static void free_list(char **list, int count) +{ + int i; + + if (list == NULL) + return; + + for (i = 0; i < count; i++) + free(list[i]); + + free(list); +} + +static char **list_migration_checks(int *count) +{ + DIR *dir; + struct dirent *de; + char **list = NULL; + int len = 0; + + *count = 0; + + dir = opendir(MIG_CHECKS_DIR); + if (dir == NULL) { + CU_DEBUG("Unable to open migration checks dir: %s (%s)", + MIG_CHECKS_DIR, + strerror(errno)); + *count = -1; + return NULL; + } + + while ((de = readdir(dir)) != NULL) { + int ret; + char *path = NULL; + + if (de->d_name[0] == '.') + continue; + + if (*count == len) { + char **tmp; + + len = (len * 2) + 1; + tmp = realloc(list, sizeof(char *) * len); + if (tmp == NULL) { + CU_DEBUG("Failed to alloc check list"); + goto error; + } + + list = tmp; + } + + ret = asprintf(&path, + "%s/%s", + MIG_CHECKS_DIR, + de->d_name); + if (ret == -1) { + CU_DEBUG("Failed to alloc path for check"); + goto error; + } + + if (is_valid_check(path)) { + list[*count] = path; + (*count) += 1; + } else { + CU_DEBUG("Invalid check program: %s", path); + free(path); + } + } + + closedir(dir); + + return list; + error: + closedir(dir); + + free_list(list, *count); + *count = 0; + + return NULL; +} + +static CMPIStatus _call_check(virDomainPtr dom, + const char *prog, + const char *param_path) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + pid_t pid; + int i; + int rc = -1; + + pid = fork(); + if (pid == 0) { + virConnectPtr conn = virDomainGetConnect(dom); + const char *name = virDomainGetName(dom); + const char *uri = virConnectGetURI(conn); + + if (setpgrp() == -1) + perror("setpgrp"); + + execl(prog, prog, name, uri, param_path, NULL); + CU_DEBUG("exec(%s) failed: %s", prog, strerror(errno)); + _exit(1); + } + + for (i = 0; i < (MIG_CHECKS_TIMEOUT * 4); i++) { + int status; + if (waitpid(pid, &status, WNOHANG) != pid) { + usleep(250000); + } else { + rc = WEXITSTATUS(status); + break; + } + } + + if (rc == -1) { + CU_DEBUG("Killing off stale child %i", pid); + killpg(pid, SIGKILL); + waitpid(pid, NULL, WNOHANG); + } + + if (rc != 0) { + char *name = strdup(prog); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Migration check `%s' failed", + basename(name)); + free(name); + } + + return s; +} + +static CMPIStatus call_external_checks(virDomainPtr dom, + const char *param_path) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + char **list = NULL; + int count = 0; + int i; + + list = list_migration_checks(&count); + if (count < 0) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to execute migration checks"); + goto out; + } else if (list == NULL) { + goto out; + } + + for (i = 0; i < count; i++) { + CU_DEBUG("Calling migration check: %s", list[i]); + s = _call_check(dom, list[i], param_path); + if (s.rc != CMPI_RC_OK) { + CU_DEBUG("...Failed"); + break; + } else + CU_DEBUG("...OK"); + } + out: + free_list(list, count); + + return s; +} + +static char *write_params(CMPIArray *array) +{ + int i; + int fd; + char *filename = strdup("/tmp/libvirtcim_mig.XXXXXX"); + FILE *file = NULL; + + if (filename == NULL) { + CU_DEBUG("Unable to get temporary file"); + return NULL; + } + + fd = mkstemp(filename); + if (fd < 0) { + CU_DEBUG("Unable to get temporary file: %s", strerror(errno)); + free(filename); + filename = NULL; + goto out; + } + + file = fdopen(fd, "w"); + if (file == NULL) { + CU_DEBUG("Unable to open temporary file: %s", strerror(errno)); + free(filename); + filename = NULL; + goto out; + } + + for (i = 0; i < CMGetArrayCount(array, NULL); i++) { + CMPIData d; + CMPIStatus s; + + d = CMGetArrayElementAt(array, i, &s); + if ((s.rc != CMPI_RC_OK) || CMIsNullValue(d)) { + CU_DEBUG("Unable to get array[%i]: %s", + i, + CMGetCharPtr(s.msg)); + continue; + } + + fprintf(file, "%s\n", CMGetCharPtr(d.value.string)); + } + + out: + if (file != NULL) + fclose(file); + + close(fd); + + return filename; +} + +static char *get_parms_file(const CMPIObjectPath *ref, + const CMPIArgs *argsin) +{ + CMPIStatus s; + CMPIArray *array; + CMPIInstance *msd; + + s = get_msd(ref, argsin, &msd); + if (s.rc != CMPI_RC_OK) + return NULL; + + if (cu_get_array_prop(msd, "CheckParameters", &array) == CMPI_RC_OK) + return write_params(array); + else + return NULL; +} + static CMPIStatus vs_migratable(const CMPIObjectPath *ref, const char *domain, const char *destination, @@ -276,6 +537,7 @@ static CMPIStatus vs_migratable(const CM CMPIBoolean isMigratable = 0; uint16_t type; virDomainPtr dom = NULL; + char *path = NULL; s = get_msd_values(ref, destination, argsin, &type, &dconn); if (s.rc != CMPI_RC_OK) @@ -298,6 +560,11 @@ static CMPIStatus vs_migratable(const CM } s = check_caps(conn, dconn); + if (s.rc != CMPI_RC_OK) + goto out; + + path = get_parms_file(ref, argsin); + s = call_external_checks(dom, path); if (s.rc != CMPI_RC_OK) goto out; @@ -315,6 +582,10 @@ static CMPIStatus vs_migratable(const CM virDomainFree(dom); virConnectClose(conn); virConnectClose(dconn); + + if (path != NULL) + unlink(path); + free(path); return s; } From danms at us.ibm.com Wed Mar 12 16:49:26 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 09:49:26 -0700 Subject: [Libvirt-cim] [PATCH] Add domain ref checking to isMigratable Message-ID: <42b808d88849cbc642af.1205340566@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205340424 25200 # Node ID 42b808d88849cbc642af67b2769b120624f66a42 # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 Add domain ref checking to isMigratable Tested by adding an invalid key to the ComputerSystem REF, which would pass before. It now fails and points out the offending key, as expected. Signed-off-by: Dan Smith diff -r b739fc9b1332 -r 42b808d88849 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 09:47:04 2008 -0700 @@ -38,6 +38,7 @@ #include "Virt_VSMigrationService.h" #include "Virt_HostSystem.h" +#include "Virt_ComputerSystem.h" #include "Virt_VSMigrationSettingData.h" #define CIM_JOBSTATE_STARTING 3 @@ -276,6 +277,7 @@ static CMPIStatus vs_migratable(const CM CMPIBoolean isMigratable = 0; uint16_t type; virDomainPtr dom = NULL; + CMPIInstance *dominst; s = get_msd_values(ref, destination, argsin, &type, &dconn); if (s.rc != CMPI_RC_OK) @@ -296,6 +298,10 @@ static CMPIStatus vs_migratable(const CM "No such domain"); goto out; } + + s = get_domain_by_ref(_BROKER, ref, &dominst); + if (s.rc != CMPI_RC_OK) + goto out; s = check_caps(conn, dconn); if (s.rc != CMPI_RC_OK) From kaitlin at linux.vnet.ibm.com Wed Mar 12 19:38:50 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Wed, 12 Mar 2008 12:38:50 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Use libvirt's storage management In-Reply-To: References: Message-ID: <47D8314A.5010905@linux.vnet.ibm.com> Dan Smith wrote: > Subject says it all. > > Some reasonable testing of this to make sure it still: > (a) works as it did before on <=0.4.0, and > (b) works with the storage stuff if you have 0.4.1 I had libvirt 0.4.0, so I tested this before and after I updated to 0.4.1. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Wed Mar 12 19:56:19 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Wed, 12 Mar 2008 12:56:19 -0700 Subject: [Libvirt-cim] [PATCH] Make migration return proper value for "Job Started" In-Reply-To: <82b18a386bda9c09e6f4.1205334581@caffeine.beaverton.ibm.com> References: <82b18a386bda9c09e6f4.1205334581@caffeine.beaverton.ibm.com> Message-ID: <47D83563.5020802@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205331569 25200 > # Node ID 82b18a386bda9c09e6f4f41a0b3acbeeba7f0ea9 > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > Make migration return proper value for "Job Started" > > Signed-off-by: Dan Smith > > diff -r b739fc9b1332 -r 82b18a386bda src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 > +++ b/src/Virt_VSMigrationService.c Wed Mar 12 07:19:29 2008 -0700 > @@ -927,7 +927,7 @@ static CMPIStatus migrate_do(const CMPIO > > thread = _BROKER->xft->newThread((void*)migration_thread, job, 0); > > - retcode = 0; > + retcode = 4096; /* Job Started */ > > out: > CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); > My ignorance here - not sure where the 4096 value is coming from. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From danms at us.ibm.com Wed Mar 12 20:22:18 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 13:22:18 -0700 Subject: [Libvirt-cim] [PATCH] Make migration return proper value for "Job Started" Message-ID: <4aa425bba4e2f0834001.1205353338@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205353332 25200 # Node ID 4aa425bba4e2f0834001bef08766e06a83c50da2 # Parent 42b808d88849cbc642af67b2769b120624f66a42 Make migration return proper value for "Job Started" Changes: - Use a constant for return value. This seems to be a convention at least in the SVPC profiles, although it's relatively informally defined. Signed-off-by: Dan Smith diff -r 42b808d88849 -r 4aa425bba4e2 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Wed Mar 12 09:47:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 13:22:12 2008 -0700 @@ -40,6 +40,7 @@ #include "Virt_HostSystem.h" #include "Virt_ComputerSystem.h" #include "Virt_VSMigrationSettingData.h" +#include "svpc_types.h" #define CIM_JOBSTATE_STARTING 3 #define CIM_JOBSTATE_RUNNING 4 @@ -307,7 +308,7 @@ static CMPIStatus vs_migratable(const CM if (s.rc != CMPI_RC_OK) goto out; - retcode = 0; + retcode = CIM_SVPC_RETURN_COMPLETED; cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); @@ -933,7 +934,7 @@ static CMPIStatus migrate_do(const CMPIO thread = _BROKER->xft->newThread((void*)migration_thread, job, 0); - retcode = 0; + retcode = CIM_SVPC_RETURN_JOB_STARTED; out: CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); diff -r 42b808d88849 -r 4aa425bba4e2 src/svpc_types.h --- a/src/svpc_types.h Wed Mar 12 09:47:04 2008 -0700 +++ b/src/svpc_types.h Wed Mar 12 13:22:12 2008 -0700 @@ -44,6 +44,9 @@ const static int cim_res_types[CIM_RES_T /* Vendor-specific extension; should be documented somewhere */ #define CIM_VSSD_RECOVERY_PRESERVE 123 +#define CIM_SVPC_RETURN_JOB_STARTED 4096 +#define CIM_SVPC_RETURN_COMPLETED 0 + #include #include From kaitlin at linux.vnet.ibm.com Wed Mar 12 22:14:43 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Wed, 12 Mar 2008 15:14:43 -0700 Subject: [Libvirt-cim] [PATCH] Make migration return proper value for "Job Started" In-Reply-To: <4aa425bba4e2f0834001.1205353338@caffeine.beaverton.ibm.com> References: <4aa425bba4e2f0834001.1205353338@caffeine.beaverton.ibm.com> Message-ID: <47D855D3.1050106@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205353332 25200 > # Node ID 4aa425bba4e2f0834001bef08766e06a83c50da2 > # Parent 42b808d88849cbc642af67b2769b120624f66a42 > Make migration return proper value for "Job Started" > > Changes: > - Use a constant for return value. This seems to be a convention at least > in the SVPC profiles, although it's relatively informally defined. > Ah, I see - this makes sense now, thanks! +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Wed Mar 12 22:37:44 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Wed, 12 Mar 2008 15:37:44 -0700 Subject: [Libvirt-cim] [PATCH] Add domain ref checking to isMigratable In-Reply-To: <42b808d88849cbc642af.1205340566@caffeine.beaverton.ibm.com> References: <42b808d88849cbc642af.1205340566@caffeine.beaverton.ibm.com> Message-ID: <47D85B38.8040006@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205340424 25200 > # Node ID 42b808d88849cbc642af67b2769b120624f66a42 > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > Add domain ref checking to isMigratable > > Tested by adding an invalid key to the ComputerSystem REF, which would > pass before. It now fails and points out the offending key, as expected. > > Signed-off-by: Dan Smith > > diff -r b739fc9b1332 -r 42b808d88849 src/Virt_VSMigrationService.c Virt_VSMigrationService doesn't link to Virt_ComputerSystem, so I get a symbol error when I tried to test this. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Wed Mar 12 22:54:09 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Wed, 12 Mar 2008 15:54:09 -0700 Subject: [Libvirt-cim] [PATCH] Use live migration if MigrationType isn't defined in MSD Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1205362434 25200 # Node ID df3c20a332e01e4e9f90f6ccdc61857515d57a7f # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 Use live migration if MigrationType isn't defined in MSD. diff -r b739fc9b1332 -r df3c20a332e0 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 15:53:54 2008 -0700 @@ -100,9 +100,8 @@ static CMPIStatus get_migration_type(CMP ret = cu_get_u16_prop(msd, "MigrationType", type); if (ret != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - ret, - "Invalid MigrationType value"); + CU_DEBUG("Using default MigrationType: %d", CIM_MIGRATE_LIVE); + *type = CIM_MIGRATE_LIVE; } return s; From danms at us.ibm.com Wed Mar 12 23:09:19 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 16:09:19 -0700 Subject: [Libvirt-cim] [PATCH] Add domain ref checking to isMigratable In-Reply-To: <47D85B38.8040006@linux.vnet.ibm.com> (Kaitlin Rupert's message of "Wed, 12 Mar 2008 15:37:44 -0700") References: <42b808d88849cbc642af.1205340566@caffeine.beaverton.ibm.com> <47D85B38.8040006@linux.vnet.ibm.com> Message-ID: <874pbbzgio.fsf@caffeine.beaverton.ibm.com> KR> Virt_VSMigrationService doesn't link to Virt_ComputerSystem, so I KR> get a symbol error when I tried to test this. You're right, it doesn't. Interestingly, I had the migration indication subscribed, which had the migration provider loaded, hence no symbol error. Replacement on the way. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Wed Mar 12 23:49:45 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 12 Mar 2008 16:49:45 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Add domain ref checking to isMigratable Message-ID: # HG changeset patch # User Dan Smith # Date 1205365783 25200 # Node ID c655c11291a0817c4a804f41bcaa64bbcd34efc5 # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 (#2) Add domain ref checking to isMigratable Tested by adding an invalid key to the ComputerSystem REF, which would pass before. It now fails and points out the offending key, as expected. Changes: - Link to libVirt_ComputerSystem - Use the proper ref and set the namespace, since it's not done for us - Move the Name key extraction up a level to reduce duplication and make the CS ref available for the get_domain_by_ref() call Signed-off-by: Dan Smith diff -r b739fc9b1332 -r c655c11291a0 src/Makefile.am --- a/src/Makefile.am Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Makefile.am Wed Mar 12 16:49:43 2008 -0700 @@ -163,9 +163,9 @@ libVirt_ElementSettingData_la_LIBADD = - libVirt_VSMigrationCapabilities_la_SOURCES = Virt_VSMigrationCapabilities.c -libVirt_VSMigrationService_la_DEPENDENCIES = libVirt_HostSystem.la libVirt_VSMigrationSettingData.la +libVirt_VSMigrationService_la_DEPENDENCIES = libVirt_HostSystem.la libVirt_VSMigrationSettingData.la libVirt_ComputerSystem.la libVirt_VSMigrationService_la_SOURCES = Virt_VSMigrationService.c -libVirt_VSMigrationService_la_LIBADD = -lVirt_HostSystem -lVirt_VSMigrationSettingData +libVirt_VSMigrationService_la_LIBADD = -lVirt_HostSystem -lVirt_VSMigrationSettingData -lVirt_ComputerSystem libVirt_VSMigrationSettingData_la_SOURCES = Virt_VSMigrationSettingData.c diff -r b739fc9b1332 -r c655c11291a0 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 16:49:43 2008 -0700 @@ -38,6 +38,7 @@ #include "Virt_VSMigrationService.h" #include "Virt_HostSystem.h" +#include "Virt_ComputerSystem.h" #include "Virt_VSMigrationSettingData.h" #define CIM_JOBSTATE_STARTING 3 @@ -263,7 +264,7 @@ static CMPIStatus check_hver(virConnectP } static CMPIStatus vs_migratable(const CMPIObjectPath *ref, - const char *domain, + CMPIObjectPath *system, const char *destination, const CMPIResult *results, const CMPIArgs *argsin, @@ -276,6 +277,15 @@ static CMPIStatus vs_migratable(const CM CMPIBoolean isMigratable = 0; uint16_t type; virDomainPtr dom = NULL; + CMPIInstance *dominst; + const char *domain; + + if (cu_get_str_path(system, "Name", &domain) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Missing key (Name) in ComputerSystem"); + goto out; + } s = get_msd_values(ref, destination, argsin, &type, &dconn); if (s.rc != CMPI_RC_OK) @@ -296,6 +306,11 @@ static CMPIStatus vs_migratable(const CM "No such domain"); goto out; } + + CMSetNameSpace(system, NAMESPACE(ref)); + s = get_domain_by_ref(_BROKER, system, &dominst); + if (s.rc != CMPI_RC_OK) + goto out; s = check_caps(conn, dconn); if (s.rc != CMPI_RC_OK) @@ -329,18 +344,9 @@ static CMPIStatus vs_migratable_host(CMP CMPIStatus s; const char *dhost = NULL; CMPIObjectPath *system; - const char *name = NULL; cu_get_str_arg(argsin, "DestinationHost", &dhost); cu_get_ref_arg(argsin, "ComputerSystem", &system); - - if (cu_get_str_path(system, "Name", &name) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing key (Name) in ComputerSystem"); - METHOD_RETURN(results, 1); - return s; - } if (!check_refs_pfx_match(ref, system)) { cu_statusf(_BROKER, &s, @@ -350,7 +356,7 @@ static CMPIStatus vs_migratable_host(CMP return s; } - return vs_migratable(ref, name, dhost, results, argsin, argsout); + return vs_migratable(ref, system, dhost, results, argsin, argsout); } static CMPIStatus vs_migratable_system(CMPIMethodMI *self, @@ -364,7 +370,6 @@ static CMPIStatus vs_migratable_system(C CMPIObjectPath *dsys; CMPIObjectPath *sys; const char *dname; - const char *name; cu_get_ref_arg(argsin, "DestinationSystem", &dsys); cu_get_ref_arg(argsin, "ComputerSystem", &sys); @@ -377,14 +382,6 @@ static CMPIStatus vs_migratable_system(C return s; } - if (cu_get_str_path(sys, "Name", &name) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing key (Name) in ComputerSystem"); - METHOD_RETURN(results, 1); - return s; - } - if (!check_refs_pfx_match(ref, sys)) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -393,7 +390,7 @@ static CMPIStatus vs_migratable_system(C return s; } - return vs_migratable(ref, name, dname, results, argsin, argsout); + return vs_migratable(ref, sys, dname, results, argsin, argsout); } static const char *ind_type_to_name(int ind_type) From veillard at redhat.com Thu Mar 13 06:54:03 2008 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 13 Mar 2008 02:54:03 -0400 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: <47D7AF95.3040804@linux.vnet.ibm.com> References: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> <87myp62ruw.fsf@caffeine.beaverton.ibm.com> <47D5AF79.2040903@linux.vnet.ibm.com> <47D7AF95.3040804@linux.vnet.ibm.com> Message-ID: <20080313065403.GA31643@redhat.com> On Wed, Mar 12, 2008 at 11:25:25AM +0100, Heidi Eckhart wrote: > Kaitlin Rupert wrote: > >Dan Smith wrote: > >>DS> + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) > >> > >>I should point out that this was just thrown in there to have > >>something in place. I'm not sure what a good location would be. > >>Perhaps $prefix/libexec/libvirt-cim/extchecks ? > >> > >> > > > >I think having libvirt-cim in the path is a good way to go. It's more > >descriptive that way. > I agree. I agree too, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ From heidieck at linux.vnet.ibm.com Thu Mar 13 12:55:14 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:55:14 +0100 Subject: [Libvirt-cim] [PATCH 2 of 2] ECTP: adopt interface changes of RegisteredProfile In-Reply-To: Message-ID: <32a472f243e4f4a94e5c.1205412914@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205412134 -3600 # Node ID 32a472f243e4f4a94e5c79a1f7393f1764e5cba8 # Parent c54f01516458be69a914427668857951fb94e278 ECTP: adopt interface changes of RegisteredProfile wbemain -ac CIM_ElementConformsToProfile 'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="wrong"' is returning localhost:5988/root/virt:KVM_RegisteredProfile.InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0" instead of NOT_FOUND Signed-off-by: Heidi Eckhart diff -r c54f01516458 -r 32a472f243e4 src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:41:27 2008 +0100 +++ b/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:42:14 2008 +0100 @@ -60,7 +60,7 @@ static CMPIStatus elem_instances(const C char *classname; classname = get_typed_class(pfx_from_conn(conn), - profile->provider_name); + profile->scoping_class); if (classname == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -72,7 +72,7 @@ static CMPIStatus elem_instances(const C if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) goto out; - en = CBEnumInstances(_BROKER, info->context , op, NULL, &s); + en = CBEnumInstances(_BROKER, info->context , op, info->properties, &s); if (en == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -103,12 +103,17 @@ static CMPIStatus prof_to_elem(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance = NULL; virConnectPtr conn = NULL; const char *id; int i; if (!match_hypervisor_prefix(ref, info)) return s; + + s = get_profile_by_ref(_BROKER, ref, info->properties, &instance); + if (s.rc != CMPI_RC_OK) + goto out; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) @@ -122,11 +127,12 @@ static CMPIStatus prof_to_elem(const CMP } for (i = 0; profiles[i] != NULL; i++) { - if (STREQ(id, profiles[i]->reg_id)) { - s = elem_instances(ref, info, list, - profiles[i], conn); - if ((s.rc != CMPI_RC_OK)) - goto out; + if (STREQC(id, profiles[i]->reg_id)) { + s = elem_instances(ref, + info, + list, + profiles[i], + conn); break; } } @@ -142,13 +148,20 @@ static CMPIStatus elem_to_prof(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; + CMPIInstance *instance = NULL; virConnectPtr conn = NULL; char *classname; - struct reg_prof *candidate; int i; if (!match_hypervisor_prefix(ref, info)) + return s; + + instance = CBGetInstance(_BROKER, + info->context, + ref, + NULL, + &s); + if (s.rc != CMPI_RC_OK) return s; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); @@ -164,22 +177,19 @@ static CMPIStatus elem_to_prof(const CMP } for (i = 0; profiles[i] != NULL; i++) { - candidate = profiles[i]; - if (!STREQC(candidate->provider_name, classname)) + if (!STREQC(profiles[i]->scoping_class, classname)) continue; - instance = reg_prof_instance(_BROKER, - "root/interop", - NULL, - conn, - candidate); - if (instance == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Can't create profile instance"); + s = get_profile(_BROKER, + ref, + info->properties, + CIM_INTEROP_NS, + pfx_from_conn(conn), + profiles[i], + &instance); + if (s.rc != CMPI_RC_OK) goto out; - } - + inst_list_add(list, instance); } From heidieck at linux.vnet.ibm.com Thu Mar 13 12:55:13 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:55:13 +0100 Subject: [Libvirt-cim] [PATCH 1 of 2] RegisteredProfile: adopt common look and feel of interfaces In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205412087 -3600 # Node ID c54f01516458be69a914427668857951fb94e278 # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 RegisteredProfile: adopt common look and feel of interfaces Signed-off-by: Heidi Eckhart diff -r b739fc9b1332 -r c54f01516458 src/Virt_RegisteredProfile.c --- a/src/Virt_RegisteredProfile.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_RegisteredProfile.c Thu Mar 13 13:41:27 2008 +0100 @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2008 * * Authors: * Dan Smith @@ -40,19 +40,21 @@ const static CMPIBroker *_BROKER; -CMPIInstance *reg_prof_instance(const CMPIBroker *broker, - const char *namespace, - const char **properties, - virConnectPtr conn, - struct reg_prof *profile) +CMPIStatus get_profile(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + const char* interop_namespace, + const char* pfx, + struct reg_prof *profile, + CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *instance = NULL; - + instance = get_typed_instance(broker, - pfx_from_conn(conn), + pfx, "RegisteredProfile", - namespace); + interop_namespace); if (instance == NULL) { cu_statusf(broker, &s, @@ -63,10 +65,7 @@ CMPIInstance *reg_prof_instance(const CM if (properties) { const char *keys[] = {"InstanceID", NULL}; - s = CMSetPropertyFilter(instance, properties, keys); - if (s.rc != CMPI_RC_OK) { - goto out; - } + CMSetPropertyFilter(instance, properties, keys); } CMSetProperty(instance, "InstanceID", @@ -81,41 +80,122 @@ CMPIInstance *reg_prof_instance(const CM CMSetProperty(instance, "RegisteredVersion", (CMPIValue *)profile->reg_version, CMPI_chars); + *_inst = instance; + out: - return instance; + + return s; } -static CMPIStatus enum_profs(const CMPIObjectPath *ref, - const CMPIResult *results, - const char **properties, - bool names_only) +CMPIStatus get_profile_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *name, + const char **properties, + CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; + virConnectPtr conn = NULL; + int i; + bool found = false; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } + + for (i = 0; profiles[i] != NULL; i++) { + if(STREQ(name, profiles[i]->reg_id)) { + CMPIInstance *inst = NULL; + + s = get_profile(broker, + reference, + properties, + CIM_INTEROP_NS, + pfx_from_conn(conn), + profiles[i], + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + found = true; + break; + } + } + + if (found == false) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s)", + name); + + out: + virConnectClose(conn); + + return s; +} + +CMPIStatus get_profile_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + const char *name = NULL; + + if (cu_get_str_path(reference, "InstanceID", &name) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "No InstanceID specified"); + goto out; + } + + s = get_profile_by_name(broker, reference, name, properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + + out: + return s; +} + +CMPIStatus enum_profiles(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; int i; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) - return s; + goto out; for (i = 0; profiles[i] != NULL; i++) { - instance = reg_prof_instance(_BROKER, - NAMESPACE(ref), - properties, - conn, - profiles[i]); - if (instance == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Can't create profile instance"); - goto out; - } + CMPIInstance *inst = NULL; - if (names_only) - cu_return_instance_name(results, instance); - else - CMReturnInstance(results, instance); + s = get_profile(broker, + reference, + properties, + CIM_INTEROP_NS, + pfx_from_conn(conn), + profiles[i], + &inst); + + if (s.rc != CMPI_RC_OK) + continue; + + inst_list_add(list, inst); } out: @@ -124,50 +204,27 @@ static CMPIStatus enum_profs(const CMPIO return s; } -static CMPIStatus get_prof(const CMPIObjectPath *ref, - const CMPIResult *results, - const char **properties) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance = NULL; - virConnectPtr conn = NULL; - const char* id; - int i; +static CMPIStatus return_enum_profiles(const CMPIObjectPath *reference, + const CMPIResult *results, + const char **properties, + const bool names_only) +{ + struct inst_list list; + CMPIStatus s; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); + inst_list_init(&list); + + s = enum_profiles(_BROKER, reference, properties, &list); + if (s.rc != CMPI_RC_OK) goto out; - } - if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "No InstanceID specified"); - goto out; - } + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); - for (i = 0; profiles[i] != NULL; i++) { - if(STREQ(id, profiles[i]->reg_id)) { - instance = reg_prof_instance(_BROKER, - NAMESPACE(ref), - properties, - conn, - profiles[i]); - break; - } - } - - if(instance) - CMReturnInstance(results, instance); - else - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "Profile instance not found"); out: - virConnectClose(conn); + inst_list_free(&list); return s; } @@ -177,7 +234,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return enum_profs(reference, results, NULL, true); + return return_enum_profiles(reference, results, NULL, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -186,7 +243,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return enum_profs(reference, results, properties, false); + return return_enum_profiles(reference, results, properties, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -195,7 +252,17 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - return get_prof(reference, results, properties); + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + + s = get_profile_by_ref(_BROKER, reference, properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: + return s; } DEFAULT_CI(); diff -r b739fc9b1332 -r c54f01516458 src/Virt_RegisteredProfile.h --- a/src/Virt_RegisteredProfile.h Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_RegisteredProfile.h Thu Mar 13 13:41:27 2008 +0100 @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2008 * * Authors: * Heidi Eckhart @@ -21,11 +21,29 @@ #ifndef __VIRT_REGISTERED_PROFILE_H #define __VIRT_REGISTERED_PROFILE_H -CMPIInstance *reg_prof_instance(const CMPIBroker *broker, - const char *namespace, - const char **properties, - virConnectPtr conn, - struct reg_prof *profile); +CMPIStatus enum_profiles(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + struct inst_list *list); + +CMPIStatus get_profile(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + const char* interop_namespace, + const char* pfx, + struct reg_prof *profile, + CMPIInstance **_inst); + +CMPIStatus get_profile_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *name, + const char **properties, + CMPIInstance **_inst); + +CMPIStatus get_profile_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + CMPIInstance **_inst); #endif diff -r b739fc9b1332 -r c54f01516458 src/profiles.h --- a/src/profiles.h Tue Mar 11 13:28:04 2008 -0700 +++ b/src/profiles.h Thu Mar 13 13:41:27 2008 +0100 @@ -1,8 +1,9 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2008 * * Authors: * Jay Gagnon + * Heidi Eckhart * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +19,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Interop Namespace */ +#define CIM_INTEROP_NS "root/interop" + struct reg_prof { uint16_t reg_org; // Valid: 1 = Other, 2 = DMTF char *reg_id; @@ -26,7 +31,7 @@ struct reg_prof { int ad_types; char *other_reg_org; char *ad_type_descriptions; - char *provider_name; + char *scoping_class; }; struct reg_prof SystemVirtualization = { @@ -34,7 +39,7 @@ struct reg_prof SystemVirtualization = { .reg_id = "CIM:DSP1042-SystemVirtualization-1.0.0", .reg_name = "System Virtualization", .reg_version = "1.0.0", - .provider_name = "HostSystem" + .scoping_class = "HostSystem" }; struct reg_prof VirtualSystem = { @@ -42,7 +47,7 @@ struct reg_prof VirtualSystem = { .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a", .reg_name = "Virtual System Profile", .reg_version = "1.0.0a", - .provider_name = "ComputerSystem" + .scoping_class = "ComputerSystem" }; From heidieck at linux.vnet.ibm.com Thu Mar 13 12:55:12 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:55:12 +0100 Subject: [Libvirt-cim] [PATCH 0 of 2] RegisteredProfile adopt common look and feel of interfaces and adopt interface to ECTP Message-ID: This patch set adopts the common look and feel of the instance provider to RegisteredProfile. The changes are then adopted to ECTP. This fixes ECTP's validation of the client submitted object path. From heidieck at linux.vnet.ibm.com Thu Mar 13 12:58:30 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:58:30 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] RegisteredProfile: add instances for each implemented profile In-Reply-To: Message-ID: <91c4e3da0404a28014db.1205413110@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205412147 -3600 # Node ID 91c4e3da0404a28014dbff799a841d951ce235f5 # Parent 32a472f243e4f4a94e5c79a1f7393f1764e5cba8 RegisteredProfile: add instances for each implemented profile The following DMTF Profiles are implemented by the libvirt-cim provider package: - DSP1042 System Virtualization 1.0.0 - DSP1045 Memory Resource Virtualization 1.0.0 - DSP1057 Virtual System 1.0.0 - DSP1059 Generic Device Resource Virtualization 1.0.0 - DSP1081 Virtual System Migration 0.8.1 Signed-off-by: Heidi Eckhart diff -r 32a472f243e4 -r 91c4e3da0404 src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:42:14 2008 +0100 +++ b/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:42:27 2008 +0100 @@ -58,6 +58,9 @@ static CMPIStatus elem_instances(const C CMPIEnumeration *en = NULL; CMPIData data ; char *classname; + + if (profile->scoping_class == NULL) + return s; classname = get_typed_class(pfx_from_conn(conn), profile->scoping_class); diff -r 32a472f243e4 -r 91c4e3da0404 src/profiles.h --- a/src/profiles.h Thu Mar 13 13:42:14 2008 +0100 +++ b/src/profiles.h Thu Mar 13 13:42:27 2008 +0100 @@ -32,6 +32,16 @@ struct reg_prof { char *other_reg_org; char *ad_type_descriptions; char *scoping_class; + struct reg_prof *scoping_profile; +}; + +struct reg_prof VirtualSystem = { + .reg_org = 2, + .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a", + .reg_name = "Virtual System Profile", + .reg_version = "1.0.0a", + .scoping_class = "ComputerSystem", + .scoping_profile = NULL }; struct reg_prof SystemVirtualization = { @@ -39,22 +49,44 @@ struct reg_prof SystemVirtualization = { .reg_id = "CIM:DSP1042-SystemVirtualization-1.0.0", .reg_name = "System Virtualization", .reg_version = "1.0.0", - .scoping_class = "HostSystem" + .scoping_class = "HostSystem", + .scoping_profile = &VirtualSystem }; -struct reg_prof VirtualSystem = { +struct reg_prof GenericDeviceResourceVirtualization = { .reg_org = 2, - .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a", - .reg_name = "Virtual System Profile", - .reg_version = "1.0.0a", - .scoping_class = "ComputerSystem" + .reg_id = "CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0", + .reg_name = "Generic Device Resource Virtualization", + .reg_version = "1.0.0", + .scoping_class = NULL, + .scoping_profile = &SystemVirtualization }; +struct reg_prof MemoryResourceVirtualization = { + .reg_org = 2, + .reg_id = "CIM:DSP1045-MemoryResourceVirtualization-1.0.0", + .reg_name = "Memory Resource Virtualization", + .reg_version = "1.0.0", + .scoping_class = NULL, + .scoping_profile = &SystemVirtualization +}; + +struct reg_prof VirtualSystemMigration = { + .reg_org = 2, + .reg_id = "CIM:DSP1081-VirtualSystemMigration-1.0", + .reg_name = "Virtual System Migration", + .reg_version = "1.0", + .scoping_class = NULL, + .scoping_profile = &SystemVirtualization +}; // Make sure to add pointer to your reg_prof struct here. struct reg_prof *profiles[] = { &SystemVirtualization, &VirtualSystem, + &GenericDeviceResourceVirtualization, + &MemoryResourceVirtualization, + &VirtualSystemMigration, NULL }; From heidieck at linux.vnet.ibm.com Thu Mar 13 12:58:32 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:58:32 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] ECTP: adopt the changes made to profile.h In-Reply-To: Message-ID: <66cb0be19c8c3432c048.1205413112@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205412163 -3600 # Node ID 66cb0be19c8c3432c0484edbb40468817c3fbadd # Parent 450c46695ca4265d74f2686b64d1be27b96bd3db ECTP: adopt the changes made to profile.h Signed-off-by: Heidi Eckhart diff -r 450c46695ca4 -r 66cb0be19c8c src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:42:32 2008 +0100 +++ b/src/Virt_ElementConformsToProfile.c Thu Mar 13 13:42:43 2008 +0100 @@ -180,6 +180,9 @@ static CMPIStatus elem_to_prof(const CMP } for (i = 0; profiles[i] != NULL; i++) { + if (profiles[i]->scoping_class == NULL) + continue; + if (!STREQC(profiles[i]->scoping_class, classname)) continue; From heidieck at linux.vnet.ibm.com Thu Mar 13 12:58:29 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:58:29 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] Complete list of implemented DMTF's Profiles and add ReferencedProfile association Message-ID: This patch set - RegisteredProfile lists now all by this provider package implemented DMTF Profiles - add association ReferencedProfile for conformance to Profile Registration Profile (this association shows the relations between the different profiles) - fix ECTP seg fault caused by changes in profile.h - From heidieck at linux.vnet.ibm.com Thu Mar 13 12:58:31 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 13:58:31 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] Add association ReferencedProfile for conformance to DMTF's Profile Registration Profile In-Reply-To: Message-ID: <450c46695ca4265d74f2.1205413111@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205412152 -3600 # Node ID 450c46695ca4265d74f2686b64d1be27b96bd3db # Parent 91c4e3da0404a28014dbff799a841d951ce235f5 Add association ReferencedProfile for conformance to DMTF's Profile Registration Profile Signed-off-by: Heidi Eckhart diff -r 91c4e3da0404 -r 450c46695ca4 Makefile.am --- a/Makefile.am Thu Mar 13 13:42:27 2008 +0100 +++ b/Makefile.am Thu Mar 13 13:42:32 2008 +0100 @@ -45,7 +45,8 @@ INTEROP_MOFS = \ schema/ComputerSystem.mof \ schema/HostSystem.mof \ schema/RegisteredProfile.mof \ - schema/ElementConformsToProfile.mof + schema/ElementConformsToProfile.mof \ + schema/ReferencedProfile.mof REGS = \ @@ -89,7 +90,8 @@ REGS = \ INTEROP_REGS = \ schema/RegisteredProfile.registration \ - schema/ElementConformsToProfile.registration + schema/ElementConformsToProfile.registration \ + schema/ReferencedProfile.registration pkgdata_DATA = $(MOFS) $(REGS) pkgdata_SCRIPTS = provider-register.sh diff -r 91c4e3da0404 -r 450c46695ca4 schema/ReferencedProfile.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/ReferencedProfile.mof Thu Mar 13 13:42:32 2008 +0100 @@ -0,0 +1,34 @@ +// Copyright IBM Corp. 2008 + +[Association, + Description ( + "Associates a RegisteredProfile with its scoping RegisteredProfile."), + Provider("cmpi::Virt_ReferencedProfile") +] +class Xen_ReferencedProfile : CIM_ReferencedProfile +{ + + [Override ("Antecedent")] + Xen_RegisteredProfile REF Antecedent; + + [Override ("Dependent")] + Xen_RegisteredProfile REF Dependent; + +}; + +[Association, + Description ( + "Associates a RegisteredProfile with its scoping RegisteredProfile."), + Provider("cmpi::Virt_ReferencedProfile") +] +class KVM_ReferencedProfile : CIM_ReferencedProfile +{ + + [Override ("Antecedent")] + KVM_RegisteredProfile REF Antecedent; + + [Override ("Dependent")] + KVM_RegisteredProfile REF Dependent; + +}; + diff -r 91c4e3da0404 -r 450c46695ca4 schema/ReferencedProfile.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/ReferencedProfile.registration Thu Mar 13 13:42:32 2008 +0100 @@ -0,0 +1,4 @@ +# Copyright IBM Corp. 2008 +# Classname Namespace ProviderName ProviderModule ProviderTypes +Xen_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association +KVM_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association diff -r 91c4e3da0404 -r 450c46695ca4 src/Makefile.am --- a/src/Makefile.am Thu Mar 13 13:42:27 2008 +0100 +++ b/src/Makefile.am Thu Mar 13 13:42:32 2008 +0100 @@ -46,6 +46,7 @@ provider_LTLIBRARIES = libVirt_ComputerS libVirt_HostedDependency.la \ libVirt_RegisteredProfile.la \ libVirt_ElementConformsToProfile.la \ + libVirt_ReferencedProfile.la \ libVirt_SettingsDefineCapabilities.la \ libVirt_HostedResourcePool.la \ libVirt_ElementCapabilities.la \ @@ -98,6 +99,10 @@ libVirt_ElementConformsToProfile_la_DEPE libVirt_ElementConformsToProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la libVirt_ElementConformsToProfile_la_SOURCES = Virt_ElementConformsToProfile.c libVirt_ElementConformsToProfile_la_LIBADD = -lVirt_RegisteredProfile + +libVirt_ReferencedProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la +libVirt_ReferencedProfile_la_SOURCES = Virt_ReferencedProfile.c +libVirt_ReferencedProfile_la_LIBADD = -lVirt_RegisteredProfile libVirt_EnabledLogicalElementCapabilities_la_SOURCES = Virt_EnabledLogicalElementCapabilities.c diff -r 91c4e3da0404 -r 450c46695ca4 src/Virt_ReferencedProfile.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Virt_ReferencedProfile.c Thu Mar 13 13:42:32 2008 +0100 @@ -0,0 +1,226 @@ +/* + * Copyright IBM Corp. 2008 + * + * Authors: + * Heidi Eckhart + * + * 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 +#include +#include +#include + +#include "cmpidt.h" +#include "cmpift.h" +#include "cmpimacs.h" + +#include +#include "misc_util.h" +#include "profiles.h" +#include + +#include "config.h" + +#include "Virt_RegisteredProfile.h" + +const static CMPIBroker *_BROKER; + +static struct reg_prof *get_reg_prof_by_ref(const CMPIObjectPath *ref) +{ + const char* name; + int i; + + if (cu_get_str_path(ref, "InstanceID", &name) != CMPI_RC_OK) + return NULL; + + for (i = 0; profiles[i] != NULL; i++) { + if(STREQ(name, profiles[i]->reg_id)) + return profiles[i]; + } + + return NULL; +} + +static CMPIStatus prof_to_prof(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + virConnectPtr conn = NULL; + struct reg_prof *source; + struct reg_prof *scope; + int i; + + if (!match_hypervisor_prefix(ref, info)) + goto out; + + s = get_profile_by_ref(_BROKER, ref, info->properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + if (conn == NULL) + goto out; + + source = get_reg_prof_by_ref(ref); + if (source == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Can't find RegisteredProfile instance"); + goto out; + } + + if (source->scoping_profile != NULL) { + s = get_profile(_BROKER, + ref, + info->properties, + CIM_INTEROP_NS, + pfx_from_conn(conn), + source->scoping_profile, + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + inst_list_add(list, inst); + } + + for (i = 0; profiles[i] != NULL; i++) { + if (profiles[i]->scoping_profile == NULL) + continue; + + scope = profiles[i]->scoping_profile; + if (!STREQC(scope->reg_id, source->reg_id)) + continue; + + s = get_profile(_BROKER, + ref, + info->properties, + CIM_INTEROP_NS, + pfx_from_conn(conn), + profiles[i], + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, inst); + } + + out: + virConnectClose(conn); + + return s; +} + +static CMPIInstance *make_ref(const CMPIObjectPath *source_ref, + const CMPIInstance *target_inst, + struct std_assoc_info *info, + struct std_assoc *assoc); + +static char* registered_profile[] = { + "Xen_RegisteredProfile", + "KVM_RegisteredProfile", + NULL +}; + +static char* assoc_classname[] = { + "Xen_ReferencedProfile", + "KVM_ReferencedProfile", + NULL +}; + +static struct std_assoc forward = { + .source_class = (char**)®istered_profile, + .source_prop = "Antecedent", + + .target_class = (char**)®istered_profile, + .target_prop = "Dependent", + + .assoc_class = (char**)&assoc_classname, + + .handler = prof_to_prof, + .make_ref = make_ref +}; + +static struct std_assoc backward = { + .source_class = (char**)®istered_profile, + .source_prop = "Dependent", + + .target_class = (char**)®istered_profile, + .target_prop = "Antecedent", + + .assoc_class = (char**)&assoc_classname, + + .handler = prof_to_prof, + .make_ref = make_ref +}; + +static struct std_assoc *assoc_handlers[] = { + &forward, + &backward, + NULL +}; + +static CMPIInstance *make_ref(const CMPIObjectPath *source_ref, + const CMPIInstance *target_inst, + struct std_assoc_info *info, + struct std_assoc *assoc) +{ + CMPIInstance *ref_inst = NULL; + struct std_assoc *ref_assoc = NULL; + struct reg_prof *source; + char* assoc_classname; + + assoc_classname = class_base_name(assoc->assoc_class[0]); + + ref_inst = get_typed_instance(_BROKER, + CLASSNAME(source_ref), + assoc_classname, + NAMESPACE(source_ref)); + + source = get_reg_prof_by_ref(source_ref); + if (source->scoping_profile != NULL) + ref_assoc = &backward; + else + ref_assoc = assoc; + + if (ref_inst != NULL) { + CMPIObjectPath *target_ref; + + target_ref = CMGetObjectPath(target_inst, NULL); + + set_reference(ref_assoc, ref_inst, + source_ref, target_ref); + } + + free(assoc_classname); + + return ref_inst; +} + +STDA_AssocMIStub(, + Virt_ReferencedProfile, + _BROKER, + libvirt_cim_init(), + assoc_handlers); +/* + * Local Variables: + * mode: C + * c-set-style: "K&R" + * tab-width: 8 + * c-basic-offset: 8 + * indent-tabs-mode: nil + * End: + */ From grendel at linux.vnet.ibm.com Thu Mar 13 13:24:55 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 09:24:55 -0400 Subject: [Libvirt-cim] [PATCH] Make migration return proper value for "Job Started" In-Reply-To: <4aa425bba4e2f0834001.1205353338@caffeine.beaverton.ibm.com> References: <4aa425bba4e2f0834001.1205353338@caffeine.beaverton.ibm.com> Message-ID: <47D92B27.1000008@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205353332 25200 > # Node ID 4aa425bba4e2f0834001bef08766e06a83c50da2 > # Parent 42b808d88849cbc642af67b2769b120624f66a42 > Make migration return proper value for "Job Started" > > Changes: > - Use a constant for return value. This seems to be a convention at least > in the SVPC profiles, although it's relatively informally defined. > > Signed-off-by: Dan Smith > > OHMYGOD no don't modify VSMigrationService oh great now it's gonna crash but only on my machine and it's gonna take a week to figure out I'll just start gdb now and wait for it! ... +1 -- -Jay From grendel at linux.vnet.ibm.com Thu Mar 13 13:27:10 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 09:27:10 -0400 Subject: [Libvirt-cim] [PATCH] Use live migration if MigrationType isn't defined in MSD In-Reply-To: References: Message-ID: <47D92BAE.1030703@linux.vnet.ibm.com> Kaitlin Rupert wrote: > # HG changeset patch > # User Kaitlin Rupert > # Date 1205362434 25200 > # Node ID df3c20a332e01e4e9f90f6ccdc61857515d57a7f > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > Use live migration if MigrationType isn't defined in MSD. > > diff -r b739fc9b1332 -r df3c20a332e0 src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 > +++ b/src/Virt_VSMigrationService.c Wed Mar 12 15:53:54 2008 -0700 > @@ -100,9 +100,8 @@ static CMPIStatus get_migration_type(CMP > > ret = cu_get_u16_prop(msd, "MigrationType", type); > if (ret != CMPI_RC_OK) { > - cu_statusf(_BROKER, &s, > - ret, > - "Invalid MigrationType value"); > + CU_DEBUG("Using default MigrationType: %d", CIM_MIGRATE_LIVE); > + *type = CIM_MIGRATE_LIVE; > } > > return s; > > > Man, VSMigrationService is getting all the action lately. I don't see any members being added to the migration_job struct, so I'd imagine this is safe. :) +1 -- -Jay From grendel at linux.vnet.ibm.com Thu Mar 13 13:28:47 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 09:28:47 -0400 Subject: [Libvirt-cim] [PATCH] (#2) Add domain ref checking to isMigratable In-Reply-To: References: Message-ID: <47D92C0F.9080801@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205365783 25200 > # Node ID c655c11291a0817c4a804f41bcaa64bbcd34efc5 > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > (#2) Add domain ref checking to isMigratable > > Tested by adding an invalid key to the ComputerSystem REF, which would > pass before. It now fails and points out the offending key, as expected. > > Changes: > - Link to libVirt_ComputerSystem > - Use the proper ref and set the namespace, since it's not done for us > - Move the Name key extraction up a level to reduce duplication and make > the CS ref available for the get_domain_by_ref() call > > Signed-off-by: Dan Smith > > > Looks good from here. +1 -- -Jay From grendel at linux.vnet.ibm.com Thu Mar 13 13:29:48 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 09:29:48 -0400 Subject: [Libvirt-cim] [PATCH 2 of 3] [RFC] Add configure support for migration check settings In-Reply-To: <20080313065403.GA31643@redhat.com> References: <35861307381c7f9bd604.1205173552@caffeine.beaverton.ibm.com> <87myp62ruw.fsf@caffeine.beaverton.ibm.com> <47D5AF79.2040903@linux.vnet.ibm.com> <47D7AF95.3040804@linux.vnet.ibm.com> <20080313065403.GA31643@redhat.com> Message-ID: <47D92C4C.8000003@linux.vnet.ibm.com> Daniel Veillard wrote: > On Wed, Mar 12, 2008 at 11:25:25AM +0100, Heidi Eckhart wrote: > >> Kaitlin Rupert wrote: >> >>> Dan Smith wrote: >>> >>>> DS> + [MIG_CHECKS_DIR=/usr/libexec/extchecks]) >>>> >>>> I should point out that this was just thrown in there to have >>>> something in place. I'm not sure what a good location would be. >>>> Perhaps $prefix/libexec/libvirt-cim/extchecks ? >>>> >>>> >>>> >>> I think having libvirt-cim in the path is a good way to go. It's more >>> descriptive that way. >>> >> I agree. >> > > I agree too, > > Daniel > > I refuse to be the only person on the list who doesn't explicitly agree with this. -- -Jay From danms at us.ibm.com Thu Mar 13 14:01:04 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 13 Mar 2008 07:01:04 -0700 Subject: [Libvirt-cim] [PATCH] Use live migration if MigrationType isn't defined in MSD In-Reply-To: (Kaitlin Rupert's message of "Wed, 12 Mar 2008 15:54:09 -0700") References: Message-ID: <87wso6yb8f.fsf@caffeine.beaverton.ibm.com> KR> # HG changeset patch KR> # User Kaitlin Rupert KR> # Date 1205362434 25200 KR> # Node ID df3c20a332e01e4e9f90f6ccdc61857515d57a7f KR> # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 KR> Use live migration if MigrationType isn't defined in MSD. Can we get a Signed-off-by in here? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Thu Mar 13 14:18:57 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 07:18:57 -0700 Subject: [Libvirt-cim] [PATCH] Use live migration if MigrationType isn't defined in MSD In-Reply-To: <87wso6yb8f.fsf@caffeine.beaverton.ibm.com> References: <87wso6yb8f.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D937D1.6090607@linux.vnet.ibm.com> Dan Smith wrote: > KR> # HG changeset patch > KR> # User Kaitlin Rupert > KR> # Date 1205362434 25200 > KR> # Node ID df3c20a332e01e4e9f90f6ccdc61857515d57a7f > KR> # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > KR> Use live migration if MigrationType isn't defined in MSD. > > Can we get a Signed-off-by in here? > > Eeek - not sure how that was missed. Thanks for catching it. I'll resend. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Thu Mar 13 14:15:38 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 07:15:38 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Use live migration if MigrationType isn't defined in MSD Message-ID: <388332fc798482beb034.1205417738@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1205417729 25200 # Node ID 388332fc798482beb0349785003097054c4867dc # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 (#2) Use live migration if MigrationType isn't defined in MSD. Updates: - Added DCO. Signed-off-by: Kaitlin Rupert diff -r b739fc9b1332 -r 388332fc7984 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Thu Mar 13 07:15:29 2008 -0700 @@ -100,9 +100,8 @@ static CMPIStatus get_migration_type(CMP ret = cu_get_u16_prop(msd, "MigrationType", type); if (ret != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - ret, - "Invalid MigrationType value"); + CU_DEBUG("Using default MigrationType: %d", CIM_MIGRATE_LIVE); + *type = CIM_MIGRATE_LIVE; } return s; From danms at us.ibm.com Thu Mar 13 14:28:36 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 13 Mar 2008 07:28:36 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] RegisteredProfile: adopt common look and feel of interfaces In-Reply-To: (Heidi Eckhart's message of "Thu, 13 Mar 2008 13:55:13 +0100") References: Message-ID: <87skyuy9yj.fsf@caffeine.beaverton.ibm.com> HE> +CMPIStatus get_profile(const CMPIBroker *broker, HE> + const CMPIObjectPath *reference, HE> + const char **properties, HE> + const char* interop_namespace, HE> + const char* pfx, HE> + struct reg_prof *profile, HE> + CMPIInstance **_inst) This is a really long function signature. You seem to call it with a constant for "interop_namespace". Is there any reason to keep it variable, instead of just assuming the constant inside the function? HE> CMPIStatus s = {CMPI_RC_OK, NULL}; HE> CMPIInstance *instance = NULL; HE> - HE> + You add whitespace here. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Thu Mar 13 14:56:13 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 13 Mar 2008 07:56:13 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] Add association ReferencedProfile for conformance to DMTF's Profile Registration Profile In-Reply-To: <450c46695ca4265d74f2.1205413111@dyn-9-152-210-82.boeblingen.de.ibm.com> (Heidi Eckhart's message of "Thu, 13 Mar 2008 13:58:31 +0100") References: <450c46695ca4265d74f2.1205413111@dyn-9-152-210-82.boeblingen.de.ibm.com> Message-ID: <87od9iy8oi.fsf@caffeine.beaverton.ibm.com> HE> +static CMPIStatus prof_to_prof(const CMPIObjectPath *ref, HE> + struct std_assoc_info *info, HE> + struct inst_list *list) HE> +{ HE> + CMPIStatus s = {CMPI_RC_OK, NULL}; HE> + CMPIInstance *inst = NULL; HE> + virConnectPtr conn = NULL; HE> + struct reg_prof *source; HE> + struct reg_prof *scope; HE> + int i; HE> + HE> + if (!match_hypervisor_prefix(ref, info)) HE> + goto out; HE> + HE> + s = get_profile_by_ref(_BROKER, ref, info->properties, &inst); HE> + if (s.rc != CMPI_RC_OK) HE> + goto out; HE> + HE> + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); HE> + if (conn == NULL) HE> + goto out; HE> + HE> + source = get_reg_prof_by_ref(ref); HE> + if (source == NULL) { HE> + cu_statusf(_BROKER, &s, HE> + CMPI_RC_ERR_FAILED, HE> + "Can't find RegisteredProfile instance"); HE> + goto out; HE> + } HE> + HE> + if (source->scoping_profile != NULL) { HE> + s = get_profile(_BROKER, HE> + ref, HE> + info->properties, HE> + CIM_INTEROP_NS, HE> + pfx_from_conn(conn), HE> + source->scoping_profile, HE> + &inst); HE> + if (s.rc != CMPI_RC_OK) HE> + goto out; HE> + inst_list_add(list, inst); HE> + } HE> + HE> + for (i = 0; profiles[i] != NULL; i++) { HE> + if (profiles[i]->scoping_profile == NULL) HE> + continue; HE> + HE> + scope = profiles[i]->scoping_profile; HE> + if (!STREQC(scope->reg_id, source->reg_id)) HE> + continue; HE> + HE> + s = get_profile(_BROKER, HE> + ref, HE> + info->properties, HE> + CIM_INTEROP_NS, HE> + pfx_from_conn(conn), HE> + profiles[i], HE> + &inst); HE> + if (s.rc != CMPI_RC_OK) HE> + goto out; HE> + HE> + inst_list_add(list, inst); HE> + } HE> + HE> + out: HE> + virConnectClose(conn); HE> + HE> + return s; HE> +} This seems a little long to me. Can we break the loop out into a helper function? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Thu Mar 13 15:12:22 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 08:12:22 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Add domain ref checking to isMigratable In-Reply-To: References: Message-ID: <47D94456.8010808@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205365783 25200 > # Node ID c655c11291a0817c4a804f41bcaa64bbcd34efc5 > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > (#2) Add domain ref checking to isMigratable > > Tested by adding an invalid key to the ComputerSystem REF, which would > pass before. It now fails and points out the offending key, as expected. > > Changes: > - Link to libVirt_ComputerSystem > - Use the proper ref and set the namespace, since it's not done for us > - Move the Name key extraction up a level to reduce duplication and make > the CS ref available for the get_domain_by_ref() call > > Signed-off-by: Dan Smith > > diff -r b739fc9b1332 -r c655c11291a0 src/Makefile.am This patch works much better. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From heidieck at linux.vnet.ibm.com Thu Mar 13 15:27:22 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 16:27:22 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] Add association ReferencedProfile for conformance to DMTF's Profile Registration Profile In-Reply-To: <87od9iy8oi.fsf@caffeine.beaverton.ibm.com> References: <450c46695ca4265d74f2.1205413111@dyn-9-152-210-82.boeblingen.de.ibm.com> <87od9iy8oi.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D947DA.1070107@linux.vnet.ibm.com> Dan Smith wrote: > This seems a little long to me. Can we break the loop out into a > helper function? > sure :) -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Thu Mar 13 15:37:23 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 16:37:23 +0100 Subject: [Libvirt-cim] [PATCH 1 of 2] RegisteredProfile: adopt common look and feel of interfaces In-Reply-To: <87skyuy9yj.fsf@caffeine.beaverton.ibm.com> References: <87skyuy9yj.fsf@caffeine.beaverton.ibm.com> Message-ID: <47D94A33.4020705@linux.vnet.ibm.com> Dan Smith wrote: > HE> +CMPIStatus get_profile(const CMPIBroker *broker, > HE> + const CMPIObjectPath *reference, > HE> + const char **properties, > HE> + const char* interop_namespace, > HE> + const char* pfx, > HE> + struct reg_prof *profile, > HE> + CMPIInstance **_inst) > > This is a really long function signature. You seem to call it with a > constant for "interop_namespace". Is there any reason to keep it > variable, instead of just assuming the constant inside the function? > As this is only a preparation for the case that "who ever" would force us to also work with Pegasus' root/PG_InterOp namespace ... what would definitely mean, that we had to update the provider anyway ... I'm also fine with removing this currently not-used-future-outlook parameter. > HE> CMPIStatus s = {CMPI_RC_OK, NULL}; > HE> CMPIInstance *instance = NULL; > HE> - > HE> + > > You add whitespace here. > Oops ... will fix it -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From kaitlin at linux.vnet.ibm.com Thu Mar 13 16:08:56 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 09:08:56 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] RegisteredProfile: add instances for each implemented profile In-Reply-To: <91c4e3da0404a28014db.1205413110@dyn-9-152-210-82.boeblingen.de.ibm.com> References: <91c4e3da0404a28014db.1205413110@dyn-9-152-210-82.boeblingen.de.ibm.com> Message-ID: <47D95198.9020005@linux.vnet.ibm.com> > +struct reg_prof VirtualSystemMigration = { > + .reg_org = 2, > + .reg_id = "CIM:DSP1081-VirtualSystemMigration-1.0", > + .reg_name = "Virtual System Migration", > + .reg_version = "1.0", > + .scoping_class = NULL, > + .scoping_profile = &SystemVirtualization > +}; Is the 1.0 version available somewhere on the DMTF site? The most recent version I've seen in 0.8.1. Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From heidieck at linux.vnet.ibm.com Thu Mar 13 16:56:06 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 17:56:06 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] (#3) [RFC] Add external migration checks In-Reply-To: References: Message-ID: <47D95CA6.6030304@linux.vnet.ibm.com> As Jay already said - the code is of that high quality that we are used to get from you :). So I have no concerns about the implementation of your approach. But I have concerns in regard to the approach how this feature is added to the providers. First: its not a (let me say) common CIM way to add a property array to a class and let the client use this array as de-facto command line interface. What you want to do is giving the client a possibility to enhance the providers build in functionality - without rewriting the provider. And this functionality should be configurable by the client. The idea is valid and the implementation is straightforward. But what the client gets is a very powerful access point to - not only the resource managed by this class, but also to - all other resources on the system. So please don't blame me for bringing up security issues, but you do not have under control what kind of scripts will be put into this directory. As you officially need to point clients to this directory to make clear how to use the CheckParamaters property, its well known. But deep in my heard I trust the system admins, that they do not copy some strange scripts in there ;). So I know that this argument can be very fast invalidated. On the other hand, all scripts ... also of different authors, because you can have more than one mgmt. app on one system ... have to make sure, that they can handle input parameters, that might follow absolutely no logic. But ok, this is the responsibility of the client to harden its scripts in that way. So these issues are bound to the implementation approach and something I could live with. What does not mean, that I like this time-bomb. As I said before, the way how this feature is added to the schema is definitely not CIM conform. Its a property misused as command line interface. That's not what a property is - yet by definition of the word itself ;). But I don't only want to vote against this patch set without having a proposal. Normally you start evaluating the necessary functionality and enhance the existing model. This could mean adding methods or properties. But we can not foresee what the client wants to do by its scripts. On the other hand I can imagine that the amount of checks is limited. First by the intention of CheckParameters - which is de-facto a replacement for the methods CheckIsVSMigratable...(). And second by the hypervisor itself. So I suggest to go the CIM way for implementing this functionality. What you want is enhancing CheckIsVSMigratable...() and also the executing methods MigrateVSTo...(), because these methods have to do the check again, as between the client's CheckIsVSMigratable...() result and the MigrateVSTo...() request is enough time, that the result of the check can became invalid in the meantime. I looked a bit through the Migration Profile and found a class that I suggest to use for this functionality. That's the description of this class: "CIM_VirtualSystemMigrationSettingData defines the parameters to control a virtual system migration implementation, as managed by a CIM_VirtualSystemMigrationService. It is expected that a migration implementation will subclass this class to add implementation-specific migration options." An instance of this class is transported to all CheckIsVSMigratable...() and MigrateVSTo...() via the MigrationSettingData parameter. So we stay absolutely conform to the Migration Profile. The Xen and KVM subclasses can check properties, that are well know to cause migration problems. E.g. if the migration depends on the architecture, this class can get a property of maybe TargetArchitecture, which needs to be checked by the provider. Your approach of letting the client parameterize scripts through this class might look like this: [Description("An array containing the scripts to be executed as part of the check, if the migration is possible.")] string ScriptsToExecute[]; [Description("An array containing the parameters given as input to the scripts defined by ScriptsToExecute. Each entry in this array is related to the same array entry in ScriptToExecute. A list of parameters for one script is divided by space characters.")] string ScriptsParameterList[]; What do you - and all the others in this list interested in this feature - think about this ? Thanks ... Heidi -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Thu Mar 13 16:59:26 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 17:59:26 +0100 Subject: [Libvirt-cim] [PATCH] (#2) Add domain ref checking to isMigratable In-Reply-To: References: Message-ID: <47D95D6E.7020309@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205365783 25200 > # Node ID c655c11291a0817c4a804f41bcaa64bbcd34efc5 > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > (#2) Add domain ref checking to isMigratable > > Tested by adding an invalid key to the ComputerSystem REF, which would > pass before. It now fails and points out the offending key, as expected. > > Changes: > - Link to libVirt_ComputerSystem > - Use the proper ref and set the namespace, since it's not done for us > - Move the Name key extraction up a level to reduce duplication and make > the CS ref available for the get_domain_by_ref() call > > Signed-off-by: Dan Smith > > I still have local problems to apply patches, but for me it looks good and I trust the others ... +1 :) -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Thu Mar 13 17:00:34 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 18:00:34 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] RegisteredProfile: add instances for each implemented profile In-Reply-To: <47D95198.9020005@linux.vnet.ibm.com> References: <91c4e3da0404a28014db.1205413110@dyn-9-152-210-82.boeblingen.de.ibm.com> <47D95198.9020005@linux.vnet.ibm.com> Message-ID: <47D95DB2.6030309@linux.vnet.ibm.com> Kaitlin Rupert wrote: >> +struct reg_prof VirtualSystemMigration = { >> + .reg_org = 2, >> + .reg_id = "CIM:DSP1081-VirtualSystemMigration-1.0", >> + .reg_name = "Virtual System Migration", >> + .reg_version = "1.0", >> + .scoping_class = NULL, >> + .scoping_profile = &SystemVirtualization >> +}; > > Is the 1.0 version available somewhere on the DMTF site? The most > recent version I've seen in 0.8.1. > > Thanks! > Hehe ... yes, its 0.8.1 defining to set RegisteredVersion to 1.0 . So it was not my idea ;). -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Thu Mar 13 17:03:15 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Thu, 13 Mar 2008 18:03:15 +0100 Subject: [Libvirt-cim] [PATCH] (#2) Use live migration if MigrationType isn't defined in MSD In-Reply-To: <388332fc798482beb034.1205417738@elm3b41.beaverton.ibm.com> References: <388332fc798482beb034.1205417738@elm3b41.beaverton.ibm.com> Message-ID: <47D95E53.2020802@linux.vnet.ibm.com> Kaitlin Rupert wrote: > # HG changeset patch > # User Kaitlin Rupert > # Date 1205417729 25200 > # Node ID 388332fc798482beb0349785003097054c4867dc > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > (#2) Use live migration if MigrationType isn't defined in MSD. > > Updates: > - Added DCO. > > Signed-off-by: Kaitlin Rupert > > diff -r b739fc9b1332 -r 388332fc7984 src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 > +++ b/src/Virt_VSMigrationService.c Thu Mar 13 07:15:29 2008 -0700 > @@ -100,9 +100,8 @@ static CMPIStatus get_migration_type(CMP > > ret = cu_get_u16_prop(msd, "MigrationType", type); > if (ret != CMPI_RC_OK) { > - cu_statusf(_BROKER, &s, > - ret, > - "Invalid MigrationType value"); > + CU_DEBUG("Using default MigrationType: %d", CIM_MIGRATE_LIVE); > + *type = CIM_MIGRATE_LIVE; > } > > return s; > > Excellent catch ... +1 -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From danms at us.ibm.com Thu Mar 13 17:36:40 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 13 Mar 2008 10:36:40 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] (#3) [RFC] Add external migration checks In-Reply-To: <47D95CA6.6030304@linux.vnet.ibm.com> (Heidi Eckhart's message of "Thu, 13 Mar 2008 17:56:06 +0100") References: <47D95CA6.6030304@linux.vnet.ibm.com> Message-ID: <87ve3qwmon.fsf@caffeine.beaverton.ibm.com> HE> I looked a bit through the Migration Profile and found a class HE> that I suggest to use for this functionality. That's the HE> description of this class: "CIM_VirtualSystemMigrationSettingData HE> defines the parameters to control a virtual system migration HE> implementation, as managed by a HE> CIM_VirtualSystemMigrationService. It is expected that a migration HE> implementation will subclass this class to add HE> implementation-specific migration options." An instance of this HE> class is transported to all CheckIsVSMigratable...() and HE> MigrateVSTo...() via the MigrationSettingData parameter. So we HE> stay absolutely conform to the Migration Profile. The Xen and KVM HE> subclasses can check properties, that are well know to cause HE> migration problems. This is what I did. I extended Xen_MigrationSettingData to include the CheckParameters[] property, which is what I pass to the check program. There are no additional arguments to either of the CIM methods, and this extra property of the SettingData is optional. HE> Your approach of letting the client parameterize scripts through HE> this class might look like this: [Description("An array containing HE> the scripts to be executed as part of the check, if the migration HE> is possible.")] string ScriptsToExecute[]; [Description("An array HE> containing the parameters given as input to the scripts defined by HE> ScriptsToExecute. Each entry in this array is related to the same HE> array entry in ScriptToExecute. A list of parameters for one HE> script is divided by space characters.")] string HE> ScriptsParameterList[]; Choosing the external checks to run does two things: (1) It means that the client must know which checks are available on the host, and (2) it means that the client must change if the system administrator changes the name of the check on disk. Giving the client visibility and control over what we run and where seems to (1) be more of a security risk, and (2) be too specific. What I have now is less of "run command A with argument B" and more of "Here is some information I have that should help determine if a migration can succeed". I think that the latter is more generally applicable. However, if others feel strongly, we can change this to a list of programs and a list of arguments. Thanks Heidi! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Thu Mar 13 18:49:17 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 14:49:17 -0400 Subject: [Libvirt-cim] [PATCH] Fix bizarre crash in VSMigrationService Message-ID: <24baa607951031ef22b5.1205434157@naegling> # HG changeset patch # User Jay Gagnon # Date 1205334578 14400 # Node ID 24baa607951031ef22b5263742135bef9f24d29b # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 Fix bizarre crash in VSMigrationService Apparently I was the only one seeing this, but I hit a very strange bug in Virt_VSMigrationService. It would just totally implode whenever I tried to migrate a system. It was eventually tracked down to the transport member of the migration_job struct; for some reason if that member (which we don't even use anymore) is removed everything works perfectly. This might bear more investigation, but for the time being the fix should at least be put in. Signed-off-by: Jay Gagnon diff -r b739fc9b1332 -r 24baa6079510 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 11 13:28:04 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 12 11:09:38 2008 -0400 @@ -64,7 +64,6 @@ struct migration_job { char *ref_cn; char *ref_ns; uint16_t type; - uint16_t transport; char uuid[33]; }; From grendel at linux.vnet.ibm.com Thu Mar 13 18:58:33 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 14:58:33 -0400 Subject: [Libvirt-cim] [PATCH] Fix bizarre crash in VSMigrationService In-Reply-To: <24baa607951031ef22b5.1205434157@naegling> References: <24baa607951031ef22b5.1205434157@naegling> Message-ID: <47D97959.2010001@linux.vnet.ibm.com> Jay Gagnon wrote: > # HG changeset patch > # User Jay Gagnon > # Date 1205334578 14400 > # Node ID 24baa607951031ef22b5263742135bef9f24d29b > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > Fix bizarre crash in VSMigrationService > > Apparently I was the only one seeing this, but I hit a very strange bug in Virt_VSMigrationService. It would just totally implode whenever I tried to migrate a system. It was eventually tracked down to the transport member of the migration_job struct; for some reason if that member (which we don't even use anymore) is removed everything works perfectly. This might bear more investigation, but for the time being the fix should at least be put in. > > Signed-off-by: Jay Gagnon > > Sorry, totally forgot to send this out yesterday. Or most of today. Anyway, there it is. -- -Jay From grendel at linux.vnet.ibm.com Thu Mar 13 18:58:33 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 13 Mar 2008 14:58:33 -0400 Subject: [Libvirt-cim] [PATCH] Fix bizarre crash in VSMigrationService In-Reply-To: <24baa607951031ef22b5.1205434157@naegling> References: <24baa607951031ef22b5.1205434157@naegling> Message-ID: <47D97959.2010001@linux.vnet.ibm.com> Jay Gagnon wrote: > # HG changeset patch > # User Jay Gagnon > # Date 1205334578 14400 > # Node ID 24baa607951031ef22b5263742135bef9f24d29b > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > Fix bizarre crash in VSMigrationService > > Apparently I was the only one seeing this, but I hit a very strange bug in Virt_VSMigrationService. It would just totally implode whenever I tried to migrate a system. It was eventually tracked down to the transport member of the migration_job struct; for some reason if that member (which we don't even use anymore) is removed everything works perfectly. This might bear more investigation, but for the time being the fix should at least be put in. > > Signed-off-by: Jay Gagnon > > Sorry, totally forgot to send this out yesterday. Or most of today. Anyway, there it is. -- -Jay From kaitlin at linux.vnet.ibm.com Thu Mar 13 20:57:08 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 13:57:08 -0700 Subject: [Libvirt-cim] [PATCH] Fix bizarre crash in VSMigrationService In-Reply-To: <24baa607951031ef22b5.1205434157@naegling> References: <24baa607951031ef22b5.1205434157@naegling> Message-ID: <47D99524.90402@linux.vnet.ibm.com> Jay Gagnon wrote: > # HG changeset patch > # User Jay Gagnon > # Date 1205334578 14400 > # Node ID 24baa607951031ef22b5263742135bef9f24d29b > # Parent b739fc9b13320e07a39f3932396c8411c2d4ad75 > Fix bizarre crash in VSMigrationService > > Apparently I was the only one seeing this, but I hit a very strange bug in Virt_VSMigrationService. It would just totally implode whenever I tried to migrate a system. It was eventually tracked down to the transport member of the migration_job struct; for some reason if that member (which we don't even use anymore) is removed everything works perfectly. This might bear more investigation, but for the time being the fix should at least be put in. > > Signed-off-by: Jay Gagnon > > diff -r b739fc9b1332 -r 24baa6079510 src/Virt_VSMigrationService.c I'm not sure why this fixes your problem, but it's definitely not needed anymore. +1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Thu Mar 13 21:28:49 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 14:28:49 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] RegisteredProfile: add instances for each implemented profile In-Reply-To: <47D95DB2.6030309@linux.vnet.ibm.com> References: <91c4e3da0404a28014db.1205413110@dyn-9-152-210-82.boeblingen.de.ibm.com> <47D95198.9020005@linux.vnet.ibm.com> <47D95DB2.6030309@linux.vnet.ibm.com> Message-ID: <47D99C91.5050703@linux.vnet.ibm.com> Heidi Eckhart wrote: > Kaitlin Rupert wrote: >>> +struct reg_prof VirtualSystemMigration = { >>> + .reg_org = 2, >>> + .reg_id = "CIM:DSP1081-VirtualSystemMigration-1.0", >>> + .reg_name = "Virtual System Migration", >>> + .reg_version = "1.0", >>> + .scoping_class = NULL, >>> + .scoping_profile = &SystemVirtualization >>> +}; >> >> Is the 1.0 version available somewhere on the DMTF site? The most >> recent version I've seen in 0.8.1. >> >> Thanks! >> > Hehe ... yes, its 0.8.1 defining to set RegisteredVersion to 1.0 . So it > was not my idea ;). > Oh, interesting. I missed that when I looked at the profile. -- Kaitlin Rupert IBM Linux Technology Center kaitlin at linux.vnet.ibm.com From kaitlin at linux.vnet.ibm.com Fri Mar 14 00:10:29 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 17:10:29 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] Clean up uri param in VSMigrationService In-Reply-To: Message-ID: <9905f7a33ed9ef02ff6e.1205453429@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1205453395 25200 # Node ID 9905f7a33ed9ef02ff6ecfc0d1b5b335dcd16580 # Parent 2fa4dbe7b38189aeb1ddb4b770c531a75df788d3 Clean up uri param in VSMigrationService. Now that the connection pointer is a part of the job struct, we don't have a uri parameter to pass around. Signed-off-by: Kaitlin Rupert diff -r 2fa4dbe7b381 -r 9905f7a33ed9 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 13 17:09:54 2008 -0700 +++ b/src/Virt_VSMigrationService.c Thu Mar 13 17:09:55 2008 -0700 @@ -625,12 +625,14 @@ static CMPIStatus define_guest_on_target static CMPIStatus handle_migrate(virConnectPtr dconn, virDomainPtr dom, - char *uri, int type, struct migration_job *job) { CMPIStatus s = {CMPI_RC_OK, NULL}; virDomainPtr ddom = NULL; + char *uri; + + uri = virConnectGetURI(dconn); CU_DEBUG("Migrating %s -> %s", job->domain, uri); ddom = virDomainMigrate(dom, dconn, type, NULL, NULL, 0); @@ -642,13 +644,13 @@ static CMPIStatus handle_migrate(virConn } virDomainFree(ddom); + free(uri); return s; } static CMPIStatus handle_offline_migrate(virConnectPtr dconn, virDomainPtr dom, - char *uri, struct migration_job *job) { CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -688,7 +690,6 @@ static CMPIStatus migrate_vs(struct migr CMPIStatus s; virConnectPtr conn = NULL; virDomainPtr dom = NULL; - char *uri = NULL; conn = connect_by_classname(_BROKER, job->ref_cn, &s); if (conn == NULL) @@ -706,16 +707,16 @@ static CMPIStatus migrate_vs(struct migr switch(job->type) { case CIM_MIGRATE_OTHER: CU_DEBUG("Preparing for offline migration"); - s = handle_offline_migrate(job->conn, dom, uri, job); + s = handle_offline_migrate(job->conn, dom, job); break; case CIM_MIGRATE_LIVE: CU_DEBUG("Preparing for live migration"); - s = handle_migrate(job->conn, dom, uri, VIR_MIGRATE_LIVE, job); + s = handle_migrate(job->conn, dom, VIR_MIGRATE_LIVE, job); break; case CIM_MIGRATE_RESUME: case CIM_MIGRATE_RESTART: CU_DEBUG("Preparing for static migration"); - s = handle_migrate(job->conn, dom, uri, 0, job); + s = handle_migrate(job->conn, dom, 0, job); break; default: CU_DEBUG("Unsupported migration type (%d)", job->type); @@ -745,7 +746,6 @@ static CMPIStatus migrate_vs(struct migr out: raise_deleted_ind(job); - free(uri); virDomainFree(dom); virConnectClose(conn); From kaitlin at linux.vnet.ibm.com Fri Mar 14 00:10:30 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 17:10:30 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] Remove the system from the source guest In-Reply-To: Message-ID: <8a689c81d44016468f58.1205453430@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1205453397 25200 # Node ID 8a689c81d44016468f58f10df8026f729c1cb2aa # Parent 9905f7a33ed9ef02ff6ecfc0d1b5b335dcd16580 Remove the system from the source guest. If the guest is still defined on the source after the migrate, remove the guest. Signed-off-by: Kaitlin Rupert diff -r 9905f7a33ed9 -r 8a689c81d440 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 13 17:09:55 2008 -0700 +++ b/src/Virt_VSMigrationService.c Thu Mar 13 17:09:57 2008 -0700 @@ -685,6 +685,24 @@ static CMPIStatus handle_offline_migrate return s; } +static CMPIStatus remove_guest(char *dom_name, + virDomainPtr dom, + virConnectPtr conn) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + if (!domain_exists(conn, dom_name)) + goto out; + + if (virDomainUndefine(dom)) + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to remove guest from target system."); + + out: + return s; +} + static CMPIStatus migrate_vs(struct migration_job *job) { CMPIStatus s; @@ -729,6 +747,10 @@ static CMPIStatus migrate_vs(struct migr if (s.rc != CMPI_RC_OK) goto out; + s = remove_guest(job->domain, dom, conn); + if (s.rc != CMPI_RC_OK) + CU_DEBUG("Undefine of guest on source system failed"); + CU_DEBUG("Migration succeeded"); s = define_guest_on_target(job->conn, NULL, job, false); From kaitlin at linux.vnet.ibm.com Fri Mar 14 00:10:27 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 17:10:27 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] Add function to persist a guest on migration. Message-ID: Also include a function that undefines a guest from the source system once the migration is complete. From kaitlin at linux.vnet.ibm.com Fri Mar 14 00:10:28 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 17:10:28 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] Define guest before migrating In-Reply-To: Message-ID: <2fa4dbe7b38189aeb1dd.1205453428@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1205453394 25200 # Node ID 2fa4dbe7b38189aeb1ddb4b770c531a75df788d3 # Parent 311b85abee28e75975e4758b6bc0a5974d3de937 Define guest before migrating. This step ensures that the guest will persist even when the guest is shutdown / destroyed. Since prepare_offline_migration() already has most of the code for this, the re_offline_migration() function can be removed and a common define_gest function can be used instead. Signed-off-by: Kaitlin Rupert diff -r 311b85abee28 -r 2fa4dbe7b381 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 13 08:06:29 2008 -0700 +++ b/src/Virt_VSMigrationService.c Thu Mar 13 17:09:54 2008 -0700 @@ -578,6 +578,51 @@ static void migrate_job_set_state(struct CU_DEBUG("Failed to raise indication"); } +static CMPIStatus define_guest_on_target(virConnectPtr dconn, + virDomainPtr dom, + struct migration_job *job, + bool is_offline_migrate) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virDomainPtr ddom = NULL; + char *xml = NULL; + + if (!is_offline_migrate) { + ddom = virDomainLookupByName(dconn, job->domain); + if (ddom == NULL) { + CU_DEBUG("Failed to lookup `%s'", job->domain); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to lookup domain `%s'", job->domain); + goto out; + } + + xml = virDomainGetXMLDesc(ddom, 0); + } + else + xml = virDomainGetXMLDesc(dom, 0); + + if (xml == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to retrieve domain XML."); + goto out; + } + + ddom = virDomainDefineXML(dconn, xml); + if (ddom == NULL) { + CU_DEBUG("Failed to define domain from XML"); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to create domain"); + } + + out: + free(xml); + virDomainFree(ddom); + return s; +} + static CMPIStatus handle_migrate(virConnectPtr dconn, virDomainPtr dom, char *uri, @@ -601,8 +646,10 @@ static CMPIStatus handle_migrate(virConn return s; } -static CMPIStatus prepare_offline_migrate(virDomainPtr dom, - char **xml) +static CMPIStatus handle_offline_migrate(virConnectPtr dconn, + virDomainPtr dom, + char *uri, + struct migration_job *job) { CMPIStatus s = {CMPI_RC_OK, NULL}; virDomainInfo info; @@ -623,41 +670,13 @@ static CMPIStatus prepare_offline_migrat goto out; } - *xml = virDomainGetXMLDesc(dom, 0); - if (*xml == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to retrieve domain XML."); - goto out; - } - - out: - return s; -} - -static CMPIStatus handle_offline_migrate(virConnectPtr dconn, - virDomainPtr dom, - char *uri, - char *xml, - struct migration_job *job) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - virDomainPtr new_dom; - - if (domain_exists(dconn, job->domain)) { - CU_DEBUG("This domain already exists on the target system."); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "This domain already exists on the target system"); - goto out; - } - - new_dom = virDomainDefineXML(dconn, xml); - if (new_dom == NULL) { - CU_DEBUG("Failed to define domain from XML"); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to create domain"); + s = define_guest_on_target(dconn, dom, job, true); + if (s.rc != CMPI_RC_OK) { + CU_DEBUG("Define failed"); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to define guest on target system"); + goto out; } out: @@ -670,7 +689,6 @@ static CMPIStatus migrate_vs(struct migr virConnectPtr conn = NULL; virDomainPtr dom = NULL; char *uri = NULL; - char *xml = NULL; conn = connect_by_classname(_BROKER, job->ref_cn, &s); if (conn == NULL) @@ -685,16 +703,10 @@ static CMPIStatus migrate_vs(struct migr goto out; } - if (job->type == CIM_MIGRATE_OTHER) { - s = prepare_offline_migrate(dom, &xml); - if (s.rc != CMPI_RC_OK) - goto out; - } - switch(job->type) { case CIM_MIGRATE_OTHER: CU_DEBUG("Preparing for offline migration"); - s = handle_offline_migrate(job->conn, dom, uri, xml, job); + s = handle_offline_migrate(job->conn, dom, uri, job); break; case CIM_MIGRATE_LIVE: CU_DEBUG("Preparing for live migration"); @@ -717,6 +729,15 @@ static CMPIStatus migrate_vs(struct migr goto out; CU_DEBUG("Migration succeeded"); + + s = define_guest_on_target(job->conn, NULL, job, false); + if (s.rc != CMPI_RC_OK) { + CU_DEBUG("Define failed"); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to define guest on target system"); + } + cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); @@ -725,7 +746,6 @@ static CMPIStatus migrate_vs(struct migr raise_deleted_ind(job); free(uri); - free(xml); virDomainFree(dom); virConnectClose(conn); From kaitlin at linux.vnet.ibm.com Fri Mar 14 01:42:42 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Thu, 13 Mar 2008 18:42:42 -0700 Subject: [Libvirt-cim] [PATCH] Add DestinationHostFormatsSupported to VSMigrationCapabilities Message-ID: # HG changeset patch # User Kaitlin Rupert # Date 1205458680 25200 # Node ID f46db9de4778069c5cb0c5b7183944d3fbd4370b # Parent 8a689c81d44016468f58f10df8026f729c1cb2aa Add DestinationHostFormatsSupported to VSMigrationCapabilities. libvirt reports that it support IPv6, although I have not tested it. But I'm including it in our supported host list. >From the mof, we have: "DomainNameFormatSupported", "IPv4DottedDecimalFormatSupported", "IPv6TextFormatSupported", Signed-off-by: Kaitlin Rupert diff -r 8a689c81d440 -r f46db9de4778 src/Virt_VSMigrationCapabilities.c --- a/src/Virt_VSMigrationCapabilities.c Thu Mar 13 17:09:57 2008 -0700 +++ b/src/Virt_VSMigrationCapabilities.c Thu Mar 13 18:38:00 2008 -0700 @@ -39,6 +39,10 @@ const static CMPIBroker *_BROKER; #define SVPC_MIG_CVSIMTH 4 #define SVPC_MIG_CVSIMTS 5 +#define SVPC_MIG_DOMAIN 2 +#define SVPC_MIG_IPv4 3 +#define SVPC_MIG_IPv6 4 + static CMPIStatus set_method_properties(const CMPIBroker *broker, CMPIInstance *inst) { @@ -76,6 +80,36 @@ static CMPIStatus set_method_properties( cu_statusf(broker, &s, CMPI_RC_OK, ""); + return s; +} + +static CMPIStatus set_formats_property(const CMPIBroker *broker, + CMPIInstance *inst) +{ + CMPIArray *array; + CMPIStatus s = {CMPI_RC_OK, NULL}; + uint16_t val; + + array = CMNewArray(broker, 3, CMPI_uint16, &s); + if (s.rc != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "CMNewArray() call failed."); + return s; + } + + val = SVPC_MIG_DOMAIN; + CMSetArrayElementAt(array, 0, (CMPIValue *)&val, CMPI_uint16); + + val = SVPC_MIG_IPv4; + CMSetArrayElementAt(array, 1, (CMPIValue *)&val, CMPI_uint16); + + val = SVPC_MIG_IPv6; + CMSetArrayElementAt(array, 2, (CMPIValue *)&val, CMPI_uint16); + + CMSetProperty(inst, "DestinationHostFormatsSupported", + (CMPIValue *)&array, CMPI_uint16A); + return s; } @@ -113,6 +147,10 @@ CMPIStatus get_migration_caps(const CMPI s = set_method_properties(broker, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = set_formats_property(broker, inst); if (s.rc != CMPI_RC_OK) goto out; From heidieck at linux.vnet.ibm.com Fri Mar 14 09:05:25 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 10:05:25 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] (#3) [RFC] Add external migration checks In-Reply-To: <87ve3qwmon.fsf@caffeine.beaverton.ibm.com> References: <47D95CA6.6030304@linux.vnet.ibm.com> <87ve3qwmon.fsf@caffeine.beaverton.ibm.com> Message-ID: <47DA3FD5.3030308@linux.vnet.ibm.com> Dan Smith wrote: > HE> I looked a bit through the Migration Profile and found a class > HE> that I suggest to use for this functionality. That's the > HE> description of this class: "CIM_VirtualSystemMigrationSettingData > HE> defines the parameters to control a virtual system migration > HE> implementation, as managed by a > HE> CIM_VirtualSystemMigrationService. It is expected that a migration > HE> implementation will subclass this class to add > HE> implementation-specific migration options." An instance of this > HE> class is transported to all CheckIsVSMigratable...() and > HE> MigrateVSTo...() via the MigrationSettingData parameter. So we > HE> stay absolutely conform to the Migration Profile. The Xen and KVM > HE> subclasses can check properties, that are well know to cause > HE> migration problems. > > This is what I did. I extended Xen_MigrationSettingData to include > the CheckParameters[] property, which is what I pass to the check > program. There are no additional arguments to either of the CIM > methods, and this extra property of the SettingData is optional. > > Sorry Dan, either I'm working too long or I should go to an optician and let me give "very strong" glasses. I was under the impression that MigrationService itself was extended by CheckParameters. So, I'm fine with your integration into the model. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor From heidieck at linux.vnet.ibm.com Fri Mar 14 10:11:27 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:11:27 +0100 Subject: [Libvirt-cim] [PATCH 1 of 2] RegisteredProfile: adopt common look and feel of interfaces In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205488933 -3600 # Node ID a16bf3b5d0b964739a92ddbba418ab02709be59b # Parent 311b85abee28e75975e4758b6bc0a5974d3de937 RegisteredProfile: adopt common look and feel of interfaces Signed-off-by: Heidi Eckhart diff -r 311b85abee28 -r a16bf3b5d0b9 src/Virt_RegisteredProfile.c --- a/src/Virt_RegisteredProfile.c Thu Mar 13 08:06:29 2008 -0700 +++ b/src/Virt_RegisteredProfile.c Fri Mar 14 11:02:13 2008 +0100 @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2008 * * Authors: * Dan Smith @@ -40,19 +40,20 @@ const static CMPIBroker *_BROKER; -CMPIInstance *reg_prof_instance(const CMPIBroker *broker, - const char *namespace, - const char **properties, - virConnectPtr conn, - struct reg_prof *profile) +CMPIStatus get_profile(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + const char* pfx, + struct reg_prof *profile, + CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *instance = NULL; instance = get_typed_instance(broker, - pfx_from_conn(conn), + pfx, "RegisteredProfile", - namespace); + CIM_INTEROP_NS); if (instance == NULL) { cu_statusf(broker, &s, @@ -63,10 +64,7 @@ CMPIInstance *reg_prof_instance(const CM if (properties) { const char *keys[] = {"InstanceID", NULL}; - s = CMSetPropertyFilter(instance, properties, keys); - if (s.rc != CMPI_RC_OK) { - goto out; - } + CMSetPropertyFilter(instance, properties, keys); } CMSetProperty(instance, "InstanceID", @@ -81,41 +79,120 @@ CMPIInstance *reg_prof_instance(const CM CMSetProperty(instance, "RegisteredVersion", (CMPIValue *)profile->reg_version, CMPI_chars); + *_inst = instance; + out: - return instance; + + return s; } -static CMPIStatus enum_profs(const CMPIObjectPath *ref, - const CMPIResult *results, - const char **properties, - bool names_only) +CMPIStatus get_profile_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *name, + const char **properties, + CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; + virConnectPtr conn = NULL; + int i; + bool found = false; + + conn = connect_by_classname(broker, CLASSNAME(reference), &s); + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } + + for (i = 0; profiles[i] != NULL; i++) { + if(STREQ(name, profiles[i]->reg_id)) { + CMPIInstance *inst = NULL; + + s = get_profile(broker, + reference, + properties, + pfx_from_conn(conn), + profiles[i], + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + found = true; + break; + } + } + + if (found == false) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance (%s)", + name); + + out: + virConnectClose(conn); + + return s; +} + +CMPIStatus get_profile_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + CMPIInstance **_inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + const char *name = NULL; + + if (cu_get_str_path(reference, "InstanceID", &name) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "No InstanceID specified"); + goto out; + } + + s = get_profile_by_name(broker, reference, name, properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + s = cu_validate_ref(broker, reference, inst); + if (s.rc != CMPI_RC_OK) + goto out; + + *_inst = inst; + + out: + return s; +} + +CMPIStatus enum_profiles(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; int i; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) - return s; + goto out; for (i = 0; profiles[i] != NULL; i++) { - instance = reg_prof_instance(_BROKER, - NAMESPACE(ref), - properties, - conn, - profiles[i]); - if (instance == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Can't create profile instance"); - goto out; - } + CMPIInstance *inst = NULL; - if (names_only) - cu_return_instance_name(results, instance); - else - CMReturnInstance(results, instance); + s = get_profile(broker, + reference, + properties, + pfx_from_conn(conn), + profiles[i], + &inst); + + if (s.rc != CMPI_RC_OK) + continue; + + inst_list_add(list, inst); } out: @@ -124,50 +201,27 @@ static CMPIStatus enum_profs(const CMPIO return s; } -static CMPIStatus get_prof(const CMPIObjectPath *ref, - const CMPIResult *results, - const char **properties) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance = NULL; - virConnectPtr conn = NULL; - const char* id; - int i; +static CMPIStatus return_enum_profiles(const CMPIObjectPath *reference, + const CMPIResult *results, + const char **properties, + const bool names_only) +{ + struct inst_list list; + CMPIStatus s; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); - if (conn == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "No such instance"); + inst_list_init(&list); + + s = enum_profiles(_BROKER, reference, properties, &list); + if (s.rc != CMPI_RC_OK) goto out; - } - if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "No InstanceID specified"); - goto out; - } + if (names_only) + cu_return_instance_names(results, &list); + else + cu_return_instances(results, &list); - for (i = 0; profiles[i] != NULL; i++) { - if(STREQ(id, profiles[i]->reg_id)) { - instance = reg_prof_instance(_BROKER, - NAMESPACE(ref), - properties, - conn, - profiles[i]); - break; - } - } - - if(instance) - CMReturnInstance(results, instance); - else - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_NOT_FOUND, - "Profile instance not found"); out: - virConnectClose(conn); + inst_list_free(&list); return s; } @@ -177,7 +231,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return enum_profs(reference, results, NULL, true); + return return_enum_profiles(reference, results, NULL, true); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -186,7 +240,7 @@ static CMPIStatus EnumInstances(CMPIInst const CMPIObjectPath *reference, const char **properties) { - return enum_profs(reference, results, properties, false); + return return_enum_profiles(reference, results, properties, false); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -195,7 +249,17 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - return get_prof(reference, results, properties); + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + + s = get_profile_by_ref(_BROKER, reference, properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + CMReturnInstance(results, inst); + + out: + return s; } DEFAULT_CI(); diff -r 311b85abee28 -r a16bf3b5d0b9 src/Virt_RegisteredProfile.h --- a/src/Virt_RegisteredProfile.h Thu Mar 13 08:06:29 2008 -0700 +++ b/src/Virt_RegisteredProfile.h Fri Mar 14 11:02:13 2008 +0100 @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2008 * * Authors: * Heidi Eckhart @@ -21,11 +21,28 @@ #ifndef __VIRT_REGISTERED_PROFILE_H #define __VIRT_REGISTERED_PROFILE_H -CMPIInstance *reg_prof_instance(const CMPIBroker *broker, - const char *namespace, - const char **properties, - virConnectPtr conn, - struct reg_prof *profile); +CMPIStatus enum_profiles(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + struct inst_list *list); + +CMPIStatus get_profile(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + const char* pfx, + struct reg_prof *profile, + CMPIInstance **_inst); + +CMPIStatus get_profile_by_name(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char *name, + const char **properties, + CMPIInstance **_inst); + +CMPIStatus get_profile_by_ref(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const char **properties, + CMPIInstance **_inst); #endif diff -r 311b85abee28 -r a16bf3b5d0b9 src/profiles.h --- a/src/profiles.h Thu Mar 13 08:06:29 2008 -0700 +++ b/src/profiles.h Fri Mar 14 11:02:13 2008 +0100 @@ -1,8 +1,9 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2008 * * Authors: * Jay Gagnon + * Heidi Eckhart * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +19,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Interop Namespace */ +#define CIM_INTEROP_NS "root/interop" + struct reg_prof { uint16_t reg_org; // Valid: 1 = Other, 2 = DMTF char *reg_id; @@ -26,7 +31,7 @@ struct reg_prof { int ad_types; char *other_reg_org; char *ad_type_descriptions; - char *provider_name; + char *scoping_class; }; struct reg_prof SystemVirtualization = { @@ -34,7 +39,7 @@ struct reg_prof SystemVirtualization = { .reg_id = "CIM:DSP1042-SystemVirtualization-1.0.0", .reg_name = "System Virtualization", .reg_version = "1.0.0", - .provider_name = "HostSystem" + .scoping_class = "HostSystem" }; struct reg_prof VirtualSystem = { @@ -42,7 +47,7 @@ struct reg_prof VirtualSystem = { .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a", .reg_name = "Virtual System Profile", .reg_version = "1.0.0a", - .provider_name = "ComputerSystem" + .scoping_class = "ComputerSystem" }; From heidieck at linux.vnet.ibm.com Fri Mar 14 10:11:26 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:11:26 +0100 Subject: [Libvirt-cim] [PATCH 0 of 2] #2 - RegisteredProfile adopt common look and feel of interfaces and adopt interface to ECTP Message-ID: This patch set adopts the common look and feel of the instance provider to RegisteredProfile. The changes are then adopted to ECTP. This fixes ECTP's validation of the client submitted object path. Diff to patch set 1: - removed namespace from get_profile() signature, as dynamic configuration is not used at the moment From heidieck at linux.vnet.ibm.com Fri Mar 14 10:11:28 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:11:28 +0100 Subject: [Libvirt-cim] [PATCH 2 of 2] ECTP: adopt interface changes of RegisteredProfile In-Reply-To: Message-ID: <59f38ff0007af1489c49.1205489488@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205488995 -3600 # Node ID 59f38ff0007af1489c4946672f6caa5b5fe196ce # Parent a16bf3b5d0b964739a92ddbba418ab02709be59b ECTP: adopt interface changes of RegisteredProfile wbemain -ac CIM_ElementConformsToProfile 'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="wrong"' is returning localhost:5988/root/virt:KVM_RegisteredProfile.InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0" instead of NOT_FOUND Signed-off-by: Heidi Eckhart diff -r a16bf3b5d0b9 -r 59f38ff0007a src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Fri Mar 14 11:02:13 2008 +0100 +++ b/src/Virt_ElementConformsToProfile.c Fri Mar 14 11:03:15 2008 +0100 @@ -60,7 +60,7 @@ static CMPIStatus elem_instances(const C char *classname; classname = get_typed_class(pfx_from_conn(conn), - profile->provider_name); + profile->scoping_class); if (classname == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -72,7 +72,7 @@ static CMPIStatus elem_instances(const C if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) goto out; - en = CBEnumInstances(_BROKER, info->context , op, NULL, &s); + en = CBEnumInstances(_BROKER, info->context , op, info->properties, &s); if (en == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -103,12 +103,17 @@ static CMPIStatus prof_to_elem(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance = NULL; virConnectPtr conn = NULL; const char *id; int i; if (!match_hypervisor_prefix(ref, info)) return s; + + s = get_profile_by_ref(_BROKER, ref, info->properties, &instance); + if (s.rc != CMPI_RC_OK) + goto out; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) @@ -122,11 +127,12 @@ static CMPIStatus prof_to_elem(const CMP } for (i = 0; profiles[i] != NULL; i++) { - if (STREQ(id, profiles[i]->reg_id)) { - s = elem_instances(ref, info, list, - profiles[i], conn); - if ((s.rc != CMPI_RC_OK)) - goto out; + if (STREQC(id, profiles[i]->reg_id)) { + s = elem_instances(ref, + info, + list, + profiles[i], + conn); break; } } @@ -142,13 +148,20 @@ static CMPIStatus elem_to_prof(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; + CMPIInstance *instance = NULL; virConnectPtr conn = NULL; char *classname; - struct reg_prof *candidate; int i; if (!match_hypervisor_prefix(ref, info)) + return s; + + instance = CBGetInstance(_BROKER, + info->context, + ref, + NULL, + &s); + if (s.rc != CMPI_RC_OK) return s; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); @@ -164,22 +177,18 @@ static CMPIStatus elem_to_prof(const CMP } for (i = 0; profiles[i] != NULL; i++) { - candidate = profiles[i]; - if (!STREQC(candidate->provider_name, classname)) + if (!STREQC(profiles[i]->scoping_class, classname)) continue; - instance = reg_prof_instance(_BROKER, - "root/interop", - NULL, - conn, - candidate); - if (instance == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Can't create profile instance"); + s = get_profile(_BROKER, + ref, + info->properties, + pfx_from_conn(conn), + profiles[i], + &instance); + if (s.rc != CMPI_RC_OK) goto out; - } - + inst_list_add(list, instance); } From heidieck at linux.vnet.ibm.com Fri Mar 14 10:13:17 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:13:17 +0100 Subject: [Libvirt-cim] [PATCH 3 of 3] ECTP: adopt the changes made to profile.h In-Reply-To: Message-ID: <02c3b6c131b678f1bf68.1205489597@dyn-9-152-210-82.boeblingen.de.ibm.com> # HG changeset patch # User Heidi Eckhart # Date 1205489076 -3600 # Node ID 02c3b6c131b678f1bf68cb92b533794ae1dc9940 # Parent c999b77057ddaf774c3519f0d4ccca892f32af57 ECTP: adopt the changes made to profile.h Signed-off-by: Heidi Eckhart diff -r c999b77057dd -r 02c3b6c131b6 src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Fri Mar 14 11:04:19 2008 +0100 +++ b/src/Virt_ElementConformsToProfile.c Fri Mar 14 11:04:36 2008 +0100 @@ -180,6 +180,9 @@ static CMPIStatus elem_to_prof(const CMP } for (i = 0; profiles[i] != NULL; i++) { + if (profiles[i]->scoping_class == NULL) + continue; + if (!STREQC(profiles[i]->scoping_class, classname)) continue; From heidieck at linux.vnet.ibm.com Fri Mar 14 10:13:14 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:13:14 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] #2 - Complete list of implemented DMTF's Profiles and add ReferencedProfile association Message-ID: This patch set - RegisteredProfile lists now all by this provider package implemented DMTF Profiles - add association ReferencedProfile for conformance to Profile Registration Profile (this association shows the relations between the different profiles) - fix ECTP seg fault caused by changes in profile.h Diff to patch set 1: - reoragnized prof_to_prof() into smaller functions From heidieck at linux.vnet.ibm.com Fri Mar 14 10:13:15 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:13:15 +0100 Subject: [Libvirt-cim] [PATCH 1 of 3] RegisteredProfile: add instances for each implemented profile In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205488997 -3600 # Node ID be69ef2880db3d8410f5db7acb39587a26bfdd9d # Parent 59f38ff0007af1489c4946672f6caa5b5fe196ce RegisteredProfile: add instances for each implemented profile The following DMTF Profiles are implemented by the libvirt-cim provider package: - DSP1042 System Virtualization 1.0.0 - DSP1045 Memory Resource Virtualization 1.0.0 - DSP1057 Virtual System 1.0.0 - DSP1059 Generic Device Resource Virtualization 1.0.0 - DSP1081 Virtual System Migration 0.8.1 Signed-off-by: Heidi Eckhart diff -r 59f38ff0007a -r be69ef2880db src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Fri Mar 14 11:03:15 2008 +0100 +++ b/src/Virt_ElementConformsToProfile.c Fri Mar 14 11:03:17 2008 +0100 @@ -58,6 +58,9 @@ static CMPIStatus elem_instances(const C CMPIEnumeration *en = NULL; CMPIData data ; char *classname; + + if (profile->scoping_class == NULL) + return s; classname = get_typed_class(pfx_from_conn(conn), profile->scoping_class); diff -r 59f38ff0007a -r be69ef2880db src/profiles.h --- a/src/profiles.h Fri Mar 14 11:03:15 2008 +0100 +++ b/src/profiles.h Fri Mar 14 11:03:17 2008 +0100 @@ -32,6 +32,16 @@ struct reg_prof { char *other_reg_org; char *ad_type_descriptions; char *scoping_class; + struct reg_prof *scoping_profile; +}; + +struct reg_prof VirtualSystem = { + .reg_org = 2, + .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a", + .reg_name = "Virtual System Profile", + .reg_version = "1.0.0a", + .scoping_class = "ComputerSystem", + .scoping_profile = NULL }; struct reg_prof SystemVirtualization = { @@ -39,22 +49,44 @@ struct reg_prof SystemVirtualization = { .reg_id = "CIM:DSP1042-SystemVirtualization-1.0.0", .reg_name = "System Virtualization", .reg_version = "1.0.0", - .scoping_class = "HostSystem" + .scoping_class = "HostSystem", + .scoping_profile = &VirtualSystem }; -struct reg_prof VirtualSystem = { +struct reg_prof GenericDeviceResourceVirtualization = { .reg_org = 2, - .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a", - .reg_name = "Virtual System Profile", - .reg_version = "1.0.0a", - .scoping_class = "ComputerSystem" + .reg_id = "CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0", + .reg_name = "Generic Device Resource Virtualization", + .reg_version = "1.0.0", + .scoping_class = NULL, + .scoping_profile = &SystemVirtualization }; +struct reg_prof MemoryResourceVirtualization = { + .reg_org = 2, + .reg_id = "CIM:DSP1045-MemoryResourceVirtualization-1.0.0", + .reg_name = "Memory Resource Virtualization", + .reg_version = "1.0.0", + .scoping_class = NULL, + .scoping_profile = &SystemVirtualization +}; + +struct reg_prof VirtualSystemMigration = { + .reg_org = 2, + .reg_id = "CIM:DSP1081-VirtualSystemMigration-1.0", + .reg_name = "Virtual System Migration", + .reg_version = "1.0", + .scoping_class = NULL, + .scoping_profile = &SystemVirtualization +}; // Make sure to add pointer to your reg_prof struct here. struct reg_prof *profiles[] = { &SystemVirtualization, &VirtualSystem, + &GenericDeviceResourceVirtualization, + &MemoryResourceVirtualization, + &VirtualSystemMigration, NULL }; From heidieck at linux.vnet.ibm.com Fri Mar 14 10:13:16 2008 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Fri, 14 Mar 2008 11:13:16 +0100 Subject: [Libvirt-cim] [PATCH 2 of 3] Add association ReferencedProfile for conformance to DMTF's Profile Registration Profile In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1205489059 -3600 # Node ID c999b77057ddaf774c3519f0d4ccca892f32af57 # Parent be69ef2880db3d8410f5db7acb39587a26bfdd9d Add association ReferencedProfile for conformance to DMTF's Profile Registration Profile Signed-off-by: Heidi Eckhart diff -r be69ef2880db -r c999b77057dd Makefile.am --- a/Makefile.am Fri Mar 14 11:03:17 2008 +0100 +++ b/Makefile.am Fri Mar 14 11:04:19 2008 +0100 @@ -45,7 +45,8 @@ INTEROP_MOFS = \ schema/ComputerSystem.mof \ schema/HostSystem.mof \ schema/RegisteredProfile.mof \ - schema/ElementConformsToProfile.mof + schema/ElementConformsToProfile.mof \ + schema/ReferencedProfile.mof REGS = \ @@ -89,7 +90,8 @@ REGS = \ INTEROP_REGS = \ schema/RegisteredProfile.registration \ - schema/ElementConformsToProfile.registration + schema/ElementConformsToProfile.registration \ + schema/ReferencedProfile.registration pkgdata_DATA = $(MOFS) $(REGS) pkgdata_SCRIPTS = provider-register.sh diff -r be69ef2880db -r c999b77057dd schema/ReferencedProfile.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/ReferencedProfile.mof Fri Mar 14 11:04:19 2008 +0100 @@ -0,0 +1,34 @@ +// Copyright IBM Corp. 2008 + +[Association, + Description ( + "Associates a RegisteredProfile with its scoping RegisteredProfile."), + Provider("cmpi::Virt_ReferencedProfile") +] +class Xen_ReferencedProfile : CIM_ReferencedProfile +{ + + [Override ("Antecedent")] + Xen_RegisteredProfile REF Antecedent; + + [Override ("Dependent")] + Xen_RegisteredProfile REF Dependent; + +}; + +[Association, + Description ( + "Associates a RegisteredProfile with its scoping RegisteredProfile."), + Provider("cmpi::Virt_ReferencedProfile") +] +class KVM_ReferencedProfile : CIM_ReferencedProfile +{ + + [Override ("Antecedent")] + KVM_RegisteredProfile REF Antecedent; + + [Override ("Dependent")] + KVM_RegisteredProfile REF Dependent; + +}; + diff -r be69ef2880db -r c999b77057dd schema/ReferencedProfile.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/ReferencedProfile.registration Fri Mar 14 11:04:19 2008 +0100 @@ -0,0 +1,4 @@ +# Copyright IBM Corp. 2008 +# Classname Namespace ProviderName ProviderModule ProviderTypes +Xen_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association +KVM_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association diff -r be69ef2880db -r c999b77057dd src/Makefile.am --- a/src/Makefile.am Fri Mar 14 11:03:17 2008 +0100 +++ b/src/Makefile.am Fri Mar 14 11:04:19 2008 +0100 @@ -46,6 +46,7 @@ provider_LTLIBRARIES = libVirt_ComputerS libVirt_HostedDependency.la \ libVirt_RegisteredProfile.la \ libVirt_ElementConformsToProfile.la \ + libVirt_ReferencedProfile.la \ libVirt_SettingsDefineCapabilities.la \ libVirt_HostedResourcePool.la \ libVirt_ElementCapabilities.la \ @@ -98,6 +99,10 @@ libVirt_ElementConformsToProfile_la_DEPE libVirt_ElementConformsToProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la libVirt_ElementConformsToProfile_la_SOURCES = Virt_ElementConformsToProfile.c libVirt_ElementConformsToProfile_la_LIBADD = -lVirt_RegisteredProfile + +libVirt_ReferencedProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la +libVirt_ReferencedProfile_la_SOURCES = Virt_ReferencedProfile.c +libVirt_ReferencedProfile_la_LIBADD = -lVirt_RegisteredProfile libVirt_EnabledLogicalElementCapabilities_la_SOURCES = Virt_EnabledLogicalElementCapabilities.c diff -r be69ef2880db -r c999b77057dd src/Virt_ReferencedProfile.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Virt_ReferencedProfile.c Fri Mar 14 11:04:19 2008 +0100 @@ -0,0 +1,271 @@ +/* + * Copyright IBM Corp. 2008 + * + * Authors: + * Heidi Eckhart + * + * 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 +#include +#include +#include + +#include "cmpidt.h" +#include "cmpift.h" +#include "cmpimacs.h" + +#include +#include "misc_util.h" +#include "profiles.h" +#include + +#include "config.h" + +#include "Virt_RegisteredProfile.h" + +const static CMPIBroker *_BROKER; + +static struct reg_prof *get_reg_prof_by_ref(const CMPIObjectPath *ref) +{ + const char* name; + int i; + + if (cu_get_str_path(ref, "InstanceID", &name) != CMPI_RC_OK) + return NULL; + + for (i = 0; profiles[i] != NULL; i++) { + if(STREQ(name, profiles[i]->reg_id)) + return profiles[i]; + } + + return NULL; +} + +static CMPIStatus get_scoping_prof_by_source(const CMPIObjectPath *ref, + struct std_assoc_info *info, + virConnectPtr conn, + struct reg_prof *source, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + + if (source->scoping_profile != NULL) { + s = get_profile(_BROKER, + ref, + info->properties, + pfx_from_conn(conn), + source->scoping_profile, + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + inst_list_add(list, inst); + } + + out: + return s; +} + +static CMPIStatus get_scoping_prof_by_list(const CMPIObjectPath *ref, + struct std_assoc_info *info, + virConnectPtr conn, + struct reg_prof *source, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + struct reg_prof *scope; + int i; + + for (i = 0; profiles[i] != NULL; i++) { + if (profiles[i]->scoping_profile == NULL) + continue; + + scope = profiles[i]->scoping_profile; + if (!STREQC(scope->reg_id, source->reg_id)) + continue; + + s = get_profile(_BROKER, + ref, + info->properties, + pfx_from_conn(conn), + profiles[i], + &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + inst_list_add(list, inst); + } + + out: + return s; +} + +static CMPIStatus enum_reg_prof_by_source(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct reg_prof *source, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virConnectPtr conn = NULL; + + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + if (conn == NULL) + goto out; + + s = get_scoping_prof_by_source(ref, info, conn, source, list); + if (s.rc != CMPI_RC_OK) + goto out; + + s = get_scoping_prof_by_list(ref, info, conn, source, list); + if (s.rc != CMPI_RC_OK) + goto out; + + out: + virConnectClose(conn); + + return s; +} + +static CMPIStatus prof_to_prof(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst = NULL; + struct reg_prof *source; + + if (!match_hypervisor_prefix(ref, info)) + goto out; + + s = get_profile_by_ref(_BROKER, ref, info->properties, &inst); + if (s.rc != CMPI_RC_OK) + goto out; + + source = get_reg_prof_by_ref(ref); + if (source == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Can't find RegisteredProfile instance"); + goto out; + } + + s = enum_reg_prof_by_source(ref, info, source, list); + + out: + return s; +} + +static CMPIInstance *make_ref(const CMPIObjectPath *source_ref, + const CMPIInstance *target_inst, + struct std_assoc_info *info, + struct std_assoc *assoc); + +static char* registered_profile[] = { + "Xen_RegisteredProfile", + "KVM_RegisteredProfile", + NULL +}; + +static char* assoc_classname[] = { + "Xen_ReferencedProfile", + "KVM_ReferencedProfile", + NULL +}; + +static struct std_assoc forward = { + .source_class = (char**)®istered_profile, + .source_prop = "Antecedent", + + .target_class = (char**)®istered_profile, + .target_prop = "Dependent", + + .assoc_class = (char**)&assoc_classname, + + .handler = prof_to_prof, + .make_ref = make_ref +}; + +static struct std_assoc backward = { + .source_class = (char**)®istered_profile, + .source_prop = "Dependent", + + .target_class = (char**)®istered_profile, + .target_prop = "Antecedent", + + .assoc_class = (char**)&assoc_classname, + + .handler = prof_to_prof, + .make_ref = make_ref +}; + +static struct std_assoc *assoc_handlers[] = { + &forward, + &backward, + NULL +}; + +static CMPIInstance *make_ref(const CMPIObjectPath *source_ref, + const CMPIInstance *target_inst, + struct std_assoc_info *info, + struct std_assoc *assoc) +{ + CMPIInstance *ref_inst = NULL; + struct std_assoc *ref_assoc = NULL; + struct reg_prof *source; + char* assoc_classname; + + assoc_classname = class_base_name(assoc->assoc_class[0]); + + ref_inst = get_typed_instance(_BROKER, + CLASSNAME(source_ref), + assoc_classname, + NAMESPACE(source_ref)); + + source = get_reg_prof_by_ref(source_ref); + if (source->scoping_profile != NULL) + ref_assoc = &backward; + else + ref_assoc = assoc; + + if (ref_inst != NULL) { + CMPIObjectPath *target_ref; + + target_ref = CMGetObjectPath(target_inst, NULL); + + set_reference(ref_assoc, ref_inst, + source_ref, target_ref); + } + + free(assoc_classname); + + return ref_inst; +} + +STDA_AssocMIStub(, + Virt_ReferencedProfile, + _BROKER, + libvirt_cim_init(), + assoc_handlers); +/* + * Local Variables: + * mode: C + * c-set-style: "K&R" + * tab-width: 8 + * c-basic-offset: 8 + * indent-tabs-mode: nil + * End: + */ From danms at us.ibm.com Fri Mar 14 15:14:47 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 14 Mar 2008 08:14:47 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] (#3) [RFC] Add external migration checks In-Reply-To: <47DA3FD5.3030308@linux.vnet.ibm.com> (Heidi Eckhart's message of "Fri, 14 Mar 2008 10:05:25 +0100") References: <47D95CA6.6030304@linux.vnet.ibm.com> <87ve3qwmon.fsf@caffeine.beaverton.ibm.com> <47DA3FD5.3030308@linux.vnet.ibm.com> Message-ID: <87bq5hwd5k.fsf@caffeine.beaverton.ibm.com> HE> I was under the impression that MigrationService itself was HE> extended by CheckParameters. So, I'm fine with your integration HE> into the model. Okay, no problem :) Thanks for the review! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 14 17:22:11 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 14 Mar 2008 10:22:11 -0700 Subject: [Libvirt-cim] [PATCH] Make sure RegisteredProfile.registration gets included in pkgdata_DATA Message-ID: <5ba7f26dd986188b2b2b.1205515331@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205515109 25200 # Node ID 5ba7f26dd986188b2b2b6f257f27e1261570185a # Parent 58da2f9d92e39567b75d8537a833aba0da994f92 Make sure RegisteredProfile.registration gets included in pkgdata_DATA Signed-off-by: Dan Smith diff -r 58da2f9d92e3 -r 5ba7f26dd986 Makefile.am --- a/Makefile.am Mon Mar 03 09:58:19 2008 -0800 +++ b/Makefile.am Fri Mar 14 10:18:29 2008 -0700 @@ -91,7 +91,7 @@ INTEROP_REGS = \ schema/RegisteredProfile.registration \ schema/ElementConformsToProfile.registration -pkgdata_DATA = $(MOFS) $(REGS) +pkgdata_DATA = $(MOFS) $(REGS) $(INTEROP_REGS) pkgdata_SCRIPTS = provider-register.sh EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) \ From grendel at linux.vnet.ibm.com Fri Mar 14 17:34:16 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 14 Mar 2008 13:34:16 -0400 Subject: [Libvirt-cim] [PATCH] Make sure RegisteredProfile.registration gets included in pkgdata_DATA In-Reply-To: <5ba7f26dd986188b2b2b.1205515331@caffeine.beaverton.ibm.com> References: <5ba7f26dd986188b2b2b.1205515331@caffeine.beaverton.ibm.com> Message-ID: <47DAB718.7000809@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205515109 25200 > # Node ID 5ba7f26dd986188b2b2b6f257f27e1261570185a > # Parent 58da2f9d92e39567b75d8537a833aba0da994f92 > Make sure RegisteredProfile.registration gets included in pkgdata_DATA > > Signed-off-by: Dan Smith > Nice catch, +1 -- -Jay From danms at us.ibm.com Mon Mar 17 14:34:34 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 17 Mar 2008 07:34:34 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] Define guest before migrating In-Reply-To: <2fa4dbe7b38189aeb1dd.1205453428@elm3b41.beaverton.ibm.com> (Kaitlin Rupert's message of "Thu, 13 Mar 2008 17:10:28 -0700") References: <2fa4dbe7b38189aeb1dd.1205453428@elm3b41.beaverton.ibm.com> Message-ID: <87bq5dv2px.fsf@caffeine.beaverton.ibm.com> KR> +static CMPIStatus define_guest_on_target(virConnectPtr dconn, KR> + virDomainPtr dom, KR> + struct migration_job *job, KR> + bool is_offline_migrate) KR> +{ KR> + CMPIStatus s = {CMPI_RC_OK, NULL}; KR> + virDomainPtr ddom = NULL; KR> + char *xml = NULL; KR> + KR> + if (!is_offline_migrate) { KR> + ddom = virDomainLookupByName(dconn, job->domain); KR> + if (ddom == NULL) { KR> + CU_DEBUG("Failed to lookup `%s'", job->domain); KR> + cu_statusf(_BROKER, &s, KR> + CMPI_RC_ERR_FAILED, KR> + "Failed to lookup domain `%s'", job->domain); KR> + goto out; KR> + } KR> + KR> + xml = virDomainGetXMLDesc(ddom, 0); KR> + } KR> + else That 'else' is broken. KR> + xml = virDomainGetXMLDesc(dom, 0); KR> + KR> + if (xml == NULL) { KR> + cu_statusf(_BROKER, &s, KR> + CMPI_RC_ERR_FAILED, KR> + "Unable to retrieve domain XML."); KR> + goto out; KR> + } KR> + KR> + ddom = virDomainDefineXML(dconn, xml); KR> + if (ddom == NULL) { KR> + CU_DEBUG("Failed to define domain from XML"); KR> + cu_statusf(_BROKER, &s, KR> + CMPI_RC_ERR_FAILED, KR> + "Failed to create domain"); KR> + } KR> + KR> + out: KR> + free(xml); KR> + virDomainFree(ddom); KR> + return s; KR> +} KR> + I really don't like the way this function re-defines an existing guest on the remote or copies one from local to remote depending on the flag. To me it looks like it should be able to just fail if it can't virDomainGetXMLDesc(dom). If you pass in a remote dom then it will do the redefine. If you pass in a local dom, it will effectively copy. KR> switch(job->type) { KR> case CIM_MIGRATE_OTHER: KR> CU_DEBUG("Preparing for offline migration"); KR> - s = handle_offline_migrate(job->conn, dom, uri, xml, job); KR> + s = handle_offline_migrate(job->conn, dom, uri, job); KR> break; KR> case CIM_MIGRATE_LIVE: KR> CU_DEBUG("Preparing for live migration"); KR> @@ -717,6 +729,15 @@ static CMPIStatus migrate_vs(struct migr KR> goto out; KR> CU_DEBUG("Migration succeeded"); KR> + KR> + s = define_guest_on_target(job->conn, NULL, job, false); KR> + if (s.rc != CMPI_RC_OK) { KR> + CU_DEBUG("Define failed"); KR> + cu_statusf(_BROKER, &s, KR> + CMPI_RC_ERR_FAILED, KR> + "Unable to define guest on target system"); KR> + } KR> + KR> cu_statusf(_BROKER, &s, KR> CMPI_RC_OK, KR> ""); It seems to me that a migration of any sort has now become like an offline migration, but with a little extra goo in the middle. So, I wonder if we can't change the switch above to something like this: xml = virDomainGetXMLDesc(local_dom); switch (type) { case CIM_MIGRATE_OTHER: /* Offline */ break; case CIM_MIGRATE_LIVE: s = handle_migration(dconn, dom) break; default: /* ERROR */ } if (s.rc == CMPI_RC_OK) define_guest_on_target(dconn, xml); Thus, offline migration is mostly just a fall-through, but the other migration types have actual work in the middle. Thoughts? Since Kaitlin is out, I'll pick this up and re-swizzle. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 17 17:33:30 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 17 Mar 2008 10:33:30 -0700 Subject: [Libvirt-cim] [PATCH] Make external check code not consider absence of the check dir a failure Message-ID: <420c2f10feb2cacc2081.1205775210@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205775186 25200 # Node ID 420c2f10feb2cacc2081a65a0022fcb8355c7887 # Parent 6a4ee1677ad7c63aabcb1291b6f677b82d8098db Make external check code not consider absence of the check dir a failure Signed-off-by: Dan Smith diff -r 6a4ee1677ad7 -r 420c2f10feb2 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 17 10:14:16 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 17 10:33:06 2008 -0700 @@ -316,7 +316,7 @@ static char **list_migration_checks(int CU_DEBUG("Unable to open migration checks dir: %s (%s)", MIG_CHECKS_DIR, strerror(errno)); - *count = -1; + *count = 0; return NULL; } From danms at us.ibm.com Mon Mar 17 20:22:47 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 17 Mar 2008 13:22:47 -0700 Subject: [Libvirt-cim] [PATCH] Make migration indications not crash the provider if they fail to be Message-ID: <47f5fc1ac66dad65785d.1205785367@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205785362 25200 # Node ID 47f5fc1ac66dad65785dd050d6b4b9fe95948f8a # Parent 0c1fb92b677674d5f94648020f72707c5eb16dd8 Make migration indications not crash the provider if they fail to be created. Also make raise_indication() tolerant of getting a NULL. Signed-off-by: Dan Smith diff -r 0c1fb92b6776 -r 47f5fc1ac66d src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 17 12:22:19 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 17 13:22:42 2008 -0700 @@ -692,6 +692,9 @@ static bool raise_indication(const CMPIC CMPIStatus s; const char *ind_name = NULL; + if (ind == NULL) + return false; + ind_name = ind_type_to_name(ind_type); CU_DEBUG("Setting SourceInstance"); @@ -730,6 +733,7 @@ static CMPIInstance *prepare_indication( if (ind == NULL) { CU_DEBUG("Failed to create ind, type '%s:%s_%s'", ns, "Xen", ind_name); + goto out; } if (ind_type == MIG_MODIFIED) { From danms at us.ibm.com Mon Mar 17 20:23:37 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 17 Mar 2008 13:23:37 -0700 Subject: [Libvirt-cim] [PATCH] During a migrate, grab xml, do migration, define at the end Message-ID: <802a5fbe87ed0dff07f2.1205785417@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205785376 25200 # Node ID 802a5fbe87ed0dff07f2dc75622a9e674d891156 # Parent 47f5fc1ac66dad65785dd050d6b4b9fe95948f8a During a migrate, grab xml, do migration, define at the end ...in a more consistent manner that makes offline migration an effective NOP. Signed-off-by: Dan Smith diff -r 47f5fc1ac66d -r 802a5fbe87ed src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 17 13:22:42 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 17 13:22:56 2008 -0700 @@ -860,6 +860,23 @@ static CMPIStatus handle_migrate(virConn { CMPIStatus s = {CMPI_RC_OK, NULL}; virDomainPtr ddom = NULL; + virDomainInfo info; + int ret; + + ret = virDomainGetInfo(dom, &info); + if (ret == -1) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Error getting domain info"); + goto out; + } + + if ((const int)info.state == VIR_DOMAIN_SHUTOFF) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_INVALID_PARAMETER, + "Domain must not be shut off for live migration"); + goto out; + } CU_DEBUG("Migrating %s -> %s", job->domain, uri); ddom = virDomainMigrate(dom, dconn, type, NULL, NULL, 0); @@ -869,71 +886,75 @@ static CMPIStatus handle_migrate(virConn CMPI_RC_ERR_FAILED, "Migration Failed"); } - + out: virDomainFree(ddom); return s; } -static CMPIStatus prepare_offline_migrate(virDomainPtr dom, - char **xml) +static CMPIStatus prepare_migrate(virDomainPtr dom, + char **xml) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + *xml = virDomainGetXMLDesc(dom, 0); + if (*xml == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to retrieve domain XML."); + goto out; + } + + out: + return s; +} + +static CMPIStatus complete_migrate(virDomainPtr ldom, + virConnectPtr rconn, + const char *xml) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + virDomainPtr newdom = NULL; + + if (virDomainUndefine(ldom) == -1) { + CU_DEBUG("Undefine of local domain failed"); + } + + newdom = virDomainDefineXML(rconn, xml); + if (newdom == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to define domain"); + goto out; + } + + CU_DEBUG("Defined domain on destination host"); + out: + virDomainFree(newdom); + + return s; +} + +static CMPIStatus ensure_dom_offline(virDomainPtr dom) { CMPIStatus s = {CMPI_RC_OK, NULL}; virDomainInfo info; int ret; ret = virDomainGetInfo(dom, &info); - if (ret != 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unabled to get info for domain."); + if (ret == -1) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Error getting domain info"); goto out; } if ((const int)info.state != VIR_DOMAIN_SHUTOFF) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_INVALID_PARAMETER, - "Domain must be shutoff for offline migration."); - goto out; - } - - *xml = virDomainGetXMLDesc(dom, 0); - if (*xml == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to retrieve domain XML."); - goto out; - } - - out: - return s; -} - -static CMPIStatus handle_offline_migrate(virConnectPtr dconn, - virDomainPtr dom, - char *uri, - char *xml, - struct migration_job *job) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - virDomainPtr new_dom; - - if (domain_exists(dconn, job->domain)) { - CU_DEBUG("This domain already exists on the target system."); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "This domain already exists on the target system"); - goto out; - } - - new_dom = virDomainDefineXML(dconn, xml); - if (new_dom == NULL) { - CU_DEBUG("Failed to define domain from XML"); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Failed to create domain"); - } - + "Domain must be shut off for offline migration"); + goto out; + } out: return s; } @@ -959,27 +980,33 @@ static CMPIStatus migrate_vs(struct migr goto out; } - if (job->type == CIM_MIGRATE_OTHER) { - s = prepare_offline_migrate(dom, &xml); - if (s.rc != CMPI_RC_OK) - goto out; - } + if (domain_exists(job->conn, job->domain)) { + CU_DEBUG("Remote domain `%s' exists", job->domain); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Remote already has domain `%s'", job->domain); + goto out; + } + + s = prepare_migrate(dom, &xml); + if (s.rc != CMPI_RC_OK) + goto out; switch(job->type) { case CIM_MIGRATE_OTHER: - CU_DEBUG("Preparing for offline migration"); - s = handle_offline_migrate(job->conn, dom, uri, xml, job); + CU_DEBUG("Offline migration"); + s = ensure_dom_offline(dom); break; case CIM_MIGRATE_LIVE: - CU_DEBUG("Preparing for live migration"); + CU_DEBUG("Live migration"); s = handle_migrate(job->conn, dom, uri, VIR_MIGRATE_LIVE, job); break; case CIM_MIGRATE_RESUME: case CIM_MIGRATE_RESTART: - CU_DEBUG("Preparing for static migration"); + CU_DEBUG("Static migration"); s = handle_migrate(job->conn, dom, uri, 0, job); break; - default: + default: CU_DEBUG("Unsupported migration type (%d)", job->type); cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -990,11 +1017,13 @@ static CMPIStatus migrate_vs(struct migr if (s.rc != CMPI_RC_OK) goto out; - CU_DEBUG("Migration succeeded"); - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - + s = complete_migrate(dom, job->conn, xml); + if (s.rc == CMPI_RC_OK) { + CU_DEBUG("Migration succeeded"); + } else { + CU_DEBUG("Migration failed: %s", + CMGetCharPtr(s.msg)); + } out: raise_deleted_ind(job); From danms at us.ibm.com Mon Mar 17 20:23:45 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 17 Mar 2008 13:23:45 -0700 Subject: [Libvirt-cim] [PATCH] Remove stale parameter in handle_migrate() function Message-ID: <4c26cc6ccb4f239d97eb.1205785425@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205785395 25200 # Node ID 4c26cc6ccb4f239d97ebfadd6f3913b54f52c9cd # Parent 802a5fbe87ed0dff07f2dc75622a9e674d891156 Remove stale parameter in handle_migrate() function Signed-off-by: Dan Smith diff -r 802a5fbe87ed -r 4c26cc6ccb4f src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Mon Mar 17 13:22:56 2008 -0700 +++ b/src/Virt_VSMigrationService.c Mon Mar 17 13:23:15 2008 -0700 @@ -854,7 +854,6 @@ static void migrate_job_set_state(struct static CMPIStatus handle_migrate(virConnectPtr dconn, virDomainPtr dom, - char *uri, int type, struct migration_job *job) { @@ -878,7 +877,7 @@ static CMPIStatus handle_migrate(virConn goto out; } - CU_DEBUG("Migrating %s -> %s", job->domain, uri); + CU_DEBUG("Migrating %s", job->domain); ddom = virDomainMigrate(dom, dconn, type, NULL, NULL, 0); if (ddom == NULL) { CU_DEBUG("Migration failed"); @@ -999,12 +998,12 @@ static CMPIStatus migrate_vs(struct migr break; case CIM_MIGRATE_LIVE: CU_DEBUG("Live migration"); - s = handle_migrate(job->conn, dom, uri, VIR_MIGRATE_LIVE, job); + s = handle_migrate(job->conn, dom, VIR_MIGRATE_LIVE, job); break; case CIM_MIGRATE_RESUME: case CIM_MIGRATE_RESTART: CU_DEBUG("Static migration"); - s = handle_migrate(job->conn, dom, uri, 0, job); + s = handle_migrate(job->conn, dom, 0, job); break; default: CU_DEBUG("Unsupported migration type (%d)", job->type); From danms at us.ibm.com Tue Mar 18 19:44:38 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 18 Mar 2008 12:44:38 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Fix up VirtualSystemType-related bits Message-ID: The VirtualSystemType field of a ComputerSystem must match one of the entries in the associated VSMCapabilities object's VirtualSystemTypesSupported field. From danms at us.ibm.com Tue Mar 18 19:44:40 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 18 Mar 2008 12:44:40 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add VirtualSystemType to ComputerSystem In-Reply-To: Message-ID: <4fc9937235ebb9b789f4.1205869480@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205869429 25200 # Node ID 4fc9937235ebb9b789f411949a78a007339c46e1 # Parent 05e2ef48609226150b605477015207d0ae59a758 Add VirtualSystemType to ComputerSystem Signed-off-by: Dan Smith diff -r 05e2ef486092 -r 4fc9937235eb src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Tue Mar 18 12:25:52 2008 -0700 +++ b/src/Virt_ComputerSystem.c Tue Mar 18 12:43:49 2008 -0700 @@ -301,6 +301,35 @@ static int set_other_id_info(const CMPIB return 1; } +static bool set_type(CMPIInstance *instance) +{ + CMPIObjectPath *op; + CMPIStatus s; + char *prefix = NULL; + bool rc = false; + + op = CMGetObjectPath(instance, &s); + if ((s.rc != CMPI_RC_OK) || (op == NULL)) { + CU_DEBUG("Failed to get OP from CS instance to set type"); + goto out; + } + + prefix = class_prefix_name(CLASSNAME(op)); + if (prefix == NULL) { + CU_DEBUG("Unknown prefix for class: %s", CLASSNAME(op)); + goto out; + } + + CMSetProperty(instance, "VirtualSystemType", + prefix, CMPI_chars); + + rc = true; + out: + free(prefix); + + return rc; +} + /* Populate an instance with information from a domain */ static CMPIStatus set_properties(const CMPIBroker *broker, virDomainPtr dom, @@ -337,6 +366,10 @@ static CMPIStatus set_properties(const C if (!set_other_id_info(broker, uuid, prefix, instance)) { /* Print trace error */ + goto out; + } + + if (!set_type(instance)) { goto out; } From danms at us.ibm.com Tue Mar 18 19:44:39 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 18 Mar 2008 12:44:39 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Fix TypesSupported in VSMC In-Reply-To: Message-ID: <05e2ef48609226150b60.1205869479@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1205868352 25200 # Node ID 05e2ef48609226150b605477015207d0ae59a758 # Parent 4c26cc6ccb4f239d97ebfadd6f3913b54f52c9cd Fix TypesSupported in VSMC Signed-off-by: Dan Smith diff -r 4c26cc6ccb4f -r 05e2ef486092 src/Virt_VirtualSystemManagementCapabilities.c --- a/src/Virt_VirtualSystemManagementCapabilities.c Mon Mar 17 13:23:15 2008 -0700 +++ b/src/Virt_VirtualSystemManagementCapabilities.c Tue Mar 18 12:25:52 2008 -0700 @@ -93,7 +93,7 @@ static CMPIStatus set_inst_properties(co CMSetArrayElementAt(array, 0, (CMPIValue *)&str, CMPI_string); - CMSetProperty(inst, "TypesSupported", + CMSetProperty(inst, "VirtualSystemTypesSupported", (CMPIValue *)&array, CMPI_stringA); out: From grendel at linux.vnet.ibm.com Tue Mar 18 20:23:26 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 18 Mar 2008 16:23:26 -0400 Subject: [Libvirt-cim] [PATCH 0 of 2] Fix up VirtualSystemType-related bits In-Reply-To: References: Message-ID: <47E024BE.2070708@linux.vnet.ibm.com> Dan Smith wrote: > The VirtualSystemType field of a ComputerSystem must match one of the entries > in the associated VSMCapabilities object's VirtualSystemTypesSupported field. > > Simple and straightforward, just the way I like em. +1 -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 18 20:24:11 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 18 Mar 2008 16:24:11 -0400 Subject: [Libvirt-cim] [PATCH] Remove stale parameter in handle_migrate() function In-Reply-To: <4c26cc6ccb4f239d97eb.1205785425@caffeine.beaverton.ibm.com> References: <4c26cc6ccb4f239d97eb.1205785425@caffeine.beaverton.ibm.com> Message-ID: <47E024EB.2090001@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205785395 25200 > # Node ID 4c26cc6ccb4f239d97ebfadd6f3913b54f52c9cd > # Parent 802a5fbe87ed0dff07f2dc75622a9e674d891156 > Remove stale parameter in handle_migrate() function > > Signed-off-by: Dan Smith > > Funny how things like that happen. +1 -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 18 20:25:53 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 18 Mar 2008 16:25:53 -0400 Subject: [Libvirt-cim] [PATCH] Make migration indications not crash the provider if they fail to be In-Reply-To: <47f5fc1ac66dad65785d.1205785367@caffeine.beaverton.ibm.com> References: <47f5fc1ac66dad65785d.1205785367@caffeine.beaverton.ibm.com> Message-ID: <47E02551.80400@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205785362 25200 > # Node ID 47f5fc1ac66dad65785dd050d6b4b9fe95948f8a > # Parent 0c1fb92b677674d5f94648020f72707c5eb16dd8 > Make migration indications not crash the provider if they fail to be > created. Also make raise_indication() tolerant of getting a NULL. > > Signed-off-by: Dan Smith > > I would feel worse about having totally blown that if it weren't in VSMigrationService. I am so sick of that provider at this point, I can't feel any emotion about it at all. Thanks for catching it. +1 -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 18 20:26:26 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 18 Mar 2008 16:26:26 -0400 Subject: [Libvirt-cim] [PATCH] Make external check code not consider absence of the check dir a failure In-Reply-To: <420c2f10feb2cacc2081.1205775210@caffeine.beaverton.ibm.com> References: <420c2f10feb2cacc2081.1205775210@caffeine.beaverton.ibm.com> Message-ID: <47E02572.2020703@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205775186 25200 > # Node ID 420c2f10feb2cacc2081a65a0022fcb8355c7887 > # Parent 6a4ee1677ad7c63aabcb1291b6f677b82d8098db > Make external check code not consider absence of the check dir a failure > > Signed-off-by: Dan Smith > Straight out of the "fair enough" department. +1 -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 18 20:32:47 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 18 Mar 2008 16:32:47 -0400 Subject: [Libvirt-cim] [PATCH] During a migrate, grab xml, do migration, define at the end In-Reply-To: <802a5fbe87ed0dff07f2.1205785417@caffeine.beaverton.ibm.com> References: <802a5fbe87ed0dff07f2.1205785417@caffeine.beaverton.ibm.com> Message-ID: <47E026EF.9080108@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205785376 25200 > # Node ID 802a5fbe87ed0dff07f2dc75622a9e674d891156 > # Parent 47f5fc1ac66dad65785dd050d6b4b9fe95948f8a > During a migrate, grab xml, do migration, define at the end > ...in a more consistent manner that makes offline migration an effective > NOP. > > Signed-off-by: Dan Smith > > +static CMPIStatus complete_migrate(virDomainPtr ldom, > + virConnectPtr rconn, > + const char *xml) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > + virDomainPtr newdom = NULL; > + > + if (virDomainUndefine(ldom) == -1) { > + CU_DEBUG("Undefine of local domain failed"); > + } > And we're okay with that failing? Not questioning the validity, just confirming intent. Other than that, not much to talk about. A bit of it falls under the category of me not seeing glaring code issues and not knowing enough about migration to question the deeper logic behind the change, although I do like the more coherent switch block. So assuming this CU_DEBUG doesn't also need to do some error handling, I'll +1 this. -- -Jay From danms at us.ibm.com Tue Mar 18 20:37:49 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 18 Mar 2008 13:37:49 -0700 Subject: [Libvirt-cim] [PATCH] During a migrate, grab xml, do migration, define at the end In-Reply-To: <47E026EF.9080108@linux.vnet.ibm.com> (Jay Gagnon's message of "Tue, 18 Mar 2008 16:32:47 -0400") References: <802a5fbe87ed0dff07f2.1205785417@caffeine.beaverton.ibm.com> <47E026EF.9080108@linux.vnet.ibm.com> Message-ID: <87myovlqea.fsf@caffeine.beaverton.ibm.com> JG> And we're okay with that failing? Not questioning the validity, JG> just confirming intent. Yeah, I think so, because it means that either (1) the domain has already been undefined (which is okay) or (2) that we'll end up with the domain on both the remote and local machine. Either of these are better than dropping the domain on the floor (i.e. not having it defined in either place and it appearing to just, well, disappear. Agreed? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Wed Mar 19 13:48:48 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 19 Mar 2008 09:48:48 -0400 Subject: [Libvirt-cim] [PATCH] During a migrate, grab xml, do migration, define at the end In-Reply-To: <87myovlqea.fsf@caffeine.beaverton.ibm.com> References: <802a5fbe87ed0dff07f2.1205785417@caffeine.beaverton.ibm.com> <47E026EF.9080108@linux.vnet.ibm.com> <87myovlqea.fsf@caffeine.beaverton.ibm.com> Message-ID: <47E119C0.5030608@linux.vnet.ibm.com> Dan Smith wrote: > JG> And we're okay with that failing? Not questioning the validity, > JG> just confirming intent. > > Yeah, I think so, because it means that either (1) the domain has > already been undefined (which is okay) or (2) that we'll end up with > the domain on both the remote and local machine. Either of these are > better than dropping the domain on the floor (i.e. not having it > defined in either place and it appearing to just, well, disappear. > Agreed? > > It's pretty clear that worst-case is dropping it on the floor, I just wasn't sure what our position was on having a domain on both machines. I suppose there's no data loss, and the user can always go, "What are you doing there?" and get rid of the stale one later. Works for me. -- -Jay From danms at us.ibm.com Wed Mar 19 19:10:11 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 19 Mar 2008 12:10:11 -0700 Subject: [Libvirt-cim] [PATCH] Revert VirtualSystemType change from ComputerSystem Message-ID: # HG changeset patch # User Dan Smith # Date 1205953799 25200 # Node ID bca26ef36f5c53123f43113c4f0564dc06f715fe # Parent 7c94914c7796139bb6afd9a64acde9558216affe Revert VirtualSystemType change from ComputerSystem I misread the profile while writing the previous patch up. This is already done correctly in our VSSD. My bad. Signed-off-by: Dan Smith diff -r 7c94914c7796 -r bca26ef36f5c src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Tue Mar 18 13:29:54 2008 -0700 +++ b/src/Virt_ComputerSystem.c Wed Mar 19 12:09:59 2008 -0700 @@ -301,35 +301,6 @@ static int set_other_id_info(const CMPIB return 1; } -static bool set_type(CMPIInstance *instance) -{ - CMPIObjectPath *op; - CMPIStatus s; - char *prefix = NULL; - bool rc = false; - - op = CMGetObjectPath(instance, &s); - if ((s.rc != CMPI_RC_OK) || (op == NULL)) { - CU_DEBUG("Failed to get OP from CS instance to set type"); - goto out; - } - - prefix = class_prefix_name(CLASSNAME(op)); - if (prefix == NULL) { - CU_DEBUG("Unknown prefix for class: %s", CLASSNAME(op)); - goto out; - } - - CMSetProperty(instance, "VirtualSystemType", - prefix, CMPI_chars); - - rc = true; - out: - free(prefix); - - return rc; -} - /* Populate an instance with information from a domain */ static CMPIStatus set_properties(const CMPIBroker *broker, virDomainPtr dom, @@ -366,10 +337,6 @@ static CMPIStatus set_properties(const C if (!set_other_id_info(broker, uuid, prefix, instance)) { /* Print trace error */ - goto out; - } - - if (!set_type(instance)) { goto out; } From danms at us.ibm.com Thu Mar 20 18:29:06 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 20 Mar 2008 11:29:06 -0700 Subject: [Libvirt-cim] [PATCH] Make IsMigratable return "not migratable" instead of error, unless an error Message-ID: <205b3e4958957713fd45.1206037746@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206037711 25200 # Node ID 205b3e4958957713fd45a211c6229f09af19e243 # Parent c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a Make IsMigratable return "not migratable" instead of error, unless an error really occurred. Log the failure of an individual check for tracking down an error. It really seems that a status message return value to indicate *why* something isn't migratable. Signed-off-by: Dan Smith diff -r c8c0e264c75c -r 205b3e495895 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Thu Mar 20 10:47:48 2008 -0700 +++ b/src/Virt_VSMigrationService.c Thu Mar 20 11:28:31 2008 -0700 @@ -523,6 +523,14 @@ static char *get_parms_file(const CMPIOb return NULL; } +static void log_status(CMPIStatus *s, const char *prefix) +{ + CU_DEBUG("%s: %s", prefix, CMGetCharPtr(s->msg)); + + s->rc = CMPI_RC_OK; + s->msg = NULL; +} + static CMPIStatus vs_migratable(const CMPIObjectPath *ref, CMPIObjectPath *system, const char *destination, @@ -557,8 +565,10 @@ static CMPIStatus vs_migratable(const CM goto out; s = check_hver(conn, dconn); - if (s.rc != CMPI_RC_OK) - goto out; + if (s.rc != CMPI_RC_OK) { + log_status(&s, "Hypervisor version check failed"); + goto out; + } dom = virDomainLookupByName(conn, domain); if (dom == NULL) { @@ -574,13 +584,17 @@ static CMPIStatus vs_migratable(const CM goto out; s = check_caps(conn, dconn); - if (s.rc != CMPI_RC_OK) - goto out; + if (s.rc != CMPI_RC_OK) { + log_status(&s, "Hypervisor capabilities check failed"); + goto out; + } path = get_parms_file(ref, argsin); s = call_external_checks(dom, path); - if (s.rc != CMPI_RC_OK) - goto out; + if (s.rc != CMPI_RC_OK) { + log_status(&s, "An external check failed"); + goto out; + } retcode = CIM_SVPC_RETURN_COMPLETED; cu_statusf(_BROKER, &s, From grendel at linux.vnet.ibm.com Fri Mar 21 13:56:46 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 21 Mar 2008 09:56:46 -0400 Subject: [Libvirt-cim] [PATCH] Revert VirtualSystemType change from ComputerSystem In-Reply-To: References: Message-ID: <47E3BE9E.9050308@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1205953799 25200 > # Node ID bca26ef36f5c53123f43113c4f0564dc06f715fe > # Parent 7c94914c7796139bb6afd9a64acde9558216affe > Revert VirtualSystemType change from ComputerSystem > > I misread the profile while writing the previous patch up. This is > already done correctly in our VSSD. My bad. > > Signed-off-by: Dan Smith > > Betrayed by our fearless leader! Will the team's morale ever recover?! -- -Jay From grendel at linux.vnet.ibm.com Fri Mar 21 14:50:45 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 21 Mar 2008 10:50:45 -0400 Subject: [Libvirt-cim] [PATCH] Make IsMigratable return "not migratable" instead of error, unless an error In-Reply-To: <205b3e4958957713fd45.1206037746@caffeine.beaverton.ibm.com> References: <205b3e4958957713fd45.1206037746@caffeine.beaverton.ibm.com> Message-ID: <47E3CB45.3010408@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206037711 25200 > # Node ID 205b3e4958957713fd45a211c6229f09af19e243 > # Parent c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a > Make IsMigratable return "not migratable" instead of error, unless an error > really occurred. Log the failure of an individual check for tracking down > an error. It really seems that a status message return value to indicate > *why* something isn't migratable. > > Signed-off-by: Dan Smith > > > I'd agree that it would nice to be able to give a little info back. Nice upside to having the log_status function broken out like that is if the clients ever decide they can handle the additional info it will be easy for us to make the change. +1 -- -Jay From danms at us.ibm.com Fri Mar 21 15:29:56 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 21 Mar 2008 08:29:56 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Implement restart-style migration Message-ID: Adds restart migration, which shuts down a guest, moves the config to a remote host, and then restarts the domain. Also includes a fix to domain_online() This seems like a pretty effective and safe way to move a guest around if you don't need it to stay up in the process. From danms at us.ibm.com Fri Mar 21 15:29:58 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 21 Mar 2008 08:29:58 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add restart migration In-Reply-To: Message-ID: <6c2d68b9722a23a94075.1206113398@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206113389 25200 # Node ID 6c2d68b9722a23a94075172270acffad1bbbad6f # Parent c3dca3932e0b9f80778cbd6cbdfa09de4a7632a9 Add restart migration Based on a patch Kaitlin started on before she left and sent to me. Signed-off-by: Dan Smith Signed-off-by: Kaitlin Rupert diff -r c3dca3932e0b -r 6c2d68b9722a src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Fri Mar 21 08:23:06 2008 -0700 +++ b/src/Virt_VSMigrationService.c Fri Mar 21 08:29:49 2008 -0700 @@ -55,6 +55,8 @@ #define CIM_JOBSTATE_RUNNING 4 #define CIM_JOBSTATE_COMPLETE 7 +#define MIGRATE_SHUTDOWN_TIMEOUT 120 + #define METHOD_RETURN(r, v) do { \ uint32_t rc = v; \ CMReturnData(r, (CMPIValue *)&rc, CMPI_uint32); \ @@ -905,6 +907,46 @@ static CMPIStatus handle_migrate(virConn return s; } +static CMPIStatus handle_restart_migrate(virConnectPtr dconn, + virDomainPtr dom, + struct migration_job *job) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret; + int i; + + CU_DEBUG("Shutting down domain for migration"); + ret = virDomainShutdown(dom); + if (ret != 0) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to shutdown guest"); + goto out; + } + + for (i = 0; i < MIGRATE_SHUTDOWN_TIMEOUT; i++) { + if ((i % 30) == 0) { + CU_DEBUG("Polling for shutdown completion..."); + } + + if (!domain_online(dom)) + goto out; + + sleep(1); + } + + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Domain failed to shutdown in %i seconds", + MIGRATE_SHUTDOWN_TIMEOUT); + out: + CU_DEBUG("Domain %s shutdown", + s.rc == CMPI_RC_OK ? "did" : "did NOT"); + + return s; +} + + static CMPIStatus prepare_migrate(virDomainPtr dom, char **xml) { @@ -924,7 +966,8 @@ static CMPIStatus prepare_migrate(virDom static CMPIStatus complete_migrate(virDomainPtr ldom, virConnectPtr rconn, - const char *xml) + const char *xml, + bool restart) { CMPIStatus s = {CMPI_RC_OK, NULL}; virDomainPtr newdom = NULL; @@ -942,6 +985,16 @@ static CMPIStatus complete_migrate(virDo } CU_DEBUG("Defined domain on destination host"); + + if (restart) { + CU_DEBUG("Restarting domain on remote host"); + if (virDomainCreate(newdom) != 0) { + CU_DEBUG("Failed to start domain on remote host"); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to start domain on remote host"); + } + } out: virDomainFree(newdom); @@ -1015,10 +1068,13 @@ static CMPIStatus migrate_vs(struct migr s = handle_migrate(job->conn, dom, VIR_MIGRATE_LIVE, job); break; case CIM_MIGRATE_RESUME: - case CIM_MIGRATE_RESTART: CU_DEBUG("Static migration"); s = handle_migrate(job->conn, dom, 0, job); break; + case CIM_MIGRATE_RESTART: + CU_DEBUG("Restart migration"); + s = handle_restart_migrate(job->conn, dom, job); + break; default: CU_DEBUG("Unsupported migration type (%d)", job->type); cu_statusf(_BROKER, &s, @@ -1030,7 +1086,10 @@ static CMPIStatus migrate_vs(struct migr if (s.rc != CMPI_RC_OK) goto out; - s = complete_migrate(dom, job->conn, xml); + s = complete_migrate(dom, + job->conn, + xml, + job->type == CIM_MIGRATE_RESTART); if (s.rc == CMPI_RC_OK) { CU_DEBUG("Migration succeeded"); } else { From danms at us.ibm.com Fri Mar 21 15:29:57 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 21 Mar 2008 08:29:57 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Make domain_online() re-lookup domain to make sure we're getting fresh info In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1206112986 25200 # Node ID c3dca3932e0b9f80778cbd6cbdfa09de4a7632a9 # Parent 594c9195e59c8025ea18b3d6b5ca43b322db55e1 Make domain_online() re-lookup domain to make sure we're getting fresh info This is necessary if you're using domain_online() in a polling loop. Signed-off-by: Dan Smith diff -r 594c9195e59c -r c3dca3932e0b libxkutil/misc_util.c --- a/libxkutil/misc_util.c Thu Mar 20 13:13:57 2008 -0700 +++ b/libxkutil/misc_util.c Fri Mar 21 08:23:06 2008 -0700 @@ -378,12 +378,25 @@ bool domain_online(virDomainPtr dom) bool domain_online(virDomainPtr dom) { virDomainInfo info; - - if (virDomainGetInfo(dom, &info) != 0) + virDomainPtr _dom; + bool rc; + + _dom = virDomainLookupByName(virDomainGetConnect(dom), + virDomainGetName(dom)); + if (_dom == NULL) { + CU_DEBUG("Unable to re-lookup domain"); return false; - - return (info.state == VIR_DOMAIN_BLOCKED) || - (info.state == VIR_DOMAIN_RUNNING); + } + + if (virDomainGetInfo(_dom, &info) != 0) + rc = false; + else + rc = (info.state == VIR_DOMAIN_BLOCKED) || + (info.state == VIR_DOMAIN_RUNNING) || + (info.state == VIR_DOMAIN_NOSTATE); + virDomainFree(_dom); + + return rc; } int parse_id(const char *id, From danms at us.ibm.com Fri Mar 21 15:41:52 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 21 Mar 2008 08:41:52 -0700 Subject: [Libvirt-cim] [PATCH] Document the Type values in MSD's schema Message-ID: <594c9195e59c8025ea18.1206114112@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206044037 25200 # Node ID 594c9195e59c8025ea18b3d6b5ca43b322db55e1 # Parent 205b3e4958957713fd45a211c6229f09af19e243 Document the Type values in MSD's schema Signed-off-by: Dan Smith diff -r 205b3e495895 -r 594c9195e59c schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Thu Mar 20 11:28:31 2008 -0700 +++ b/schema/VSMigrationSettingData.mof Thu Mar 20 13:13:57 2008 -0700 @@ -1,6 +1,20 @@ // Copyright IBM Corp. 2007 class CIM_VirtualSystemMigrationSettingData : CIM_SettingData { + [ Description( + "MigrationType describes a type of migration operation " + "to be performed.\n" + "A value of 2 - Virtual System is to be migrated in a 'live' " + "manner such that the running of the Virtual System is " + "minimally impacted during the move.\n" + "A value of 3 - Virtual System will be temporarily paused " + "prior to migration and then resume running after it is " + "moved.\n" + "A value of 4 - The Virtual System will be quiesced to a " + "stopped state prior to migration and then restarted after " + "it is moved."), + ValueMap {"0","1","2","3","4"}, + Values { "Unknown", "Other", "Live", "Resume", "Restart" }] uint16 MigrationType; uint16 Priority; From danms at us.ibm.com Fri Mar 21 16:42:07 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 21 Mar 2008 09:42:07 -0700 Subject: [Libvirt-cim] [PATCH] Add kernel/initrd support to Xen_VSSD Message-ID: # HG changeset patch # User Dan Smith # Date 1206117651 25200 # Node ID ff7434bc724db507c23a8c4f9628d82dcae44ec7 # Parent 6c2d68b9722a23a94075172270acffad1bbbad6f Add kernel/initrd support to Xen_VSSD Signed-off-by: Dan Smith diff -r 6c2d68b9722a -r ff7434bc724d schema/VSSD.mof --- a/schema/VSSD.mof Fri Mar 21 08:29:49 2008 -0700 +++ b/schema/VSSD.mof Fri Mar 21 09:40:51 2008 -0700 @@ -15,6 +15,12 @@ class Xen_VirtualSystemSettingData : CIM "para-virtualized mode")] string Bootloader; string BootloaderArgs; + + [Description ("The direct-boot kernel for PV guests not using a bootloader")] + string Kernel; + + [Description ("The direct-boot ramdisk for PV guests not using a bootloader")] + string Ramdisk; [Description ("The device to boot from when in fully-virtualized mode." "One of hd,fd,cdrom.")] diff -r 6c2d68b9722a -r ff7434bc724d src/Virt_VSSD.c --- a/src/Virt_VSSD.c Fri Mar 21 08:29:49 2008 -0700 +++ b/src/Virt_VSSD.c Fri Mar 21 09:40:51 2008 -0700 @@ -70,6 +70,16 @@ static void _set_pv_prop(struct domain * if (dominfo->bootloader_args != NULL) CMSetProperty(inst, "BootloaderArgs", (CMPIValue *)dominfo->bootloader_args, + CMPI_chars); + + if (dominfo->os_info.pv.kernel != NULL) + CMSetProperty(inst, "Kernel", + (CMPIValue *)dominfo->os_info.pv.kernel, + CMPI_chars); + + if (dominfo->os_info.pv.initrd != NULL) + CMSetProperty(inst, "Ramdisk", + (CMPIValue *)dominfo->os_info.pv.initrd, CMPI_chars); } diff -r 6c2d68b9722a -r ff7434bc724d src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Mar 21 08:29:49 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Fri Mar 21 09:40:51 2008 -0700 @@ -90,19 +90,33 @@ static int xenpv_vssd_to_domain(CMPIInst domain->type = DOMAIN_XENPV; + free(domain->bootloader); ret = cu_get_str_prop(inst, "Bootloader", &val); - if (ret != CMPI_RC_OK) - val = ""; - - free(domain->bootloader); - domain->bootloader = strdup(val); - + if (ret == CMPI_RC_OK) + domain->bootloader = strdup(val); + else + domain->bootloader = NULL; + + free(domain->bootloader_args); ret = cu_get_str_prop(inst, "BootloaderArgs", &val); - if (ret != CMPI_RC_OK) - val = ""; - - free(domain->bootloader_args); - domain->bootloader_args = strdup(val); + if (ret == CMPI_RC_OK) + domain->bootloader_args = strdup(val); + else + domain->bootloader_args = NULL; + + free(domain->os_info.pv.kernel); + ret = cu_get_str_prop(inst, "Kernel", &val); + if (ret == CMPI_RC_OK) + domain->os_info.pv.kernel = strdup(val); + else + domain->os_info.pv.kernel = NULL; + + free(domain->os_info.pv.initrd); + ret = cu_get_str_prop(inst, "Ramdisk", &val); + if (ret == CMPI_RC_OK) + domain->os_info.pv.initrd = strdup(val); + else + domain->os_info.pv.initrd = NULL; return 1; } From danms at us.ibm.com Mon Mar 24 18:33:38 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 11:33:38 -0700 Subject: [Libvirt-cim] [PATCH] Relax permissions on schema install temporary directory Message-ID: <6cc2fd98582341e8a506.1206383618@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206375916 25200 # Node ID 6cc2fd98582341e8a5068efaa19fb6dc2f61c140 # Parent ff7434bc724db507c23a8c4f9628d82dcae44ec7 Relax permissions on schema install temporary directory This eliminates a failure if the pegasus utilities are setuid to the Pegasus user Signed-off-by: Dan Smith diff -r ff7434bc724d -r 6cc2fd985823 base_schema/install_base_schema.sh.in --- a/base_schema/install_base_schema.sh.in Fri Mar 21 09:40:51 2008 -0700 +++ b/base_schema/install_base_schema.sh.in Mon Mar 24 09:25:16 2008 -0700 @@ -6,6 +6,7 @@ SCHEMA_VERSION="2.16" SCHEMA_VERSION="2.16" TMPDIR=$(mktemp -d /tmp/cim_schema.XXXXX) +chmod a+x $TMPDIR if [ ! -z "$CIM_DEBUG" ]; then set -x From danms at us.ibm.com Mon Mar 24 19:24:15 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 12:24:15 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Add first bits of LXC support Message-ID: This set adds very preliminary support to libvirt-cim for LXC guests. Added are changes to the ComputerSystem, HostSystem, and VSSD schema as well as the change required to make misc_utils capable of generation lxc:// URIs. From danms at us.ibm.com Mon Mar 24 19:24:16 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 12:24:16 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Add LXC support to ComputerSystem, HostSystem, and VSMS schema In-Reply-To: Message-ID: <9a53365f6ff549292ab8.1206386656@elm3b25.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206386444 25200 # Node ID 9a53365f6ff549292ab8148a9954c534c187870f # Parent c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a Add LXC support to ComputerSystem, HostSystem, and VSMS schema Signed-off-by: Dan Smith diff -r c8c0e264c75c -r 9a53365f6ff5 schema/ComputerSystem.mof --- a/schema/ComputerSystem.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystem.mof Mon Mar 24 12:20:44 2008 -0700 @@ -26,3 +26,16 @@ class KVM_ComputerSystem : CIM_ComputerS }; +[Description ( + "A class derived from CIM_ComputerSystem to represent " + "the LXC virtual machines running on the system."), + Provider("cmpi::Virt_ComputerSystem") +] +class LXC_ComputerSystem : CIM_ComputerSystem +{ + + [Description("UUID assigned to this virtual machine.")] + string UUID; + +}; + diff -r c8c0e264c75c -r 9a53365f6ff5 schema/ComputerSystem.registration --- a/schema/ComputerSystem.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystem.registration Mon Mar 24 12:20:44 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method KVM_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method +LXC_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method \ No newline at end of file diff -r c8c0e264c75c -r 9a53365f6ff5 schema/HostSystem.mof --- a/schema/HostSystem.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostSystem.mof Mon Mar 24 12:20:44 2008 -0700 @@ -18,3 +18,12 @@ class KVM_HostSystem : CIM_ComputerSyste { }; +[Description ( + "A class derived from CIM_ComputerSystem to represent " + "the LXC host system."), + Provider("cmpi::Virt_HostSystem") +] +class LXC_HostSystem : CIM_ComputerSystem +{ +}; + diff -r c8c0e264c75c -r 9a53365f6ff5 schema/HostSystem.registration --- a/schema/HostSystem.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostSystem.registration Mon Mar 24 12:20:44 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_HostSystem root/virt Virt_HostSystem Virt_HostSystem instance KVM_HostSystem root/virt Virt_HostSystem Virt_HostSystem instance +LXC_HostSystem root/virt Virt_HostSystem Virt_HostSystem instance diff -r c8c0e264c75c -r 9a53365f6ff5 schema/VirtualSystemManagementService.mof --- a/schema/VirtualSystemManagementService.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemManagementService.mof Mon Mar 24 12:20:44 2008 -0700 @@ -9,3 +9,8 @@ class KVM_VirtualSystemManagementService class KVM_VirtualSystemManagementService : CIM_VirtualSystemManagementService { }; + +[Provider("cmpi::Virt_VirtualSystemManagementService")] +class LXC_VirtualSystemManagementService : CIM_VirtualSystemManagementService +{ +}; diff -r c8c0e264c75c -r 9a53365f6ff5 schema/VirtualSystemManagementService.registration --- a/schema/VirtualSystemManagementService.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemManagementService.registration Mon Mar 24 12:20:44 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemManagementService root/virt Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance KVM_VirtualSystemManagementService root/virt Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance +LXC_VirtualSystemManagementService root/virt Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance From danms at us.ibm.com Mon Mar 24 19:24:17 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 12:24:17 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add LXC support to misc_utils functions In-Reply-To: Message-ID: <08bd3393c777cb87b8bf.1206386657@elm3b25.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206386465 25200 # Node ID 08bd3393c777cb87b8bfc4ad5d8ef0ceedb12590 # Parent 9a53365f6ff549292ab8148a9954c534c187870f Add LXC support to misc_utils functions Signed-off-by: Dan Smith diff -r 9a53365f6ff5 -r 08bd3393c777 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Mon Mar 24 12:20:44 2008 -0700 +++ b/libxkutil/misc_util.c Mon Mar 24 12:21:05 2008 -0700 @@ -46,6 +46,8 @@ static const char *cn_to_uri(const char return "xen"; else if (STARTS_WITH(classname, "KVM")) return "qemu:///system"; + else if (STARTS_WITH(classname, "LXC")) + return "lxc:///system"; else return NULL; } @@ -200,6 +202,8 @@ const char *pfx_from_conn(virConnectPtr pfx = "Xen"; else if (STARTS_WITH(uri, "qemu")) pfx = "KVM"; + else if (STARTS_WITH(uri, "lxc")) + pfx = "LXC"; free(uri); From peter.mellquist at hp.com Mon Mar 24 20:29:34 2008 From: peter.mellquist at hp.com (Mellquist, Peter) Date: Mon, 24 Mar 2008 20:29:34 +0000 Subject: [Libvirt-cim] State of libvirt-cim project Message-ID: Hello, I am interested in the current status of this project. Is Xen the only hypervisor supported at this point? What DMTF virtualization profiles are currently complete?, which ones are not? What level of testing / verification exists? Are both OpenPegasus and SFCB fully supported? What areas of contribution are needed? Thanks and sorry for all the questions. Peter Peter Mellquist Hewlett-Packard Company Open Source and Linux Organization peter.mellquist at hp.com From danms at us.ibm.com Mon Mar 24 20:56:29 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 13:56:29 -0700 Subject: [Libvirt-cim] State of libvirt-cim project References: Message-ID: <87prtj3koy.fsf@caffeine.beaverton.ibm.com> PM> Hello, Hi Peter! PM> Is Xen the only hypervisor supported at this point? No, KVM is supported as well, although it is definitely not as "heavily traveled" as Xen so far. We're in the process of adding Linux Containers support as well (see my patch set from earlier today), as support materializes in libvirt. PM> What DMTF virtualization profiles are currently complete?, which PM> ones are not? That's a hard question to answer, IMHO. I think we're pretty well covered on the SVP and VSP profiles, and we use the relevant bits of the RAP, GDRV profile, VS migration, etc. For more details on the profiles we claim support for, see profiles.h in the source tree: http://libvirt.org/hg/libvirt-cim/file/c8c0e264c75c/src/profiles.h PM> What level of testing / verification exists? We have some internal test-suite right now that we plan to publish very soon. PM> Are both OpenPegasus and SFCB fully supported? Yes. We do most of our testing on Pegasus, but SFCB gets a fair bit of use as well. If you find something that works in one and not the other, we'll fix it. PM> What areas of contribution are needed? Testing and exercising KVM would be a good thing, if you're interested in using it. Any additional platform support that you want (OpenVZ, for example) would be good to add. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 24 20:56:26 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 13:56:26 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add LXC support to misc_utils functions In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1206390944 25200 # Node ID be1948c5fb0eb677fd45b177012b49674bee3da5 # Parent 560f30acf513ef3738aa0265c3a9c65841c53393 Add LXC support to misc_utils functions Signed-off-by: Dan Smith diff -r 560f30acf513 -r be1948c5fb0e libxkutil/misc_util.c --- a/libxkutil/misc_util.c Mon Mar 24 13:35:31 2008 -0700 +++ b/libxkutil/misc_util.c Mon Mar 24 13:35:44 2008 -0700 @@ -46,6 +46,8 @@ static const char *cn_to_uri(const char return "xen"; else if (STARTS_WITH(classname, "KVM")) return "qemu:///system"; + else if (STARTS_WITH(classname, "LXC")) + return "lxc:///system"; else return NULL; } @@ -200,6 +202,8 @@ const char *pfx_from_conn(virConnectPtr pfx = "Xen"; else if (STARTS_WITH(uri, "qemu")) pfx = "KVM"; + else if (STARTS_WITH(uri, "lxc")) + pfx = "LXC"; free(uri); From danms at us.ibm.com Mon Mar 24 20:56:24 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 13:56:24 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] (#2) Add first bits of LXC support Message-ID: Updated the previous set to include all LXC schema changes From danms at us.ibm.com Mon Mar 24 20:56:25 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 24 Mar 2008 13:56:25 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Add LXC support to schema In-Reply-To: Message-ID: <560f30acf513ef3738aa.1206392185@elm3b25.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206390931 25200 # Node ID 560f30acf513ef3738aa0265c3a9c65841c53393 # Parent c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a Add LXC support to schema There are definitely some bits that need to be revisited here, but this at least gives us an LXC class for everything. Signed-off-by: Dan Smith diff -r c8c0e264c75c -r 560f30acf513 schema/AllocationCapabilities.mof --- a/schema/AllocationCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/AllocationCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -10,3 +10,8 @@ class KVM_AllocationCapabilities : CIM_A { }; +[Provider("cmpi::Virt_AllocationCapabilities")] +class LXC_AllocationCapabilities : CIM_AllocationCapabilities +{ +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/AllocationCapabilities.registration --- a/schema/AllocationCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/AllocationCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_AllocationCapabilities root/virt Virt_AllocationCapabilities Virt_AllocationCapabilities instance KVM_AllocationCapabilities root/virt Virt_AllocationCapabilities Virt_AllocationCapabilities instance +LXC_AllocationCapabilities root/virt Virt_AllocationCapabilities Virt_AllocationCapabilities instance diff -r c8c0e264c75c -r 560f30acf513 schema/ComputerSystem.mof --- a/schema/ComputerSystem.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystem.mof Mon Mar 24 13:35:31 2008 -0700 @@ -26,3 +26,16 @@ class KVM_ComputerSystem : CIM_ComputerS }; +[Description ( + "A class derived from CIM_ComputerSystem to represent " + "the LXC virtual machines running on the system."), + Provider("cmpi::Virt_ComputerSystem") +] +class LXC_ComputerSystem : CIM_ComputerSystem +{ + + [Description("UUID assigned to this virtual machine.")] + string UUID; + +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/ComputerSystem.registration --- a/schema/ComputerSystem.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystem.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method KVM_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method +LXC_ComputerSystem root/virt Virt_ComputerSystem Virt_ComputerSystem instance method diff -r c8c0e264c75c -r 560f30acf513 schema/ComputerSystemIndication.mof --- a/schema/ComputerSystemIndication.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystemIndication.mof Mon Mar 24 13:35:31 2008 -0700 @@ -41,3 +41,24 @@ class KVM_ComputerSystemModifiedIndicati class KVM_ComputerSystemModifiedIndication : CIM_InstModification { }; + +[Description ("LXC_ComputerSystem created"), + Provider("cmpi::Virt_ComputerSystemIndication") +] +class LXC_ComputerSystemCreatedIndication : CIM_InstCreation +{ +}; + +[Description ("LXC_ComputerSystem deleted"), + Provider("cmpi::Virt_ComputerSystemIndication") +] +class LXC_ComputerSystemDeletedIndication : CIM_InstDeletion +{ +}; + +[Description ("LXC_ComputerSystem modified"), + Provider("cmpi::Virt_ComputerSystemIndication") +] +class LXC_ComputerSystemModifiedIndication : CIM_InstModification +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ComputerSystemIndication.registration --- a/schema/ComputerSystemIndication.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystemIndication.registration Mon Mar 24 13:35:31 2008 -0700 @@ -6,3 +6,4 @@ KVM_ComputerSystemCreatedIndication root KVM_ComputerSystemCreatedIndication root/virt Virt_ComputerSystemIndicationProvider Virt_ComputerSystemIndication indication method KVM_ComputerSystemDeletedIndication root/virt Virt_ComputerSystemIndicationProvider Virt_ComputerSystemIndication indication method KVM_ComputerSystemModifiedIndication root/virt Virt_ComputerSystemIndicationProvider Virt_ComputerSystemIndication indication method +LXC_ComputerSystemModifiedIndication root/virt Virt_ComputerSystemIndicationProvider Virt_ComputerSystemIndication indication method diff -r c8c0e264c75c -r 560f30acf513 schema/ComputerSystemMigrationIndication.mof --- a/schema/ComputerSystemMigrationIndication.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystemMigrationIndication.mof Mon Mar 24 13:35:31 2008 -0700 @@ -12,6 +12,14 @@ class Xen_ComputerSystemMigrationJobCrea Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] class KVM_ComputerSystemMigrationJobCreatedIndication : CIM_InstCreation +{ + uint32 RaiseIndication([IN] CIM_InstCreation REF TheIndication); +}; + +[Description ("LXC_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class LXC_ComputerSystemMigrationJobCreatedIndication : CIM_InstCreation { uint32 RaiseIndication([IN] CIM_InstCreation REF TheIndication); }; @@ -32,6 +40,14 @@ class KVM_ComputerSystemMigrationJobModi uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); }; +[Description ("LXC_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class LXC_ComputerSystemMigrationJobModifiedIndication : CIM_InstModification +{ + uint32 RaiseIndication([IN] CIM_InstModification REF TheIndication); +}; + [Description ("Xen_ComputerSystem migration status"), Provider("cmpi::Virt_ComputerSystemMigrationIndication") ] @@ -47,3 +63,11 @@ class KVM_ComputerSystemMigrationJobDele { uint32 RaiseIndication([IN] CIM_InstDeletion REF TheIndication); }; + +[Description ("LXC_ComputerSystem migration status"), + Provider("cmpi::Virt_ComputerSystemMigrationIndication") +] +class LXC_ComputerSystemMigrationJobDeletedIndication : CIM_InstDeletion +{ + uint32 RaiseIndication([IN] CIM_InstDeletion REF TheIndication); +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ComputerSystemMigrationIndication.registration --- a/schema/ComputerSystemMigrationIndication.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ComputerSystemMigrationIndication.registration Mon Mar 24 13:35:31 2008 -0700 @@ -6,3 +6,4 @@ KVM_ComputerSystemMigrationJobCreatedInd KVM_ComputerSystemMigrationJobCreatedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method KVM_ComputerSystemMigrationJobModifiedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method KVM_ComputerSystemMigrationJobDeletedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method +LXC_ComputerSystemMigrationJobDeletedIndication root/virt Virt_ComputerSystemMigrationIndicationProvider Virt_ComputerSystemMigrationIndication indication method diff -r c8c0e264c75c -r 560f30acf513 schema/DiskPool.mof --- a/schema/DiskPool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/DiskPool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -10,3 +10,8 @@ class KVM_DiskPool : CIM_ResourcePool { }; +[Provider("cmpi::Virt_DevicePool")] +class LXC_DiskPool : CIM_ResourcePool +{ +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/DiskPool.registration --- a/schema/DiskPool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/DiskPool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_DiskPool root/virt Virt_DevicePool Virt_DevicePool instance KVM_DiskPool root/virt Virt_DevicePool Virt_DevicePool instance +LXC_DiskPool root/virt Virt_DevicePool Virt_DevicePool instance diff -r c8c0e264c75c -r 560f30acf513 schema/ElementAllocatedFromPool.mof --- a/schema/ElementAllocatedFromPool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementAllocatedFromPool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -13,3 +13,10 @@ class KVM_ElementAllocatedFromPool : CIM class KVM_ElementAllocatedFromPool : CIM_ElementAllocatedFromPool { }; + +[Association, + Provider("cmpi::Virt_ElementAllocatedFromPool") +] +class LXC_ElementAllocatedFromPool : CIM_ElementAllocatedFromPool +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ElementAllocatedFromPool.registration --- a/schema/ElementAllocatedFromPool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementAllocatedFromPool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ElementAllocatedFromPool root/virt Virt_ElementAllocatedFromPool Virt_ElementAllocatedFromPool association KVM_ElementAllocatedFromPool root/virt Virt_ElementAllocatedFromPool Virt_ElementAllocatedFromPool association +LXC_ElementAllocatedFromPool root/virt Virt_ElementAllocatedFromPool Virt_ElementAllocatedFromPool association diff -r c8c0e264c75c -r 560f30acf513 schema/ElementCapabilities.mof --- a/schema/ElementCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,12 @@ class KVM_ElementCapabilities : CIM_Elem { }; +[Association, + Description ( + "A class to associate a ManagedElement with its Capabilities."), + Provider("cmpi::Virt_ElementCapabilities") +] +class LXC_ElementCapabilities : CIM_ElementCapabilities +{ +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/ElementCapabilities.registration --- a/schema/ElementCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ElementCapabilities root/virt Virt_ElementCapabilities Virt_ElementCapabilities association KVM_ElementCapabilities root/virt Virt_ElementCapabilities Virt_ElementCapabilities association +LXC_ElementCapabilities root/virt Virt_ElementCapabilities Virt_ElementCapabilities association diff -r c8c0e264c75c -r 560f30acf513 schema/ElementConformsToProfile.mof --- a/schema/ElementConformsToProfile.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementConformsToProfile.mof Mon Mar 24 13:35:31 2008 -0700 @@ -26,3 +26,15 @@ class KVM_ElementConformsToProfile : CIM }; +[Association, + Description ( + "A class to associate a ManagedElement with its RegisteredProfile."), + Provider("cmpi::Virt_ElementConformsToProfile") +] +class LXC_ElementConformsToProfile : CIM_ElementConformsToProfile +{ + + [Override ("ConformantStandard")] + LXC_RegisteredProfile REF ConformantStandard; + +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ElementConformsToProfile.registration --- a/schema/ElementConformsToProfile.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementConformsToProfile.registration Mon Mar 24 13:35:31 2008 -0700 @@ -4,3 +4,4 @@ Xen_ElementConformsToProfile root/intero Xen_ElementConformsToProfile root/interop Virt_ElementConformsToProfile Virt_ElementConformsToProfile association KVM_ElementConformsToProfile root/virt Virt_ElementConformsToProfile Virt_ElementConformsToProfile association KVM_ElementConformsToProfile root/interop Virt_ElementConformsToProfile Virt_ElementConformsToProfile association +LXC_ElementConformsToProfile root/interop Virt_ElementConformsToProfile Virt_ElementConformsToProfile association diff -r c8c0e264c75c -r 560f30acf513 schema/ElementSettingData.mof --- a/schema/ElementSettingData.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementSettingData.mof Mon Mar 24 13:35:31 2008 -0700 @@ -13,3 +13,10 @@ class KVM_ElementSettingData : CIM_Eleme class KVM_ElementSettingData : CIM_ElementSettingData { }; + +[Association, + Provider("cmpi::Virt_ElementSettingData") +] +class LXC_ElementSettingData : CIM_ElementSettingData +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ElementSettingData.registration --- a/schema/ElementSettingData.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ElementSettingData.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData association KVM_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData association +LXC_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData association diff -r c8c0e264c75c -r 560f30acf513 schema/EnabledLogicalElementCapabilities.mof --- a/schema/EnabledLogicalElementCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/EnabledLogicalElementCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,11 @@ class KVM_EnabledLogicalElementCapabilit { }; +[Description ( + "A class derived from CIM_Capabilities to represent " + "the changes that can be made to a started LXC virtual system"), + Provider("cmpi::Virt_EnabledLogicalElementCapabilities") +] +class LXC_EnabledLogicalElementCapabilities : CIM_EnabledLogicalElementCapabilities +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/EnabledLogicalElementCapabilities.registration --- a/schema/EnabledLogicalElementCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/EnabledLogicalElementCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_EnabledLogicalElementCapabilities root/virt Virt_EnabledLogicalElementCapabilities Virt_EnabledLogicalElementCapabilities instance KVM_EnabledLogicalElementCapabilities root/virt Virt_EnabledLogicalElementCapabilities Virt_EnabledLogicalElementCapabilities instance +LXC_EnabledLogicalElementCapabilities root/virt Virt_EnabledLogicalElementCapabilities Virt_EnabledLogicalElementCapabilities instance diff -r c8c0e264c75c -r 560f30acf513 schema/HostSystem.mof --- a/schema/HostSystem.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostSystem.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,11 @@ class KVM_HostSystem : CIM_ComputerSyste { }; +[Description ( + "A class derived from CIM_ComputerSystem to represent " + "the LXC host system."), + Provider("cmpi::Virt_HostSystem") +] +class LXC_HostSystem : CIM_ComputerSystem +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/HostSystem.registration --- a/schema/HostSystem.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostSystem.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_HostSystem root/virt Virt_HostSystem Virt_HostSystem instance KVM_HostSystem root/virt Virt_HostSystem Virt_HostSystem instance +LXC_HostSystem root/virt Virt_HostSystem Virt_HostSystem instance diff -r c8c0e264c75c -r 560f30acf513 schema/HostedDependency.mof --- a/schema/HostedDependency.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostedDependency.mof Mon Mar 24 13:35:31 2008 -0700 @@ -19,3 +19,13 @@ class KVM_HostedDependency : CIM_HostedD class KVM_HostedDependency : CIM_HostedDependency { }; + +[Association, + Description ( + "HostedDependency defines a ManagedElement in the context of " + "another ManagedElement in which it resides."), + Provider("cmpi::Virt_HostedDependency") +] +class LXC_HostedDependency : CIM_HostedDependency +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/HostedDependency.registration --- a/schema/HostedDependency.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostedDependency.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_HostedDependency root/virt Virt_HostedDependency Virt_HostedDependency association KVM_HostedDependency root/virt Virt_HostedDependency Virt_HostedDependency association +LXC_HostedDependency root/virt Virt_HostedDependency Virt_HostedDependency association diff -r c8c0e264c75c -r 560f30acf513 schema/HostedResourcePool.mof --- a/schema/HostedResourcePool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostedResourcePool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -16,4 +16,13 @@ class Xen_HostedResourcePool : CIM_Hoste ] class KVM_HostedResourcePool : CIM_HostedResourcePool { -}; \ No newline at end of file +}; + +[Association, + Description ( + "Associates a host system to its resource pools"), + Provider("cmpi::Virt_HostedResourcePool") +] +class LXC_HostedResourcePool : CIM_HostedResourcePool +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/HostedResourcePool.registration --- a/schema/HostedResourcePool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostedResourcePool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association -KVM_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association \ No newline at end of file +KVM_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool associationLXC_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association diff -r c8c0e264c75c -r 560f30acf513 schema/HostedService.mof --- a/schema/HostedService.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostedService.mof Mon Mar 24 13:35:31 2008 -0700 @@ -13,3 +13,10 @@ class KVM_HostedService : CIM_HostedServ class KVM_HostedService : CIM_HostedService { }; + +[Association, + Provider("cmpi::Virt_HostedService") +] +class LXC_HostedService : CIM_HostedService +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/HostedService.registration --- a/schema/HostedService.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/HostedService.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_HostedService root/virt Virt_HostedService Virt_HostedService association KVM_HostedService root/virt Virt_HostedService Virt_HostedService association +LXC_HostedService root/virt Virt_HostedService Virt_HostedService association diff -r c8c0e264c75c -r 560f30acf513 schema/LogicalDisk.mof --- a/schema/LogicalDisk.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/LogicalDisk.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,12 @@ class KVM_LogicalDisk : CIM_LogicalDisk { }; +[Description ( + "A class derived from CIM_LogicalDisk to represent " + "the KVM virtual disks on the system."), + Provider("cmpi::Virt_Device") +] +class LXC_LogicalDisk : CIM_LogicalDisk +{ +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/LogicalDisk.registration --- a/schema/LogicalDisk.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/LogicalDisk.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_LogicalDisk root/virt Virt_Device Virt_Device instance KVM_LogicalDisk root/virt Virt_Device Virt_Device instance +LXC_LogicalDisk root/virt Virt_Device Virt_Device instance diff -r c8c0e264c75c -r 560f30acf513 schema/Memory.mof --- a/schema/Memory.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/Memory.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,11 @@ class KVM_Memory : CIM_Memory { }; +[Description ( + "A class derived from CIM_Memory to represent " + "the KVM virtual memory."), + Provider("cmpi::Virt_Device") +] +class LXC_Memory : CIM_Memory +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/Memory.registration --- a/schema/Memory.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/Memory.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_Memory root/virt Virt_Device Virt_Device instance KVM_Memory root/virt Virt_Device Virt_Device instance +LXC_Memory root/virt Virt_Device Virt_Device instance diff -r c8c0e264c75c -r 560f30acf513 schema/MemoryPool.mof --- a/schema/MemoryPool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/MemoryPool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -10,3 +10,7 @@ class KVM_MemoryPool : CIM_ResourcePool { }; +[Provider("cmpi::Virt_DevicePool")] +class LXC_MemoryPool : CIM_ResourcePool +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/MemoryPool.registration --- a/schema/MemoryPool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/MemoryPool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_MemoryPool root/virt Virt_DevicePool Virt_DevicePool instance KVM_MemoryPool root/virt Virt_DevicePool Virt_DevicePool instance +LXC_MemoryPool root/virt Virt_DevicePool Virt_DevicePool instance diff -r c8c0e264c75c -r 560f30acf513 schema/NetPool.mof --- a/schema/NetPool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/NetPool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -10,3 +10,7 @@ class KVM_NetworkPool : CIM_ResourcePool { }; +[Provider("cmpi::Virt_DevicePool")] +class LXC_NetworkPool : CIM_ResourcePool +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/NetPool.registration --- a/schema/NetPool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/NetPool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance -KVM_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance \ No newline at end of file +KVM_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instanceLXC_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance diff -r c8c0e264c75c -r 560f30acf513 schema/NetworkPort.mof --- a/schema/NetworkPort.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/NetworkPort.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,11 @@ class KVM_NetworkPort : CIM_NetworkPort { }; +[Description ( + "A class derived from CIM_NetworkPort to represent " + "the LXC virtual network interfaces on the system."), + Provider("cmpi::Virt_Device") +] +class LXC_NetworkPort : CIM_NetworkPort +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/NetworkPort.registration --- a/schema/NetworkPort.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/NetworkPort.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_NetworkPort root/virt Virt_Device Virt_Device instance KVM_NetworkPort root/virt Virt_Device Virt_Device instance +LXC_NetworkPort root/virt Virt_Device Virt_Device instance diff -r c8c0e264c75c -r 560f30acf513 schema/Processor.mof --- a/schema/Processor.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/Processor.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,11 @@ class KVM_Processor : CIM_Processor { }; +[Description ( + "A class derived from CIM_Processor to represent " + "the LXC virtual processors."), + Provider("cmpi::Virt_Device") +] +class LXC_Processor : CIM_Processor +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/Processor.registration --- a/schema/Processor.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/Processor.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_Processor root/virt Virt_Device Virt_Device instance KVM_Processor root/virt Virt_Device Virt_Device instance +LXC_Processor root/virt Virt_Device Virt_Device instance diff -r c8c0e264c75c -r 560f30acf513 schema/ProcessorPool.mof --- a/schema/ProcessorPool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ProcessorPool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -10,3 +10,7 @@ class KVM_ProcessorPool : CIM_ResourcePo { }; +[Provider("cmpi::Virt_DevicePool")] +class LXC_ProcessorPool : CIM_ResourcePool +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ProcessorPool.registration --- a/schema/ProcessorPool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ProcessorPool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ProcessorPool root/virt Virt_DevicePool Virt_DevicePool instance KVM_ProcessorPool root/virt Virt_DevicePool Virt_DevicePool instance +LXC_ProcessorPool root/virt Virt_DevicePool Virt_DevicePool instance diff -r c8c0e264c75c -r 560f30acf513 schema/ReferencedProfile.mof --- a/schema/ReferencedProfile.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ReferencedProfile.mof Mon Mar 24 13:35:31 2008 -0700 @@ -32,3 +32,18 @@ class KVM_ReferencedProfile : CIM_Refere }; +[Association, + Description ( + "Associates a RegisteredProfile with its scoping RegisteredProfile."), + Provider("cmpi::Virt_ReferencedProfile") +] +class LXC_ReferencedProfile : CIM_ReferencedProfile +{ + + [Override ("Antecedent")] + LXC_RegisteredProfile REF Antecedent; + + [Override ("Dependent")] + LXC_RegisteredProfile REF Dependent; + +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ReferencedProfile.registration --- a/schema/ReferencedProfile.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ReferencedProfile.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association KVM_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association +LXC_ReferencedProfile root/interop Virt_ReferencedProfile Virt_ReferencedProfile association diff -r c8c0e264c75c -r 560f30acf513 schema/RegisteredProfile.mof --- a/schema/RegisteredProfile.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/RegisteredProfile.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,12 @@ class KVM_RegisteredProfile : CIM_Regist { }; +[Description ( + "A class derived from CIM_RegisteredProfile to represent " + "an advertised conformant profile."), + Provider("cmpi::Virt_RegisteredProfile") +] +class LXC_RegisteredProfile : CIM_RegisteredProfile +{ +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/RegisteredProfile.registration --- a/schema/RegisteredProfile.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/RegisteredProfile.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_RegisteredProfile root/interop Virt_RegisteredProfile Virt_RegisteredProfile instance KVM_RegisteredProfile root/interop Virt_RegisteredProfile Virt_RegisteredProfile instance +LXC_RegisteredProfile root/interop Virt_RegisteredProfile Virt_RegisteredProfile instance diff -r c8c0e264c75c -r 560f30acf513 schema/ResourceAllocationFromPool.mof --- a/schema/ResourceAllocationFromPool.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourceAllocationFromPool.mof Mon Mar 24 13:35:31 2008 -0700 @@ -13,3 +13,10 @@ class KVM_ResourceAllocationFromPool : C class KVM_ResourceAllocationFromPool : CIM_ResourceAllocationFromPool { }; + +[Association, + Provider("cmpi::Virt_ResourceAllocationFromPool") +] +class LXC_ResourceAllocationFromPool : CIM_ResourceAllocationFromPool +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ResourceAllocationFromPool.registration --- a/schema/ResourceAllocationFromPool.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourceAllocationFromPool.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association -KVM_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association \ No newline at end of file +KVM_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool associationLXC_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association diff -r c8c0e264c75c -r 560f30acf513 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourceAllocationSettingData.mof Mon Mar 24 13:35:31 2008 -0700 @@ -5,6 +5,10 @@ class Xen_ResourceAllocationSettingData }; class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData +{ +}; + +class LXC_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { }; @@ -30,6 +34,13 @@ class KVM_DiskResourceAllocationSettingD }; +[Description ("LXC virtual disk configuration"), + Provider("cmpi::Virt_RASD") +] +class LXC_DiskResourceAllocationSettingData : LXC_ResourceAllocationSettingData +{ +}; + [Description ("Xen virtual network configuration"), Provider("cmpi::Virt_RASD") ] @@ -52,6 +63,13 @@ class KVM_NetResourceAllocationSettingDa }; +[Description ("LXC virtual network configuration"), + Provider("cmpi::Virt_RASD") +] +class LXC_NetResourceAllocationSettingData : LXC_ResourceAllocationSettingData +{ +}; + [Description ("Xen virtual processor"), Provider("cmpi::Virt_RASD") ] @@ -63,6 +81,13 @@ class Xen_ProcResourceAllocationSettingD Provider("cmpi::Virt_RASD") ] class KVM_ProcResourceAllocationSettingData : KVM_ResourceAllocationSettingData +{ +}; + +[Description ("LXC virtual processor"), + Provider("cmpi::Virt_RASD") +] +class LXC_ProcResourceAllocationSettingData : LXC_ResourceAllocationSettingData { }; @@ -79,3 +104,10 @@ class KVM_MemResourceAllocationSettingDa class KVM_MemResourceAllocationSettingData : KVM_ResourceAllocationSettingData { }; + +[Description ("LXC virtual memory"), + Provider("cmpi::Virt_RASD") +] +class LXC_MemResourceAllocationSettingData : LXC_ResourceAllocationSettingData +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ResourceAllocationSettingData.registration --- a/schema/ResourceAllocationSettingData.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourceAllocationSettingData.registration Mon Mar 24 13:35:31 2008 -0700 @@ -8,3 +8,4 @@ KVM_NetResourceAllocationSettingData roo KVM_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance KVM_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +LXC_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance diff -r c8c0e264c75c -r 560f30acf513 schema/ResourcePoolConfigurationCapabilities.mof --- a/schema/ResourcePoolConfigurationCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourcePoolConfigurationCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -9,3 +9,8 @@ class KVM_ResourcePoolConfigurationCapab class KVM_ResourcePoolConfigurationCapabilities : CIM_ResourcePoolConfigurationCapabilities { }; + +[Provider("cmpi::Virt_ResourcePoolConfigurationCapabilities")] +class LXC_ResourcePoolConfigurationCapabilities : CIM_ResourcePoolConfigurationCapabilities +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ResourcePoolConfigurationCapabilities.registration --- a/schema/ResourcePoolConfigurationCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourcePoolConfigurationCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance -KVM_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance \ No newline at end of file +KVM_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instanceLXC_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance diff -r c8c0e264c75c -r 560f30acf513 schema/ResourcePoolConfigurationService.mof --- a/schema/ResourcePoolConfigurationService.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourcePoolConfigurationService.mof Mon Mar 24 13:35:31 2008 -0700 @@ -9,3 +9,8 @@ class KVM_ResourcePoolConfigurationServi class KVM_ResourcePoolConfigurationService : CIM_ResourcePoolConfigurationService { }; + +[Provider("cmpi::Virt_ResourcePoolConfigurationService")] +class LXC_ResourcePoolConfigurationService : CIM_ResourcePoolConfigurationService +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/ResourcePoolConfigurationService.registration --- a/schema/ResourcePoolConfigurationService.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/ResourcePoolConfigurationService.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method -KVM_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method \ No newline at end of file +KVM_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance methodLXC_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method diff -r c8c0e264c75c -r 560f30acf513 schema/SettingsDefineCapabilities.mof --- a/schema/SettingsDefineCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/SettingsDefineCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -14,3 +14,10 @@ class KVM_SettingsDefineCapabilities : C { }; +[Association, + Provider("cmpi::Virt_SettingsDefineCapabilities") +] +class LXC_SettingsDefineCapabilities : CIM_SettingsDefineCapabilities +{ +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/SettingsDefineCapabilities.registration --- a/schema/SettingsDefineCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/SettingsDefineCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_SettingsDefineCapabilities root/virt Virt_SettingsDefineCapabilities Virt_SettingsDefineCapabilities association KVM_SettingsDefineCapabilities root/virt Virt_SettingsDefineCapabilities Virt_SettingsDefineCapabilities association +LXC_SettingsDefineCapabilities root/virt Virt_SettingsDefineCapabilities Virt_SettingsDefineCapabilities association diff -r c8c0e264c75c -r 560f30acf513 schema/SettingsDefineState.mof --- a/schema/SettingsDefineState.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/SettingsDefineState.mof Mon Mar 24 13:35:31 2008 -0700 @@ -12,4 +12,11 @@ class Xen_SettingsDefineState : CIM_Sett ] class KVM_SettingsDefineState : CIM_SettingsDefineState { -}; \ No newline at end of file +}; + +[Association, + Provider("cmpi::Virt_SettingsDefineState") +] +class LXC_SettingsDefineState : CIM_SettingsDefineState +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/SettingsDefineState.registration --- a/schema/SettingsDefineState.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/SettingsDefineState.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_SettingsDefineState root/virt Virt_SettingsDefineState Virt_SettingsDefineState association KVM_SettingsDefineState root/virt Virt_SettingsDefineState Virt_SettingsDefineState association +LXC_SettingsDefineState root/virt Virt_SettingsDefineState Virt_SettingsDefineState association diff -r c8c0e264c75c -r 560f30acf513 schema/SystemDevice.mof --- a/schema/SystemDevice.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/SystemDevice.mof Mon Mar 24 13:35:31 2008 -0700 @@ -32,3 +32,18 @@ class KVM_SystemDevice : CIM_SystemDevic }; +[Association, + Description ( + "A class to associate a LXC_ComputerSystem with its devices." ), + Provider("cmpi::Virt_SystemDevice") +] +class LXC_SystemDevice : CIM_SystemDevice +{ + + [Override ( "GroupComponent" )] + LXC_ComputerSystem REF GroupComponent; + + [Override ( "PartComponent" )] + CIM_LogicalDevice REF PartComponent; + +}; diff -r c8c0e264c75c -r 560f30acf513 schema/SystemDevice.registration --- a/schema/SystemDevice.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/SystemDevice.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_SystemDevice root/virt Virt_SystemDevice Virt_SystemDevice association KVM_SystemDevice root/virt Virt_SystemDevice Virt_SystemDevice association +LXC_SystemDevice root/virt Virt_SystemDevice Virt_SystemDevice association diff -r c8c0e264c75c -r 560f30acf513 schema/VSMigrationCapabilities.mof --- a/schema/VSMigrationCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSMigrationCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -17,3 +17,7 @@ class Xen_VirtualSystemMigrationCapabili [Provider("cmpi::Virt_VSMigrationCapabilities")] class KVM_VirtualSystemMigrationCapabilities : CIM_VirtualSystemMigrationCapabilities { }; + +[Provider("cmpi::Virt_VSMigrationCapabilities")] +class LXC_VirtualSystemMigrationCapabilities : CIM_VirtualSystemMigrationCapabilities { +}; diff -r c8c0e264c75c -r 560f30acf513 schema/VSMigrationCapabilities.registration --- a/schema/VSMigrationCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSMigrationCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance -KVM_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance \ No newline at end of file +KVM_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instanceLXC_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance diff -r c8c0e264c75c -r 560f30acf513 schema/VSMigrationService.mof --- a/schema/VSMigrationService.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSMigrationService.mof Mon Mar 24 13:35:31 2008 -0700 @@ -76,3 +76,7 @@ class KVM_VirtualSystemMigrationService class KVM_VirtualSystemMigrationService : CIM_VirtualSystemMigrationService { }; +[Provider("cmpi::Virt_VSMigrationService")] +class LXC_VirtualSystemMigrationService : CIM_VirtualSystemMigrationService { +}; + diff -r c8c0e264c75c -r 560f30acf513 schema/VSMigrationService.registration --- a/schema/VSMigrationService.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSMigrationService.registration Mon Mar 24 13:35:31 2008 -0700 @@ -1,4 +1,4 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method -KVM_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method \ No newline at end of file +KVM_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance methodLXC_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method diff -r c8c0e264c75c -r 560f30acf513 schema/VSMigrationSettingData.mof --- a/schema/VSMigrationSettingData.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSMigrationSettingData.mof Mon Mar 24 13:35:31 2008 -0700 @@ -21,3 +21,11 @@ class KVM_VirtualSystemMigrationSettingD uint16 TransportType; string CheckParameters[]; }; + +[Provider("cmpi::Virt_VSMigrationSettingData")] +class LXC_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData { + [ ValueMap {"0","1","2","3","4","5","6"}, + Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }] + uint16 TransportType; + string CheckParameters[]; +}; diff -r c8c0e264c75c -r 560f30acf513 schema/VSMigrationSettingData.registration --- a/schema/VSMigrationSettingData.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSMigrationSettingData.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemMigrationSettingData root/virt Virt_VSMigrationSettingData Virt_VSMigrationSettingData instance KVM_VirtualSystemMigrationSettingData root/virt Virt_VSMigrationSettingData Virt_VSMigrationSettingData instance +LXC_VirtualSystemMigrationSettingData root/virt Virt_VSMigrationSettingData Virt_VSMigrationSettingData instance diff -r c8c0e264c75c -r 560f30acf513 schema/VSSD.mof --- a/schema/VSSD.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSSD.mof Mon Mar 24 13:35:31 2008 -0700 @@ -34,3 +34,16 @@ class KVM_VirtualSystemSettingData : CIM string BootDevice; }; + +[Description ( + "A class derived from CIM_VirtualSystemSettingData to represent " + "the config of LXC containers running on the system."), + Provider("cmpi::Virt_VSSD") +] +class LXC_VirtualSystemSettingData : CIM_VirtualSystemSettingData +{ + + [Description ("Path to the init process for the container")] + string InitPath; + +}; diff -r c8c0e264c75c -r 560f30acf513 schema/VSSD.registration --- a/schema/VSSD.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSSD.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemSettingData root/virt Virt_VSSD Virt_VSSD instance KVM_VirtualSystemSettingData root/virt Virt_VSSD Virt_VSSD instance +LXC_VirtualSystemSettingData root/virt Virt_VSSD Virt_VSSD instance diff -r c8c0e264c75c -r 560f30acf513 schema/VSSDComponent.mof --- a/schema/VSSDComponent.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSSDComponent.mof Mon Mar 24 13:35:31 2008 -0700 @@ -13,3 +13,10 @@ class KVM_VirtualSystemSettingDataCompon class KVM_VirtualSystemSettingDataComponent : CIM_Component { }; + +[Association, + Provider("cmpi::Virt_VSSDComponent") +] +class LXC_VirtualSystemSettingDataComponent : CIM_Component +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/VSSDComponent.registration --- a/schema/VSSDComponent.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VSSDComponent.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemSettingDataComponent root/virt Virt_VSSDComponent Virt_VSSDComponent association KVM_VirtualSystemSettingDataComponent root/virt Virt_VSSDComponent Virt_VSSDComponent association +LXC_VirtualSystemSettingDataComponent root/virt Virt_VSSDComponent Virt_VSSDComponent association diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemManagementCapabilities.mof --- a/schema/VirtualSystemManagementCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemManagementCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -18,3 +18,11 @@ class KVM_VirtualSystemManagementCapabil { }; +[Description ( + "A class derived from CIM_Capabilities to represent " + "the management capabilities of a LXC virtual system."), + Provider("cmpi::Virt_VirtualSystemManagementCapabilities") +] +class LXC_VirtualSystemManagementCapabilities : CIM_VirtualSystemManagementCapabilities +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemManagementCapabilities.registration --- a/schema/VirtualSystemManagementCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemManagementCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemManagementCapabilities root/virt Virt_VirtualSystemManagementCapabilities Virt_VirtualSystemManagementCapabilities instance KVM_VirtualSystemManagementCapabilities root/virt Virt_VirtualSystemManagementCapabilities Virt_VirtualSystemManagementCapabilities instance +LXC_VirtualSystemManagementCapabilities root/virt Virt_VirtualSystemManagementCapabilities Virt_VirtualSystemManagementCapabilities instance diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemManagementService.mof --- a/schema/VirtualSystemManagementService.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemManagementService.mof Mon Mar 24 13:35:31 2008 -0700 @@ -9,3 +9,8 @@ class KVM_VirtualSystemManagementService class KVM_VirtualSystemManagementService : CIM_VirtualSystemManagementService { }; + +[Provider("cmpi::Virt_VirtualSystemManagementService")] +class LXC_VirtualSystemManagementService : CIM_VirtualSystemManagementService +{ +}; diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemManagementService.registration --- a/schema/VirtualSystemManagementService.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemManagementService.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemManagementService root/virt Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance KVM_VirtualSystemManagementService root/virt Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance +LXC_VirtualSystemManagementService root/virt Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemSnapshotService.mof --- a/schema/VirtualSystemSnapshotService.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemSnapshotService.mof Mon Mar 24 13:35:31 2008 -0700 @@ -5,3 +5,4 @@ "32769: Memory-only, terminal (domain is offline after op)")] class Xen_VirtualSystemSnapshotService : CIM_VirtualSystemSnapshotService { }; class KVM_VirtualSystemSnapshotService : CIM_VirtualSystemSnapshotService { }; +class LXC_VirtualSystemSnapshotService : CIM_VirtualSystemSnapshotService { }; diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemSnapshotService.registration --- a/schema/VirtualSystemSnapshotService.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemSnapshotService.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemSnapshotService root/virt Virt_VirtualSystemSnapshotService Virt_VirtualSystemSnapshotService method instance KVM_VirtualSystemSnapshotService root/virt Virt_VirtualSystemSnapshotService Virt_VirtualSystemSnapshotService method instance +LXC_VirtualSystemSnapshotService root/virt Virt_VirtualSystemSnapshotService Virt_VirtualSystemSnapshotService method instance diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemSnapshotServiceCapabilities.mof --- a/schema/VirtualSystemSnapshotServiceCapabilities.mof Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemSnapshotServiceCapabilities.mof Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ class Xen_VirtualSystemSnapshotServiceCapabilities : CIM_VirtualSystemSnapshotServiceCapabilities {}; class KVM_VirtualSystemSnapshotServiceCapabilities : CIM_VirtualSystemSnapshotServiceCapabilities {}; +class LXC_VirtualSystemSnapshotServiceCapabilities : CIM_VirtualSystemSnapshotServiceCapabilities {}; diff -r c8c0e264c75c -r 560f30acf513 schema/VirtualSystemSnapshotServiceCapabilities.registration --- a/schema/VirtualSystemSnapshotServiceCapabilities.registration Thu Mar 20 10:47:48 2008 -0700 +++ b/schema/VirtualSystemSnapshotServiceCapabilities.registration Mon Mar 24 13:35:31 2008 -0700 @@ -2,3 +2,4 @@ # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemSnapshotServiceCapabilities root/virt Virt_VirtualSystemSnapshotServiceCapabilities Virt_VirtualSystemSnapshotServiceCapabilities instance KVM_VirtualSystemSnapshotServiceCapabilities root/virt Virt_VirtualSystemSnapshotServiceCapabilities Virt_VirtualSystemSnapshotServiceCapabilities instance +LXC_VirtualSystemSnapshotServiceCapabilities root/virt Virt_VirtualSystemSnapshotServiceCapabilities Virt_VirtualSystemSnapshotServiceCapabilities instance From grendel at linux.vnet.ibm.com Tue Mar 25 13:46:24 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 09:46:24 -0400 Subject: [Libvirt-cim] State of libvirt-cim project In-Reply-To: References: Message-ID: <47E90230.8000100@linux.vnet.ibm.com> Mellquist, Peter wrote: > Hello, > > I am interested in the current status of this project. > > Is Xen the only hypervisor supported at this point? > What DMTF virtualization profiles are currently complete?, which ones are not? > What level of testing / verification exists? > Are both OpenPegasus and SFCB fully supported? > What areas of contribution are needed? > > > Thanks and sorry for all the questions. > > Peter > > Peter Mellquist > Hewlett-Packard Company > Open Source and Linux Organization > peter.mellquist at hp.com > > All I've got to add to what Dan said is that I develop and test exclusively against sfcb (when there are Pegasus issues with my code I make Kaitlin and Dan test :-P) so sfcb sees about as much exercise with our providers as Pegasus does, and if you find an issue that seems sfcb exclusive, we've got an environment ready to replicate the behavior in. Oh, and when one of your questions is "What areas of contribution are needed?" you can feel free to ask as many other ones as you want. :-) -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 25 13:59:10 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 09:59:10 -0400 Subject: [Libvirt-cim] [PATCH 1 of 2] Make domain_online() re-lookup domain to make sure we're getting fresh info In-Reply-To: References: Message-ID: <47E9052E.7030901@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206112986 25200 > # Node ID c3dca3932e0b9f80778cbd6cbdfa09de4a7632a9 > # Parent 594c9195e59c8025ea18b3d6b5ca43b322db55e1 > Make domain_online() re-lookup domain to make sure we're getting fresh info > > This is necessary if you're using domain_online() in a polling loop. > > Signed-off-by: Dan Smith > > diff -r 594c9195e59c -r c3dca3932e0b libxkutil/misc_util.c > --- a/libxkutil/misc_util.c Thu Mar 20 13:13:57 2008 -0700 > +++ b/libxkutil/misc_util.c Fri Mar 21 08:23:06 2008 -0700 > @@ -378,12 +378,25 @@ bool domain_online(virDomainPtr dom) > bool domain_online(virDomainPtr dom) > { > virDomainInfo info; > - > - if (virDomainGetInfo(dom, &info) != 0) > + virDomainPtr _dom; > + bool rc; > + > + _dom = virDomainLookupByName(virDomainGetConnect(dom), > + virDomainGetName(dom)); > + if (_dom == NULL) { > + CU_DEBUG("Unable to re-lookup domain"); > return false; > I definitely could be wrong here, but I thought that virDomainGetInfo got live info regardless of the age of the virDomainPtr, as long as it still referenced the right domain. I seem to remember running into that when I was writing the ComputerSystemModifiedIndication code, and that was the reason I had to get XML description and store it, instead of just pulling from two different virDomainPtrs and comparing. That said, this can't hurt, so if we don't have a definite answer I'm totally cool with it. -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 25 14:25:15 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 10:25:15 -0400 Subject: [Libvirt-cim] [PATCH 2 of 2] Add restart migration In-Reply-To: <6c2d68b9722a23a94075.1206113398@caffeine.beaverton.ibm.com> References: <6c2d68b9722a23a94075.1206113398@caffeine.beaverton.ibm.com> Message-ID: <47E90B4B.5020906@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206113389 25200 > # Node ID 6c2d68b9722a23a94075172270acffad1bbbad6f > # Parent c3dca3932e0b9f80778cbd6cbdfa09de4a7632a9 > Add restart migration > > Based on a patch Kaitlin started on before she left and sent to me. > > Signed-off-by: Dan Smith > Signed-off-by: Kaitlin Rupert > > +static CMPIStatus handle_restart_migrate(virConnectPtr dconn, > + virDomainPtr dom, > + struct migration_job *job) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > + int ret; > + int i; > + > + CU_DEBUG("Shutting down domain for migration"); > + ret = virDomainShutdown(dom); > + if (ret != 0) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Unable to shutdown guest"); > + goto out; > + } > + > + for (i = 0; i < MIGRATE_SHUTDOWN_TIMEOUT; i++) { > + if ((i % 30) == 0) { > + CU_DEBUG("Polling for shutdown completion..."); > + } > Everything looks good to me, but whenever I see the modulo operator I wanna make sure I know what's going on. This is essentially "print a 'polling' message every thirty seconds so the user can see we haven't died", right? And not to sign myself up for more work, but would this be the kind of place for an indication? -- -Jay From danms at us.ibm.com Tue Mar 25 14:43:21 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 25 Mar 2008 07:43:21 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Make domain_online() re-lookup domain to make sure we're getting fresh info In-Reply-To: <47E9052E.7030901@linux.vnet.ibm.com> (Jay Gagnon's message of "Tue, 25 Mar 2008 09:59:10 -0400") References: <47E9052E.7030901@linux.vnet.ibm.com> Message-ID: <87d4pi3lva.fsf@caffeine.beaverton.ibm.com> JG> I definitely could be wrong here, but I thought that JG> virDomainGetInfo got live info regardless of the age of the JG> virDomainPtr, as long as it still referenced the right domain. I JG> seem to remember running into that when I was writing the JG> ComputerSystemModifiedIndication code, and that was the reason I JG> had to get XML description and store it, instead of just pulling JG> from two different virDomainPtrs and comparing. Yeah, I thought so too, and it does, to some extent. However, I think the problem I was running into was when the domain goes from online to offline state, the DomInfo returned from the DomPtr isn't correct anymore. So what would happen was I would never see the SHUTDOWN state, it would just start returning NO_STATE after the domain went away. This solves that problem. Given that people expect the behavior from this function that you describe, I think making sure we do what we need to do for that is good :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Tue Mar 25 13:59:10 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 09:59:10 -0400 Subject: [Libvirt-cim] [PATCH 1 of 2] Make domain_online() re-lookup domain to make sure we're getting fresh info In-Reply-To: References: Message-ID: <47E9052E.7030901@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206112986 25200 > # Node ID c3dca3932e0b9f80778cbd6cbdfa09de4a7632a9 > # Parent 594c9195e59c8025ea18b3d6b5ca43b322db55e1 > Make domain_online() re-lookup domain to make sure we're getting fresh info > > This is necessary if you're using domain_online() in a polling loop. > > Signed-off-by: Dan Smith > > diff -r 594c9195e59c -r c3dca3932e0b libxkutil/misc_util.c > --- a/libxkutil/misc_util.c Thu Mar 20 13:13:57 2008 -0700 > +++ b/libxkutil/misc_util.c Fri Mar 21 08:23:06 2008 -0700 > @@ -378,12 +378,25 @@ bool domain_online(virDomainPtr dom) > bool domain_online(virDomainPtr dom) > { > virDomainInfo info; > - > - if (virDomainGetInfo(dom, &info) != 0) > + virDomainPtr _dom; > + bool rc; > + > + _dom = virDomainLookupByName(virDomainGetConnect(dom), > + virDomainGetName(dom)); > + if (_dom == NULL) { > + CU_DEBUG("Unable to re-lookup domain"); > return false; > I definitely could be wrong here, but I thought that virDomainGetInfo got live info regardless of the age of the virDomainPtr, as long as it still referenced the right domain. I seem to remember running into that when I was writing the ComputerSystemModifiedIndication code, and that was the reason I had to get XML description and store it, instead of just pulling from two different virDomainPtrs and comparing. That said, this can't hurt, so if we don't have a definite answer I'm totally cool with it. -- -Jay From danms at us.ibm.com Tue Mar 25 14:58:57 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 25 Mar 2008 07:58:57 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Add restart migration In-Reply-To: <47E90B4B.5020906@linux.vnet.ibm.com> (Jay Gagnon's message of "Tue, 25 Mar 2008 10:25:15 -0400") References: <6c2d68b9722a23a94075.1206113398@caffeine.beaverton.ibm.com> <47E90B4B.5020906@linux.vnet.ibm.com> Message-ID: <878x063l5a.fsf@caffeine.beaverton.ibm.com> JG> looks good to me, but whenever I see the modulo operator I JG> wanna make sure I know what's going on. This is essentially "print a JG> polling' message every thirty seconds so the user can see we haven't JG> died", right? Not the user so much as the person trying to debug what's going on. I did that to help track the shutdown, while I was trying to figure out why the states weren't transitioning properly. In reality, only a few of those will be printed, so it shouldn't be a big deal, but it's certainly easily removed. JG> And not to sign myself up for more work, but would this be the JG> kind of place for an indication? Well, the regular migration indications will still fire, as will a CSModified indication, so I think we're covered. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From grendel at linux.vnet.ibm.com Tue Mar 25 15:22:44 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 11:22:44 -0400 Subject: [Libvirt-cim] [PATCH] Add kernel/initrd support to Xen_VSSD In-Reply-To: References: Message-ID: <47E918C4.2020105@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206117651 25200 > # Node ID ff7434bc724db507c23a8c4f9628d82dcae44ec7 > # Parent 6c2d68b9722a23a94075172270acffad1bbbad6f > Add kernel/initrd support to Xen_VSSD > > Signed-off-by: Dan Smith > > > Looks good, +1 -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 25 15:23:36 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 11:23:36 -0400 Subject: [Libvirt-cim] [PATCH] Relax permissions on schema install temporary directory In-Reply-To: <6cc2fd98582341e8a506.1206383618@caffeine.beaverton.ibm.com> References: <6cc2fd98582341e8a506.1206383618@caffeine.beaverton.ibm.com> Message-ID: <47E918F8.7090903@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206375916 25200 > # Node ID 6cc2fd98582341e8a5068efaa19fb6dc2f61c140 > # Parent ff7434bc724db507c23a8c4f9628d82dcae44ec7 > Relax permissions on schema install temporary directory > > This eliminates a failure if the pegasus utilities are setuid to the > Pegasus user > > Signed-off-by: Dan Smith > > > I'm thinking of writing a thunderbird extension that gives me a keybinding to reply to a message with "+1. Yay, Pegasus." -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 25 15:37:34 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 11:37:34 -0400 Subject: [Libvirt-cim] [PATCH 1 of 2] Add LXC support to schema In-Reply-To: <560f30acf513ef3738aa.1206392185@elm3b25.beaverton.ibm.com> References: <560f30acf513ef3738aa.1206392185@elm3b25.beaverton.ibm.com> Message-ID: <47E91C3E.6050608@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206390931 25200 > # Node ID 560f30acf513ef3738aa0265c3a9c65841c53393 > # Parent c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a > Add LXC support to schema > > There are definitely some bits that need to be revisited here, but this at least > gives us an LXC class for everything. > > Signed-off-by: Dan Smith > > > Holy tedious schema changes, batman! Seriously, though. It figures the one part of the project we really don't control has to be all clunky. And since we can't do anything about it... +1 -- -Jay From grendel at linux.vnet.ibm.com Tue Mar 25 15:39:57 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 25 Mar 2008 11:39:57 -0400 Subject: [Libvirt-cim] [PATCH 2 of 2] Add LXC support to misc_utils functions In-Reply-To: References: Message-ID: <47E91CCD.3080104@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206390944 25200 > # Node ID be1948c5fb0eb677fd45b177012b49674bee3da5 > # Parent 560f30acf513ef3738aa0265c3a9c65841c53393 > Add LXC support to misc_utils functions > > Signed-off-by: Dan Smith > > diff -r 560f30acf513 -r be1948c5fb0e libxkutil/misc_util.c > --- a/libxkutil/misc_util.c Mon Mar 24 13:35:31 2008 -0700 > +++ b/libxkutil/misc_util.c Mon Mar 24 13:35:44 2008 -0700 > @@ -46,6 +46,8 @@ static const char *cn_to_uri(const char > return "xen"; > else if (STARTS_WITH(classname, "KVM")) > return "qemu:///system"; > + else if (STARTS_WITH(classname, "LXC")) > + return "lxc:///system"; > else > return NULL; > } > @@ -200,6 +202,8 @@ const char *pfx_from_conn(virConnectPtr > pfx = "Xen"; > else if (STARTS_WITH(uri, "qemu")) > pfx = "KVM"; > + else if (STARTS_WITH(uri, "lxc")) > + pfx = "LXC"; > > free(uri); > > > How awesome is this? Way awesome. +9 -- -Jay From danms at us.ibm.com Tue Mar 25 20:45:08 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 25 Mar 2008 13:45:08 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Add beginnings of LXC XML parsing Message-ID: This set adds system and disk device parsing for LXC guests. From danms at us.ibm.com Tue Mar 25 20:45:09 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 25 Mar 2008 13:45:09 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Add container XML parsing support. Currently I only have examples of disk In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1206477801 25200 # Node ID b0e186e914481af381875b5f7465018bdb9fe1e1 # Parent 5b0c9449f1e59422f1e695a0da6b8f2c18a4ca43 Add container XML parsing support. Currently I only have examples of disk devices, so that's all we parse here. However, we now parse the container domain XML, as well as type devices as virt_dev_disk devices. This lets you enumerate LXC_LogicalDisk. All of the associations will need to be updated with the LXC variants before the relationships will work, but that should be all that is necessary. Signed-off-by: Dan Smith diff -r 5b0c9449f1e5 -r b0e186e91448 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Mar 24 13:35:44 2008 -0700 +++ b/libxkutil/device_parsing.c Tue Mar 25 13:43:21 2008 -0700 @@ -36,7 +36,8 @@ #include "xmlgen.h" #include "../src/svpc_types.h" -#define DISK_XPATH (xmlChar *)"/domain/devices/disk" +#define DISK_XPATH (xmlChar *)"/domain/devices/disk | "\ + "/domain/devices/filesystem" #define VCPU_XPATH (xmlChar *)"/domain/vcpu" #define NET_XPATH (xmlChar *)"/domain/devices/interface" #define EMU_XPATH (xmlChar *)"/domain/devices/emulator" @@ -135,7 +136,63 @@ static char *get_node_content(xmlNode *n return buf; } -static int parse_disk_device(xmlNode *dnode, struct virt_device **vdevs) +static int parse_fs_device(xmlNode *dnode, struct virt_device **vdevs) +{ + struct virt_device *vdev = NULL; + struct disk_device *ddev = NULL; + xmlNode *child = NULL; + + vdev = calloc(1, sizeof(*vdev)); + if (vdev == NULL) + goto err; + + ddev = (&vdev->dev.disk); + + ddev->type = get_attr_value(dnode, "type"); + if (ddev->type == NULL) { + CU_DEBUG("No type"); + goto err; + } + + for (child = dnode->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "source")) { + ddev->source = get_attr_value(child, "dir"); + if (ddev->source == NULL) { + CU_DEBUG("No source dir"); + goto err; + } + } else if (XSTREQ(child->name, "target")) { + ddev->virtual_dev = get_attr_value(child, "dir"); + if (ddev->virtual_dev == NULL) { + CU_DEBUG("No target dir"); + goto err; + } + } + } + + if ((ddev->source == NULL) || (ddev->virtual_dev == NULL)) { + CU_DEBUG("S: %s D: %s", ddev->source, ddev->virtual_dev); + goto err; + } + + ddev->disk_type = DISK_FS; + + vdev->type = CIM_RES_TYPE_DISK; + vdev->id = strdup(ddev->virtual_dev); + + *vdevs = vdev; + + return 1; + + err: + CU_DEBUG("Error parsing fs"); + cleanup_disk_device(ddev); + free(vdev); + + return 0; +} + +static int parse_block_device(xmlNode *dnode, struct virt_device **vdevs) { struct virt_device *vdev = NULL; struct disk_device *ddev = NULL; @@ -195,6 +252,20 @@ static int parse_disk_device(xmlNode *dn return 0; } +static int parse_disk_device(xmlNode *dnode, struct virt_device **vdevs) +{ + CU_DEBUG("Disk node: %s", dnode->name); + + if (XSTREQ(dnode->name, "disk")) + return parse_block_device(dnode, vdevs); + else if (XSTREQ(dnode->name, "filesystem")) + return parse_fs_device(dnode, vdevs); + else { + CU_DEBUG("Unknown disk device: %s", dnode->name); + return 0; + } +} + static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) { struct virt_device *vdev = NULL; @@ -668,6 +739,8 @@ static int parse_os(struct domain *domin else if (XSTREQ(child->name, "boot")) dominfo->os_info.fv.boot = get_attr_value(child, "dev"); + else if (XSTREQ(child->name, "init")) + STRPROP(dominfo, os_info.lxc.init, child); } if ((STREQC(dominfo->os_info.fv.type, "hvm")) && @@ -676,6 +749,8 @@ static int parse_os(struct domain *domin else if ((STREQC(dominfo->typestr, "kvm")) || (STREQC(dominfo->typestr, "qemu"))) dominfo->type = DOMAIN_KVM; + else if (STREQC(dominfo->typestr, "lxc")) + dominfo->type = DOMAIN_LXC; else if (STREQC(dominfo->os_info.pv.type, "linux")) dominfo->type = DOMAIN_XENPV; else @@ -836,6 +911,8 @@ void cleanup_dominfo(struct domain **dom free(dom->os_info.fv.type); free(dom->os_info.fv.loader); free(dom->os_info.fv.boot); + } else if (dom->type == DOMAIN_LXC) { + free(dom->os_info.lxc.init); } else { CU_DEBUG("Unknown domain type %i", dom->type); } diff -r 5b0c9449f1e5 -r b0e186e91448 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Mar 24 13:35:44 2008 -0700 +++ b/libxkutil/device_parsing.h Tue Mar 25 13:43:21 2008 -0700 @@ -35,7 +35,7 @@ struct disk_device { char *driver; char *source; char *virtual_dev; - enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE} disk_type; + enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type; }; struct net_device { @@ -88,8 +88,12 @@ struct fv_os_info { char *boot; }; +struct lxc_os_info { + char *init; +}; + struct domain { - enum { DOMAIN_XENPV, DOMAIN_XENFV, DOMAIN_KVM } type; + enum { DOMAIN_XENPV, DOMAIN_XENFV, DOMAIN_KVM, DOMAIN_LXC } type; char *name; char *typestr; /*xen, kvm, etc */ char *uuid; @@ -99,6 +103,7 @@ struct domain { union { struct pv_os_info pv; struct fv_os_info fv; + struct lxc_os_info lxc; } os_info; int on_poweroff; From danms at us.ibm.com Tue Mar 25 20:45:10 2008 From: danms at us.ibm.com (Dan Smith) Date: Tue, 25 Mar 2008 13:45:10 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] Make xml_parse_test work for LXC guests (for disk devices and system) In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1206477901 25200 # Node ID c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf # Parent b0e186e914481af381875b5f7465018bdb9fe1e1 Make xml_parse_test work for LXC guests (for disk devices and system) Signed-off-by: Dan Smith diff -r b0e186e91448 -r c2b027700cb7 libxkutil/xml_parse_test.c --- a/libxkutil/xml_parse_test.c Tue Mar 25 13:43:21 2008 -0700 +++ b/libxkutil/xml_parse_test.c Tue Mar 25 13:45:01 2008 -0700 @@ -44,6 +44,8 @@ static void print_os(struct domain *dom, print_value(d, "Type", dom->os_info.fv.type); print_value(d, "Loader", dom->os_info.fv.loader); print_value(d, "Boot", dom->os_info.fv.boot); + } else if (dom->type == DOMAIN_LXC) { + print_value(d, "Init", dom->os_info.lxc.init); } else { fprintf(d, "[ Unknown domain type %i ]\n", dom->type); } From grendel at linux.vnet.ibm.com Wed Mar 26 14:16:08 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 26 Mar 2008 10:16:08 -0400 Subject: [Libvirt-cim] [PATCH 0 of 2] Add beginnings of LXC XML parsing In-Reply-To: References: Message-ID: <47EA5AA8.10202@linux.vnet.ibm.com> Dan Smith wrote: > This set adds system and disk device parsing for LXC guests. > > Code looks good, and I'll trust that you're using the xml right, for two reasons: one, you've done all the other xml stuff; two, no way I'm gonna try and figure that out if I don't have to. :) +1 -- -Jay From danms at us.ibm.com Wed Mar 26 14:24:20 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 26 Mar 2008 07:24:20 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] Add beginnings of LXC XML parsing In-Reply-To: <47EA5AA8.10202@linux.vnet.ibm.com> (Jay Gagnon's message of "Wed, 26 Mar 2008 10:16:08 -0400") References: <47EA5AA8.10202@linux.vnet.ibm.com> Message-ID: <87r6dxzhpn.fsf@caffeine.beaverton.ibm.com> JG> Code looks good, and I'll trust that you're using the xml right, JG> for two reasons: one, you've done all the other xml stuff; two, no JG> way I'm gonna try and figure that out if I don't have to. :) Well, it's not easy to test in the full stack without a patched libvirt, and even still, it's not quite "there yet". However, the point of the tester tool is that you can test a static XML file, like the container description Dave posted on the libvirt list. Anyway, I've done that and it works. I'm sure that this will need plenty of refinement as libvirt gains more support :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Wed Mar 26 17:14:58 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 26 Mar 2008 10:14:58 -0700 Subject: [Libvirt-cim] [PATCH] Make isMigratable return true if it makes it all the way through the checks, Message-ID: <19f1da7d9a42f35ab345.1206551698@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206551684 25200 # Node ID 19f1da7d9a42f35ab345699b36e22d6981b26342 # Parent c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf Make isMigratable return true if it makes it all the way through the checks, false otherwise. These should be independent of the return code and the status, which the patch fixes. Signed-off-by: Dan Smith diff -r c2b027700cb7 -r 19f1da7d9a42 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 25 13:45:01 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 26 10:14:44 2008 -0700 @@ -543,7 +543,7 @@ static CMPIStatus vs_migratable(const CM CMPIStatus s; virConnectPtr conn = NULL; virConnectPtr dconn = NULL; - uint32_t retcode = 1; + uint32_t retcode = SVPC_RETURN_COMPLETED; CMPIBoolean isMigratable = 0; uint16_t type; virDomainPtr dom = NULL; @@ -598,14 +598,13 @@ static CMPIStatus vs_migratable(const CM goto out; } - retcode = CIM_SVPC_RETURN_COMPLETED; + isMigratable = 1; cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); out: CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); - isMigratable = (retcode == 0); CMAddArg(argsout, "IsMigratable", (CMPIValue *)&isMigratable, CMPI_boolean); From danms at us.ibm.com Wed Mar 26 17:47:29 2008 From: danms at us.ibm.com (Dan Smith) Date: Wed, 26 Mar 2008 10:47:29 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Make isMigratable return true if it makes it all the way through the checks, Message-ID: <055180f1b8538a497dac.1206553649@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206553643 25200 # Node ID 055180f1b8538a497dac8272a02ff63c626f3190 # Parent c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf (#2) Make isMigratable return true if it makes it all the way through the checks, false otherwise. These should be independent of the return code and the status, which the patch fixes. Changes: - Removed stupidity Signed-off-by: Dan Smith diff -r c2b027700cb7 -r 055180f1b853 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Tue Mar 25 13:45:01 2008 -0700 +++ b/src/Virt_VSMigrationService.c Wed Mar 26 10:47:23 2008 -0700 @@ -543,7 +543,7 @@ static CMPIStatus vs_migratable(const CM CMPIStatus s; virConnectPtr conn = NULL; virConnectPtr dconn = NULL; - uint32_t retcode = 1; + uint32_t retcode = CIM_SVPC_RETURN_COMPLETED; CMPIBoolean isMigratable = 0; uint16_t type; virDomainPtr dom = NULL; @@ -598,14 +598,13 @@ static CMPIStatus vs_migratable(const CM goto out; } - retcode = CIM_SVPC_RETURN_COMPLETED; + isMigratable = 1; cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); out: CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32); - isMigratable = (retcode == 0); CMAddArg(argsout, "IsMigratable", (CMPIValue *)&isMigratable, CMPI_boolean); From grendel at linux.vnet.ibm.com Thu Mar 27 13:04:01 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 27 Mar 2008 09:04:01 -0400 Subject: [Libvirt-cim] [PATCH] Make isMigratable return true if it makes it all the way through the checks, In-Reply-To: <19f1da7d9a42f35ab345.1206551698@caffeine.beaverton.ibm.com> References: <19f1da7d9a42f35ab345.1206551698@caffeine.beaverton.ibm.com> Message-ID: <47EB9B41.50004@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206551684 25200 > # Node ID 19f1da7d9a42f35ab345699b36e22d6981b26342 > # Parent c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf > Make isMigratable return true if it makes it all the way through the checks, > false otherwise. These should be independent of the return code and the > status, which the patch fixes. > > Signed-off-by: Dan Smith > > > Not a huge fan of this whole rc for the check and result of the check thing, but CIM can take the heat for that one. +1 -- -Jay From grendel at linux.vnet.ibm.com Thu Mar 27 13:07:16 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Thu, 27 Mar 2008 09:07:16 -0400 Subject: [Libvirt-cim] [PATCH] (#2) Make isMigratable return true if it makes it all the way through the checks, In-Reply-To: <055180f1b8538a497dac.1206553649@caffeine.beaverton.ibm.com> References: <055180f1b8538a497dac.1206553649@caffeine.beaverton.ibm.com> Message-ID: <47EB9C04.4090400@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206553643 25200 > # Node ID 055180f1b8538a497dac8272a02ff63c626f3190 > # Parent c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf > (#2) Make isMigratable return true if it makes it all the way through the checks, > false otherwise. These should be independent of the return code and the > status, which the patch fixes. > > Changes: > - Removed stupidity > > Signed-off-by: Dan Smith > > Figures I finally remember to ack version one and don't even notice a version two. I'm having a hard time seeing the difference between the two patches though, which makes me feel oh so smart since it's like five lines of change. Could you enlighten me? -- -Jay From danms at us.ibm.com Thu Mar 27 13:38:38 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 27 Mar 2008 06:38:38 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Make isMigratable return true if it makes it all the way through the checks, In-Reply-To: <47EB9C04.4090400@linux.vnet.ibm.com> (Jay Gagnon's message of "Thu, 27 Mar 2008 09:07:16 -0400") References: <055180f1b8538a497dac.1206553649@caffeine.beaverton.ibm.com> <47EB9C04.4090400@linux.vnet.ibm.com> Message-ID: <87zlskwald.fsf@caffeine.beaverton.ibm.com> JG> Figures I finally remember to ack version one and don't even JG> notice a version two. I'm having a hard time seeing the difference JG> between the two patches though, which makes me feel oh so smart JG> since it's like five lines of change. Could you enlighten me? Sorry, I meant to reply to the first one and point out the problem (although I should have let Stefan do it, since he found it). I forgot a CIM_ prefix to one of the constants. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Thu Mar 27 18:20:08 2008 From: danms at us.ibm.com (Dan Smith) Date: Thu, 27 Mar 2008 11:20:08 -0700 Subject: [Libvirt-cim] Announcement: test suite now available Message-ID: <87k5jouizr.fsf@caffeine.beaverton.ibm.com> I'm pleased to announce that our internal test suite has been made public. The tree is available here: http://libvirt.org/hg/cimtest I'm sure that there will be all kinds of brokenness exposed as people try to use it outside of our environment. Please post any issues that you may have. The suite uses pywbem (current svn snapshot required) for the CIM client tasks and ssh to connect to the machine under test to validate against virsh. The cimtest_sshkey.pub file must be added to root's authorized_keys file to enable this. Changes to allow generation of a site ssh key will need to be made to mitigate the obvious risk involved. A sample invocation looks like this: % export CIM_USER=root % export CIM_PASS=password % export CIM_NS=root/virt % ./runtests libvirt-cim -i localhost We will start posting regular test results on various platforms using this soon, which should provide a baseline to compare against. More detail will need to be added to the website, I'm sure, but this should be enough to get people started. Please post issues you have and test results if you can get them! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From lizg at cn.ibm.com Fri Mar 28 02:10:03 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Fri, 28 Mar 2008 10:10:03 +0800 Subject: [Libvirt-cim] [PATCH] Add missing newlines in some LXC schema lines Message-ID: <888b094934bd3d17b95d.1206670203@zeit.cn.ibm.com> # HG changeset patch # User Zhengang Li # Date 1206669991 -28800 # Node ID 888b094934bd3d17b95df1702a0ad654d5fdf5e2 # Parent c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf Add missing newlines in some LXC schema lines Signed-off-by: Zhengang Li diff -r c2b027700cb7 -r 888b094934bd schema/HostedResourcePool.registration --- a/schema/HostedResourcePool.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/HostedResourcePool.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association -KVM_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool associationLXC_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association +KVM_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association +LXC_HostedResourcePool root/virt Virt_HostedResourcePool Virt_HostedResourcePool association diff -r c2b027700cb7 -r 888b094934bd schema/NetPool.registration --- a/schema/NetPool.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/NetPool.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance -KVM_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instanceLXC_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance +KVM_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance +LXC_NetworkPool root/virt Virt_DevicePool Virt_DevicePool instance diff -r c2b027700cb7 -r 888b094934bd schema/ResourceAllocationFromPool.registration --- a/schema/ResourceAllocationFromPool.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/ResourceAllocationFromPool.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association -KVM_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool associationLXC_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association +KVM_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association +LXC_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPool Virt_ResourceAllocationFromPool association diff -r c2b027700cb7 -r 888b094934bd schema/ResourcePoolConfigurationCapabilities.registration --- a/schema/ResourcePoolConfigurationCapabilities.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/ResourcePoolConfigurationCapabilities.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance -KVM_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instanceLXC_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance +KVM_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance +LXC_ResourcePoolConfigurationCapabilities root/virt Virt_ResourcePoolConfigurationCapabilities Virt_ResourcePoolConfigurationCapabilities instance diff -r c2b027700cb7 -r 888b094934bd schema/ResourcePoolConfigurationService.registration --- a/schema/ResourcePoolConfigurationService.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/ResourcePoolConfigurationService.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method -KVM_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance methodLXC_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method +KVM_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method +LXC_ResourcePoolConfigurationService root/virt Virt_ResourcePoolConfigurationService Virt_ResourcePoolConfigurationService instance method diff -r c2b027700cb7 -r 888b094934bd schema/VSMigrationCapabilities.registration --- a/schema/VSMigrationCapabilities.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/VSMigrationCapabilities.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance -KVM_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instanceLXC_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance +KVM_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance +LXC_VirtualSystemMigrationCapabilities root/virt Virt_VSMigrationCapabilities Virt_VSMigrationCapabilities instance diff -r c2b027700cb7 -r 888b094934bd schema/VSMigrationService.registration --- a/schema/VSMigrationService.registration Tue Mar 25 13:45:01 2008 -0700 +++ b/schema/VSMigrationService.registration Fri Mar 28 10:06:31 2008 +0800 @@ -1,4 +1,5 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes Xen_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method -KVM_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance methodLXC_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method +KVM_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method +LXC_VirtualSystemMigrationService root/virt Virt_VSMigrationService Virt_VSMigrationService instance method From lizg at cn.ibm.com Fri Mar 28 06:32:12 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Fri, 28 Mar 2008 14:32:12 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] Add virt tag to set_uuid in common_util.py Message-ID: <0ffa3f03d77302fb7f28.1206685932@zeit.cn.ibm.com> # HG changeset patch # User Zhengang Li # Date 1206685818 -28800 # Node ID 0ffa3f03d77302fb7f289f8ddb537380fc885040 # Parent c9bb4d898469450c851139d5faa58a5818835e08 [TEST] Add virt tag to set_uuid in common_util.py Otherwise, KVM domain's uuid is not recorded. Signed-off-by: Zhengang Li diff -r c9bb4d898469 -r 0ffa3f03d773 suites/libvirt-cim/lib/XenKvmLib/common_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Mar 27 11:07:12 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Fri Mar 28 14:30:18 2008 +0800 @@ -93,7 +93,7 @@ def create_using_definesystem(domain_nam undefine_test_domain(dname, options.ip, virt=virt) return XFAIL_RC(bug) - set_uuid(viruuid(domain_name, ip)) + set_uuid(viruuid(domain_name, ip, virt=virt)) myxml = dumpxml(domain_name, ip, virt=virt) name = xml_get_dom_name(myxml) From yunguol at cn.ibm.com Fri Mar 28 07:04:08 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:04:08 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] modified enmuclass lib support virt argument In-Reply-To: Message-ID: <9ae9d9c26a3024f02c88.1206687848@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206687269 25200 # Node ID 9ae9d9c26a3024f02c8837ba0bca023385ab5c3d # Parent c9bb4d898469450c851139d5faa58a5818835e08 [TEST] modified enmuclass lib support virt argument Meanwhile, adapt to the current format Signed-off-by: Guolian Yun diff -r c9bb4d898469 -r 9ae9d9c26a30 suites/libvirt-cim/lib/XenKvmLib/enumclass.py --- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Thu Mar 27 11:07:12 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Thu Mar 27 23:54:29 2008 -0700 @@ -215,7 +215,13 @@ class KVM_DiskResourceAllocationSettingD # ex: Xen_RegisteredProfile # keyname = The keyvalue # ex: InstanceID in case of Xen_RegisteredProfile -def enumerate_inst(server, classname): +def enumerate_inst(server, classname, virt="Xen"): + classname = "%s" % classname + new_classname = classname.split('_') + if len(new_classname) == 2: + classname = classname[1] + + classname = eval(get_typed_class(virt, classname)) instances = [] conn = pywbem.WBEMConnection('http://%s' % server, (Globals.CIM_USER, Globals.CIM_PASS), From yunguol at cn.ibm.com Fri Mar 28 07:04:09 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:04:09 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [TEST] update VSMC.01 test case for XenFV and KVM support In-Reply-To: Message-ID: <8a41117ff62a63324dcb.1206687849@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206687608 25200 # Node ID 8a41117ff62a63324dcb8b7036602368c9693ecc # Parent 9ae9d9c26a3024f02c8837ba0bca023385ab5c3d [TEST] update VSMC.01 test case for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 9ae9d9c26a30 -r 8a41117ff62a suites/libvirt-cim/cimtest/VirtualSystemMigrationCapabilities/01_enum.py --- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationCapabilities/01_enum.py Thu Mar 27 23:54:29 2008 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationCapabilities/01_enum.py Fri Mar 28 00:00:08 2008 -0700 @@ -24,10 +24,11 @@ import sys from XenKvmLib import enumclass +from XenKvmLib.classes import get_typed_class from CimTest.Globals import log_param, CIM_ERROR_ENUMERATE, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] def print_error(fieldname, ret_value, exp_value): logger.error("%s Mismatch", fieldname) @@ -39,12 +40,13 @@ def main(): log_param() # Expected values from the enumetation - cn = 'Xen_VirtualSystemMigrationCapabilities' + cn = get_typed_class(options.virt, 'VirtualSystemMigrationCapabilities') instid = 'MigrationCapabilities' try: vsmc = enumclass.enumerate_inst(options.ip, - enumclass.Xen_VirtualSystemMigrationCapabilities) + "VirtualSystemMigrationCapabilities", + options.virt) except Exception: logger.error(CIM_ERROR_ENUMERATE, cn) return FAIL From yunguol at cn.ibm.com Fri Mar 28 07:04:07 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:04:07 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] [TEST] update VSMC test cases and helper function for XenFV and KVm support Message-ID: Signed-off-by: Guolian Yun From yunguol at cn.ibm.com Fri Mar 28 07:04:10 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:04:10 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [TEST] update VSMC.02 for XenFV and KVM support In-Reply-To: Message-ID: <2507972be4b50c6f618d.1206687850@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206687821 25200 # Node ID 2507972be4b50c6f618d4a1d6a1ebea9084048da # Parent 8a41117ff62a63324dcb8b7036602368c9693ecc [TEST] update VSMC.02 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 8a41117ff62a -r 2507972be4b5 suites/libvirt-cim/cimtest/VirtualSystemMigrationCapabilities/02_vsmc_gi_errs.py --- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationCapabilities/02_vsmc_gi_errs.py Fri Mar 28 00:00:08 2008 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationCapabilities/02_vsmc_gi_errs.py Fri Mar 28 00:03:41 2008 -0700 @@ -4,7 +4,7 @@ # # Authors: # Deepti B. Kalakeri -# +# Guolian Yun # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public @@ -52,8 +52,9 @@ from CimTest.Globals import do_main from CimTest.Globals import do_main from CimTest.ReturnCodes import PASS, FAIL from XenKvmLib.common_util import try_getinstance +from XenKvmLib.classes import get_typed_class -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] expr_values = { "invalid_instid" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND, \ @@ -67,7 +68,7 @@ def main(): log_param() status = PASS conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS) - classname = 'Xen_VirtualSystemMigrationCapabilities' + classname = get_typed_class(options.virt, 'VirtualSystemMigrationCapabilities') field = 'INVALID_Instid_KeyName' keys = { field : "RPCC" } From yunguol at cn.ibm.com Fri Mar 28 07:16:22 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:16:22 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] update EC.01 for XenFV and KVM support In-Reply-To: Message-ID: <5eae4d73506a53965f3f.1206688582@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206688341 25200 # Node ID 5eae4d73506a53965f3fcf1bb132d04bd9266c4a # Parent c9bb4d898469450c851139d5faa58a5818835e08 [TEST] update EC.01 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r c9bb4d898469 -r 5eae4d73506a suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Thu Mar 27 11:07:12 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Fri Mar 28 00:12:21 2008 -0700 @@ -25,11 +25,12 @@ from VirtLib import live from VirtLib import live from XenKvmLib import assoc from XenKvmLib import hostsystem +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] @do_main(sup_types) def main(): @@ -37,15 +38,16 @@ def main(): Globals.log_param() try: - host_sys = hostsystem.enumerate(options.ip)[0] + host_sys = hostsystem.enumerate(options.ip, options.virt)[0] except Exception: - Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, 'Xen_HostSystem') + Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, get_typed_class(options.virt, 'HostSystem')) return FAIL try: elc = assoc.AssociatorNames(options.ip, - "Xen_ElementCapabilities", - "Xen_HostSystem", + "ElementCapabilities", + "HostSystem", + options.virt, Name = host_sys.Name, CreationClassName = host_sys.CreationClassName) except Exception: @@ -53,8 +55,8 @@ def main(): return FAIL - valid_elc_name = ["Xen_VirtualSystemManagementCapabilities", - "Xen_VirtualSystemMigrationCapabilities"] + valid_elc_name = [get_typed_class(options.virt, "VirtualSystemManagementCapabilities"), + get_typed_class(options.virt, "VirtualSystemMigrationCapabilities")] valid_elc_id = ["ManagementCapabilities", "MigrationCapabilities"] @@ -74,15 +76,16 @@ def main(): for system in cs: try: elec = assoc.AssociatorNames(options.ip, - "Xen_ElementCapabilities", - "Xen_ComputerSystem", + "ElementCapabilities", + "ComputerSystem", + options.virt, Name = system, - CreationClassName = "Xen_ComputerSystem") + CreationClassName = get_typed_class(options.virt, "ComputerSystem")) except Exception: Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % system) return FAIL - if elec[0].classname != "Xen_EnabledLogicalElementCapabilities": + if elec[0].classname != get_typed_class(options.virt, "EnabledLogicalElementCapabilities"): Globals.logger.error("ElementCapabilities association classname error") return FAIL elif elec[0].keybindings['InstanceID'] != system: From yunguol at cn.ibm.com Fri Mar 28 07:16:24 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:16:24 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [TEST] update EC.04 for XenFV and KVM support In-Reply-To: Message-ID: <2d0b34afb5b4b886f169.1206688584@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206688562 25200 # Node ID 2d0b34afb5b4b886f1690d17d7d2f2adb4b054b1 # Parent b8c7f56633f9f273e615f58f7c82b6524dea82d5 [TEST] update EC.04 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r b8c7f56633f9 -r 2d0b34afb5b4 suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py Fri Mar 28 00:14:10 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py Fri Mar 28 00:16:02 2008 -0700 @@ -24,11 +24,12 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -37,13 +38,12 @@ def try_assoc(ref, ref_class, exp_rc, ex conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) - log_param() status = FAIL rc = -1 names = [] try: - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -56,16 +56,19 @@ def try_assoc(ref, ref_class, exp_rc, ex logger.error(details) finally: if rc == 0: - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) + logger.error("%s_ElementCapabilities associator should NOT return excepted \ + result with a wrong key name and value of %s input" % (options.virt, ref_class)) status = FAIL return status @do_main(sup_types) def main(): + options = main.options rc = PASS - cap_list = {"Xen_VirtualSystemManagementCapabilities" : "ManagementCapabilities", - "Xen_VirtualSystemMigrationCapabilities" : "MigrationCapabilities"} + log_param() + cap_list = {get_typed_class(options.virt, "VirtualSystemManagementCapabilities") : "ManagementCapabilities", + get_typed_class(options.virt, "VirtualSystemMigrationCapabilities") : "MigrationCapabilities"} for k, v in cap_list.items(): instanceref = CIMInstanceName(k, @@ -75,9 +78,9 @@ def main(): status = FAIL return status - elecref = CIMInstanceName("Xen_EnabledLogicalElementCapabilities", + elecref = CIMInstanceName(get_typed_class(options.virt, "EnabledLogicalElementCapabilities"), keybindings = {"InstanceID" : "wrong"}) - rc = try_assoc(elecref, "Xen_EnabledLogicalElementCapabilities", + rc = try_assoc(elecref, get_typed_class(options.virt, "EnabledLogicalElementCapabilities"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL From yunguol at cn.ibm.com Fri Mar 28 07:16:21 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:16:21 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] [TEST] update EC test cases for XenFV and KVM support Message-ID: Signed-off-by: Guolian Yun From yunguol at cn.ibm.com Fri Mar 28 07:16:23 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Fri, 28 Mar 2008 00:16:23 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [TEST] update EC.03 for XenFV and KVM support In-Reply-To: Message-ID: # HG changeset patch # User Guolian Yun # Date 1206688450 25200 # Node ID b8c7f56633f9f273e615f58f7c82b6524dea82d5 # Parent 5eae4d73506a53965f3fcf1bb132d04bd9266c4a [TEST] update EC.03 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 5eae4d73506a -r b8c7f56633f9 suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Fri Mar 28 00:12:21 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Fri Mar 28 00:14:10 2008 -0700 @@ -25,11 +25,12 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import hostsystem +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -44,7 +45,7 @@ def try_assoc(ref, ref_class, exp_rc, ex names = [] try: - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -57,7 +58,8 @@ def try_assoc(ref, ref_class, exp_rc, ex logger.error(details) finally: if rc == 0: - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) + logger.error("%s_ElementCapabilities associator should NOT return excepted result \ + with a wrong key name and value of %s input" % (options.virt, ref_class)) status = FAIL return status @@ -67,18 +69,20 @@ def main(): def main(): options = main.options rc = PASS + log_param() - instanceref = CIMInstanceName("Xen_HostSystem", + instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"}) - rc = try_assoc(instanceref, "Xen_HostSystem", exp_rc, exp_desc, options) + rc = try_assoc(instanceref, get_typed_class(options.virt, "HostSystem"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL return status - instance_cs = CIMInstanceName("Xen_ComputerSystem", - keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"}) - rc = try_assoc(instance_cs, "Xen_ComputerSystem", exp_rc, exp_desc, options) + instance_cs = CIMInstanceName(get_typed_class(options.virt, "ComputerSystem"), + keybindings = {"Name" : "wrong", + "CreationClassName" : get_typed_class(options.virt,"ComputerSystem")}) + rc = try_assoc(instance_cs, get_typed_class(options.virt, "ComputerSystem"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL return status From lizg at cn.ibm.com Fri Mar 28 09:26:22 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Fri, 28 Mar 2008 17:26:22 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] Add kernel params in VSSD construction in vsms Message-ID: # HG changeset patch # User Zhengang Li # Date 1206696365 -28800 # Node ID f9d1d6a61670a3700c5a569d2eeb31d29b5f9da2 # Parent 877558f5cbe913300335b7069d8e21a6257638a4 [TEST] Add kernel params in VSSD construction in vsms Provider has added Kernel/Bootloader properties for para-virt. This is the change to utilize those properties. Signed-off-by: Zhengang Li diff -r 877558f5cbe9 -r f9d1d6a61670 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Mar 28 17:23:54 2008 +0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Mar 28 17:26:05 2008 +0800 @@ -25,6 +25,7 @@ import pywbem import pywbem from CimTest.CimExt import CIMMethodClass, CIMClassMOF from CimTest import Globals +from VirtLib import live from XenKvmLib import vxml from XenKvmLib.classes import get_typed_class, get_class_type, virt_types @@ -33,6 +34,10 @@ RASD_TYPE_NET_ETHER = 10 RASD_TYPE_NET_ETHER = 10 RASD_TYPE_NET_OTHER = 11 RASD_TYPE_DISK = 17 + +VSSD_RECOVERY_NONE = 2 +VSSD_RECOVERY_RESTART = 3 +VSSD_RECOVERY_PRESERVE = 123 def eval_cls(basename): def func(f): @@ -81,17 +86,25 @@ def enumerate_instances(server, virt='Xe # classes to define VSSD parameters class CIM_VirtualSystemSettingData(CIMClassMOF): - def __init__(self, name='test_domain', set_vs_id = True): + def __init__(self, name='test_domain', virt): type = get_class_type(self.__class__.__name__) self.InstanceID = '%s:%s' % (type, name) self.Caption = self.Description = 'Virtual System' - self.ElementName = name + self.VirtualSystemIdentifier = self.ElementName = name self.VirtualSystemType = type self.CreationClassName = self.__class__.__name__ - self.isFullVirt = (type == 'KVM') + self.AutomaticShutdownAction = VSSD_RECOVERY_NONE + self.AutomaticRecoveryAction = VSSD_RECOVERY_NONE + + self.isFullVirt = (type == 'KVM' or virt == 'XenFV') + if self.isFullVirt: + self.BootDevice = 'hd' + else: + self.Bootloader = live.bootloader(Globals.CIM_IP, 0) + self.BootloaderArgs = '' + self.Kernel = vxml.XenXML.kernel_path + self.Ramdisk = vxml.XenXML.init_path - if set_vs_id == True: - self.VirtualSystemIdentifier = name class Xen_VirtualSystemSettingData(CIM_VirtualSystemSettingData): pass @@ -193,7 +206,7 @@ def default_vssd_rasd_str(dom_name='test mem_mb=512, virt='Xen'): class_vssd = get_vssd_class(virt) - vssd = class_vssd(name=dom_name) + vssd = class_vssd(name=dom_name, virt=virt) class_dasd = get_dasd_class(virt) if virt == 'KVM': From zli at linux.vnet.ibm.com Fri Mar 28 09:47:22 2008 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Fri, 28 Mar 2008 17:47:22 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] Add kernel params in VSSD construction in vsms In-Reply-To: References: Message-ID: <47ECBEAA.8030504@linux.vnet.ibm.com> > - def __init__(self, name='test_domain', set_vs_id = True): > + def __init__(self, name='test_domain', virt): bad line here. please ignore this patch. I'll resend. -- - Zhengang From zli at linux.vnet.ibm.com Fri Mar 28 10:06:25 2008 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Fri, 28 Mar 2008 18:06:25 +0800 Subject: [Libvirt-cim] [PATCH 2 of 3] [TEST] update EC.03 for XenFV and KVM support In-Reply-To: References: Message-ID: <47ECC321.2070803@linux.vnet.ibm.com> Guo Lian Yun wrote: > # HG changeset patch > # User Guolian Yun > # Date 1206688450 25200 > # Node ID b8c7f56633f9f273e615f58f7c82b6524dea82d5 > # Parent 5eae4d73506a53965f3fcf1bb132d04bd9266c4a > [TEST] update EC.03 for XenFV and KVM support > > Signed-off-by: Guolian Yun > > diff -r 5eae4d73506a -r b8c7f56633f9 suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py > --- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Fri Mar 28 00:12:21 2008 -0700 > +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Fri Mar 28 00:14:10 2008 -0700 > @@ -25,11 +25,12 @@ from pywbem.cim_obj import CIMInstanceNa > from pywbem.cim_obj import CIMInstanceName > from XenKvmLib import assoc > from XenKvmLib import hostsystem > +from XenKvmLib.classes import get_typed_class > from CimTest import Globals > from CimTest.Globals import log_param, logger, do_main > from CimTest.ReturnCodes import PASS, FAIL > > -sup_types = ['Xen'] > +sup_types = ['Xen', 'XenFV', 'KVM'] > > exp_rc = 6 #CIM_ERR_NOT_FOUND > exp_desc = "No such instance" > @@ -44,7 +45,7 @@ def try_assoc(ref, ref_class, exp_rc, ex > names = [] > > try: > - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") > + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) > rc = 0 > except pywbem.CIMError, (rc, desc): > if rc == exp_rc and desc.find(exp_desc) >= 0: > @@ -57,7 +58,8 @@ def try_assoc(ref, ref_class, exp_rc, ex > logger.error(details) > finally: > if rc == 0: > - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) > + logger.error("%s_ElementCapabilities associator should NOT return excepted result \ > + with a wrong key name and value of %s input" % (options.virt, ref_class)) I prefer the error log use the base classname. So possibly we don't necessarily need to pass the options.virt here. > status = FAIL > > return status -- - Zhengang From zli at linux.vnet.ibm.com Fri Mar 28 10:01:27 2008 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Fri, 28 Mar 2008 18:01:27 +0800 Subject: [Libvirt-cim] [PATCH 0 of 3] [TEST] update VSMC test cases and helper function for XenFV and KVm support In-Reply-To: References: Message-ID: <47ECC1F7.1080108@linux.vnet.ibm.com> Guo Lian Yun wrote: > Signed-off-by: Guolian Yun > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > +1 for this bundle. -- - Zhengang From lizg at cn.ibm.com Fri Mar 28 13:47:36 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Fri, 28 Mar 2008 21:47:36 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms Message-ID: # HG changeset patch # User Zhengang Li # Date 1206712013 -28800 # Node ID c67d4960d4073c641beeb1fe5180862001c247ae # Parent 877558f5cbe913300335b7069d8e21a6257638a4 [TEST] .2# Add kernel params in VSSD construction in vsms Provider has added Kernel/Bootloader properties for para-virt. This is the change to utilize those properties. The non-default argument follows default argment error fixed in this version. Signed-off-by: Zhengang Li diff -r 877558f5cbe9 -r c67d4960d407 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Mar 28 17:23:54 2008 +0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Mar 28 21:46:53 2008 +0800 @@ -25,6 +25,7 @@ import pywbem import pywbem from CimTest.CimExt import CIMMethodClass, CIMClassMOF from CimTest import Globals +from VirtLib import live from XenKvmLib import vxml from XenKvmLib.classes import get_typed_class, get_class_type, virt_types @@ -33,6 +34,10 @@ RASD_TYPE_NET_ETHER = 10 RASD_TYPE_NET_ETHER = 10 RASD_TYPE_NET_OTHER = 11 RASD_TYPE_DISK = 17 + +VSSD_RECOVERY_NONE = 2 +VSSD_RECOVERY_RESTART = 3 +VSSD_RECOVERY_PRESERVE = 123 def eval_cls(basename): def func(f): @@ -81,17 +86,25 @@ def enumerate_instances(server, virt='Xe # classes to define VSSD parameters class CIM_VirtualSystemSettingData(CIMClassMOF): - def __init__(self, name='test_domain', set_vs_id = True): + def __init__(self, name, virt): type = get_class_type(self.__class__.__name__) self.InstanceID = '%s:%s' % (type, name) self.Caption = self.Description = 'Virtual System' - self.ElementName = name + self.VirtualSystemIdentifier = self.ElementName = name self.VirtualSystemType = type self.CreationClassName = self.__class__.__name__ - self.isFullVirt = (type == 'KVM') + self.AutomaticShutdownAction = VSSD_RECOVERY_NONE + self.AutomaticRecoveryAction = VSSD_RECOVERY_NONE + + self.isFullVirt = (type == 'KVM' or virt == 'XenFV') + if self.isFullVirt: + self.BootDevice = 'hd' + else: + self.Bootloader = live.bootloader(Globals.CIM_IP, 0) + self.BootloaderArgs = '' + self.Kernel = vxml.XenXML.kernel_path + self.Ramdisk = vxml.XenXML.init_path - if set_vs_id == True: - self.VirtualSystemIdentifier = name class Xen_VirtualSystemSettingData(CIM_VirtualSystemSettingData): pass @@ -193,7 +206,7 @@ def default_vssd_rasd_str(dom_name='test mem_mb=512, virt='Xen'): class_vssd = get_vssd_class(virt) - vssd = class_vssd(name=dom_name) + vssd = class_vssd(name=dom_name, virt=virt) class_dasd = get_dasd_class(virt) if virt == 'KVM': From danms at us.ibm.com Fri Mar 28 14:19:51 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 28 Mar 2008 07:19:51 -0700 Subject: [Libvirt-cim] [PATCH] Add missing newlines in some LXC schema lines In-Reply-To: <888b094934bd3d17b95d.1206670203@zeit.cn.ibm.com> (lizg@cn.ibm.com's message of "Fri, 28 Mar 2008 10:10:03 +0800") References: <888b094934bd3d17b95d.1206670203@zeit.cn.ibm.com> Message-ID: <87ej9vnd6g.fsf@caffeine.beaverton.ibm.com> ZL> # HG changeset patch ZL> # User Zhengang Li ZL> # Date 1206669991 -28800 ZL> # Node ID 888b094934bd3d17b95df1702a0ad654d5fdf5e2 ZL> # Parent c2b027700cb7a3075a9b9f56acd6d52cbd1f6fdf ZL> Add missing newlines in some LXC schema lines Hmm, that's strange. I'm curious about why my Pegasus didn't complain about these obvious errors. Looks like my automated conversion script had some flaws :) Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 28 14:39:01 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 28 Mar 2008 07:39:01 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] modified enmuclass lib support virt argument In-Reply-To: <9ae9d9c26a3024f02c88.1206687848@elm3b197.beaverton.ibm.com> (Guo Lian Yun's message of "Fri, 28 Mar 2008 00:04:08 -0700") References: <9ae9d9c26a3024f02c88.1206687848@elm3b197.beaverton.ibm.com> Message-ID: <8763v6oquy.fsf@caffeine.beaverton.ibm.com> GY> # HG changeset patch GY> # User Guolian Yun GY> # Date 1206687269 25200 GY> # Node ID 9ae9d9c26a3024f02c8837ba0bca023385ab5c3d GY> # Parent c9bb4d898469450c851139d5faa58a5818835e08 GY> [TEST] modified enmuclass lib support virt argument GY> Meanwhile, adapt to the current format So are you saying that the split() on "_" is temporary? GY> + new_classname = classname.split('_') GY> + if len(new_classname) == 2: GY> + classname = classname[1] Even if it is temporary, this should be: new_classname = classname.split("_", 1) so that you don't have to check the length. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 28 14:50:53 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 28 Mar 2008 07:50:53 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms In-Reply-To: (lizg@cn.ibm.com's message of "Fri, 28 Mar 2008 21:47:36 +0800") References: Message-ID: <871w5uoqb6.fsf@caffeine.beaverton.ibm.com> ZL> + self.Kernel = vxml.XenXML.kernel_path ZL> + self.Ramdisk = vxml.XenXML.init_path I assume that this will not cause a problem if the test domain does not have a kernel/initrd set? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Fri Mar 28 20:34:48 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 28 Mar 2008 13:34:48 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Make 02_destroysystem actually test the right thing Message-ID: # HG changeset patch # User Dan Smith # Date 1206736402 25200 # Node ID fe283ed5273e0983adf6355c9d6d8e1e81dcdde2 # Parent 612ccb311e273b091659fe14f0471567abe61d08 [TEST] Make 02_destroysystem actually test the right thing This test was passing incorrectly because it was only looking at the active domain list instead of active+inactive. The DestroySystem method in the provider was only doing a destroy, which means that it disappeared from the active list and this test considered that a PASS. Signed-off-by: Dan Smith diff -r 612ccb311e27 -r fe283ed5273e suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py Fri Mar 28 00:03:41 2008 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py Fri Mar 28 13:33:22 2008 -0700 @@ -25,7 +25,7 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from VirtLib import utils -from VirtLib.live import active_domain_list +from VirtLib.live import domain_list from XenKvmLib import vsms, vxml from XenKvmLib.classes import get_typed_class from CimTest.Globals import do_main @@ -50,7 +50,7 @@ def main(): 'Name':default_dom, 'CreationClassName':classname}) - list_before = active_domain_list(options.ip, options.virt) + list_before = domain_list(options.ip, options.virt) status = PASS rc = -1 @@ -62,7 +62,7 @@ def main(): logger.error(details) status = FAIL - list_after = active_domain_list(options.ip, options.virt) + list_after = domain_list(options.ip, options.virt) status = PASS if default_dom not in list_before: From danms at us.ibm.com Fri Mar 28 20:35:10 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 28 Mar 2008 13:35:10 -0700 Subject: [Libvirt-cim] [PATCH] Make DestroySystem actually undefine a domain as it should Message-ID: <1e1c2cd2ef0bff684df3.1206736510@caffeine.beaverton.ibm.com> # HG changeset patch # User Dan Smith # Date 1206736474 25200 # Node ID 1e1c2cd2ef0bff684df37d5c94d7b66b6189295c # Parent 2eaed9da089f7b49d85eadeb75334c11c869ffc8 Make DestroySystem actually undefine a domain as it should Also clean up the error path and CMPIValue stuff in the method while we're swizzling Signed-off-by: Dan Smith diff -r 2eaed9da089f -r 1e1c2cd2ef0b src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Mar 28 07:20:02 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Fri Mar 28 13:34:34 2008 -0700 @@ -479,54 +479,56 @@ static CMPIStatus destroy_system(CMPIMet CMPIArgs *argsout) { const char *dom_name = NULL; - CMPIStatus status = {CMPI_RC_OK, NULL}; - CMPIValue rc; + CMPIStatus status; + uint32_t rc = IM_RC_FAILED; CMPIObjectPath *sys; - - virConnectPtr conn; + virConnectPtr conn = NULL; + virDomainPtr dom = NULL; conn = connect_by_classname(_BROKER, CLASSNAME(reference), &status); - if (conn == NULL) { - rc.uint32 = IM_RC_FAILED; - goto error1; - } - - if (cu_get_ref_arg(argsin, "AffectedSystem", &sys) != CMPI_RC_OK) { - rc.uint32 = IM_RC_FAILED; - goto error2; - } + if (conn == NULL) + goto error; + + if (cu_get_ref_arg(argsin, "AffectedSystem", &sys) != CMPI_RC_OK) + goto error; dom_name = get_key_from_ref_arg(argsin, "AffectedSystem", "Name"); - if (dom_name == NULL) { - rc.uint32 = IM_RC_FAILED; - goto error2; - } + if (dom_name == NULL) + goto error; // Make sure system exists and destroy it. - if (domain_exists(conn, dom_name)) { - virDomainPtr dom = virDomainLookupByName(conn, dom_name); - if (!virDomainDestroy(dom)) { - rc.uint32 = IM_RC_OK; - } else { - rc.uint32 = IM_RC_FAILED; - cu_statusf(_BROKER, &status, - CMPI_RC_ERR_FAILED, - "Domain already exists"); - } - virDomainFree(dom); + if (!domain_exists(conn, dom_name)) + goto error; + + dom = virDomainLookupByName(conn, dom_name); + if (dom == NULL) { + CU_DEBUG("No such domain `%s', dom_name"); + rc = IM_RC_SYS_NOT_FOUND; + goto error; + } + + virDomainDestroy(dom); /* Okay for this to fail */ + if (virDomainUndefine(dom) == 0) { + rc = IM_RC_OK; trigger_indication(context, "ComputerSystemDeletedIndication", NAMESPACE(reference)); - } else { - rc.uint32 = IM_RC_SYS_NOT_FOUND; - } - - error2: + } + +error: + if (rc == IM_RC_SYS_NOT_FOUND) + cu_statusf(_BROKER, &status, + CMPI_RC_ERR_FAILED, + "Failed to find domain"); + else if (rc == IM_RC_OK) + status = (CMPIStatus){CMPI_RC_OK, NULL}; + + virDomainFree(dom); virConnectClose(conn); - error1: CMReturnData(results, &rc, CMPI_uint32); + return status; } From zli at linux.vnet.ibm.com Sat Mar 29 00:26:07 2008 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Sat, 29 Mar 2008 08:26:07 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms In-Reply-To: <871w5uoqb6.fsf@caffeine.beaverton.ibm.com> References: <871w5uoqb6.fsf@caffeine.beaverton.ibm.com> Message-ID: <47ED8C9F.6000304@linux.vnet.ibm.com> Dan Smith wrote: > ZL> + self.Kernel = vxml.XenXML.kernel_path > ZL> + self.Ramdisk = vxml.XenXML.init_path > > I assume that this will not cause a problem if the test domain does > not have a kernel/initrd set? It falls in the para-virt part. So KVM and XenFV won't get this set. We'll revisit LxC later when that's ready. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- - Zhengang From danms at us.ibm.com Sat Mar 29 02:43:20 2008 From: danms at us.ibm.com (Dan Smith) Date: Fri, 28 Mar 2008 19:43:20 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms References: <871w5uoqb6.fsf@caffeine.beaverton.ibm.com> <47ED8C9F.6000304@linux.vnet.ibm.com> Message-ID: <87lk42merb.fsf@caffeine.beaverton.ibm.com> ZL> It falls in the para-virt part. So KVM and XenFV won't get this ZL> set. We'll revisit LxC later when that's ready. Right, but what about a paravirt test domain that uses a bootloader and does not have a specific kernel/ramdisk? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From zli at linux.vnet.ibm.com Mon Mar 31 05:26:04 2008 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Mon, 31 Mar 2008 13:26:04 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms In-Reply-To: <87lk42merb.fsf@caffeine.beaverton.ibm.com> References: <871w5uoqb6.fsf@caffeine.beaverton.ibm.com> <47ED8C9F.6000304@linux.vnet.ibm.com> <87lk42merb.fsf@caffeine.beaverton.ibm.com> Message-ID: <47F075EC.1080908@linux.vnet.ibm.com> Dan Smith wrote: > ZL> It falls in the para-virt part. So KVM and XenFV won't get this > ZL> set. We'll revisit LxC later when that's ready. > > Right, but what about a paravirt test domain that uses a bootloader > and does not have a specific kernel/ramdisk? I'm not aware of this. Can you give me an example? > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- - Zhengang From yunguol at cn.ibm.com Mon Mar 31 05:50:45 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 22:50:45 -0700 Subject: [Libvirt-cim] [PATCH] [CU] add one class to keep a list of received indications Message-ID: <66fc3211e0bf16d2be0d.1206942645@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206942619 25200 # Node ID 66fc3211e0bf16d2be0d39e2f0a4d74b84fb15f9 # Parent e9037a5a7df99bb63ae5e90ade698592af7b7e92 [CU] add one class to keep a list of received indications Signed-off-by: Guolian Yun diff -r e9037a5a7df9 -r 66fc3211e0bf tools/indication_tester.py --- a/tools/indication_tester.py Mon Mar 10 12:05:59 2008 -0700 +++ b/tools/indication_tester.py Sun Mar 30 22:50:19 2008 -0700 @@ -286,6 +286,11 @@ class CIMIndication: def __str__(self): return self.name +class CIMIndicationServer(BaseHTTPServer.HTTPServer): + def __init__(self, *args): + BaseHTTPServer.HTTPServer.__init__(self, *args) + self.indications = [] + class CIMSocketHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_POST(self): length = self.headers.getheader('content-length') @@ -295,6 +300,7 @@ class CIMSocketHandler(BaseHTTPServer.Ba print "Got indication: %s" % indication if self.server.print_ind: print "%s\n\n" % data + self.server.indications.append(indication) class CIMIndicationSubscription: def __init__(self, name, typ, ns, print_ind, sysname): @@ -305,6 +311,7 @@ class CIMIndicationSubscription: self.server = BaseHTTPServer.HTTPServer(('', 8000), CIMSocketHandler) self.server.print_ind = print_ind + self.server.indications = [] self.port = 8000 self.filter_xml = filter_xml(name, typ, ns, sysname) From yunguol at cn.ibm.com Mon Mar 31 06:04:49 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:04:49 -0700 Subject: [Libvirt-cim] [PATCH 0 of 2] [TEST] bundles of ComputerSystemCreatedIndication tc Message-ID: The need patch of indication_tester is in libcmpiutil tree, you can copy it to cimtest lib make ComputerSystmeCreatedIndication tc work Signed-off-by: Guolian Yun From yunguol at cn.ibm.com Mon Mar 31 06:04:51 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:04:51 -0700 Subject: [Libvirt-cim] [PATCH 2 of 2] [TEST] add ComputerSystemCreatedIndication test case In-Reply-To: Message-ID: <4bf2d38a4ce6d74c4834.1206943491@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206943438 25200 # Node ID 4bf2d38a4ce6d74c4834ade3177d12dc03bc26d8 # Parent 769a9211a486b64e6a3dedcd964ab6c93989202b [TEST] add ComputerSystemCreatedIndication test case Signed-off-by: Guolian Yun diff -r 769a9211a486 -r 4bf2d38a4ce6 suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py Sun Mar 30 23:03:58 2008 -0700 @@ -0,0 +1,92 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Guolian Yun +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU 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 +# General Public License for more details. +# +# You should have received a copy of the GNU 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 +# + +import sys +import os +import signal +import time +from CimTest.Globals import log_param, logger +from CimTest.Globals import do_main +from CimTest.ReturnCodes import PASS, FAIL +from XenKvmLib.common_util import create_using_definesystem +from XenKvmLib.test_doms import undefine_test_domain +from XenKvmLib.classes import get_typed_class +from XenKvmLib.indication_tester import CIMIndicationSubscription +from XenKvmLib.vxml import set_default + +SUPPORTED_TYPES = ['Xen', 'XenFV', 'KVM'] + +test_dom = "domU" + + at do_main(SUPPORTED_TYPES) +def main(): + options = main.options + log_param() + status = FAIL + + dict = set_default(options.ip) + indication_name = get_typed_class(options.virt, 'ComputerSystemCreatedIndication') + + sub = CIMIndicationSubscription(dict['default_name'], indication_name, dict['default_ns'], + dict['default_print_ind'], dict['default_sysname']) + sub.subscribe(dict['default_url'], dict['default_auth']) + logger.info("Watching for %s" % indication_name) + + try: + pid = os.fork() + if pid == 0: + sub.server.handle_request() + if len(sub.server.indications) == 0: + logger.error("No valid indications received") + sys.exit(1) + elif str(sub.server.indications[0]) != indication_name: + logger.error("Received indication %s instead of %s" % (indication_name, str(sub.server.indications[0]))) + sys.exit(2) + else: + sys.exit(0) + else: + create_using_definesystem(test_dom, options.ip, None, None, options.virt) + for i in range(0,100): + pw = os.waitpid(pid, os.WNOHANG)[1] + if pw == 0: + logger.info("Great, got indication successfuly") + status = PASS + break + elif pw == 1 and i < 99: + logger.info("still in child process, waiting for indication") + time.sleep(1) + else: + logger.error("Received indication error or wait too long") + break + except Exception, details: + logger.error("Unknown exception happened") + logger.error(details) + finally: + sub.unsubscribe(dict['default_auth']) + logger.info("Cancelling subscription for %s" % indication_name) + os.kill(pid, signal.SIGKILL) + undefine_test_domain(test_dom, options.ip, options.virt) + + return status + +if __name__=="__main__": + sys.exit(main()) From yunguol at cn.ibm.com Mon Mar 31 06:04:50 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:04:50 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] [TEST] add default value setting for indication test case In-Reply-To: Message-ID: <769a9211a486b64e6a3d.1206943490@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206943227 25200 # Node ID 769a9211a486b64e6a3dedcd964ab6c93989202b # Parent 612ccb311e273b091659fe14f0471567abe61d08 [TEST] add default value setting for indication test case Signed-off-by: Guolian Yun diff -r 612ccb311e27 -r 769a9211a486 suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Mar 28 00:03:41 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Sun Mar 30 23:00:27 2008 -0700 @@ -37,7 +37,7 @@ from xml import xpath from xml import xpath from VirtLib import utils, live from XenKvmLib.test_doms import set_uuid -from CimTest.Globals import logger, CIM_IP +from CimTest.Globals import logger, CIM_IP, CIM_PORT, CIM_NS, CIM_USER, CIM_PASS from CimTest.ReturnCodes import SKIP from XenKvmLib.classes import virt_types @@ -548,3 +548,17 @@ def get_class(virt): if virt in virt_types: return eval(virt + 'XML') +def set_default(server): + dict = {} + dict['default_sysname'] = live.full_hostname(server) + dict['default_port'] = CIM_PORT + dict['default_url'] = "%s:%s" % (dict['default_sysname'], dict['default_port']) + dict['default_ns'] = CIM_NS + dict['default_name'] = "Test" + dict['default_dump'] = False + dict['default_print_ind'] = False + dict['default_username'] = CIM_USER + dict['default_password'] = CIM_PASS + dict['default_auth'] = (dict['default_username'], dict['default_password']) + + return dict From yunguol at cn.ibm.com Mon Mar 31 06:36:55 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:36:55 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] update EC.01 for XenFV and KVM support In-Reply-To: Message-ID: <0c1a7077faebe978965e.1206945415@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206944886 25200 # Node ID 0c1a7077faebe978965e537505e978117f623929 # Parent 612ccb311e273b091659fe14f0471567abe61d08 [TEST] update EC.01 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 612ccb311e27 -r 0c1a7077faeb suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Fri Mar 28 00:03:41 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Sun Mar 30 23:28:06 2008 -0700 @@ -25,11 +25,12 @@ from VirtLib import live from VirtLib import live from XenKvmLib import assoc from XenKvmLib import hostsystem +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] @do_main(sup_types) def main(): @@ -37,15 +38,16 @@ def main(): Globals.log_param() try: - host_sys = hostsystem.enumerate(options.ip)[0] + host_sys = hostsystem.enumerate(options.ip, options.virt)[0] except Exception: - Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, 'Xen_HostSystem') + Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, get_typed_class(options.virt, 'HostSystem')) return FAIL try: elc = assoc.AssociatorNames(options.ip, - "Xen_ElementCapabilities", - "Xen_HostSystem", + "ElementCapabilities", + "HostSystem", + options.virt, Name = host_sys.Name, CreationClassName = host_sys.CreationClassName) except Exception: @@ -53,8 +55,8 @@ def main(): return FAIL - valid_elc_name = ["Xen_VirtualSystemManagementCapabilities", - "Xen_VirtualSystemMigrationCapabilities"] + valid_elc_name = [get_typed_class(options.virt, "VirtualSystemManagementCapabilities"), + get_typed_class(options.virt, "VirtualSystemMigrationCapabilities")] valid_elc_id = ["ManagementCapabilities", "MigrationCapabilities"] @@ -70,19 +72,20 @@ def main(): return FAIL - cs = live.domain_list(options.ip) + cs = live.domain_list(options.ip, options.virt) for system in cs: try: elec = assoc.AssociatorNames(options.ip, - "Xen_ElementCapabilities", - "Xen_ComputerSystem", + "ElementCapabilities", + "ComputerSystem", + options.virt, Name = system, CreationClassName = "Xen_ComputerSystem") except Exception: Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % system) return FAIL - if elec[0].classname != "Xen_EnabledLogicalElementCapabilities": + if elec[0].classname != get_typed_class(options.virt, "EnabledLogicalElementCapabilities"): Globals.logger.error("ElementCapabilities association classname error") return FAIL elif elec[0].keybindings['InstanceID'] != system: From yunguol at cn.ibm.com Mon Mar 31 06:36:54 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:36:54 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] [TEST] update EC test cases for XenFV and KVM support Message-ID: Signed-off-by: Guolian Yun From yunguol at cn.ibm.com Mon Mar 31 06:36:57 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:36:57 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] [TEST] update EC.04 for XenFV and KVM support In-Reply-To: Message-ID: <8a80ce6eb0938f83877f.1206945417@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206945382 25200 # Node ID 8a80ce6eb0938f83877ffd54e047a6a54c58f756 # Parent 8a88d71e2fc844fcf4a2fd45924c9971e1639dac [TEST] update EC.04 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 8a88d71e2fc8 -r 8a80ce6eb093 suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py Sun Mar 30 23:33:34 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py Sun Mar 30 23:36:22 2008 -0700 @@ -24,11 +24,12 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -37,13 +38,12 @@ def try_assoc(ref, ref_class, exp_rc, ex conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) - log_param() status = FAIL rc = -1 names = [] try: - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -56,16 +56,19 @@ def try_assoc(ref, ref_class, exp_rc, ex logger.error(details) finally: if rc == 0: - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) + logger.error("ElementCapabilities associator should NOT return excepted result \ + with a wrong key name and value of %s input" % ref_class) status = FAIL return status @do_main(sup_types) def main(): + options = main.options + log_param() rc = PASS - cap_list = {"Xen_VirtualSystemManagementCapabilities" : "ManagementCapabilities", - "Xen_VirtualSystemMigrationCapabilities" : "MigrationCapabilities"} + cap_list = {get_typed_class(options.virt, "VirtualSystemManagementCapabilities") : "ManagementCapabilities", + get_typed_class(options.virt, "VirtualSystemMigrationCapabilities") : "MigrationCapabilities"} for k, v in cap_list.items(): instanceref = CIMInstanceName(k, @@ -75,9 +78,9 @@ def main(): status = FAIL return status - elecref = CIMInstanceName("Xen_EnabledLogicalElementCapabilities", + elecref = CIMInstanceName(get_typed_class(options.virt, "EnabledLogicalElementCapabilities"), keybindings = {"InstanceID" : "wrong"}) - rc = try_assoc(elecref, "Xen_EnabledLogicalElementCapabilities", + rc = try_assoc(elecref, get_typed_class(options.virt, "EnabledLogicalElementCapabilities"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL From yunguol at cn.ibm.com Mon Mar 31 06:36:56 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Sun, 30 Mar 2008 23:36:56 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] [TEST] update EC.03 for XenFV and KVM support In-Reply-To: Message-ID: <8a88d71e2fc844fcf4a2.1206945416@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206945214 25200 # Node ID 8a88d71e2fc844fcf4a2fd45924c9971e1639dac # Parent 0c1a7077faebe978965e537505e978117f623929 [TEST] update EC.03 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 0c1a7077faeb -r 8a88d71e2fc8 suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Sun Mar 30 23:28:06 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Sun Mar 30 23:33:34 2008 -0700 @@ -25,11 +25,12 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import hostsystem +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -38,13 +39,12 @@ def try_assoc(ref, ref_class, exp_rc, ex conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) - log_param() status = FAIL rc = -1 names = [] try: - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -57,7 +57,8 @@ def try_assoc(ref, ref_class, exp_rc, ex logger.error(details) finally: if rc == 0: - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) + logger.error("ElementCapabilities associator should NOT return excepted result \ + with a wrong key name and value of %s input" % ref_class) status = FAIL return status @@ -67,18 +68,20 @@ def main(): def main(): options = main.options rc = PASS + log_param() - instanceref = CIMInstanceName("Xen_HostSystem", + instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"}) - rc = try_assoc(instanceref, "Xen_HostSystem", exp_rc, exp_desc, options) + rc = try_assoc(instanceref, get_typed_class(options.virt, "HostSystem"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL return status - instance_cs = CIMInstanceName("Xen_ComputerSystem", - keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"}) - rc = try_assoc(instance_cs, "Xen_ComputerSystem", exp_rc, exp_desc, options) + instance_cs = CIMInstanceName(get_typed_class(options.virt, "ComputerSystem"), + keybindings = {"Name" : "wrong", + "CreationClassName" : get_typed_class(options.virt,"ComputerSystem")}) + rc = try_assoc(instance_cs, get_typed_class(options.virt, "ComputerSystem"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL return status From yunguol at cn.ibm.com Mon Mar 31 08:01:07 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:01:07 -0700 Subject: [Libvirt-cim] [PATCH 1 of 5] [TEST] devices lib changes for XenFV and KVM support In-Reply-To: Message-ID: <41d06111a09a3f7542fa.1206950467@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206950073 25200 # Node ID 41d06111a09a3f7542fab1cedfdba5bf0e87f6c8 # Parent 612ccb311e273b091659fe14f0471567abe61d08 [TEST] devices lib changes for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 612ccb311e27 -r 41d06111a09a suites/libvirt-cim/lib/XenKvmLib/devices.py --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py Fri Mar 28 00:03:41 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py Mon Mar 31 00:54:33 2008 -0700 @@ -93,13 +93,13 @@ class KVM_Processor(CIM_Processor): class KVM_Processor(CIM_Processor): pass -def enumerate(server, devtype, keys): +def enumerate(server, devtype, keys, virt='Xen'): conn = pywbem.WBEMConnection('http://%s' % server, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) list = [] - + devtype = eval(get_typed_class(virt, devtype)) try: names = conn.EnumerateInstanceNames(devtype.__name__) except pywbem.CIMError, arg: From yunguol at cn.ibm.com Mon Mar 31 08:01:08 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:01:08 -0700 Subject: [Libvirt-cim] [PATCH 2 of 5] [TEST] update RAFP.01 for XenFV and KVM support In-Reply-To: Message-ID: # HG changeset patch # User Guolian Yun # Date 1206950184 25200 # Node ID e1cd8daac37d7ac78879912e4c635f1e9b17ed0f # Parent 41d06111a09a3f7542fab1cedfdba5bf0e87f6c8 [TEST] update RAFP.01 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 41d06111a09a -r e1cd8daac37d suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py Mon Mar 31 00:54:33 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py Mon Mar 31 00:56:24 2008 -0700 @@ -25,12 +25,13 @@ import sys import sys from VirtLib import utils from XenKvmLib import assoc -from XenKvmLib import enumclass +from XenKvmLib import enumclass +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, XFAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] @do_main(sup_types) def main(): @@ -41,44 +42,48 @@ def main(): try: key_list = { 'InstanceID' : "MemoryPool/0" } mempool = enumclass.getInstance(options.ip, - enumclass.Xen_MemoryPool, - key_list) + "MemoryPool", + key_list, + options.virt) except Exception: - logger.error(Globals.CIM_ERROR_GETINSTANCE % enumclass.Xen_MemoryPool) + logger.error(Globals.CIM_ERROR_GETINSTANCE % "MemoryPool") return FAIL try: key_list = { 'InstanceID' : "ProcessorPool/0" } procpool = enumclass.getInstance(options.ip, - enumclass.Xen_ProcessorPool, - key_list) + "ProcessorPool", + key_list, + options.virt) except Exception: - logger.error(Globals.CIM_ERROR_GETINSTANCE % enumclass.Xen_ProcessorPool) + logger.error(Globals.CIM_ERROR_GETINSTANCE % "ProcessorPool") return FAIL try: - memdata = assoc.AssociatorNames(options.ip, "Xen_ResourceAllocationFromPool", - "Xen_MemoryPool", + memdata = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool", + "MemoryPool", + options.virt, InstanceID = mempool.InstanceID) except Exception: logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % mempool.InstanceID) status = FAIL for i in range(len(memdata)): - if memdata[i].classname != "Xen_MemResourceAllocationSettingData": + if memdata[i].classname != get_typed_class(options.virt, "MemResourceAllocationSettingData"): logger.error("ERROR: Association result error") status = FAIL try: - procdata = assoc.AssociatorNames(options.ip, "Xen_ResourceAllocationFromPool", - "Xen_ProcessorPool", + procdata = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool", + "ProcessorPool", + options.virt, InstanceID = procpool.InstanceID) except Exception: logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % procpool.InstanceID) status = FAIL for j in range(len(procdata)): - if procdata[j].classname != "Xen_ProcResourceAllocationSettingData": + if procdata[j].classname != get_typed_class(options.virt, "ProcResourceAllocationSettingData"): logger.error("ERROR: Association result error") status = FAIL From yunguol at cn.ibm.com Mon Mar 31 08:01:09 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:01:09 -0700 Subject: [Libvirt-cim] [PATCH 3 of 5] [TEST] update RAFP.02 for XenFV and KVM support In-Reply-To: Message-ID: <1542ed9f28baf4b5025b.1206950469@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206950255 25200 # Node ID 1542ed9f28baf4b5025b4fffc0391131c76c2c5e # Parent e1cd8daac37d7ac78879912e4c635f1e9b17ed0f [TEST] update RAFP.02 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r e1cd8daac37d -r 1542ed9f28ba suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Mon Mar 31 00:56:24 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Mon Mar 31 00:57:35 2008 -0700 @@ -26,12 +26,13 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import devices +from XenKvmLib.classes import get_typed_class from XenKvmLib.devices import Xen_Memory, Xen_Processor from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, XFAIL -sup_types = ['xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] @do_main(sup_types) def main(): @@ -42,21 +43,22 @@ def main(): key_list = ["DeviceID", "CreationClassName", "SystemName", "SystemCreationClassName"] try: - mem = devices.enumerate(options.ip, Xen_Memory, key_list) + mem = devices.enumerate(options.ip, "Memory", key_list, options.virt) except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % devices.Xen_Memory) + logger.error(Globals.CIM_ERROR_ENUMERATE % "Memory") return FAIL try: - proc = devices.enumerate(options.ip, Xen_Processor, key_list) + proc = devices.enumerate(options.ip, "Processor", key_list, options.virt) except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % devices.Xen_Processor) + logger.error(Globals.CIM_ERROR_ENUMERATE % "Processor") return FAIL for i in range(len(mem)): try: - mempool = assoc.AssociatorNames(options.ip, "Xen_ResourceAllocationFromPool", - "Xen_MemResourceAllocationSettingData", + mempool = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool", + "MemResourceAllocationSettingData", + options.virt, InstanceID = mem[i].DeviceID) except Exception: logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % mem[i].DeviceID) @@ -72,8 +74,9 @@ def main(): for j in range(len(proc)): try: - procpool = assoc.AssociatorNames(options.ip, "Xen_ResourceAllocationFromPool", - "Xen_ProcResourceAllocationSettingData", + procpool = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool", + "ProcResourceAllocationSettingData", + options.virt, InstanceID = proc[j].DeviceID) except Exception: logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % proc[j].DeviceID) From yunguol at cn.ibm.com Mon Mar 31 08:01:10 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:01:10 -0700 Subject: [Libvirt-cim] [PATCH 4 of 5] [TEST] update RAFP.03 for XenFV and KVM support In-Reply-To: Message-ID: # HG changeset patch # User Guolian Yun # Date 1206950325 25200 # Node ID f774e7aa50928c3a11cc4cac4d66496edd1de0c8 # Parent 1542ed9f28baf4b5025b4fffc0391131c76c2c5e [TEST] update RAFP.03 for XenFV and KVM support diff -r 1542ed9f28ba -r f774e7aa5092 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/03_forward_errs.py Mon Mar 31 00:57:35 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/03_forward_errs.py Mon Mar 31 00:58:45 2008 -0700 @@ -24,11 +24,12 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, XFAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance (wrong) - resource pool type mismatch" @@ -42,7 +43,8 @@ def main(): status = FAIL - poollist = {"Xen_MemoryPool" : "wrong", "Xen_ProcessorPool" : "wrong"} + poollist = {get_typed_class(options.virt, "MemoryPool") : "wrong", + get_typed_class(options.virt, "ProcessorPool") : "wrong"} conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) @@ -52,7 +54,8 @@ def main(): names = [] try: - names = conn.AssociatorNames(instanceref, AssocClass = "Xen_ResourceAllocationFromPool") + names = conn.AssociatorNames(instanceref, + AssocClass = get_typed_class(options.virt, "ResourceAllocationFromPool")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: From yunguol at cn.ibm.com Mon Mar 31 08:01:11 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:01:11 -0700 Subject: [Libvirt-cim] [PATCH 5 of 5] [TEST] update RAFP.04 for XenFV and KVM support In-Reply-To: Message-ID: # HG changeset patch # User Guolian Yun # Date 1206950440 25200 # Node ID a0bfc37ad626afe465fc629138b4a1c2f22af1ba # Parent f774e7aa50928c3a11cc4cac4d66496edd1de0c8 [TEST] update RAFP.04 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r f774e7aa5092 -r a0bfc37ad626 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/04_reverse_errs.py Mon Mar 31 00:58:45 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/04_reverse_errs.py Mon Mar 31 01:00:40 2008 -0700 @@ -24,11 +24,12 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, XFAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -41,7 +42,8 @@ def main(): status = FAIL - dataset = {"Xen_MemResourceAllocationSettingData" : "wrong", "Xen_ProcResourceAllocationSettingData" : "wrong"} + dataset = {get_typed_class(options.virt, "MemResourceAllocationSettingData") : "wrong", + get_typed_class(options.virt, "ProcResourceAllocationSettingData") : "wrong"} conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) @@ -51,7 +53,8 @@ def main(): names = [] try: - names = conn.AssociatorNames(instanceref, AssocClass = "Xen_ResourceAllocationFromPool") + names = conn.AssociatorNames(instanceref, + AssocClass = get_typed_class(options.virt, "ResourceAllocationFromPool")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: From yunguol at cn.ibm.com Mon Mar 31 08:01:06 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:01:06 -0700 Subject: [Libvirt-cim] [PATCH 0 of 5] [TEST] update bundles of RAFP tc and devices lib for XenFV and KVM support Message-ID: Signed-off-by: Guolian Yun From yunguol at cn.ibm.com Mon Mar 31 08:42:41 2008 From: yunguol at cn.ibm.com (Guo Lian Yun) Date: Mon, 31 Mar 2008 01:42:41 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] update ElementConforms.03 for XenFV and KVM support Message-ID: <9a6366dcdb01ebe19dce.1206952961@elm3b197.beaverton.ibm.com> # HG changeset patch # User Guolian Yun # Date 1206952946 25200 # Node ID 9a6366dcdb01ebe19dceee945b9f59092e0f495d # Parent 612ccb311e273b091659fe14f0471567abe61d08 [TEST] update ElementConforms.03 for XenFV and KVM support Signed-off-by: Guolian Yun diff -r 612ccb311e27 -r 9a6366dcdb01 suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py --- a/suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py Fri Mar 28 00:03:41 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py Mon Mar 31 01:42:26 2008 -0700 @@ -3,6 +3,7 @@ # Copyright 2008 IBM Corp. # # Authors: +# Guolian Yun # Anoop V Chakkalakkal # Guolian Yun # This library is free software; you can redistribute it and/or @@ -55,14 +56,13 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib.common_util import try_assoc +from XenKvmLib.classes import get_typed_class from CimTest.ReturnCodes import PASS, FAIL from CimTest import Globals from CimTest.Globals import log_param, logger, CIM_USER, CIM_PASS, do_main -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] -classname = 'Xen_RegisteredProfile' -ac_classname = 'Xen_ElementConformsToProfile' bug = '92642' expr_values = { @@ -72,7 +72,9 @@ expr_values = { 'desc' : 'No such instance' } } -def try_invalid_assoc(name_val, i, field): +def try_invalid_assoc(name_val, i, field, virt='Xen'): + classname = get_typed_class(virt, "RegisteredProfile") + ac_classname = get_typed_class(virt, "ElementConformsToProfile") j = 0 keys = {} temp = name_val[i] @@ -106,7 +108,7 @@ def main(): tc_scen = ['INVALID_InstID_Keyname', 'INVALID_InstID_Keyvalue'] for i in range(len(tc_scen)): - retval = try_invalid_assoc(sv_name_val, i, tc_scen[i]) + retval = try_invalid_assoc(sv_name_val, i, tc_scen[i], options.virt) if retval != PASS: status = retval From danms at us.ibm.com Mon Mar 31 13:40:50 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 06:40:50 -0700 Subject: [Libvirt-cim] [PATCH] [CU] add one class to keep a list of received indications In-Reply-To: <66fc3211e0bf16d2be0d.1206942645@elm3b197.beaverton.ibm.com> (Guo Lian Yun's message of "Sun, 30 Mar 2008 22:50:45 -0700") References: <66fc3211e0bf16d2be0d.1206942645@elm3b197.beaverton.ibm.com> Message-ID: <87d4pbm2ot.fsf@caffeine.beaverton.ibm.com> GY> +class CIMIndicationServer(BaseHTTPServer.HTTPServer): GY> + def __init__(self, *args): GY> + BaseHTTPServer.HTTPServer.__init__(self, *args) GY> + self.indications = [] GY> + You add this subclass and then don't use it anywhere. Either use the subclass and add the other additional member (print_ind) or delete this bit. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 31 14:20:02 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 07:20:02 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms In-Reply-To: <47F075EC.1080908@linux.vnet.ibm.com> (Zhengang Li's message of "Mon, 31 Mar 2008 13:26:04 +0800") References: <871w5uoqb6.fsf@caffeine.beaverton.ibm.com> <47ED8C9F.6000304@linux.vnet.ibm.com> <87lk42merb.fsf@caffeine.beaverton.ibm.com> <47F075EC.1080908@linux.vnet.ibm.com> Message-ID: <877ifjm0vh.fsf@caffeine.beaverton.ibm.com> ZL> I'm not aware of this. Can you give me an example? I went digging to try to figure out the answer to my question, and I think I've got it. I'll apply. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 31 14:23:03 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 07:23:03 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Make 02_destroysystem actually test the right thing In-Reply-To: (Dan Smith's message of "Fri, 28 Mar 2008 13:34:48 -0700") References: Message-ID: <873aq7m0qg.fsf@caffeine.beaverton.ibm.com> DS> # HG changeset patch DS> # User Dan Smith DS> # Date 1206736402 25200 DS> # Node ID fe283ed5273e0983adf6355c9d6d8e1e81dcdde2 DS> # Parent 612ccb311e273b091659fe14f0471567abe61d08 DS> [TEST] Make 02_destroysystem actually test the right thing Can someone ack this please? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From lizg at cn.ibm.com Mon Mar 31 14:33:57 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Mon, 31 Mar 2008 22:33:57 +0800 Subject: [Libvirt-cim] [PATCH 2 of 3] [TEST] SystemDevice.02_reverse XenFV & KVM support In-Reply-To: Message-ID: <6c8ff6906d1c4d1fd8c6.1206974037@zeit.cn.ibm.com> # HG changeset patch # User Zhengang Li # Date 1206973985 -28800 # Node ID 6c8ff6906d1c4d1fd8c6766c5f7b70d7b7beb420 # Parent 05259e63c37a2d496411b6b473c0f107fbceb652 [TEST] SystemDevice.02_reverse XenFV & KVM support Also changed the devices.enumerate() method's 2nd param (devtype). Test cases are updated, where this method is referenced: LogicalDisk.02_nodevs ResourceAllocationFromPool.02_reverse Signed-off-by: Zhengang Li diff -r 05259e63c37a -r 6c8ff6906d1c suites/libvirt-cim/cimtest/LogicalDisk/02_nodevs.py --- a/suites/libvirt-cim/cimtest/LogicalDisk/02_nodevs.py Mon Mar 31 22:32:29 2008 +0800 +++ b/suites/libvirt-cim/cimtest/LogicalDisk/02_nodevs.py Mon Mar 31 22:33:05 2008 +0800 @@ -66,7 +66,7 @@ def main(): devid = "%s/%s" % (test_dom, test_dev) status = 0 - name = eval('devices.' + get_typed_class(options.virt, "LogicalDisk")) + name = get_typed_class(options.virt, "LogicalDisk") key_list = ["DeviceID", "CreationClassName", "SystemName", "SystemCreationClassName"] devs = devices.enumerate(options.ip, name, key_list) diff -r 05259e63c37a -r 6c8ff6906d1c suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Mon Mar 31 22:32:29 2008 +0800 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Mon Mar 31 22:33:05 2008 +0800 @@ -26,7 +26,7 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import devices -from XenKvmLib.devices import Xen_Memory, Xen_Processor +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, XFAIL @@ -42,13 +42,17 @@ def main(): key_list = ["DeviceID", "CreationClassName", "SystemName", "SystemCreationClassName"] try: - mem = devices.enumerate(options.ip, Xen_Memory, key_list) + mem = devices.enumerate(options.ip, + get_typed_class(options.virt, 'Memory'), + key_list) except Exception: logger.error(Globals.CIM_ERROR_ENUMERATE % devices.Xen_Memory) return FAIL try: - proc = devices.enumerate(options.ip, Xen_Processor, key_list) + proc = devices.enumerate(options.ip, + get_typed_class(options.virt, 'Processor'), + key_list) except Exception: logger.error(Globals.CIM_ERROR_ENUMERATE % devices.Xen_Processor) return FAIL diff -r 05259e63c37a -r 6c8ff6906d1c suites/libvirt-cim/cimtest/SystemDevice/02_reverse.py --- a/suites/libvirt-cim/cimtest/SystemDevice/02_reverse.py Mon Mar 31 22:32:29 2008 +0800 +++ b/suites/libvirt-cim/cimtest/SystemDevice/02_reverse.py Mon Mar 31 22:33:05 2008 +0800 @@ -25,18 +25,16 @@ # import sys -from XenKvmLib.test_xml import testxml from VirtLib import utils +from XenKvmLib import vxml from XenKvmLib import computersystem from XenKvmLib import assoc -from XenKvmLib.test_doms import test_domain_function from XenKvmLib import devices -from XenKvmLib.devices import Xen_NetworkPort, Xen_Memory, Xen_LogicalDisk, \ - Xen_Processor +from XenKvmLib.classes import get_typed_class from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "test_domain" test_mac = "00:11:22:33:44:55" @@ -47,21 +45,23 @@ def main(): log_param() status = FAIL - test_xml = testxml(test_dom, mac = test_mac) - test_domain_function(test_xml, options.ip, "destroy") - test_domain_function(test_xml, options.ip, "create") + cxml = vxml.get_class(options.virt)(test_dom, mac=test_mac) + cxml.create(options.ip) - devlist = [ "Xen_NetworkPort", "Xen_Memory", "Xen_LogicalDisk", \ - "Xen_Processor" ] + devlist = [ get_typed_class(options.virt, "NetworkPort"), + get_typed_class(options.virt, "Memory"), + get_typed_class(options.virt, "LogicalDisk"), + get_typed_class(options.virt, "Processor") ] key_list = ["DeviceID", "CreationClassName", "SystemName", "SystemCreationClassName"] for items in devlist: try: - devs = devices.enumerate(options.ip, eval(items), key_list) + devs = devices.enumerate(options.ip, items, key_list) except Exception, detail: logger.error("Exception: %s" % detail) - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return FAIL for dev in devs: @@ -69,24 +69,28 @@ def main(): continue try: - systems = assoc.AssociatorNames(options.ip, "Xen_SystemDevice", - items, - DeviceID=dev.DeviceID, - CreationClassName=dev.CreationClassName, - SystemName=dev.SystemName, - SystemCreationClassName=dev.SystemCreationClassName) + systems = assoc.AssociatorNames(options.ip, + get_typed_class(options.virt, "SystemDevice"), + items, virt=options.virt, + DeviceID=dev.DeviceID, + CreationClassName=dev.CreationClassName, + SystemName=dev.SystemName, + SystemCreationClassName=dev.SystemCreationClassName) except Exception, detail: logger.error("Exception: %s" % detail) - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return FAIL if systems == None: logger.error("Device association failed") - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return FAIL elif len(systems) != 1: logger.error("%s systems returned, expected 1" % len(systems)) - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return FAIL system = computersystem.system_of(options.ip, systems[0]) @@ -98,7 +102,8 @@ def main(): logger.error("Association returned wrong system: %s" % system.Name) - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return status diff -r 05259e63c37a -r 6c8ff6906d1c suites/libvirt-cim/lib/XenKvmLib/devices.py --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py Mon Mar 31 22:32:29 2008 +0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py Mon Mar 31 22:33:05 2008 +0800 @@ -101,7 +101,7 @@ def enumerate(server, devtype, keys): list = [] try: - names = conn.EnumerateInstanceNames(devtype.__name__) + names = conn.EnumerateInstanceNames(devtype) except pywbem.CIMError, arg: print arg[1] return list @@ -114,7 +114,7 @@ def enumerate(server, devtype, keys): if len(key_list) == 0: return list - list.append(devtype(server, key_list)) + list.append(eval(devtype)(server, key_list)) return list From lizg at cn.ibm.com Mon Mar 31 14:33:55 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Mon, 31 Mar 2008 22:33:55 +0800 Subject: [Libvirt-cim] [PATCH 0 of 3] [TEST] SystemDevice XenFV & KVM support Message-ID: Add XenFV & KVM support for SystemDevice test cases. Signed-off-by: Zhengang Li From lizg at cn.ibm.com Mon Mar 31 14:33:56 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Mon, 31 Mar 2008 22:33:56 +0800 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] SystemDevice.01_forward XenFV & KVM support In-Reply-To: Message-ID: <05259e63c37a2d496411.1206974036@zeit.cn.ibm.com> # HG changeset patch # User Zhengang Li # Date 1206973949 -28800 # Node ID 05259e63c37a2d496411b6b473c0f107fbceb652 # Parent c67d4960d4073c641beeb1fe5180862001c247ae [TEST] SystemDevice.01_forward XenFV & KVM support Signed-off-by: Zhengang Li diff -r c67d4960d407 -r 05259e63c37a suites/libvirt-cim/cimtest/SystemDevice/01_forward.py --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py Fri Mar 28 21:46:53 2008 +0800 +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py Mon Mar 31 22:32:29 2008 +0800 @@ -25,19 +25,18 @@ # import sys -from XenKvmLib.test_xml import testxml from VirtLib import utils from XenKvmLib import assoc -from XenKvmLib.test_doms import test_domain_function +from XenKvmLib import vxml from XenKvmLib import devices +from XenKvmLib.classes import get_typed_class from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "test_domain" test_mac = "00:11:22:33:44:55" -test_disk = "xvdb" test_cpu = 1 @do_main(sup_types) @@ -45,17 +44,26 @@ def main(): options= main.options log_param() + if options.virt == 'Xen': + test_disk = 'xvdb' + else: + test_disk = 'hdb' + status = PASS - test_xml = testxml(test_dom, vcpus = test_cpu, mac = test_mac, \ - disk = test_disk) + cxml = vxml.get_class(options.virt)(test_dom, vcpus = test_cpu, + mac = test_mac, disk = test_disk) + cxml.destroy(options.ip) + ret = cxml.create(options.ip) + if not ret: + logger.error('Unable to create domain %s' % test_dom) + return FAIL - test_domain_function(test_xml, options.ip, "destroy") - test_domain_function(test_xml, options.ip, "create") + sd_classname = get_typed_class(options.virt, 'SystemDevice') + cs_classname = get_typed_class(options.virt, 'ComputerSystem') - devs = assoc.AssociatorNames(options.ip, "Xen_SystemDevice", - "Xen_ComputerSystem", - Name=test_dom, - CreationClassName="Xen_ComputerSystem") + devs = assoc.AssociatorNames(options.ip, sd_classname, cs_classname, + virt=options.virt, + Name=test_dom, CreationClassName=cs_classname) if devs == None: logger.error("System association failed") return FAIL @@ -63,13 +71,15 @@ def main(): logger.error("No devices returned") return FAIL - devlist = ["Xen_NetworkPort", "Xen_Memory", "Xen_LogicalDisk", \ - "Xen_Processor"] + devlist = [get_typed_class(options.virt, "NetworkPort"), + get_typed_class(options.virt, "Memory"), + get_typed_class(options.virt, "LogicalDisk"), + get_typed_class(options.virt, "Processor")] key_list = {'DeviceID' : '', 'CreationClassName' : '', 'SystemName' : test_dom, - 'SystemCreationClassname' : "Xen_ComputerSystem" + 'SystemCreationClassname' : cs_classname } for items in devlist: @@ -81,14 +91,14 @@ def main(): continue devid = device.DeviceID - if items == "Xen_NetworkPort": + if items == devlist[0]: _devid = "%s/%s" % (test_dom, test_mac) - elif items == "Xen_LogicalDisk": + elif items == devlist[1]: + _devid = "%s/mem" % test_dom + elif items == devlist[2]: _devid = "%s/%s" % (test_dom, test_disk) - elif items == "Xen_Processor": + elif items == devlist[3]: _devid = "%s/%d" % (test_dom, test_cpu-1) - elif items == "Xen_Memory": - _devid = "%s/mem" % test_dom if devid != _devid: logger.error("DeviceID `%s` != `%s'" % (devid, _devid)) @@ -96,7 +106,8 @@ def main(): else: logger.info("Examined %s" % _devid) - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return status From lizg at cn.ibm.com Mon Mar 31 14:33:58 2008 From: lizg at cn.ibm.com (lizg at cn.ibm.com) Date: Mon, 31 Mar 2008 22:33:58 +0800 Subject: [Libvirt-cim] [PATCH 3 of 3] [TEST] SystemDevice.03_fwderrs XenFV & KVM support In-Reply-To: Message-ID: <7d806de944b51750ae19.1206974038@zeit.cn.ibm.com> # HG changeset patch # User Zhengang Li # Date 1206974015 -28800 # Node ID 7d806de944b51750ae19b40bb3ec655930a476e3 # Parent 6c8ff6906d1c4d1fd8c6766c5f7b70d7b7beb420 [TEST] SystemDevice.03_fwderrs XenFV & KVM support Signed-off-by: Zhengang Li diff -r 6c8ff6906d1c -r 7d806de944b5 suites/libvirt-cim/cimtest/SystemDevice/03_fwderrs.py --- a/suites/libvirt-cim/cimtest/SystemDevice/03_fwderrs.py Mon Mar 31 22:33:05 2008 +0800 +++ b/suites/libvirt-cim/cimtest/SystemDevice/03_fwderrs.py Mon Mar 31 22:33:35 2008 +0800 @@ -32,20 +32,18 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from VirtLib import utils -from XenKvmLib.test_xml import testxml +from XenKvmLib import vxml from XenKvmLib import assoc from XenKvmLib import devices -from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all -from XenKvmLib.devices import Xen_NetworkPort, Xen_Memory, Xen_LogicalDisk, Xen_Processor +from XenKvmLib.classes import get_typed_class from CimTest.Globals import log_param, logger, do_main from CimTest import Globals from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC -sup_types = ['Xen'] +sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "virt1" test_mac = "00:11:22:33:44:55" -test_disk = "xvda" test_cpu = 1 exp_rc1 = 1 #CIM_ERR_FAILED @@ -59,18 +57,25 @@ def main(): def main(): options = main.options + if options.virt == 'Xen': + test_disk = 'xvda' + else: + test_disk = 'hda' + log_param() status = PASS - test_xml = testxml(test_dom, vcpus = test_cpu, mac = test_mac, disk = test_disk) + cxml = vxml.get_class(options.virt)(test_dom, vcpus = test_cpu, + mac = test_mac, disk = test_disk) - test_domain_function(test_dom, options.ip, "destroy") - ret = test_domain_function(test_xml, options.ip, "create") + ret = cxml.create(options.ip) if not ret : logger.info("error while 'create' of VS") return FAIL - devlist = [ "Xen_NetworkPort", "Xen_Memory", - "Xen_LogicalDisk", "Xen_Processor" ] + devlist = [ get_typed_class(options.virt, "NetworkPort"), + get_typed_class(options.virt, "Memory"), + get_typed_class(options.virt, "LogicalDisk"), + get_typed_class(options.virt, "Processor") ] # Building the dict for avoiding the correct key:val pairs # while verifying with the Invalid values for the association @@ -82,7 +87,7 @@ def main(): try: for item in devlist: - devs = devices.enumerate(options.ip, eval(item), key_list) + devs = devices.enumerate(options.ip, item, key_list) for dev in devs: if dev.SystemName != test_dom: @@ -131,9 +136,10 @@ def main(): instanceref = CIMInstanceName(item, keybindings = \ {i : keyval , "CreationClassName" : item}) - try: + try: + sd_classname = get_typed_class(options.virt, 'SystemDevice') conn.AssociatorNames(instanceref, - AssocClass = "Xen_SystemDevice") + AssocClass = sd_classname) rc = 0 except pywbem.CIMError, (rc, desc): @@ -161,7 +167,8 @@ def main(): logger.info("exception" , details) status = FAIL - test_domain_function(test_dom, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return status if __name__ == "__main__": From zli at linux.vnet.ibm.com Mon Mar 31 14:44:58 2008 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Mon, 31 Mar 2008 22:44:58 +0800 Subject: [Libvirt-cim] [PATCH] [TEST] Make 02_destroysystem actually test the right thing In-Reply-To: <873aq7m0qg.fsf@caffeine.beaverton.ibm.com> References: <873aq7m0qg.fsf@caffeine.beaverton.ibm.com> Message-ID: <47F0F8EA.7000608@linux.vnet.ibm.com> Dan Smith wrote: > DS> # HG changeset patch > DS> # User Dan Smith > DS> # Date 1206736402 25200 > DS> # Node ID fe283ed5273e0983adf6355c9d6d8e1e81dcdde2 > DS> # Parent 612ccb311e273b091659fe14f0471567abe61d08 > DS> [TEST] Make 02_destroysystem actually test the right thing > > Can someone ack this please? > +1 from me, :). We'll need to catch up on reviewing patches. > > > ------------------------------------------------------------------------ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- - Zhengang From danms at us.ibm.com Mon Mar 31 15:06:39 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 08:06:39 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] update ElementConforms.03 for XenFV and KVM support In-Reply-To: <9a6366dcdb01ebe19dce.1206952961@elm3b197.beaverton.ibm.com> (Guo Lian Yun's message of "Mon, 31 Mar 2008 01:42:41 -0700") References: <9a6366dcdb01ebe19dce.1206952961@elm3b197.beaverton.ibm.com> Message-ID: <87ve33kk5c.fsf@caffeine.beaverton.ibm.com> GY> --- a/suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py Fri Mar 28 00:03:41 2008 -0700 GY> +++ b/suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py Mon Mar 31 01:42:26 2008 -0700 GY> @@ -3,6 +3,7 @@ GY> # Copyright 2008 IBM Corp. GY> # GY> # Authors: GY> +# Guolian Yun GY> # Anoop V Chakkalakkal GY> # Guolian Yun GY> # This library is free software; you can redistribute it and/or You're already in the authors list. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 31 16:25:50 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 09:25:50 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] SystemDevice.01_forward XenFV & KVM support In-Reply-To: <05259e63c37a2d496411.1206974036@zeit.cn.ibm.com> (lizg@cn.ibm.com's message of "Mon, 31 Mar 2008 22:33:56 +0800") References: <05259e63c37a2d496411.1206974036@zeit.cn.ibm.com> Message-ID: <87bq4ulv1t.fsf@caffeine.beaverton.ibm.com> ZL> + cxml = vxml.get_class(options.virt)(test_dom, vcpus = test_cpu, ZL> + mac = test_mac, disk = test_disk) I'm not familiar with the "function(foo)(bar)" syntax. Can you explain? ZL> + cxml.destroy(options.ip) ZL> + ret = cxml.create(options.ip) Why destroy it immediately and then create? Does vxml.get_class()() create the domain, or are you trying to make sure it doesn't already exist? ZL> + devlist = [get_typed_class(options.virt, "NetworkPort"), ZL> + get_typed_class(options.virt, "Memory"), ZL> + get_typed_class(options.virt, "LogicalDisk"), ZL> + get_typed_class(options.virt, "Processor")] Is this used anywhere else but below? ZL> - if items == "Xen_NetworkPort": ZL> + if items == devlist[0]: ZL> _devid = "%s/%s" % (test_dom, test_mac) ZL> - elif items == "Xen_LogicalDisk": ZL> + elif items == devlist[1]: ZL> + _devid = "%s/mem" % test_dom ZL> + elif items == devlist[2]: ZL> _devid = "%s/%s" % (test_dom, test_disk) ZL> - elif items == "Xen_Processor": ZL> + elif items == devlist[3]: ZL> _devid = "%s/%d" % (test_dom, test_cpu-1) ZL> - elif items == "Xen_Memory": ZL> - _devid = "%s/mem" % test_dom Going from class names to array values makes this harder to eye-parse. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From danms at us.ibm.com Mon Mar 31 17:55:05 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 10:55:05 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x) Message-ID: # HG changeset patch # User Dan Smith # Date 1206986066 25200 # Node ID ace377826c9c8f3b034f5c696ffb71dfb163d77b # Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec [TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x) Signed-off-by: Dan Smith diff -r 5d4743710455 -r ace377826c9c suites/libvirt-cim/lib/XenKvmLib/test_doms.py --- a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 07:54:19 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 10:54:26 2008 -0700 @@ -22,11 +22,23 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # import tempfile -import uuid import os from VirtLib import utils from VirtLib import live from CimTest.Globals import CIM_FUUID + +try: + import uuid as _uuid + def uuid(): + return str(_uuid.uuid1()) +except ImportError: + def uuid(): + from commands import getstatusoutput as run + s, o = run('uuidgen') + if s == 0: + return o + else: + raise ImportError("Missing uuid library (and can't fake it)") def define_test_domain(xml, server, virt="Xen"): name = tempfile.mktemp() @@ -74,7 +86,7 @@ def set_uuid(myuuid=0): """Generate a random uuid and record it into CIM_FUUID""" if myuuid == 0: - myuuid = uuid.uuid1().urn[9:] + myuuid = uuid() f = file(CIM_FUUID, 'a') f.write('%s\n' % myuuid) From danms at us.ibm.com Mon Mar 31 17:55:12 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 10:55:12 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Run basicConfig() on logger to make python-2.4 happy Message-ID: # HG changeset patch # User Dan Smith # Date 1206986099 25200 # Node ID bde349d23ce5320d7c593e57df45335dcae62df8 # Parent ace377826c9c8f3b034f5c696ffb71dfb163d77b [TEST] Run basicConfig() on logger to make python-2.4 happy Signed-off-by: Dan Smith diff -r ace377826c9c -r bde349d23ce5 lib/CimTest/Globals.py --- a/lib/CimTest/Globals.py Mon Mar 31 10:54:26 2008 -0700 +++ b/lib/CimTest/Globals.py Mon Mar 31 10:54:59 2008 -0700 @@ -50,6 +50,7 @@ CIM_PORT = "5988" CIM_PORT = "5988" NM = "TEST LOG" platform_sup = ["Xen", "KVM", "XenFV"] +logging.basicConfig() logger = logging.getLogger(NM) logging.PRINT = logging.DEBUG + 50 logging.addLevelName(logging.PRINT, "PRINT") From grendel at linux.vnet.ibm.com Mon Mar 31 19:08:57 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 31 Mar 2008 15:08:57 -0400 Subject: [Libvirt-cim] [PATCH] Make DestroySystem actually undefine a domain as it should In-Reply-To: <1e1c2cd2ef0bff684df3.1206736510@caffeine.beaverton.ibm.com> References: <1e1c2cd2ef0bff684df3.1206736510@caffeine.beaverton.ibm.com> Message-ID: <47F136C9.4030902@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1206736474 25200 > # Node ID 1e1c2cd2ef0bff684df37d5c94d7b66b6189295c > # Parent 2eaed9da089f7b49d85eadeb75334c11c869ffc8 > Make DestroySystem actually undefine a domain as it should > > Also clean up the error path and CMPIValue stuff in the method while > we're swizzling > > Signed-off-by: Dan Smith > I wish I could say something like, "I can't believe I forgot to actually undefine the thing," but really, who's surprised here? I'm sure not. Anyway, we obviously need that working, and the other small changes looks fine. +1 -- -Jay From grendel at linux.vnet.ibm.com Mon Mar 31 19:59:45 2008 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 31 Mar 2008 15:59:45 -0400 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] SystemDevice.01_forward XenFV & KVM support In-Reply-To: <87bq4ulv1t.fsf@caffeine.beaverton.ibm.com> References: <05259e63c37a2d496411.1206974036@zeit.cn.ibm.com> <87bq4ulv1t.fsf@caffeine.beaverton.ibm.com> Message-ID: <47F142B1.2000709@linux.vnet.ibm.com> Dan Smith wrote: > ZL> + cxml = vxml.get_class(options.virt)(test_dom, vcpus = test_cpu, > ZL> + mac = test_mac, disk = test_disk) > > I'm not familiar with the "function(foo)(bar)" syntax. Can you > explain? > > If get_class returns a class object, then the second set of parens would represent the call to that classes constructor I believe. If I'm right, my opinion would be "clever, but let's make it more obvious what's going on here." -- -Jay From danms at us.ibm.com Mon Mar 31 20:05:57 2008 From: danms at us.ibm.com (Dan Smith) Date: Mon, 31 Mar 2008 13:05:57 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] [TEST] SystemDevice.01_forward XenFV & KVM support In-Reply-To: <47F142B1.2000709@linux.vnet.ibm.com> (Jay Gagnon's message of "Mon, 31 Mar 2008 15:59:45 -0400") References: <05259e63c37a2d496411.1206974036@zeit.cn.ibm.com> <87bq4ulv1t.fsf@caffeine.beaverton.ibm.com> <47F142B1.2000709@linux.vnet.ibm.com> Message-ID: <87myoeodzu.fsf@caffeine.beaverton.ibm.com> JG> If get_class returns a class object, then the second set of parens JG> would represent the call to that classes constructor I believe. JG> If I'm right, my opinion would be "clever, but let's make it more JG> obvious what's going on here." Oh, right. After I sent my response, I figured it was a function. Either way, a temporary variable will make it cleaner....Please :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms at us.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From kaitlin at linux.vnet.ibm.com Fri Mar 28 19:02:39 2008 From: kaitlin at linux.vnet.ibm.com (Kaitlin Rupert) Date: Fri, 28 Mar 2008 12:02:39 -0700 Subject: [Libvirt-cim] [PATCH] Set status in all error cases for DestroySystem in VSMS Message-ID: <95caba1628c467332ffb.1206730959@elm3b41.beaverton.ibm.com> # HG changeset patch # User Kaitlin Rupert # Date 1206730931 25200 # Node ID 95caba1628c467332ffb129f663cef5289039744 # Parent 321e3b4320ff3c849c684f1d940f0fa917f6555c Set status in all error cases for DestroySystem in VSMS. Be sure to set a status message for the IM_RC_FAILED case. In the case that connect_by_classname() fails, set rc = -1 because connect_by_classname() sets the status. Remove domain_exists() - this has been replaced by virDomainLookupByName(). Fix typo in CU_DEBUG() statement. Signed-off-by: Kaitlin Rupert diff -r 321e3b4320ff -r 95caba1628c4 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Apr 09 10:57:05 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Fri Mar 28 12:02:11 2008 -0700 @@ -488,8 +488,10 @@ static CMPIStatus destroy_system(CMPIMet conn = connect_by_classname(_BROKER, CLASSNAME(reference), &status); - if (conn == NULL) + if (conn == NULL) { + rc = -1; goto error; + } if (cu_get_ref_arg(argsin, "AffectedSystem", &sys) != CMPI_RC_OK) goto error; @@ -498,13 +500,9 @@ static CMPIStatus destroy_system(CMPIMet if (dom_name == NULL) goto error; - // Make sure system exists and destroy it. - if (!domain_exists(conn, dom_name)) - goto error; - dom = virDomainLookupByName(conn, dom_name); if (dom == NULL) { - CU_DEBUG("No such domain `%s', dom_name"); + CU_DEBUG("No such domain `%s'", dom_name); rc = IM_RC_SYS_NOT_FOUND; goto error; } @@ -522,6 +520,10 @@ error: cu_statusf(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to find domain"); + else if (rc == IM_RC_FAILED) + cu_statusf(_BROKER, &status, + CMPI_RC_ERR_FAILED, + "Unable to retrieve domain name."); else if (rc == IM_RC_OK) status = (CMPIStatus){CMPI_RC_OK, NULL};