From veillard at redhat.com Thu Oct 25 06:53:52 2007 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 25 Oct 2007 02:53:52 -0400 Subject: [Libvirt-cim] test Message-ID: <20071025065351.GO6618@redhat.com> First message on the list for testing or archival, 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 danms at us.ibm.com Fri Oct 26 14:22:19 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 07:22:19 -0700 Subject: [Libvirt-cim] [PATCH] Move RASD base classes out of provider MOFs Message-ID: # HG changeset patch # User Dan Smith # Date 1193407510 25200 # Node ID c0f41fb8b46631e3a636e28beb50be22a7929a1e # Parent d41b62edd9412659b17b39c36d9ad488ca24f622 Move RASD base classes out of provider MOFs. This adds another script that can be used to register additional base classes to the schema, without registering a new provider. This lets us extend the base schema with our Xen_RASD and KVM_RASD classes. It also provides us a framework to install bundled base schema, which may be necessary at some point. Signed-off-by: Dan Smith diff -r d41b62edd941 -r c0f41fb8b466 Makefile.am --- a/Makefile.am Thu Oct 25 14:37:09 2007 -0700 +++ b/Makefile.am Fri Oct 26 07:05:10 2007 -0700 @@ -69,6 +69,10 @@ INTEROP_REGS = \ schema/RegisteredProfile.registration \ schema/ElementConformsToProfile.registration +EXTRA_BASE_MOFS = \ + schema/Xen_ResourceAllocationSettingData.mof \ + schema/KVM_ResourceAllocationSettingData.mof + pkgdata_DATA = $(MOFS) $(REGS) pkgdata_SCRIPTS = provider-register.sh @@ -77,6 +81,7 @@ EXTRA_DIST = schema $(pkgdata_DATA) $(pk # Un/Register the providers and class definitions from/to the current CIMOM. # @CIMSERVER@ is set by the configure script postinstall: + sh register_base.sh @CIMSERVER@ $(EXTRA_BASE_MOFS) sh provider-register.sh -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS) sh provider-register.sh -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS) diff -r d41b62edd941 -r c0f41fb8b466 register_base.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/register_base.sh Fri Oct 26 07:05:10 2007 -0700 @@ -0,0 +1,33 @@ +#!/bin/bash +# +# A script to register base classes with the CIMOM +# +# Copyright IBM Corp. 2007 +# Author: Dan Smith +# +# Usage: +# +# $ register_base.sh (sfcb|pegasus) [MOF...] +# +# FIXME: Need to make pegasus location and namespace variable + +CIMOM=$1 + +if [ -z "$CIMOM" ]; then + echo "Usage: $0 (pegasus|sfcb)" + exit 1 +fi + +shift + +if [ "$CIMOM" = "pegasus" ]; then + for i in $*; do + cimmofl -W -uc -aEV -R/var/lib/Pegasus -n /root/ibmsd $i + done +elif [ "$CIMOM" = "sfcb" ]; then + for i in $*; do + sfcbstage -n /root/ibmsd $i + done +else + echo "Unknown CIMOM type: $CIMOM" +fi diff -r d41b62edd941 -r c0f41fb8b466 schema/KVM_ResourceAllocationSettingData.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/KVM_ResourceAllocationSettingData.mof Fri Oct 26 07:05:10 2007 -0700 @@ -0,0 +1,9 @@ +// Copyright IBM Corp. 2007 +class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { + + [Key, + Description ("The type of allocated resource"), + Override ("ResourceType")] + uint16 ResourceType; + +}; diff -r d41b62edd941 -r c0f41fb8b466 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Thu Oct 25 14:37:09 2007 -0700 +++ b/schema/ResourceAllocationSettingData.mof Fri Oct 26 07:05:10 2007 -0700 @@ -1,22 +1,4 @@ // Copyright IBM Corp. 2007 -class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - -}; - -class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - -}; - [Description ("Xen virtual disk configuration")] class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData{ diff -r d41b62edd941 -r c0f41fb8b466 schema/Xen_ResourceAllocationSettingData.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/Xen_ResourceAllocationSettingData.mof Fri Oct 26 07:05:10 2007 -0700 @@ -0,0 +1,9 @@ +// Copyright IBM Corp. 2007 +class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { + + [Key, + Description ("The type of allocated resource"), + Override ("ResourceType")] + uint16 ResourceType; + +}; From danms at us.ibm.com Fri Oct 26 14:43:06 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 07:43:06 -0700 Subject: [Libvirt-cim] [PATCH] Make VSMS an instance provider Message-ID: <1fef15850ba5557cc421.1193409786@s10sp1sfcb> # HG changeset patch # User Dan Smith # Date 1193407878 25200 # Node ID 1fef15850ba5557cc421206fb3ff569f6845ad99 # Parent c0f41fb8b46631e3a636e28beb50be22a7929a1e Make VSMS an instance provider Signed-off-by: Dan Smith diff -r c0f41fb8b466 -r 1fef15850ba5 schema/VirtualSystemManagementService.registration --- a/schema/VirtualSystemManagementService.registration Fri Oct 26 07:05:10 2007 -0700 +++ b/schema/VirtualSystemManagementService.registration Fri Oct 26 07:11:18 2007 -0700 @@ -1,3 +1,3 @@ # Copyright IBM Corp. 2007 -Xen_VirtualSystemManagementService root/ibmsd Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method -KVM_VirtualSystemManagementService root/ibmsd Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method +Xen_VirtualSystemManagementService root/ibmsd Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance +KVM_VirtualSystemManagementService root/ibmsd Virt_VirtualSystemManagementService Virt_VirtualSystemManagementService method instance diff -r c0f41fb8b466 -r 1fef15850ba5 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Oct 26 07:05:10 2007 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Fri Oct 26 07:11:18 2007 -0700 @@ -896,6 +896,80 @@ STDIM_MethodMIStub(, Virt_VirtualSystemM STDIM_MethodMIStub(, Virt_VirtualSystemManagementService, _BROKER, CMNoHook, my_handlers); + +static CMPIStatus return_vsms(const CMPIObjectPath *reference, + const CMPIResult *results, + int name_only) +{ + CMPIStatus s; + CMPIInstance *inst; + + inst = get_typed_instance(_BROKER, + "VirtualSystemManagementService", + NAMESPACE(reference)); + if (inst == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to create instance"); + goto out; + } + + CMSetProperty(inst, "Name", + (CMPIValue *)"Management Service", CMPI_chars); + + if (name_only) + cu_return_instance_name(results, inst); + else + CMReturnInstance(results, inst); + + CMSetStatus(&s, CMPI_RC_OK); + + out: + return s; +} + +static CMPIStatus EnumInstanceNames(CMPIInstanceMI *self, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *reference) +{ + return return_vsms(reference, results, 1); +} + +static CMPIStatus EnumInstances(CMPIInstanceMI *self, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *reference, + const char **properties) +{ + + return return_vsms(reference, results, 0); +} + +static CMPIStatus GetInstance(CMPIInstanceMI *self, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *reference, + const char **properties) +{ + return return_vsms(reference, results, 0); +} + +DEFAULT_CI(); +DEFAULT_MI(); +DEFAULT_DI(); +DEFAULT_EQ(); +DEFAULT_INST_CLEANUP(); + +/* Avoid a warning in the stub macro below */ +CMPIInstanceMI * +Virt_VirtualSystemManagementService_Create_InstanceMI(const CMPIBroker *, + const CMPIContext *, + CMPIStatus *rc); + +CMInstanceMIStub(, Virt_VirtualSystemManagementService, _BROKER, CMNoHook); + + /* * Local Variables: * mode: C From danms at us.ibm.com Fri Oct 26 14:43:26 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 07:43:26 -0700 Subject: [Libvirt-cim] [PATCH 0 of 3] Add DiskPool support Message-ID: This set adds disk pool support and the relevant changes to RAFP and EAFP to support discovery of membership from LogicalDisk and DiskRASD. It's a little raw right now, but it works. From danms at us.ibm.com Fri Oct 26 14:43:28 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 07:43:28 -0700 Subject: [Libvirt-cim] [PATCH 2 of 3] Add diskpool support to ElementAllocatedFromPool In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1193408006 25200 # Node ID ff6c1f00f1789dfdadbacb925d6ae3314db42ae5 # Parent c43f4785810f0b1695bf21c23eb26ba4b5cf0b02 Add diskpool support to ElementAllocatedFromPool Signed-off-by: Dan Smith diff -r c43f4785810f -r ff6c1f00f178 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Fri Oct 26 07:12:48 2007 -0700 +++ b/src/Virt_ElementAllocatedFromPool.c Fri Oct 26 07:13:26 2007 -0700 @@ -222,6 +222,11 @@ static CMPIStatus pool_to_vdev(const CMP ns, poolid, list); + else if (STARTS_WITH(poolid, "DiskPool")) + devs_from_pool(CIM_RASD_TYPE_DISK, + ns, + poolid, + list); else { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, From danms at us.ibm.com Fri Oct 26 14:43:29 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 07:43:29 -0700 Subject: [Libvirt-cim] [PATCH 3 of 3] Add diskpool support to ResourceAllocationFromPool In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1193408083 25200 # Node ID addd6dbbd0464d33949466e3ff1f15e926d67cd1 # Parent ff6c1f00f1789dfdadbacb925d6ae3314db42ae5 Add diskpool support to ResourceAllocationFromPool Signed-off-by: Dan Smith diff -r ff6c1f00f178 -r addd6dbbd046 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Fri Oct 26 07:13:26 2007 -0700 +++ b/src/Virt_ResourceAllocationFromPool.c Fri Oct 26 07:14:43 2007 -0700 @@ -201,6 +201,11 @@ static CMPIStatus pool_to_rasd(const CMP NAMESPACE(ref), poolid, list); + else if (STARTS_WITH(poolid, "DiskPool")) + rasds_from_pool(CIM_RASD_TYPE_DISK, + NAMESPACE(ref), + poolid, + list); else { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, From danms at us.ibm.com Fri Oct 26 14:43:27 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 07:43:27 -0700 Subject: [Libvirt-cim] [PATCH 1 of 3] Add disk resource pools In-Reply-To: Message-ID: # HG changeset patch # User Dan Smith # Date 1193407968 25200 # Node ID c43f4785810f0b1695bf21c23eb26ba4b5cf0b02 # Parent 1fef15850ba5557cc421206fb3ff569f6845ad99 Add disk resource pools This patch parses a disk pool config file, which allows you to specify a pool name and path. The path is assumed to be a directory of image files. The Capacity and Reserved properties are reported with statvfs (although the free/reserved calculation isn't working yet). The config is hard-coded to /tmp/diskpool.conf currently, but needs to be a compile-time option. This should be a good start though. Signed-off-by: Dan Smith diff -r 1fef15850ba5 -r c43f4785810f Makefile.am --- a/Makefile.am Fri Oct 26 07:11:18 2007 -0700 +++ b/Makefile.am Fri Oct 26 07:12:48 2007 -0700 @@ -19,6 +19,7 @@ MOFS = \ schema/MemoryPool.mof \ schema/ElementCapabilities.mof \ schema/ProcessorPool.mof \ + schema/DiskPool.mof \ schema/HostedResourcePool.mof \ schema/ElementConformsToProfile.mof \ schema/ComputerSystemIndication.mof \ @@ -54,6 +55,7 @@ REGS = \ schema/MemoryPool.registration \ schema/ElementCapabilities.registration \ schema/ProcessorPool.registration \ + schema/DiskPool.registration \ schema/HostedResourcePool.registration \ schema/ComputerSystemIndication.registration \ schema/ResourceAllocationSettingData.registration \ diff -r 1fef15850ba5 -r c43f4785810f schema/DiskPool.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/DiskPool.mof Fri Oct 26 07:12:48 2007 -0700 @@ -0,0 +1,7 @@ +class Xen_DiskPool : CIM_ResourcePool +{ +}; +class KVM_DiskPool : CIM_ResourcePool +{ +}; + diff -r 1fef15850ba5 -r c43f4785810f schema/DiskPool.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/DiskPool.registration Fri Oct 26 07:12:48 2007 -0700 @@ -0,0 +1,2 @@ +Xen_DiskPool root/ibmsd Virt_DevicePoolProvider Virt_DevicePool instance +KVM_DiskPool root/ibmsd Virt_DevicePoolProvider Virt_DevicePool instance diff -r 1fef15850ba5 -r c43f4785810f src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Fri Oct 26 07:11:18 2007 -0700 +++ b/src/Virt_DevicePool.c Fri Oct 26 07:12:48 2007 -0700 @@ -19,10 +19,14 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define __USE_FILE_OFFSET64 + #include #include #include #include +#include +#include #include #include @@ -39,7 +43,147 @@ static const CMPIBroker *_BROKER; +#define DISK_POOL_CONFIG "/tmp/diskpool.conf" + char *device_pool_names[] = {"ProcessorPool", "MemoryPool", NULL}; + +struct disk_pool { + char *tag; + char *path; +}; + +static int parse_diskpool_line(struct disk_pool *pool, + const char *line) +{ + int ret; + + ret = sscanf(line, "%as %as", &pool->tag, &pool->path); + if (ret != 2) { + free(pool->tag); + free(pool->path); + } + + return (ret == 2); +} + +static int get_diskpool_config(struct disk_pool **_pools) +{ + const char *path = DISK_POOL_CONFIG; + FILE *config; + char *line = NULL; + size_t len = 0; + int count = 0; + struct disk_pool *pools = NULL; + + config = fopen(path, "r"); + if (config == NULL) { + CU_DEBUG("Failed to open %s: %m", path); + return 0; + } + + while (getline(&line, &len, config) > 0) { + pools = realloc(pools, + (count + 1) * (sizeof(*pools))); + if (pools == NULL) { + CU_DEBUG("Failed to alloc new pool"); + goto out; + } + + if (parse_diskpool_line(&pools[count], line)) + count++; + } + + out: + free(line); + *_pools = pools; + fclose(config); + + return count; +} + +static void free_diskpool(struct disk_pool *pools, int count) +{ + int i; + + if (pools == NULL) + return; + + for (i = 0; i < count; i++) { + free(pools[i].tag); + free(pools[i].path); + } + + free(pools); +} + +static char *_diskpool_member_of(const char *file) +{ + struct disk_pool *pools = NULL; + int count; + int i; + char *pool = NULL; + + count = get_diskpool_config(&pools); + if (count == 0) + return NULL; + + for (i = 0; i < count; i++) { + if (STARTS_WITH(file, pools[i].path)) { + asprintf(&pool, "DiskPool/%s", pools[i].tag); + break; + } + } + + free_diskpool(pools, count); + + return pool; +} + +static char *diskpool_member_of(const CMPIBroker *broker, char *rasd_id) +{ + char *host = NULL; + char *dev = NULL; + int ret; + virConnectPtr conn = NULL; + virDomainPtr dom = NULL; + int count = 0; + struct virt_device *devs = NULL; + int i; + char *pool = NULL; + CMPIStatus s; + + ret = parse_fq_devid(rasd_id, &host, &dev); + if (!ret) + goto out; + + conn = lv_connect(broker, &s); + if (conn == NULL) + goto out; + + dom = virDomainLookupByName(conn, host); + if (dom == NULL) + goto out; + + count = get_disk_devices(dom, &devs); + + for (i = 0; i < count; i++) { + if (STREQ((devs[i].dev.disk.virtual_dev), dev)) { + pool = _diskpool_member_of(devs[i].dev.disk.source); + break; + } + } + + out: + if (count > 0) + cleanup_virt_devices(&devs, count); + + free(host); + free(dev); + virConnectClose(conn); + virDomainFree(dom); + + return pool; +} static char *netpool_member_of(const CMPIBroker *broker, char *rasd_id) { @@ -98,6 +242,8 @@ char *pool_member_of(const CMPIBroker *b poolid = strdup("MemoryPool/0"); else if (type == CIM_RASD_TYPE_NET) poolid = netpool_member_of(broker, id); + else if (type == CIM_RASD_TYPE_DISK) + poolid = diskpool_member_of(broker, id); else return NULL; @@ -294,6 +440,96 @@ static CMPIStatus netpool_instance(virCo return s; } +static CMPIInstance *diskpool_from_path(const char *path, + const char *id, + const char *ns, + const CMPIBroker *broker) +{ + CMPIInstance *inst; + char *poolid = NULL; + const uint16_t type = CIM_RASD_TYPE_DISK; + struct statvfs vfs; + uint64_t cap; + uint64_t res; + + inst = get_typed_instance(broker, "DiskPool", ns); + + if (asprintf(&poolid, "DiskPool/%s", id) == -1) + return NULL; + + CMSetProperty(inst, "InstanceID", + (CMPIValue *)poolid, CMPI_chars); + + CMSetProperty(inst, "ResourceType", + (CMPIValue *)&type, CMPI_uint16); + + 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: + free(poolid); + + return inst; +} + +static CMPIStatus diskpool_instance(virConnectPtr conn, + struct inst_list *list, + const char *ns, + const char *id, + const CMPIBroker *broker) +{ + CMPIStatus s; + struct disk_pool *pools = NULL; + int count = 0; + int i; + + count = get_diskpool_config(&pools); + if ((id == NULL) && (count == 0)) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "No such pool `%s'", id); + goto out; + } + + for (i = 0; i < count; i++) { + CMPIInstance *pool; + + if ((id != NULL) && (!STREQ(id, pools[i].tag))) + continue; + /* Either this matches id, or we're matching all */ + + pool = diskpool_from_path(pools[i].path, + pools[i].tag, + ns, + broker); + if (pool != NULL) + inst_list_add(list, pool); + } + + CMSetStatus(&s, CMPI_RC_OK); + out: + free_diskpool(pools, count); + + return s; +} + static CMPIStatus _get_pool(const CMPIBroker *broker, virConnectPtr conn, const char *type, @@ -307,6 +543,8 @@ static CMPIStatus _get_pool(const CMPIBr 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}; } From grendel at linux.vnet.ibm.com Fri Oct 26 15:14:33 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 26 Oct 2007 11:14:33 -0400 Subject: [Libvirt-cim] [PATCH] Move RASD base classes out of provider MOFs In-Reply-To: References: Message-ID: <47220459.2070901@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193407510 25200 > # Node ID c0f41fb8b46631e3a636e28beb50be22a7929a1e > # Parent d41b62edd9412659b17b39c36d9ad488ca24f622 > Move RASD base classes out of provider MOFs. > This adds another script that can be used to register additional base classes > to the schema, without registering a new provider. This lets us extend the > base schema with our Xen_RASD and KVM_RASD classes. It also provides us > a framework to install bundled base schema, which may be necessary at some > point. > > Signed-off-by: Dan Smith > > > Ah, registration. Always so much fun. Well, this looks solid. I like the approach of breaking it off into a separate script, since it was looking like it was going to get pretty messy trying to make it work with the original. This is much cleaner. +1 -- -Jay From grendel at linux.vnet.ibm.com Fri Oct 26 15:15:30 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 26 Oct 2007 11:15:30 -0400 Subject: [Libvirt-cim] [PATCH] Make VSMS an instance provider In-Reply-To: <1fef15850ba5557cc421.1193409786@s10sp1sfcb> References: <1fef15850ba5557cc421.1193409786@s10sp1sfcb> Message-ID: <47220492.4050308@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193407878 25200 > # Node ID 1fef15850ba5557cc421206fb3ff569f6845ad99 > # Parent c0f41fb8b46631e3a636e28beb50be22a7929a1e > Make VSMS an instance provider > > Signed-off-by: Dan Smith > And an instance provider it is. Not a terribly exciting one, really, but what can ya do? Looks good, +1. -- -Jay From danms at us.ibm.com Fri Oct 26 15:35:05 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 08:35:05 -0700 Subject: [Libvirt-cim] [PATCH] Add a basic README file Message-ID: # HG changeset patch # User Dan Smith # Date 1193412852 25200 # Node ID ca75b48896652c812520d6b08eac07bc4e9473ec # Parent d41b62edd9412659b17b39c36d9ad488ca24f622 Add a basic README file I'm sure the list of requirements is not complete here, but it's a start Signed-off-by: Dan Smith diff -r d41b62edd941 -r ca75b4889665 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Fri Oct 26 08:34:12 2007 -0700 @@ -0,0 +1,36 @@ + + libvirt-cim : A CIM provider for libvirt + +Libvirt-cim is a CMPI CIM provider that implements the DMTF SVPC +virtualization model. It is free software available under the GNU +Lesser General Public License. The goal is to support most of the +features exported by libvirt itself, enabling management of multiple +platforms with a single provider. + +The latest version of the library can be found here: + + http://libvirt.org/hg/libvirt-cim + +and the development discussion mailing list is here: + + https://www.redhat.com/mailman/listinfo/libvirt-cim + +Building +-------- + +Requirements: + + - Pegasus or SFCB development headers + - libvirt 0.2.3 or greater + - e2fsprogs-devel + - libxml2 + - libcmpiutil (http://libvirt.org/hg/libcmpiutil) + - DMTF v2.16 experimental CIM Schema installed + +Procedure: + + $ ./autoconfiscate.sh + $ ./configure + $ make + $ sudo make install + $ sudo make postinstall From veillard at redhat.com Fri Oct 26 15:40:39 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 11:40:39 -0400 Subject: [Libvirt-cim] [PATCH] Add a basic README file In-Reply-To: References: Message-ID: <20071026154039.GC22029@redhat.com> On Fri, Oct 26, 2007 at 08:35:05AM -0700, Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193412852 25200 > # Node ID ca75b48896652c812520d6b08eac07bc4e9473ec > # Parent d41b62edd9412659b17b39c36d9ad488ca24f622 > Add a basic README file > I'm sure the list of requirements is not complete here, but it's a start > > Signed-off-by: Dan Smith Very needed +1 :-) BTW if you could add one for libcmpiutil too that would be great ! 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 danms at us.ibm.com Fri Oct 26 15:48:08 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 08:48:08 -0700 Subject: [Libvirt-cim] [PATCH] Add a basic README file In-Reply-To: <20071026154039.GC22029@redhat.com> (Daniel Veillard's message of "Fri, 26 Oct 2007 11:40:39 -0400") References: <20071026154039.GC22029@redhat.com> Message-ID: <87abq5q3lz.fsf@theine.beaverton.ibm.com> DV> BTW if you could add one for libcmpiutil too that would be great ! In-process :) 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 Oct 26 15:52:08 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 26 Oct 2007 11:52:08 -0400 Subject: [Libvirt-cim] [PATCH 1 of 3] Add disk resource pools In-Reply-To: References: Message-ID: <47220D28.6070906@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193407968 25200 > # Node ID c43f4785810f0b1695bf21c23eb26ba4b5cf0b02 > # Parent 1fef15850ba5557cc421206fb3ff569f6845ad99 > Add disk resource pools > This patch parses a disk pool config file, which allows you to specify a pool > name and path. The path is assumed to be a directory of image files. The > Capacity and Reserved properties are reported with statvfs (although the > free/reserved calculation isn't working yet). The config is hard-coded to > /tmp/diskpool.conf currently, but needs to be a compile-time option. This > should be a good start though. > > Signed-off-by: Dan Smith > > This seems like a fine start. +1 I can get a quick patch out to make the filepath settable via the configure script, especially if it's okay to say that validation of the filepath can wait until run time. -- -Jay From grendel at linux.vnet.ibm.com Fri Oct 26 15:53:42 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Fri, 26 Oct 2007 11:53:42 -0400 Subject: [Libvirt-cim] [PATCH 0 of 3] Add DiskPool support In-Reply-To: References: Message-ID: <47220D86.4080802@linux.vnet.ibm.com> Dan Smith wrote: > This set adds disk pool support and the relevant changes to RAFP and EAFP > to support discovery of membership from LogicalDisk and DiskRASD. It's > a little raw right now, but it works. > > Patches 2 and 3 are so simple they don't need individual acks, and they look fine. +1 -- -Jay From danms at us.ibm.com Fri Oct 26 15:59:11 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 08:59:11 -0700 Subject: [Libvirt-cim] [PATCH] Add a basic README file Message-ID: <6e4b77769d72ea84581f.1193414351@theine> # HG changeset patch # User Dan Smith # Date 1193414283 25200 # Node ID 6e4b77769d72ea84581f50c173bb98e3e977edac # Parent cdd77491efaac8f60428cbf0ef92ec8b566f5b60 Add a basic README file Signed-off-by: Dan Smith diff -r cdd77491efaa -r 6e4b77769d72 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Fri Oct 26 08:58:03 2007 -0700 @@ -0,0 +1,37 @@ + libcmpiutil : A CMPI toolkit library for writing providers + +Libcmpiutil is a library of utility functions for CMPI providers. It +is free software available under the GNU Lesser General Public +License. The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument +checking. + +The latest version of the library can be found here: + + http://libvirt.org/hg/libcmpiutil + + Development discussion currently takes place on the libvirt-cim + mailing list: + + https://www.redhat.com/mailman/listinfo/libvirt-cim + +Building +-------- + +Requirements: + + - Pegasus or SFCB development headers + - libxml2 + - Lex (if enabling the EO parser) + - Yacc (if enabling the EO parser) + - doxygen + +Procedure: + + $ ./autogen.sh + $ # You probably want the EO parser enabled + $ ./configure --enable-eoparser + $ make + $ sudo make install From veillard at redhat.com Fri Oct 26 16:39:48 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 12:39:48 -0400 Subject: [Libvirt-cim] [PATCH] Add a basic README file In-Reply-To: <6e4b77769d72ea84581f.1193414351@theine> References: <6e4b77769d72ea84581f.1193414351@theine> Message-ID: <20071026163948.GD22029@redhat.com> On Fri, Oct 26, 2007 at 08:59:11AM -0700, Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193414283 25200 > # Node ID 6e4b77769d72ea84581f50c173bb98e3e977edac > # Parent cdd77491efaac8f60428cbf0ef92ec8b566f5b60 > Add a basic README file > > Signed-off-by: Dan Smith > > diff -r cdd77491efaa -r 6e4b77769d72 README > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/README Fri Oct 26 08:58:03 2007 -0700 > @@ -0,0 +1,37 @@ > + libcmpiutil : A CMPI toolkit library for writing providers > + > +Libcmpiutil is a library of utility functions for CMPI providers. It > +is free software available under the GNU Lesser General Public > +License. The goal is to reduce the amount of repetitive work done in > +most CMPI providers by encapsulating common procedures with more > +"normal" APIs. This extends from operations like getting typed > +instance properties to standardizing method dispatch and argument > +checking. > + > +The latest version of the library can be found here: > + > + http://libvirt.org/hg/libcmpiutil > + > + Development discussion currently takes place on the libvirt-cim > + mailing list: > + > + https://www.redhat.com/mailman/listinfo/libvirt-cim > + > +Building > +-------- > + > +Requirements: > + > + - Pegasus or SFCB development headers > + - libxml2 Actually I don't think libxml2 i needed there, right ? > + - Lex (if enabling the EO parser) > + - Yacc (if enabling the EO parser) > + - doxygen > + > +Procedure: > + > + $ ./autogen.sh > + $ # You probably want the EO parser enabled > + $ ./configure --enable-eoparser > + $ make > + $ sudo make install Fine by me, +1 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 danms at us.ibm.com Fri Oct 26 16:45:18 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 09:45:18 -0700 Subject: [Libvirt-cim] [PATCH] Add a basic README file to libcmpiutil (without libxml2 as a requirement) Message-ID: <28180922bc19dc31223c.1193417118@theine> # HG changeset patch # User Dan Smith # Date 1193417112 25200 # Node ID 28180922bc19dc31223ceed66358cd108e2e2124 # Parent cdd77491efaac8f60428cbf0ef92ec8b566f5b60 Add a basic README file to libcmpiutil (without libxml2 as a requirement) Signed-off-by: Dan Smith diff -r cdd77491efaa -r 28180922bc19 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Fri Oct 26 09:45:12 2007 -0700 @@ -0,0 +1,36 @@ + libcmpiutil : A CMPI toolkit library for writing providers + +Libcmpiutil is a library of utility functions for CMPI providers. It +is free software available under the GNU Lesser General Public +License. The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument +checking. + +The latest version of the library can be found here: + + http://libvirt.org/hg/libcmpiutil + + Development discussion currently takes place on the libvirt-cim + mailing list: + + https://www.redhat.com/mailman/listinfo/libvirt-cim + +Building +-------- + +Requirements: + + - Pegasus or SFCB development headers + - Lex (if enabling the EO parser) + - Yacc (if enabling the EO parser) + - doxygen + +Procedure: + + $ ./autogen.sh + $ # You probably want the EO parser enabled + $ ./configure --enable-eoparser + $ make + $ sudo make install From danms at us.ibm.com Fri Oct 26 16:46:27 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 09:46:27 -0700 Subject: [Libvirt-cim] [PATCH] Add a basic README file In-Reply-To: <20071026163948.GD22029@redhat.com> (Daniel Veillard's message of "Fri, 26 Oct 2007 12:39:48 -0400") References: <6e4b77769d72ea84581f.1193414351@theine> <20071026163948.GD22029@redhat.com> Message-ID: <873avxq0ws.fsf@theine.beaverton.ibm.com> DV> Actually I don't think libxml2 i needed there, right ? Oops, that's correct, replacement patch on it's way... :) 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 veillard at redhat.com Fri Oct 26 17:15:03 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 13:15:03 -0400 Subject: [Libvirt-cim] [PATCH] add packaging for libcmpiutil Message-ID: <20071026171503.GA30645@redhat.com> # HG changeset patch # User Daniel Veillard # Date 1193418726 -7200 # Node ID d08da2d71ea4fbc8302758688de452bf125dd924 # Parent cdd77491efaac8f60428cbf0ef92ec8b566f5b60 - libcmpiutil.spec.in template file for libcmpiutil allowing to build RPMs - libcmpiutil.pc.in template file for libcmpiutil for a pkgconfig file - modifications to configure.ac to generate the spec and pkgconfig files - modifications to Makefile.am to include the current docs (README will have to be added) - modifications to Makefile.am to move the includes to a safer place /usr/include/libcmpiutil - modification to Makefile.am to add a 'make rpm' command which can be quite convenient at times. Daniel diff -r cdd77491efaa -r d08da2d71ea4 Makefile.am --- a/Makefile.am Thu Oct 25 13:44:11 2007 -0700 +++ b/Makefile.am Fri Oct 26 19:12:06 2007 +0200 @@ -1,7 +1,16 @@ # Copyright IBM Corp. 2007 SUBDIRS = tools -include_HEADERS = libcmpiutil.h \ +EXTRA_DIST = libcmpiutil.spec.in libcmpiutil.spec COPYING \ + libcmpiutil.pc.in libcmpiutil.pc \ + doc/doxygen.conf doc/mainpage doc/SubmittingPatches + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libcmpiutil.pc + +libcmpiutilincdir = $(includedir)/libcmpiutil + +libcmpiutilinc_HEADERS = libcmpiutil.h \ std_invokemethod.h \ std_association.h \ std_indication.h @@ -33,4 +42,8 @@ endif endif clean-local: - rm -f $(BUILT_SOURCES) *~ \ No newline at end of file + rm -f $(BUILT_SOURCES) *~ + +rpm: clean + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) + diff -r cdd77491efaa -r d08da2d71ea4 configure.ac --- a/configure.ac Thu Oct 25 13:44:11 2007 -0700 +++ b/configure.ac Fri Oct 26 19:12:06 2007 +0200 @@ -61,4 +61,5 @@ echo "Build Embedded Object parser: echo "Build Embedded Object parser: $eoparser" echo "" -AC_OUTPUT \ No newline at end of file +AC_OUTPUT(libcmpiutil.spec libcmpiutil.pc) + diff -r cdd77491efaa -r d08da2d71ea4 libcmpiutil.pc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcmpiutil.pc.in Fri Oct 26 19:12:06 2007 +0200 @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/libcmpiutil + +Name: libcmpiutil +Version: @VERSION@ +Description: CMPI Utility Library +Requires: +Libs: -L${libdir} -lcmpiutil +Cflags: -I${includedir} diff -r cdd77491efaa -r d08da2d71ea4 libcmpiutil.spec.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcmpiutil.spec.in Fri Oct 26 19:12:06 2007 +0200 @@ -0,0 +1,77 @@ +# -*- rpm-spec -*- + +Summary: CMPI Utility Library +Name: libcmpiutil +Version: @PACKAGE_VERSION@ +Release: 1%{?dist}%{?extra_release} +License: LGPL +Group: Development/Libraries +Source: libcmpiutil-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-root +URL: http://libvirt.org/CIM/ +BuildRequires: sblim-cmpi-devel +BuildRequires: flex +BuildRequires: bison + +%description +Libcmpiutil is a library of utility functions for CMPI providers. +The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument checking. + +%package devel +Summary: Libraries, includes, etc. to use the CMPI utility library +Group: Development/Libraries +Requires: sblim-cmpi-devel +Requires: pkgconfig + +%description devel +Includes and documentations for the CMPI utility library +The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument checking. + +%prep +%setup -q + +%build +%configure +make + +%install +rm -fr %{buildroot} + +%makeinstall +rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/*.a + +%clean +rm -fr %{buildroot} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-, root, root) + +%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches +%{_libdir}/lib*.so.* + +%files devel +%defattr(-, root, root) + +%{_libdir}/lib*.so +%dir %{_includedir}/ +%{_includedir}/libcmpiutil/*.h +%{_libdir}/pkgconfig/libcmpiutil.pc + +%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches + +%changelog +* Fri Oct 26 2007 Daniel Veillard - 0.1-1 +- created From danms at us.ibm.com Fri Oct 26 18:20:15 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 11:20:15 -0700 Subject: [Libvirt-cim] [PATCH] add packaging for libcmpiutil References: <20071026171503.GA30645@redhat.com> Message-ID: <87prz1oi00.fsf@theine.beaverton.ibm.com> DV> - modifications to Makefile.am to include the current docs (README will DV> have to be added) Ah, yes, I'll apply this first, and then tweak my patch to add README to the list. DV> - modifications to Makefile.am to move the includes to a safer place DV> /usr/include/libcmpiutil Yes, very good idea. I will work up a patch to libvirt-cim to adjust the include path. DV> - modification to Makefile.am to add a 'make rpm' command which can be DV> quite convenient at times. Great! I tried it and it works for me. +1 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 Oct 26 18:30:28 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 11:30:28 -0700 Subject: [Libvirt-cim] [PATCH] Add a basic README file to libcmpiutil (without libxml2 as a requirement) Message-ID: <6cb1126452eb354573b9.1193423428@localhost.localdomain> # HG changeset patch # User Dan Smith # Date 1193423426 25200 # Node ID 6cb1126452eb354573b95acd7c9077038cc24111 # Parent c771f49faf36a1d0dffc5b5ee0b053ed171fb500 Add a basic README file to libcmpiutil (without libxml2 as a requirement) Also updated the Makefile.am and spec file to include the readme. Signed-off-by: Dan Smith diff -r c771f49faf36 -r 6cb1126452eb Makefile.am --- a/Makefile.am Fri Oct 26 19:12:06 2007 +0200 +++ b/Makefile.am Fri Oct 26 11:30:26 2007 -0700 @@ -3,7 +3,7 @@ SUBDIRS = tools EXTRA_DIST = libcmpiutil.spec.in libcmpiutil.spec COPYING \ libcmpiutil.pc.in libcmpiutil.pc \ - doc/doxygen.conf doc/mainpage doc/SubmittingPatches + doc/doxygen.conf doc/mainpage doc/SubmittingPatches README pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libcmpiutil.pc diff -r c771f49faf36 -r 6cb1126452eb README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Fri Oct 26 11:30:26 2007 -0700 @@ -0,0 +1,36 @@ + libcmpiutil : A CMPI toolkit library for writing providers + +Libcmpiutil is a library of utility functions for CMPI providers. It +is free software available under the GNU Lesser General Public +License. The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument +checking. + +The latest version of the library can be found here: + + http://libvirt.org/hg/libcmpiutil + + Development discussion currently takes place on the libvirt-cim + mailing list: + + https://www.redhat.com/mailman/listinfo/libvirt-cim + +Building +-------- + +Requirements: + + - Pegasus or SFCB development headers + - Lex (if enabling the EO parser) + - Yacc (if enabling the EO parser) + - doxygen + +Procedure: + + $ ./autogen.sh + $ # You probably want the EO parser enabled + $ ./configure --enable-eoparser + $ make + $ sudo make install diff -r c771f49faf36 -r 6cb1126452eb libcmpiutil.spec.in --- a/libcmpiutil.spec.in Fri Oct 26 19:12:06 2007 +0200 +++ b/libcmpiutil.spec.in Fri Oct 26 11:30:26 2007 -0700 @@ -59,7 +59,7 @@ rm -fr %{buildroot} %files %defattr(-, root, root) -%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches +%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches README %{_libdir}/lib*.so.* %files devel @@ -70,7 +70,7 @@ rm -fr %{buildroot} %{_includedir}/libcmpiutil/*.h %{_libdir}/pkgconfig/libcmpiutil.pc -%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches +%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches README %changelog * Fri Oct 26 2007 Daniel Veillard - 0.1-1 From danms at us.ibm.com Fri Oct 26 18:35:12 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 11:35:12 -0700 Subject: [Libvirt-cim] [PATCH] add packaging for libcmpiutil In-Reply-To: <20071026171503.GA30645@redhat.com> (Daniel Veillard's message of "Fri, 26 Oct 2007 13:15:03 -0400") References: <20071026171503.GA30645@redhat.com> Message-ID: <87lk9pohb3.fsf@theine.beaverton.ibm.com> DV> # HG changeset patch DV> # User Daniel Veillard DV> # Date 1193418726 -7200 DV> # Node ID d08da2d71ea4fbc8302758688de452bf125dd924 DV> # Parent cdd77491efaac8f60428cbf0ef92ec8b566f5b60 DV> - libcmpiutil.spec.in template file for libcmpiutil allowing to build RPMs DV> - libcmpiutil.pc.in template file for libcmpiutil for a pkgconfig file DV> - modifications to configure.ac to generate the spec and pkgconfig files DV> - modifications to Makefile.am to include the current docs (README will DV> have to be added) DV> - modifications to Makefile.am to move the includes to a safer place DV> /usr/include/libcmpiutil DV> - modification to Makefile.am to add a 'make rpm' command which can be DV> quite convenient at times. DV> Daniel Can you resubmit this with a DCO sign-off in your changeset message please? 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 veillard at redhat.com Fri Oct 26 18:46:33 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 14:46:33 -0400 Subject: [Libvirt-cim] [PATCH] add packaging for libcmpiutil In-Reply-To: <87lk9pohb3.fsf@theine.beaverton.ibm.com> References: <20071026171503.GA30645@redhat.com> <87lk9pohb3.fsf@theine.beaverton.ibm.com> Message-ID: <20071026184633.GB30645@redhat.com> # HG changeset patch # User Daniel Veillard # Date 1193418726 -7200 # Node ID d08da2d71ea4fbc8302758688de452bf125dd924 # Parent cdd77491efaac8f60428cbf0ef92ec8b566f5b60 - libcmpiutil.spec.in template file for libcmpiutil allowing to build RPMs - libcmpiutil.pc.in template file for libcmpiutil for a pkgconfig file - modifications to configure.ac to generate the spec and pkgconfig files - modifications to Makefile.am to include the current docs (README will have to be added) - modifications to Makefile.am to move the includes to a safer place /usr/include/libcmpiutil - modification to Makefile.am to add a 'make rpm' command which can be quite convenient at times. Daniel Signed-off-by: Daniel Veillard diff -r cdd77491efaa -r d08da2d71ea4 Makefile.am --- a/Makefile.am Thu Oct 25 13:44:11 2007 -0700 +++ b/Makefile.am Fri Oct 26 19:12:06 2007 +0200 @@ -1,7 +1,16 @@ # Copyright IBM Corp. 2007 SUBDIRS = tools -include_HEADERS = libcmpiutil.h \ +EXTRA_DIST = libcmpiutil.spec.in libcmpiutil.spec COPYING \ + libcmpiutil.pc.in libcmpiutil.pc \ + doc/doxygen.conf doc/mainpage doc/SubmittingPatches + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libcmpiutil.pc + +libcmpiutilincdir = $(includedir)/libcmpiutil + +libcmpiutilinc_HEADERS = libcmpiutil.h \ std_invokemethod.h \ std_association.h \ std_indication.h @@ -33,4 +42,8 @@ endif endif clean-local: - rm -f $(BUILT_SOURCES) *~ \ No newline at end of file + rm -f $(BUILT_SOURCES) *~ + +rpm: clean + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) + diff -r cdd77491efaa -r d08da2d71ea4 configure.ac --- a/configure.ac Thu Oct 25 13:44:11 2007 -0700 +++ b/configure.ac Fri Oct 26 19:12:06 2007 +0200 @@ -61,4 +61,5 @@ echo "Build Embedded Object parser: echo "Build Embedded Object parser: $eoparser" echo "" -AC_OUTPUT \ No newline at end of file +AC_OUTPUT(libcmpiutil.spec libcmpiutil.pc) + diff -r cdd77491efaa -r d08da2d71ea4 libcmpiutil.pc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcmpiutil.pc.in Fri Oct 26 19:12:06 2007 +0200 @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/libcmpiutil + +Name: libcmpiutil +Version: @VERSION@ +Description: CMPI Utility Library +Requires: +Libs: -L${libdir} -lcmpiutil +Cflags: -I${includedir} diff -r cdd77491efaa -r d08da2d71ea4 libcmpiutil.spec.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcmpiutil.spec.in Fri Oct 26 19:12:06 2007 +0200 @@ -0,0 +1,77 @@ +# -*- rpm-spec -*- + +Summary: CMPI Utility Library +Name: libcmpiutil +Version: @PACKAGE_VERSION@ +Release: 1%{?dist}%{?extra_release} +License: LGPL +Group: Development/Libraries +Source: libcmpiutil-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-root +URL: http://libvirt.org/CIM/ +BuildRequires: sblim-cmpi-devel +BuildRequires: flex +BuildRequires: bison + +%description +Libcmpiutil is a library of utility functions for CMPI providers. +The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument checking. + +%package devel +Summary: Libraries, includes, etc. to use the CMPI utility library +Group: Development/Libraries +Requires: sblim-cmpi-devel +Requires: pkgconfig + +%description devel +Includes and documentations for the CMPI utility library +The goal is to reduce the amount of repetitive work done in +most CMPI providers by encapsulating common procedures with more +"normal" APIs. This extends from operations like getting typed +instance properties to standardizing method dispatch and argument checking. + +%prep +%setup -q + +%build +%configure +make + +%install +rm -fr %{buildroot} + +%makeinstall +rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/*.a + +%clean +rm -fr %{buildroot} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-, root, root) + +%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches +%{_libdir}/lib*.so.* + +%files devel +%defattr(-, root, root) + +%{_libdir}/lib*.so +%dir %{_includedir}/ +%{_includedir}/libcmpiutil/*.h +%{_libdir}/pkgconfig/libcmpiutil.pc + +%doc doc/doxygen.conf doc/mainpage doc/SubmittingPatches + +%changelog +* Fri Oct 26 2007 Daniel Veillard - 0.1-1 +- created From danms at us.ibm.com Fri Oct 26 20:36:30 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 13:36:30 -0700 Subject: [Libvirt-cim] [PATCH] Build changes for new libcmpiutil header placement Message-ID: # HG changeset patch # User Dan Smith # Date 1193430866 25200 # Node ID aaad430ea766d9a3bc0be035e595d8da17ee2122 # Parent 239f76be94c5fbf730a315408af156c3b0b0d092 Build changes for new libcmpiutil header placement This attempts to find libcmpiutil by pkg-config, but falls back on looking in some of the normal locations. Signed-off-by: Dan Smith diff -r 239f76be94c5 -r aaad430ea766 acinclude.m4 --- a/acinclude.m4 Fri Oct 26 09:15:15 2007 -0700 +++ b/acinclude.m4 Fri Oct 26 13:34:26 2007 -0700 @@ -258,7 +258,45 @@ AC_DEFUN([CHECK_LIBXML2], fi ] ) - + +AC_DEFUN([_CHECK_LIBCU_PC], + [ + if pkg-config --exists libcmpiutil; then + CPPFLAGS="$CPPFLAGS `pkg-config --cflags libcmpiutil`" + LDFLAGS="$LDFLAGS `pkg-config --libs libcmpiutil`" + found_libcu=yes + fi + ] +) + +AC_DEFUN([_CHECK_LIBCU_NOPC], + [ + DIRS="/usr /usr/local" + for dir in $DIRS; do + if test -f "${dir}/include/libcmpiutil/libcmpiutil.h"; then + CPPFLAGS="$CPPFLAGS -I${dir}/include/libcmpiutil" + LDFLAGS="$LDFLAGS -lcmpiutil -L${dir}/lib" + found_libcu=yes + fi + done + ] +) + +AC_DEFUN([CHECK_LIBCU], + [ + _CHECK_LIBCU_PC + if test "x$found_libcu" != "xyes"; then + _CHECK_LIBCU_NOPC + fi + AC_CHECK_LIB(cmpiutil, cu_check_args, [], [ + AC_MSG_ERROR(libcmpiutil not found) + ]) + AC_CHECK_HEADER([libcmpiutil.h], [], [ + AC_MSG_ERROR([libcmpiutil.h not found]) + ]) + ] +) + dnl dnl The check for the libvirt library dnl Sets the LIBVIRTDIR variable diff -r 239f76be94c5 -r aaad430ea766 configure.ac --- a/configure.ac Fri Oct 26 09:15:15 2007 -0700 +++ b/configure.ac Fri Oct 26 13:34:26 2007 -0700 @@ -133,10 +133,7 @@ fi CFLAGS_STRICT="-Werror" -AC_CHECK_LIB(cmpiutil, cu_check_args, [], [ - echo "libcmpiutil not found" - exit 1 - ]) +CHECK_LIBCU AC_ARG_ENABLE([werror], [ --enable-werror enable werror on builds [[default=yes]]], From veillard at redhat.com Fri Oct 26 21:16:06 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 17:16:06 -0400 Subject: [Libvirt-cim] [PATCH] Build changes for new libcmpiutil header placement In-Reply-To: References: Message-ID: <20071026211606.GC30645@redhat.com> On Fri, Oct 26, 2007 at 01:36:30PM -0700, Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193430866 25200 > # Node ID aaad430ea766d9a3bc0be035e595d8da17ee2122 > # Parent 239f76be94c5fbf730a315408af156c3b0b0d092 > Build changes for new libcmpiutil header placement > This attempts to find libcmpiutil by pkg-config, but falls back on > looking in some of the normal locations. > > Signed-off-by: Dan Smith I ended up with a different version in my attempt to package libvirt-cim with RPM by adding the following to configure.ac: diff -r 239f76be94c5 configure.ac --- a/configure.ac Fri Oct 26 09:15:15 2007 -0700 +++ b/configure.ac Fri Oct 26 23:11:23 2007 +0200 @@ -89,6 +89,9 @@ AC_CHECK_HEADERS([stdlib.h string.h unis # Check if the system headers conform to ANSI C AC_HEADER_STDC +dnl Need to test if pkg-config exists +PKG_PROG_PKG_CONFIG + # Check for specific add on libraries that we know we'll need # - libuuid #AC_CHECK_LIB([uuid], [uuid_generate], [have_uuid=yes], [ @@ -133,10 +136,15 @@ fi CFLAGS_STRICT="-Werror" -AC_CHECK_LIB(cmpiutil, cu_check_args, [], [ - echo "libcmpiutil not found" - exit 1 - ]) + +if test "x$PKG_CONFIG" != "x" ; then + PKG_CHECK_MODULES(LIBCMPIUTIL, libcmpiutil, ,exit) +else + AC_CHECK_LIB(cmpiutil, cu_check_args, [], [ + echo "libcmpiutil not found" + exit 1 + ]) +fi AC_ARG_ENABLE([werror], [ --enable-werror enable werror on builds [[default=yes]]], --------------------------------- and then adding references to $(LIBCMPIUTIL_LIBS) and $(LIBCMPIUTIL_CFLAGS) to src/Makefile.am and libxkutil/Makefile.am ... No idea what you would prefer, yours is probably more complete ... BTW concerning the werror, I get the following on Fedora 7 which should probably be fixed :-) gcc -DHAVE_CONFIG_H -I. -I.. -DCMPI_VERSION=100 -I/usr/include/cmpi -I/usr/include/libxml2 -I/usr/include/libvirt -g -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-format-y2k -Wcast-align -Wno-unused-value -I/usr/include/libcmpiutil -I../libxkutil -Werror -c Virt_DevicePool.c -fPIC -DPIC -o .libs/Virt_DevicePool.o cc1: warnings being treated as errors Virt_DevicePool.c: In function 'netpool_member_of': Virt_DevicePool.c:73: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result make[3]: *** [Virt_DevicePool.lo] Error 1 make[3]: Leaving directory `/u/veillard/libvirt-cim/src' 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 veillard at redhat.com Fri Oct 26 21:20:33 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 17:20:33 -0400 Subject: [Libvirt-cim] [PATCH] Add a basic README file to libcmpiutil (without libxml2 as a requirement) In-Reply-To: <6cb1126452eb354573b9.1193423428@localhost.localdomain> References: <6cb1126452eb354573b9.1193423428@localhost.localdomain> Message-ID: <20071026212033.GD30645@redhat.com> On Fri, Oct 26, 2007 at 11:30:28AM -0700, Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193423426 25200 > # Node ID 6cb1126452eb354573b95acd7c9077038cc24111 > # Parent c771f49faf36a1d0dffc5b5ee0b053ed171fb500 > Add a basic README file to libcmpiutil (without libxml2 as a requirement) > Also updated the Makefile.am and spec file to include the readme. Sure +1 ! 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 veillard at redhat.com Fri Oct 26 21:23:22 2007 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 26 Oct 2007 17:23:22 -0400 Subject: [Libvirt-cim] [PATCH] Build changes for new libcmpiutil header placement In-Reply-To: <20071026211606.GC30645@redhat.com> References: <20071026211606.GC30645@redhat.com> Message-ID: <20071026212322.GE30645@redhat.com> On Fri, Oct 26, 2007 at 05:16:06PM -0400, Daniel Veillard wrote: > On Fri, Oct 26, 2007 at 01:36:30PM -0700, Dan Smith wrote: > > # HG changeset patch > > # User Dan Smith > > # Date 1193430866 25200 > > # Node ID aaad430ea766d9a3bc0be035e595d8da17ee2122 > > # Parent 239f76be94c5fbf730a315408af156c3b0b0d092 > > Build changes for new libcmpiutil header placement > > This attempts to find libcmpiutil by pkg-config, but falls back on > > looking in some of the normal locations. > > > > Signed-off-by: Dan Smith > > I ended up with a different version in my attempt to package > libvirt-cim with RPM by adding the following to configure.ac: Okay, please use yours, mine was broken ! 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 danms at us.ibm.com Fri Oct 26 21:26:27 2007 From: danms at us.ibm.com (Dan Smith) Date: Fri, 26 Oct 2007 14:26:27 -0700 Subject: [Libvirt-cim] [PATCH] Build changes for new libcmpiutil header placement In-Reply-To: <20071026211606.GC30645@redhat.com> (Daniel Veillard's message of "Fri, 26 Oct 2007 17:16:06 -0400") References: <20071026211606.GC30645@redhat.com> Message-ID: <87hckdo9do.fsf@theine.beaverton.ibm.com> DV> +PKG_PROG_PKG_CONFIG Hmm, I'm not sure where PKG_* comes from... DV> No idea what you would prefer, yours is probably more complete ... I tested mine with several scenarios, so I'll commit mine for now. If I can find where PKG_* is, then I think I should tweak my pkg-config case to use those if possible. DV> BTW concerning the werror, I get the following on Fedora 7 which DV> should probably be fixed :-) DV> Virt_DevicePool.c:73: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result Ooops, thanks for catching that. I'll cook up a fix. 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 Sat Oct 27 16:59:16 2007 From: danms at us.ibm.com (Dan Smith) Date: Sat, 27 Oct 2007 09:59:16 -0700 Subject: [Libvirt-cim] [PATCH] Fix asprintf warning in DevicePool Message-ID: # HG changeset patch # User Dan Smith # Date 1193504300 25200 # Node ID b00e3353ccec10cdd9c3e6882067b2b73a5bd448 # Parent aaad430ea766d9a3bc0be035e595d8da17ee2122 Fix asprintf warning in DevicePool This fixes the compile warning (error) that was preventing a compile on Fedora 7. Signed-off-by: Dan Smith diff -r aaad430ea766 -r b00e3353ccec src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Fri Oct 26 13:34:26 2007 -0700 +++ b/src/Virt_DevicePool.c Sat Oct 27 09:58:20 2007 -0700 @@ -70,9 +70,11 @@ static char *netpool_member_of(const CMP for (i = 0; i < count; i++) { if (STREQ((devs[i].id), dev)) { - asprintf(&result, - "NetworkPool/%s", - devs[i].dev.net.bridge); + ret = asprintf(&result, + "NetworkPool/%s", + devs[i].dev.net.bridge); + if (ret == -1) + result = NULL; break; } } From danms at us.ibm.com Sat Oct 27 17:16:05 2007 From: danms at us.ibm.com (Dan Smith) Date: Sat, 27 Oct 2007 10:16:05 -0700 Subject: [Libvirt-cim] [PATCH] Add disk resource pools Message-ID: <06e694e6367634fab4eb.1193505365@localhost.localdomain> # HG changeset patch # User Dan Smith # Date 1193505363 25200 # Node ID 06e694e6367634fab4ebc1c1a9927cee790d31c4 # Parent f9d3ced9a8b4eb54d46997ba8f96f8105998d625 Add disk resource pools This patch parses a disk pool config file, which allows you to specify a pool name and path. The path is assumed to be a directory of image files. The Capacity and Reserved properties are reported with statvfs (although the free/reserved calculation isn't working yet). The config is hard-coded to /tmp/diskpool.conf currently, but needs to be a compile-time option. This should be a good start though. Updated to fix a similar compile warning on Fedora 7 Signed-off-by: Dan Smith diff -r f9d3ced9a8b4 -r 06e694e63676 Makefile.am --- a/Makefile.am Sat Oct 27 10:07:46 2007 -0700 +++ b/Makefile.am Sat Oct 27 10:16:03 2007 -0700 @@ -19,6 +19,7 @@ MOFS = \ schema/MemoryPool.mof \ schema/ElementCapabilities.mof \ schema/ProcessorPool.mof \ + schema/DiskPool.mof \ schema/HostedResourcePool.mof \ schema/ElementConformsToProfile.mof \ schema/ComputerSystemIndication.mof \ @@ -54,6 +55,7 @@ REGS = \ schema/MemoryPool.registration \ schema/ElementCapabilities.registration \ schema/ProcessorPool.registration \ + schema/DiskPool.registration \ schema/HostedResourcePool.registration \ schema/ComputerSystemIndication.registration \ schema/ResourceAllocationSettingData.registration \ diff -r f9d3ced9a8b4 -r 06e694e63676 schema/DiskPool.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/DiskPool.mof Sat Oct 27 10:16:03 2007 -0700 @@ -0,0 +1,7 @@ +class Xen_DiskPool : CIM_ResourcePool +{ +}; +class KVM_DiskPool : CIM_ResourcePool +{ +}; + diff -r f9d3ced9a8b4 -r 06e694e63676 schema/DiskPool.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/DiskPool.registration Sat Oct 27 10:16:03 2007 -0700 @@ -0,0 +1,2 @@ +Xen_DiskPool root/ibmsd Virt_DevicePoolProvider Virt_DevicePool instance +KVM_DiskPool root/ibmsd Virt_DevicePoolProvider Virt_DevicePool instance diff -r f9d3ced9a8b4 -r 06e694e63676 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Sat Oct 27 10:07:46 2007 -0700 +++ b/src/Virt_DevicePool.c Sat Oct 27 10:16:03 2007 -0700 @@ -19,10 +19,14 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define __USE_FILE_OFFSET64 + #include #include #include #include +#include +#include #include #include @@ -39,7 +43,151 @@ static const CMPIBroker *_BROKER; +#define DISK_POOL_CONFIG "/tmp/diskpool.conf" + char *device_pool_names[] = {"ProcessorPool", "MemoryPool", NULL}; + +struct disk_pool { + char *tag; + char *path; +}; + +static int parse_diskpool_line(struct disk_pool *pool, + const char *line) +{ + int ret; + + ret = sscanf(line, "%as %as", &pool->tag, &pool->path); + if (ret != 2) { + free(pool->tag); + free(pool->path); + } + + return (ret == 2); +} + +static int get_diskpool_config(struct disk_pool **_pools) +{ + const char *path = DISK_POOL_CONFIG; + FILE *config; + char *line = NULL; + size_t len = 0; + int count = 0; + struct disk_pool *pools = NULL; + + config = fopen(path, "r"); + if (config == NULL) { + CU_DEBUG("Failed to open %s: %m", path); + return 0; + } + + while (getline(&line, &len, config) > 0) { + pools = realloc(pools, + (count + 1) * (sizeof(*pools))); + if (pools == NULL) { + CU_DEBUG("Failed to alloc new pool"); + goto out; + } + + if (parse_diskpool_line(&pools[count], line)) + count++; + } + + out: + free(line); + *_pools = pools; + fclose(config); + + return count; +} + +static void free_diskpool(struct disk_pool *pools, int count) +{ + int i; + + if (pools == NULL) + return; + + for (i = 0; i < count; i++) { + free(pools[i].tag); + free(pools[i].path); + } + + free(pools); +} + +static char *_diskpool_member_of(const char *file) +{ + struct disk_pool *pools = NULL; + int count; + int i; + char *pool = NULL; + + count = get_diskpool_config(&pools); + if (count == 0) + return NULL; + + for (i = 0; i < count; i++) { + if (STARTS_WITH(file, pools[i].path)) { + int ret; + + ret = asprintf(&pool, "DiskPool/%s", pools[i].tag); + if (ret == -1) + pool = NULL; + break; + } + } + + free_diskpool(pools, count); + + return pool; +} + +static char *diskpool_member_of(const CMPIBroker *broker, char *rasd_id) +{ + char *host = NULL; + char *dev = NULL; + int ret; + virConnectPtr conn = NULL; + virDomainPtr dom = NULL; + int count = 0; + struct virt_device *devs = NULL; + int i; + char *pool = NULL; + CMPIStatus s; + + ret = parse_fq_devid(rasd_id, &host, &dev); + if (!ret) + goto out; + + conn = lv_connect(broker, &s); + if (conn == NULL) + goto out; + + dom = virDomainLookupByName(conn, host); + if (dom == NULL) + goto out; + + count = get_disk_devices(dom, &devs); + + for (i = 0; i < count; i++) { + if (STREQ((devs[i].dev.disk.virtual_dev), dev)) { + pool = _diskpool_member_of(devs[i].dev.disk.source); + break; + } + } + + out: + if (count > 0) + cleanup_virt_devices(&devs, count); + + free(host); + free(dev); + virConnectClose(conn); + virDomainFree(dom); + + return pool; +} static char *netpool_member_of(const CMPIBroker *broker, char *rasd_id) { @@ -100,6 +248,8 @@ char *pool_member_of(const CMPIBroker *b poolid = strdup("MemoryPool/0"); else if (type == CIM_RASD_TYPE_NET) poolid = netpool_member_of(broker, id); + else if (type == CIM_RASD_TYPE_DISK) + poolid = diskpool_member_of(broker, id); else return NULL; @@ -296,6 +446,96 @@ static CMPIStatus netpool_instance(virCo return s; } +static CMPIInstance *diskpool_from_path(const char *path, + const char *id, + const char *ns, + const CMPIBroker *broker) +{ + CMPIInstance *inst; + char *poolid = NULL; + const uint16_t type = CIM_RASD_TYPE_DISK; + struct statvfs vfs; + uint64_t cap; + uint64_t res; + + inst = get_typed_instance(broker, "DiskPool", ns); + + if (asprintf(&poolid, "DiskPool/%s", id) == -1) + return NULL; + + CMSetProperty(inst, "InstanceID", + (CMPIValue *)poolid, CMPI_chars); + + CMSetProperty(inst, "ResourceType", + (CMPIValue *)&type, CMPI_uint16); + + 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: + free(poolid); + + return inst; +} + +static CMPIStatus diskpool_instance(virConnectPtr conn, + struct inst_list *list, + const char *ns, + const char *id, + const CMPIBroker *broker) +{ + CMPIStatus s; + struct disk_pool *pools = NULL; + int count = 0; + int i; + + count = get_diskpool_config(&pools); + if ((id == NULL) && (count == 0)) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "No such pool `%s'", id); + goto out; + } + + for (i = 0; i < count; i++) { + CMPIInstance *pool; + + if ((id != NULL) && (!STREQ(id, pools[i].tag))) + continue; + /* Either this matches id, or we're matching all */ + + pool = diskpool_from_path(pools[i].path, + pools[i].tag, + ns, + broker); + if (pool != NULL) + inst_list_add(list, pool); + } + + CMSetStatus(&s, CMPI_RC_OK); + out: + free_diskpool(pools, count); + + return s; +} + static CMPIStatus _get_pool(const CMPIBroker *broker, virConnectPtr conn, const char *type, @@ -309,6 +549,8 @@ static CMPIStatus _get_pool(const CMPIBr 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}; } From zli at linux.vnet.ibm.com Mon Oct 29 09:52:20 2007 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Mon, 29 Oct 2007 17:52:20 +0800 Subject: [Libvirt-cim] cu_parse_embedded_instance() different results on sfcb & pegasus Message-ID: <4725AD54.9060908@linux.vnet.ibm.com> The VSMS.defineSystem method on pegasus currently blocks on the this difference: After cu_parse_embedded_instance(), I can get a correct value on those integer type property (e.g. ResourceType) with a sfcb CIMOM. But I failed to get any value from a pegasus CIMOM. Try the following patch: diff -r 0868c5ff8fd7 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Thu Oct 25 09:39:46 2007 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 29 17:42:52 2007 +0800 @@ -56,8 +56,21 @@ static int parse_str_inst_array(CMPIArra _BROKER, &inst); - if (ret == 0) + if (ret == 0) { + int tret = 0; + char * mystr = NULL; + uint16_t myint = 0; + tret = cu_get_str_prop(inst, "InstanceID", &mystr); + if (tret == 0) { + printf("InstanceID = %s\n", mystr); + free(mystr); + } + tret = cu_get_u16_prop(inst, "ResourceType", &myint); + if (tret == 0) { + printf("ResourceType = %d\n", myint); + } inst_list_add(list, inst); + } } return 1; The actual code that breaks lives in the function classify_resources(), I added the patch above to the function parse_str_inst_array(), right after a successful cu_parse_embedded_instance(). On sfcb, you'll see both lines (InstanceID & ResourceType). But on pegasus, only the InstanceID lines. I turned on the EODEBUG macro. Messages from libcmpiutil told me that the integer types are set as SINT64 type. The lexer & parser also take all the integer types as sint64 type. Is that the cause? -- - Zhengang From veillard at redhat.com Mon Oct 29 11:26:38 2007 From: veillard at redhat.com (Daniel Veillard) Date: Mon, 29 Oct 2007 07:26:38 -0400 Subject: [Libvirt-cim] [PATCH] Fix asprintf warning in DevicePool In-Reply-To: References: Message-ID: <20071029112638.GB16694@redhat.com> On Sat, Oct 27, 2007 at 09:59:16AM -0700, Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193504300 25200 > # Node ID b00e3353ccec10cdd9c3e6882067b2b73a5bd448 > # Parent aaad430ea766d9a3bc0be035e595d8da17ee2122 > Fix asprintf warning in DevicePool > This fixes the compile warning (error) that was preventing a compile on > Fedora 7. > > Signed-off-by: Dan Smith Looks fine to me, +1 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 veillard at redhat.com Mon Oct 29 11:29:15 2007 From: veillard at redhat.com (Daniel Veillard) Date: Mon, 29 Oct 2007 07:29:15 -0400 Subject: [Libvirt-cim] [PATCH] add RPM packaging for libvirt-cim, and cleanups Message-ID: <20071029112915.GC16694@redhat.com> # HG changeset patch # User Daniel Veillard # Date 1193656844 -3600 # Node ID 5b601a0035127544c54feaf086fb7065f873e9f9 # Parent aaad430ea766d9a3bc0be035e595d8da17ee2122 RPM Packaging changes and associated cleanups: - Augment some Makefiles variables with missing files - add a spec file template - extend the configure script to generate the spec file - add a 'make rpm' target - fix src/Makefile.am to use late binding of providerdir variable Signed-off-by: Daniel Veillard There is still one thing missing I guess in the spec file: the registration step, which I think should be run as a post-install script. The spec file saves the provider-register.sh and register_base.sh scripts in /usr/share/libvirt-cim/ so they are available at that point, but I don't understand how to best call them, so it will need some attention by someone who knows how that process should work. Daniel diff -r aaad430ea766 -r 5b601a003512 Makefile.am --- a/Makefile.am Fri Oct 26 13:34:26 2007 -0700 +++ b/Makefile.am Mon Oct 29 12:20:44 2007 +0100 @@ -74,9 +74,11 @@ EXTRA_BASE_MOFS = \ schema/KVM_ResourceAllocationSettingData.mof pkgdata_DATA = $(MOFS) $(REGS) -pkgdata_SCRIPTS = provider-register.sh +pkgdata_SCRIPTS = provider-register.sh register_base.sh -EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) +EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) \ + libvirt-cim.spec.in libvirt-cim.spec \ + doc/CodingStyle doc/SubmittingPatches # Un/Register the providers and class definitions from/to the current CIMOM. # @CIMSERVER@ is set by the configure script @@ -88,3 +90,6 @@ preuninstall: preuninstall: sh provider-register.sh -d -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS) sh provider-register.sh -d -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS) + +rpm: clean + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) diff -r aaad430ea766 -r 5b601a003512 configure.ac --- a/configure.ac Fri Oct 26 13:34:26 2007 -0700 +++ b/configure.ac Mon Oct 29 12:20:44 2007 +0100 @@ -180,7 +180,7 @@ echo "---------------------------------- echo "----------------------------------------------------------" # Generate configure scripts for the Makefile -AC_OUTPUT +AC_OUTPUT(libvirt-cim.spec) echo "You may now run make" diff -r aaad430ea766 -r 5b601a003512 libvirt-cim.spec.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libvirt-cim.spec.in Mon Oct 29 12:20:44 2007 +0100 @@ -0,0 +1,65 @@ +# -*- rpm-spec -*- + +Summary: A CIM provider for libvirt +Name: libvirt-cim +Version: @PACKAGE_VERSION@ +Release: 1%{?dist}%{?extra_release} +License: LGPL +Group: Development/Libraries +Source: libvirt-cim-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-root +URL: http://libvirt.org/CIM/ +Requires: libxml2 +Requires: libvirt >= 0.2.3 +BuildRequires: sblim-cmpi-devel +BuildRequires: libvirt-devel >= 0.2.3 +BuildRequires: e2fsprogs-devel +BuildRequires: libxml2-devel +BuildRequires: libcmpiutil-devel + +%description +Libvirt-cim is a CMPI CIM provider that implements the DMTF SVPC +virtualization model. The goal is to support most of the features +exported by libvirt itself, enabling management of multiple +platforms with a single provider. + +%prep +%setup -q + +%build +%configure --disable-werror +make + +%install +rm -fr %{buildroot} + +%makeinstall PROVIDERDIR=%{buildroot}%{_libdir}/cmpi +cp provider-register.sh register_base.sh %{buildroot}%{_datadir}/libvirt-cim/ +rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/*.a +rm -f $RPM_BUILD_ROOT%{_libdir}/cmpi/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/cmpi/*.a + +%clean +rm -fr %{buildroot} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-, root, root) + +%doc README doc/CodingStyle doc/SubmittingPatches +%doc provider-register.sh register_base.sh +%{_libdir}/lib*.so* +%{_libdir}/cmpi/lib*.so* +%{_datadir}/libvirt-cim/*.sh +%{_datadir}/libvirt-cim/*.mof +%{_datadir}/libvirt-cim/*.registration + +%changelog +* Fri Oct 26 2007 Daniel Veillard - 0.1-1 +- created diff -r aaad430ea766 -r 5b601a003512 libxkutil/Makefile.am --- a/libxkutil/Makefile.am Fri Oct 26 13:34:26 2007 -0700 +++ b/libxkutil/Makefile.am Mon Oct 29 12:20:44 2007 +0100 @@ -4,7 +4,7 @@ SUBDIRS = tests CFLAGS += $(CFLAGS_STRICT) -noinst_HEADERS = cs_util.h misc_util.h device_parsing.h hostres.h +noinst_HEADERS = cs_util.h misc_util.h device_parsing.h hostres.h xmlgen.h lib_LTLIBRARIES = libxkutil.la diff -r aaad430ea766 -r 5b601a003512 src/Makefile.am --- a/src/Makefile.am Fri Oct 26 13:34:26 2007 -0700 +++ b/src/Makefile.am Mon Oct 29 12:20:44 2007 +0100 @@ -1,7 +1,20 @@ # Copyright IBM Corp. 2007 SUBDIRS = tests -noinst_HEADERS = Virt_ElementConformsToProfile.h profiles.h +noinst_HEADERS = profiles.h svpc_types.h \ + Virt_AllocationCapabilities.h \ + Virt_ComputerSystem.h \ + Virt_ComputerSystemIndication.h \ + Virt_Device.h \ + Virt_DevicePool.h \ + Virt_ElementConformsToProfile.h \ + Virt_EnabledLogicalElementCapabilities.h \ + Virt_HostSystem.h \ + Virt_RASD.h \ + Virt_RegisteredProfile.h \ + Virt_SettingsDefineCapabilities.h \ + Virt_VirtualSystemManagementCapabilities.h \ + Virt_VSSD.h XKUADD = $(top_builddir)/libxkutil/libxkutil.la @@ -9,7 +22,7 @@ CFLAGS += -I$(top_builddir)/libxkutil $( AM_LDFLAGS = $(XKUADD) -providerdir = @PROVIDERDIR@ +providerdir = $(PROVIDERDIR) provider_LTLIBRARIES = libVirt_ComputerSystem.la \ libVirt_Device.la \ -- 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 danms at us.ibm.com Mon Oct 29 13:51:40 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 06:51:40 -0700 Subject: [Libvirt-cim] cu_parse_embedded_instance() different results on sfcb & pegasus In-Reply-To: <4725AD54.9060908@linux.vnet.ibm.com> (Zhengang Li's message of "Mon, 29 Oct 2007 17:52:20 +0800") References: <4725AD54.9060908@linux.vnet.ibm.com> Message-ID: <873avuvxjn.fsf@theine.beaverton.ibm.com> ZL> The VSMS.defineSystem method on pegasus currently blocks on the ZL> this difference: After cu_parse_embedded_instance(), I can get a ZL> correct value on those integer type property (e.g. ResourceType) ZL> with a sfcb CIMOM. But I failed to get any value from a pegasus ZL> CIMOM. Right, I think the actual problem is that we incorrectly made ResourceType a key in the subclass MOF, which is not allowed. We will need to come up with a patch against all of the classes that deal with RASDs to make them not dependent on the ResourceType, but instead on the classname. I'm going to work on this right away and hopefully will have a patch shortly. -- 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 Oct 29 14:01:10 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 07:01:10 -0700 Subject: [Libvirt-cim] [PATCH] add RPM packaging for libvirt-cim, and cleanups In-Reply-To: <20071029112915.GC16694@redhat.com> (Daniel Veillard's message of "Mon, 29 Oct 2007 07:29:15 -0400") References: <20071029112915.GC16694@redhat.com> Message-ID: <87y7dmuijd.fsf@theine.beaverton.ibm.com> DV> # HG changeset patch DV> # User Daniel Veillard DV> # Date 1193656844 -3600 DV> # Node ID 5b601a0035127544c54feaf086fb7065f873e9f9 DV> # Parent aaad430ea766d9a3bc0be035e595d8da17ee2122 DV> RPM Packaging changes and associated cleanups: DV> - Augment some Makefiles variables with missing files DV> - add a spec file template DV> - extend the configure script to generate the spec file DV> - add a 'make rpm' target DV> - fix src/Makefile.am to use late binding of providerdir variable Works for me. +1 DV> There is still one thing missing I guess in the spec file: the DV> registration step, which I think should be run as a post-install DV> script. The spec file saves the provider-register.sh and DV> register_base.sh scripts in /usr/share/libvirt-cim/ so they are DV> available at that point, but I don't understand how to best call DV> them, so it will need some attention by someone who knows how that DV> process should work. I *think* the rpm needs to do that in the postinstall step, although I'm not sure if/how the determination of which CIMOM is to be used should be made. If the rpm assumes pegasus is installed, then perhaps it should be hard-coded and the user can re-run the provider registration if they are using something non-standard? Heidi would probably be the one to comment on the convention here. Anyone have a problem with putting this in the tree now and fixing up the registration step in a subsequent patch? -- 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 Oct 29 15:14:02 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 08:14:02 -0700 Subject: [Libvirt-cim] [PATCH] Add disk resource pools In-Reply-To: <4725F816.30602@linux.vnet.ibm.com> (Jay Gagnon's message of "Mon, 29 Oct 2007 11:11:18 -0400") References: <06e694e6367634fab4eb.1193505365@localhost.localdomain> <4725F816.30602@linux.vnet.ibm.com> Message-ID: <87ejfeuf5x.fsf@theine.beaverton.ibm.com> JG> I'll import it from here and re-base my configure patch so we can JG> make the config location compile-time. Cool, 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 Oct 29 15:11:18 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 29 Oct 2007 11:11:18 -0400 Subject: [Libvirt-cim] [PATCH] Add disk resource pools In-Reply-To: <06e694e6367634fab4eb.1193505365@localhost.localdomain> References: <06e694e6367634fab4eb.1193505365@localhost.localdomain> Message-ID: <4725F816.30602@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193505363 25200 > # Node ID 06e694e6367634fab4ebc1c1a9927cee790d31c4 > # Parent f9d3ced9a8b4eb54d46997ba8f96f8105998d625 > Add disk resource pools > This patch parses a disk pool config file, which allows you to specify a pool > name and path. The path is assumed to be a directory of image files. The > Capacity and Reserved properties are reported with statvfs (although the > free/reserved calculation isn't working yet). The config is hard-coded to > /tmp/diskpool.conf currently, but needs to be a compile-time option. This > should be a good start though. > > Updated to fix a similar compile warning on Fedora 7 > > Signed-off-by: Dan Smith > > > The only change since I acked the original being a small compile warning fix, I obviously think this is good to go. I'll import it from here and re-base my configure patch so we can make the config location compile-time. -- -Jay From danms at us.ibm.com Mon Oct 29 16:06:07 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 09:06:07 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key Message-ID: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> # HG changeset patch # User Dan Smith # Date 1193673965 25200 # Node ID 07b9be7502efdeead8b1ab83df2d13bcb5398548 # Parent 82ff2daf1ddb72c0bd8a83588a03bd7a37ea110b Make RASD not dependent on ResourceType key I have tested DefineSystem() and some of the ResourcePool associations. It would be good to get a quick smoke test of the AllocationCapabilities stuff as well, just to make sure I didn't break anything. Signed-off-by: Dan Smith diff -r 82ff2daf1ddb -r 07b9be7502ef schema/KVM_ResourceAllocationSettingData.mof --- a/schema/KVM_ResourceAllocationSettingData.mof Mon Oct 29 12:20:44 2007 +0100 +++ b/schema/KVM_ResourceAllocationSettingData.mof Mon Oct 29 09:06:05 2007 -0700 @@ -1,9 +1,4 @@ // Copyright IBM Corp. 2007 class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - }; diff -r 82ff2daf1ddb -r 07b9be7502ef schema/Xen_ResourceAllocationSettingData.mof --- a/schema/Xen_ResourceAllocationSettingData.mof Mon Oct 29 12:20:44 2007 +0100 +++ b/schema/Xen_ResourceAllocationSettingData.mof Mon Oct 29 09:06:05 2007 -0700 @@ -1,9 +1,4 @@ // Copyright IBM Corp. 2007 class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - }; diff -r 82ff2daf1ddb -r 07b9be7502ef src/Makefile.am --- a/src/Makefile.am Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Makefile.am Mon Oct 29 09:06:05 2007 -0700 @@ -83,8 +83,10 @@ libVirt_ElementCapabilities_la_LIBADD = -lVirt_HostSystem libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c +libVirt_AllocationCapabilities_la_SOURCES = -lVirt_RASD libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c +libVirt_SettingsDefineCapabilities_la_SOURCES = -lVirt_RASD libVirt_RegisteredProfile_la_SOURCES = Virt_RegisteredProfile.c diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_AllocationCapabilities.c Mon Oct 29 09:06:05 2007 -0700 @@ -29,6 +29,7 @@ #include "misc_util.h" #include "Virt_AllocationCapabilities.h" +#include "Virt_RASD.h" const static CMPIBroker *_BROKER; @@ -44,8 +45,7 @@ CMPIStatus get_alloc_cap(const CMPIBroke *inst = get_typed_instance(broker, "AllocationCapabilities", NAMESPACE(ref)); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (ret != 1) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CMSetStatusWithChars(broker, &s, CMPI_RC_ERR_FAILED, "Could not get ResourceType."); goto out; diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_RASD.c Mon Oct 29 09:06:05 2007 -0700 @@ -205,10 +205,38 @@ static CMPIInstance *get_rasd_instance(c return inst; } +CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type) +{ + char *base = NULL; + CMPIrc rc = CMPI_RC_ERR_FAILED; + + base = class_base_name(cn); + if (base == NULL) + goto out; + + if (STREQ(base, "DiskResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_DISK; + else if (STREQ(base, "NetResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_NET; + else if (STREQ(base, "ProcResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_PROC; + else if (STREQ(base, "MemResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_MEM; + else + goto out; + + rc = CMPI_RC_OK; + + out: + free(base); + + return rc; +} + static CMPIStatus GetInstance(CMPIInstanceMI *self, const CMPIContext *context, const CMPIResult *results, - const CMPIObjectPath *reference, + const CMPIObjectPath *ref, const char **properties) { CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -216,7 +244,7 @@ static CMPIStatus GetInstance(CMPIInstan char *id = NULL; uint16_t type; - id = cu_get_str_path(reference, "InstanceID"); + id = cu_get_str_path(ref, "InstanceID"); if (id == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -224,14 +252,14 @@ static CMPIStatus GetInstance(CMPIInstan goto out; } - if (!cu_get_u16_path(reference, "ResourceType", &type)) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Missing or invalid ResourceType"); - goto out; - } - - inst = get_rasd_instance(context, reference, id, type); + "Unable to determine RASD type"); + goto out; + } + + inst = get_rasd_instance(context, ref, id, type); if (inst != NULL) CMReturnInstance(results, inst); diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_RASD.h --- a/src/Virt_RASD.h Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_RASD.h Mon Oct 29 09:06:05 2007 -0700 @@ -27,6 +27,7 @@ int rasds_for_domain(const CMPIBroker *b const uint16_t type, const char *ns, struct inst_list *_list); +CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); #endif diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Mon Oct 29 09:06:05 2007 -0700 @@ -42,7 +42,6 @@ static CMPIStatus rasd_to_pool(const CMP struct inst_list *list) { CMPIStatus s; - int ret; uint16_t type; char *id = NULL; char *poolid = NULL; @@ -52,11 +51,10 @@ static CMPIStatus rasd_to_pool(const CMP inst_list_init(&_list); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (!ret) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing ResourceType"); + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); goto out; } @@ -113,8 +111,16 @@ static int filter_by_pool(struct inst_li for (i = 0; i < src->cur; i++) { CMPIInstance *inst = src->list[i]; - - cu_get_u16_prop(inst, "ResourceType", &type); + CMPIObjectPath *op; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) + continue; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != + CMPI_RC_OK) + continue; + cu_get_str_prop(inst, "InstanceID", &rasd_id); poolid = pool_member_of(_BROKER, type, rasd_id); diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Mon Oct 29 09:06:05 2007 -0700 @@ -37,6 +37,7 @@ #include "svpc_types.h" #include "Virt_SettingsDefineCapabilities.h" +#include "Virt_RASD.h" const static CMPIBroker *_BROKER; @@ -315,13 +316,11 @@ static CMPIStatus alloc_cap_to_rasd(cons struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK}; - int ret; uint16_t type; CU_DEBUG("Getting ResourceType.\n"); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (ret != 1) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, "Could not get ResourceType."); goto out; diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_SettingsDefineState.c Mon Oct 29 09:06:05 2007 -0700 @@ -162,7 +162,6 @@ static CMPIStatus rasd_to_dev(const CMPI CMPIStatus s; CMPIInstance *dev = NULL; char *id = NULL; - int ret; uint16_t type; ASSOC_MATCH(info->provider_name, CLASSNAME(ref)); @@ -175,8 +174,7 @@ static CMPIStatus rasd_to_dev(const CMPI goto out; } - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (!ret) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Missing ResourceType"); diff -r 82ff2daf1ddb -r 07b9be7502ef src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Oct 29 12:20:44 2007 +0100 +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 29 09:06:05 2007 -0700 @@ -157,9 +157,15 @@ static int rasd_to_vdev(CMPIInstance *in char *id = NULL; char *name = NULL; char *devid = NULL; - - if (cu_get_u16_prop(inst, "ResourceType", &type) != CMPI_RC_OK) + CMPIObjectPath *op; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) goto err; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) + goto err; + dev->type = (int)type; if (cu_get_str_prop(inst, "InstanceID", &id) != CMPI_RC_OK) @@ -206,7 +212,6 @@ static int classify_resources(struct ins static int classify_resources(struct inst_list *all, struct domain *domain) { - int ret; int i; uint16_t type; @@ -219,8 +224,14 @@ static int classify_resources(struct ins domain->dev_net = calloc(all->cur, sizeof(struct virt_device)); for (i = 0; i < all->cur; i++) { - ret = cu_get_u16_prop(all->list[i], "ResourceType", &type); - if (ret != CMPI_RC_OK) + CMPIObjectPath *op; + + op = CMGetObjectPath(all->list[i], NULL); + if (op == NULL) + return 0; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != + CMPI_RC_OK) return 0; if (type == CIM_RASD_TYPE_PROC) @@ -681,6 +692,7 @@ static CMPIStatus _update_resources_for( struct domain *dominfo = NULL; uint16_t type; char *xml = NULL; + CMPIObjectPath *op; if (!get_dominfo(dom, &dominfo)) { cu_statusf(_BROKER, &s, @@ -689,10 +701,18 @@ static CMPIStatus _update_resources_for( goto out; } - if (cu_get_u16_prop(rasd, "ResourceType", &type) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing ResourceType"); + op = CMGetObjectPath(rasd, NULL); + if (op == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get RASD path"); + goto out; + } + + if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); goto out; } From danms at us.ibm.com Mon Oct 29 16:14:57 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 09:14:57 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> (Dan Smith's message of "Mon, 29 Oct 2007 09:06:07 -0700") References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> Message-ID: <87abq1vqwu.fsf@theine.beaverton.ibm.com> DS> diff -r 82ff2daf1ddb -r 07b9be7502ef src/Makefile.am DS> --- a/src/Makefile.am Mon Oct 29 12:20:44 2007 +0100 DS> +++ b/src/Makefile.am Mon Oct 29 09:06:05 2007 -0700 DS> @@ -83,8 +83,10 @@ libVirt_ElementCapabilities_la_LIBADD = DS> -lVirt_HostSystem DS> libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c DS> +libVirt_AllocationCapabilities_la_SOURCES = -lVirt_RASD DS> libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c DS> +libVirt_SettingsDefineCapabilities_la_SOURCES = -lVirt_RASD Oops, just noticed that I added a second _SOURCES for each modified target instead of _LIBADD. I've fixed my local version. This will still work for testing, but throws a couple warnings. -- 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 Oct 29 18:46:00 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 11:46:00 -0700 Subject: [Libvirt-cim] [PATCH] Add some useful debug messages to VSMS to assist in debugging DefineSystem Message-ID: <4a1d173152a3c4ceffe3.1193683560@localhost.localdomain> # HG changeset patch # User Dan Smith # Date 1193683554 25200 # Node ID 4a1d173152a3c4ceffe3cde01424a6576ea0ae20 # Parent 000f480e2956d631525f5151f611b3e8b41bbe8e Add some useful debug messages to VSMS to assist in debugging DefineSystem Signed-off-by: Dan Smith diff -r 000f480e2956 -r 4a1d173152a3 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Oct 29 09:13:57 2007 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 29 11:45:54 2007 -0700 @@ -85,11 +85,14 @@ static CMPIStatus define_system_parse_ar int ret; sys_str = cu_get_str_arg(argsin, "SystemSettings"); - if (sys_str == NULL) - goto out; + if (sys_str == NULL) { + CU_DEBUG("No SystemSettings string argument"); + goto out; + } ret = cu_parse_embedded_instance(sys_str, _BROKER, sys); if (ret) { + CU_DEBUG("Unable to parse SystemSettings instance"); CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, "SystemSettings parse error"); @@ -98,7 +101,7 @@ static CMPIStatus define_system_parse_ar res_arr = cu_get_array_arg(argsin, "ResourceSettings"); if (res_arr == NULL) { - printf("Failed to get array arg\n"); + CU_DEBUG("Failed to get array arg"); goto out; } @@ -227,12 +230,16 @@ static int classify_resources(struct ins CMPIObjectPath *op; op = CMGetObjectPath(all->list[i], NULL); - if (op == NULL) + if (op == NULL) { + CU_DEBUG("No path for RASD"); return 0; + } if (rasd_type_from_classname(CLASSNAME(op), &type) != - CMPI_RC_OK) + CMPI_RC_OK) { + CU_DEBUG("No type for class %s", CLASSNAME(op)) return 0; + } if (type == CIM_RASD_TYPE_PROC) rasd_to_vdev(all->list[i], @@ -261,11 +268,14 @@ static CMPIInstance *connect_and_create( CMPIInstance *inst; conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); - if (conn == NULL) + if (conn == NULL) { + CU_DEBUG("libvirt connection failed"); return NULL; + } dom = virDomainDefineXML(conn, xml); if (dom == NULL) { + CU_DEBUG("Failed to define domain from XML"); CMSetStatusWithChars(_BROKER, s, CMPI_RC_ERR_FAILED, "Failed to create domain"); @@ -274,10 +284,12 @@ static CMPIInstance *connect_and_create( name = virDomainGetName(dom); inst = instance_from_name(_BROKER, conn, (char *)name, ref); - if (inst == NULL) + if (inst == NULL) { + CU_DEBUG("Failed to get new instance"); CMSetStatusWithChars(_BROKER, s, CMPI_RC_ERR_FAILED, "Failed to lookup resulting system"); + } virConnectClose(conn); @@ -301,6 +313,7 @@ static CMPIInstance *create_system(CMPII } if (!classify_resources(resources, domain)) { + CU_DEBUG("Failed to classify resources"); cu_statusf(_BROKER, s, CMPI_RC_ERR_FAILED, "ResourceSettings Error"); @@ -308,6 +321,7 @@ static CMPIInstance *create_system(CMPII } if (!vssd_to_domain(vssd, domain)) { + CU_DEBUG("Failed to create domain from VSSD"); cu_statusf(_BROKER, s, CMPI_RC_ERR_FAILED, "SystemSettings Error"); @@ -315,7 +329,7 @@ static CMPIInstance *create_system(CMPII } xml = system_to_xml(domain); - printf("\nSystem XML:\n%s\n", xml); + CU_DEBUG("System XML:\n%s", xml); inst = connect_and_create(xml, ref, s); @@ -357,7 +371,7 @@ static CMPIStatus define_system(CMPIMeth inst_list_init(&res); - printf("Parsing args\n"); + CU_DEBUG("DefineSystem"); s = define_system_parse_args(argsin, &vssd, &res); if (s.rc != CMPI_RC_OK) From grendel at linux.vnet.ibm.com Mon Oct 29 20:04:49 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Mon, 29 Oct 2007 16:04:49 -0400 Subject: [Libvirt-cim] [PATCH] Make the location of the disk pool config file a compile-time option. No checks are done at the moment, mostly due to my lack of m4 skills. Suggestions are welcome or we can do the check in the provider itself Message-ID: <4667bc86331dbde59f7d.1193688289@wulfgar> # HG changeset patch # User Jay Gagnon # Date 1193686792 14400 # Node ID 4667bc86331dbde59f7ddbde9766d7025385eaec # Parent f2966180a03a8604d32159b12e44db18ca429a91 Make the location of the disk pool config file a compile-time option. No checks are done at the moment, mostly due to my lack of m4 skills. Suggestions are welcome or we can do the check in the provider itself. Signed-off-by: Jay Gagnon diff -r f2966180a03a -r 4667bc86331d acinclude.m4 --- a/acinclude.m4 Sat Oct 27 10:16:03 2007 -0700 +++ b/acinclude.m4 Mon Oct 29 15:39:52 2007 -0400 @@ -463,3 +463,12 @@ AC_DEFUN([DEFINE_MAXMEM], AC_DEFINE_UNQUOTED([MAX_MEM], $1, [Max memory for a guest.]) ] ) + +# +# Define disk pool config. +# +AC_DEFUN([DEFINE_DISK_CONFIG], + [ + AC_DEFINE_UNQUOTED([DISK_POOL_CONFIG], "$1", [Disk pool config filepath.]) + ] +) \ No newline at end of file diff -r f2966180a03a -r 4667bc86331d configure.ac --- a/configure.ac Sat Oct 27 10:16:03 2007 -0700 +++ b/configure.ac Mon Oct 29 15:39:52 2007 -0400 @@ -35,6 +35,11 @@ AC_ARG_VAR([TESTSUITEDIR],[the directory AC_ARG_VAR([TESTSUITEDIR],[the directory where the SBLIM testsuite is installed. ]) +AC_ARG_WITH([diskconfig], + [ --with-diskconfig=PATH Set config file for disk pool. (default=/tmp/diskpool.conf)], + [DEFINE_DISK_CONFIG($with_diskconfig)], + [DEFINE_DISK_CONFIG(/tmp/diskpool.conf)] +) AC_ARG_WITH([maxmem], [ --with-maxmem=FOO Set max memory (MB) for a guest.], [DEFINE_MAXMEM($with_maxmem)], diff -r f2966180a03a -r 4667bc86331d src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Sat Oct 27 10:16:03 2007 -0700 +++ b/src/Virt_DevicePool.c Mon Oct 29 15:39:52 2007 -0400 @@ -32,6 +32,8 @@ #include #include +#include "config.h" + #include "misc_util.h" #include "hostres.h" #include "device_parsing.h" @@ -42,8 +44,6 @@ #include "svpc_types.h" static const CMPIBroker *_BROKER; - -#define DISK_POOL_CONFIG "/tmp/diskpool.conf" char *device_pool_names[] = {"ProcessorPool", "MemoryPool", NULL}; From danms at us.ibm.com Mon Oct 29 20:24:37 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 13:24:37 -0700 Subject: [Libvirt-cim] [PATCH] Make the location of the disk pool config file a compile-time option. No checks are done at the moment, mostly due to my lack of m4 skills. Suggestions are welcome or we can do the check in the provider itself In-Reply-To: <4667bc86331dbde59f7d.1193688289@wulfgar> (Jay Gagnon's message of "Mon, 29 Oct 2007 16:04:49 -0400") References: <4667bc86331dbde59f7d.1193688289@wulfgar> Message-ID: <871wbdvfcq.fsf@theine.beaverton.ibm.com> JG> # HG changeset patch JG> # User Jay Gagnon JG> # Date 1193686792 14400 JG> # Node ID 4667bc86331dbde59f7ddbde9766d7025385eaec JG> # Parent f2966180a03a8604d32159b12e44db18ca429a91 JG> Make the location of the disk pool config file a compile-time JG> option. No checks are done at the moment, mostly due to my lack JG> of m4 skills. Suggestions are welcome or we can do the check in JG> the provider itself. Works for me. +1 The provider handles a lack of a config file as the situation where no disk pools are defined, which I think is valid. Thanks Jay! -- 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 Oct 29 20:26:33 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 13:26:33 -0700 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid Message-ID: # HG changeset patch # User Dan Smith # Date 1193689589 25200 # Node ID a9008606ede19590b358580f3bc2732f9c92c23c # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 Fix VSMS instance code to refuse to return an instance if ref is invalid Signed-off-by: Dan Smith diff -r bf5ad6924b99 -r a9008606ede1 src/Makefile.am --- a/src/Makefile.am Mon Oct 29 15:39:52 2007 -0400 +++ b/src/Makefile.am Mon Oct 29 13:26:29 2007 -0700 @@ -56,7 +56,7 @@ libVirt_ComputerSystemIndication_la_LIBA libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lpthread -lrt libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c -libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD +libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c diff -r bf5ad6924b99 -r a9008606ede1 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Oct 29 15:39:52 2007 -0400 +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 29 13:26:29 2007 -0700 @@ -44,6 +44,7 @@ #include "Virt_ComputerSystem.h" #include "Virt_ComputerSystemIndication.h" #include "Virt_RASD.h" +#include "Virt_HostSystem.h" #include "svpc_types.h" const static CMPIBroker *_BROKER; @@ -896,18 +897,24 @@ STDIM_MethodMIStub(, Virt_VirtualSystemM STDIM_MethodMIStub(, Virt_VirtualSystemManagementService, _BROKER, CMNoHook, my_handlers); - -static CMPIStatus return_vsms(const CMPIObjectPath *reference, - const CMPIResult *results, - int name_only) +static CMPIStatus _get_vsms(const CMPIObjectPath *reference, + CMPIInstance **_inst, + int name_only) { CMPIStatus s; CMPIInstance *inst; + CMPIInstance *host; + char *val = NULL; + + s = get_host_cs(_BROKER, reference, &host); + if (s.rc != CMPI_RC_OK) + goto out; inst = get_typed_instance(_BROKER, "VirtualSystemManagementService", NAMESPACE(reference)); if (inst == NULL) { + CU_DEBUG("Failed to get typed instance"); cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Failed to create instance"); @@ -916,6 +923,46 @@ static CMPIStatus return_vsms(const CMPI CMSetProperty(inst, "Name", (CMPIValue *)"Management Service", CMPI_chars); + + if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get name of System"); + goto out; + } + + CMSetProperty(inst, "SystemName", + (CMPIValue *)val, CMPI_chars); + free(val); + + if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get creation class of system"); + goto out; + } + + CMSetProperty(inst, "SystemCreationClassName", + (CMPIValue *)val, CMPI_chars); + free(val); + + CMSetStatus(&s, CMPI_RC_OK); + + *_inst = inst; + out: + return s; +} + +static CMPIStatus return_vsms(const CMPIObjectPath *reference, + const CMPIResult *results, + int name_only) +{ + CMPIInstance *inst; + CMPIStatus s; + + s = _get_vsms(reference, &inst, name_only); + if (s.rc != CMPI_RC_OK) + goto out; if (name_only) cu_return_instance_name(results, inst); @@ -923,7 +970,6 @@ static CMPIStatus return_vsms(const CMPI CMReturnInstance(results, inst); CMSetStatus(&s, CMPI_RC_OK); - out: return s; } @@ -946,13 +992,58 @@ static CMPIStatus EnumInstances(CMPIInst return return_vsms(reference, results, 0); } +static int compare_prop(const CMPIObjectPath *ref, + const CMPIInstance *inst, + const char *name, + int mandatory) +{ + char *prop = NULL; + char *key = NULL; + int rc = 0; + + key = cu_get_str_path(ref, name); + if (key == NULL) { + rc = !mandatory; + goto out; + } + + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK) + goto out; + + rc = STREQ(key, prop); + out: + free(prop); + free(key); + + return rc; +} + static CMPIStatus GetInstance(CMPIInstanceMI *self, const CMPIContext *context, const CMPIResult *results, - const CMPIObjectPath *reference, + const CMPIObjectPath *ref, const char **properties) { - return return_vsms(reference, results, 0); + CMPIInstance *inst; + CMPIStatus s; + + s = _get_vsms(ref, &inst, 0); + if (s.rc != CMPI_RC_OK) + return s; + + if (!compare_prop(ref, inst, "CreationClassName", 0) || + !compare_prop(ref, inst, "SystemName", 0) || + !compare_prop(ref, inst, "Name", 1) || + !compare_prop(ref, inst, "SystemCreationClassName", 0)) + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "No such instance"); + else { + CMSetStatus(&s, CMPI_RC_OK); + CMReturnInstance(results, inst); + } + + return s; } DEFAULT_CI(); From danms at us.ibm.com Mon Oct 29 20:30:26 2007 From: danms at us.ibm.com (Dan Smith) Date: Mon, 29 Oct 2007 13:30:26 -0700 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid In-Reply-To: (Dan Smith's message of "Mon, 29 Oct 2007 13:26:33 -0700") References: Message-ID: <87wst5u0il.fsf@theine.beaverton.ibm.com> DS> +static int compare_prop(const CMPIObjectPath *ref, DS> + const CMPIInstance *inst, DS> + const char *name, DS> + int mandatory) DS> +{ DS> + char *prop = NULL; DS> + char *key = NULL; DS> + int rc = 0; DS> + DS> + key = cu_get_str_path(ref, name); DS> + if (key == NULL) { DS> + rc = !mandatory; DS> + goto out; DS> + } DS> + DS> + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK) DS> + goto out; DS> + DS> + rc = STREQ(key, prop); DS> + out: DS> + free(prop); DS> + free(key); DS> + DS> + return rc; DS> +} I think that some variation of the above function probably deserves to be in libcmpiutil. The act of comparing an instance with a reference and make sure that all keys are either correct or unspecified seems like a common thing. There are probably other places where we need such a filter anyway. 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 heidieck at linux.vnet.ibm.com Tue Oct 30 09:00:41 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Tue, 30 Oct 2007 10:00:41 +0100 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid In-Reply-To: References: Message-ID: <4726F2B9.1000306@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193689589 25200 > # Node ID a9008606ede19590b358580f3bc2732f9c92c23c > # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 > Fix VSMS instance code to refuse to return an instance if ref is invalid > > Signed-off-by: Dan Smith > > diff -r bf5ad6924b99 -r a9008606ede1 src/Makefile.am > --- a/src/Makefile.am Mon Oct 29 15:39:52 2007 -0400 > +++ b/src/Makefile.am Mon Oct 29 13:26:29 2007 -0700 > @@ -56,7 +56,7 @@ libVirt_ComputerSystemIndication_la_LIBA > libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lpthread -lrt > > libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c > -libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD > +libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem > > libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c > > diff -r bf5ad6924b99 -r a9008606ede1 src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Mon Oct 29 15:39:52 2007 -0400 > +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 29 13:26:29 2007 -0700 > @@ -44,6 +44,7 @@ > #include "Virt_ComputerSystem.h" > #include "Virt_ComputerSystemIndication.h" > #include "Virt_RASD.h" > +#include "Virt_HostSystem.h" > #include "svpc_types.h" > > const static CMPIBroker *_BROKER; > @@ -896,18 +897,24 @@ STDIM_MethodMIStub(, Virt_VirtualSystemM > STDIM_MethodMIStub(, Virt_VirtualSystemManagementService, > _BROKER, CMNoHook, my_handlers); > > - > -static CMPIStatus return_vsms(const CMPIObjectPath *reference, > - const CMPIResult *results, > - int name_only) > +static CMPIStatus _get_vsms(const CMPIObjectPath *reference, > + CMPIInstance **_inst, > + int name_only) > { > CMPIStatus s; > CMPIInstance *inst; > + CMPIInstance *host; > + char *val = NULL; > + > + s = get_host_cs(_BROKER, reference, &host); > + if (s.rc != CMPI_RC_OK) > + goto out; > > inst = get_typed_instance(_BROKER, > "VirtualSystemManagementService", > NAMESPACE(reference)); > if (inst == NULL) { > + CU_DEBUG("Failed to get typed instance"); > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_FAILED, > "Failed to create instance"); > @@ -916,6 +923,46 @@ static CMPIStatus return_vsms(const CMPI > > CMSetProperty(inst, "Name", > (CMPIValue *)"Management Service", CMPI_chars); > + > + if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Unable to get name of System"); > + goto out; > + } > + > + CMSetProperty(inst, "SystemName", > + (CMPIValue *)val, CMPI_chars); > + free(val); > + > + if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Unable to get creation class of system"); > + goto out; > + } > + > + CMSetProperty(inst, "SystemCreationClassName", > + (CMPIValue *)val, CMPI_chars); > + free(val); > + > + CMSetStatus(&s, CMPI_RC_OK); > + > + *_inst = inst; > + out: > + return s; > +} > + > +static CMPIStatus return_vsms(const CMPIObjectPath *reference, > + const CMPIResult *results, > + int name_only) > +{ > + CMPIInstance *inst; > + CMPIStatus s; > + > + s = _get_vsms(reference, &inst, name_only); > + if (s.rc != CMPI_RC_OK) > + goto out; > > if (name_only) > cu_return_instance_name(results, inst); > @@ -923,7 +970,6 @@ static CMPIStatus return_vsms(const CMPI > CMReturnInstance(results, inst); > > CMSetStatus(&s, CMPI_RC_OK); > - > out: > return s; > } > @@ -946,13 +992,58 @@ static CMPIStatus EnumInstances(CMPIInst > return return_vsms(reference, results, 0); > } > > +static int compare_prop(const CMPIObjectPath *ref, > + const CMPIInstance *inst, > + const char *name, > + int mandatory) > +{ > + char *prop = NULL; > + char *key = NULL; > + int rc = 0; > + > + key = cu_get_str_path(ref, name); > + if (key == NULL) { > + rc = !mandatory; > + goto out; > + } > + > + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK) > + goto out; > + > + rc = STREQ(key, prop); > + out: > + free(prop); > + free(key); > + > + return rc; > +} > + > static CMPIStatus GetInstance(CMPIInstanceMI *self, > const CMPIContext *context, > const CMPIResult *results, > - const CMPIObjectPath *reference, > + const CMPIObjectPath *ref, > const char **properties) > { > - return return_vsms(reference, results, 0); > + CMPIInstance *inst; > + CMPIStatus s; > + > + s = _get_vsms(ref, &inst, 0); > + if (s.rc != CMPI_RC_OK) > + return s; > + > + if (!compare_prop(ref, inst, "CreationClassName", 0) || > + !compare_prop(ref, inst, "SystemName", 0) || > + !compare_prop(ref, inst, "Name", 1) || > + !compare_prop(ref, inst, "SystemCreationClassName", 0)) > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > In regard to DMTF's DSP200 the return code should be CMPI_RC_ERR_NOT_FOUND, as "the CIM Class does exist, but the requested CIM Instance does not exist in the specified namespace". > + "No such instance"); > + else { > + CMSetStatus(&s, CMPI_RC_OK); > + CMReturnInstance(results, inst); > + } > + > + return s; > } > > DEFAULT_CI(); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > nothing else to comment ... +1 :) -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck at linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From zli at linux.vnet.ibm.com Tue Oct 30 09:00:39 2007 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Tue, 30 Oct 2007 17:00:39 +0800 Subject: [Libvirt-cim] Automatic reply to list not working? Message-ID: <4726F2B7.1050609@linux.vnet.ibm.com> It seems that the email from the list only adds the "libvirt-cim at redhat.com" in the CC field. Replying to an email sending from the list automatically goes to the original author instead of the list itself. Is this an intended configuration in the mailing-list setup? -- - Zhengang From heidieck at linux.vnet.ibm.com Tue Oct 30 09:01:25 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Tue, 30 Oct 2007 10:01:25 +0100 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid In-Reply-To: <87wst5u0il.fsf@theine.beaverton.ibm.com> References: <87wst5u0il.fsf@theine.beaverton.ibm.com> Message-ID: <4726F2E5.5050408@linux.vnet.ibm.com> Dan Smith wrote: > DS> +static int compare_prop(const CMPIObjectPath *ref, > DS> + const CMPIInstance *inst, > DS> + const char *name, > DS> + int mandatory) > DS> +{ > DS> + char *prop = NULL; > DS> + char *key = NULL; > DS> + int rc = 0; > DS> + > DS> + key = cu_get_str_path(ref, name); > DS> + if (key == NULL) { > DS> + rc = !mandatory; > DS> + goto out; > DS> + } > DS> + > DS> + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK) > DS> + goto out; > DS> + > DS> + rc = STREQ(key, prop); > DS> + out: > DS> + free(prop); > DS> + free(key); > DS> + > DS> + return rc; > DS> +} > > I think that some variation of the above function probably deserves to > be in libcmpiutil. The act of comparing an instance with a reference > and make sure that all keys are either correct or unspecified seems > like a common thing. There are probably other places where we need > such a filter anyway. Thoughts? > I absolutely agree. Such a function should become part of libcmpiutil. > > ------------------------------------------------------------------------ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck at linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From heidieck at linux.vnet.ibm.com Tue Oct 30 09:18:56 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Tue, 30 Oct 2007 10:18:56 +0100 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid In-Reply-To: References: Message-ID: <4726F700.2020100@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193689589 25200 > # Node ID a9008606ede19590b358580f3bc2732f9c92c23c > # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 > Fix VSMS instance code to refuse to return an instance if ref is invalid > > Signed-off-by: Dan Smith > > diff -r bf5ad6924b99 -r a9008606ede1 src/Makefile.am > --- a/src/Makefile.am Mon Oct 29 15:39:52 2007 -0400 > +++ b/src/Makefile.am Mon Oct 29 13:26:29 2007 -0700 > @@ -56,7 +56,7 @@ libVirt_ComputerSystemIndication_la_LIBA > libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lpthread -lrt > > libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c > -libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD > +libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem > > libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c > > diff -r bf5ad6924b99 -r a9008606ede1 src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Mon Oct 29 15:39:52 2007 -0400 > +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 29 13:26:29 2007 -0700 > @@ -44,6 +44,7 @@ > #include "Virt_ComputerSystem.h" > #include "Virt_ComputerSystemIndication.h" > #include "Virt_RASD.h" > +#include "Virt_HostSystem.h" > #include "svpc_types.h" > > const static CMPIBroker *_BROKER; > @@ -896,18 +897,24 @@ STDIM_MethodMIStub(, Virt_VirtualSystemM > STDIM_MethodMIStub(, Virt_VirtualSystemManagementService, > _BROKER, CMNoHook, my_handlers); > > - > -static CMPIStatus return_vsms(const CMPIObjectPath *reference, > - const CMPIResult *results, > - int name_only) > +static CMPIStatus _get_vsms(const CMPIObjectPath *reference, > + CMPIInstance **_inst, > + int name_only) > { > CMPIStatus s; > CMPIInstance *inst; > + CMPIInstance *host; > + char *val = NULL; > + > + s = get_host_cs(_BROKER, reference, &host); > + if (s.rc != CMPI_RC_OK) > + goto out; > > inst = get_typed_instance(_BROKER, > "VirtualSystemManagementService", > NAMESPACE(reference)); > if (inst == NULL) { > + CU_DEBUG("Failed to get typed instance"); > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_FAILED, > "Failed to create instance"); > @@ -916,6 +923,46 @@ static CMPIStatus return_vsms(const CMPI > > CMSetProperty(inst, "Name", > (CMPIValue *)"Management Service", CMPI_chars); > + > + if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Unable to get name of System"); > + goto out; > + } > + > + CMSetProperty(inst, "SystemName", > + (CMPIValue *)val, CMPI_chars); > + free(val); > + > + if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Unable to get creation class of system"); > + goto out; > + } > + > + CMSetProperty(inst, "SystemCreationClassName", > + (CMPIValue *)val, CMPI_chars); > + free(val); > + > + CMSetStatus(&s, CMPI_RC_OK); > + > + *_inst = inst; > + out: > + return s; > +} > + > +static CMPIStatus return_vsms(const CMPIObjectPath *reference, > + const CMPIResult *results, > + int name_only) > +{ > + CMPIInstance *inst; > + CMPIStatus s; > + > + s = _get_vsms(reference, &inst, name_only); > + if (s.rc != CMPI_RC_OK) > + goto out; > > if (name_only) > cu_return_instance_name(results, inst); > @@ -923,7 +970,6 @@ static CMPIStatus return_vsms(const CMPI > CMReturnInstance(results, inst); > > CMSetStatus(&s, CMPI_RC_OK); > - > out: > return s; > } > @@ -946,13 +992,58 @@ static CMPIStatus EnumInstances(CMPIInst > return return_vsms(reference, results, 0); > } > > +static int compare_prop(const CMPIObjectPath *ref, > + const CMPIInstance *inst, > + const char *name, > + int mandatory) > +{ > + char *prop = NULL; > + char *key = NULL; > + int rc = 0; > + > + key = cu_get_str_path(ref, name); > + if (key == NULL) { > + rc = !mandatory; > + goto out; > + } > + > + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK) > + goto out; > + > + rc = STREQ(key, prop); > + out: > + free(prop); > + free(key); > + > + return rc; > +} > + > static CMPIStatus GetInstance(CMPIInstanceMI *self, > const CMPIContext *context, > const CMPIResult *results, > - const CMPIObjectPath *reference, > + const CMPIObjectPath *ref, > const char **properties) > { > - return return_vsms(reference, results, 0); > + CMPIInstance *inst; > + CMPIStatus s; > + > + s = _get_vsms(ref, &inst, 0); > + if (s.rc != CMPI_RC_OK) > + return s; > + > + if (!compare_prop(ref, inst, "CreationClassName", 0) || > + !compare_prop(ref, inst, "SystemName", 0) || > + !compare_prop(ref, inst, "Name", 1) || > + !compare_prop(ref, inst, "SystemCreationClassName", 0)) > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > In regard to DMTF's DSP200 the return code should be CMPI_RC_ERR_NOT_FOUND, as "the CIM Class does exist, but the requested CIM Instance does not exist in the specified namespace". > + "No such instance"); > + else { > + CMSetStatus(&s, CMPI_RC_OK); > + CMReturnInstance(results, inst); > + } > + > + return s; > } > > DEFAULT_CI(); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > nothing else to comment ... +1 :) -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck at linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From heidieck at linux.vnet.ibm.com Tue Oct 30 11:21:22 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Tue, 30 Oct 2007 12:21:22 +0100 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> Message-ID: <472713B2.3000207@linux.vnet.ibm.com> Dan Smith wrote: > diff -r 82ff2daf1ddb -r 07b9be7502ef schema/KVM_ResourceAllocationSettingData.mof > --- a/schema/KVM_ResourceAllocationSettingData.mof Mon Oct 29 12:20:44 2007 +0100 > +++ b/schema/KVM_ResourceAllocationSettingData.mof Mon Oct 29 09:06:05 2007 -0700 > @@ -1,9 +1,4 @@ > // Copyright IBM Corp. 2007 > class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { > > - [Key, > - Description ("The type of allocated resource"), > - Override ("ResourceType")] > - uint16 ResourceType; > - > }; > diff -r 82ff2daf1ddb -r 07b9be7502ef schema/Xen_ResourceAllocationSettingData.mof > --- a/schema/Xen_ResourceAllocationSettingData.mof Mon Oct 29 12:20:44 2007 +0100 > +++ b/schema/Xen_ResourceAllocationSettingData.mof Mon Oct 29 09:06:05 2007 -0700 > @@ -1,9 +1,4 @@ > // Copyright IBM Corp. 2007 > class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { > > - [Key, > - Description ("The type of allocated resource"), > - Override ("ResourceType")] > - uint16 ResourceType; > - > }; > What is your intention behind defining Xen/KVM_ResourceAllocationSettingData in separate mof files and adding the additional registration script register_base.sh ? Especially the registration script introduces additional maintenance effort, while the registration process is already solved by provider_register.sh. -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck at linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From danms at us.ibm.com Tue Oct 30 13:30:09 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 06:30:09 -0700 Subject: [Libvirt-cim] Automatic reply to list not working? In-Reply-To: <4726F2B7.1050609@linux.vnet.ibm.com> (Zhengang Li's message of "Tue, 30 Oct 2007 17:00:39 +0800") References: <4726F2B7.1050609@linux.vnet.ibm.com> Message-ID: <87d4uwu3vi.fsf@theine.beaverton.ibm.com> ZL> It seems that the email from the list only adds the ZL> "libvirt-cim at redhat.com" in the CC field. Replying to an email ZL> sending from the list automatically goes to the original author ZL> instead of the list itself. Actually, that's a result of people doing a reply-to-all. ZL> Is this an intended configuration in the mailing-list setup? I'm going to change the configuration to reply-to-list, I just haven't gotten around to it yet :) -- 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 Tue Oct 30 13:31:54 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 06:31:54 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <472713B2.3000207@linux.vnet.ibm.com> (Heidi Eckhart's message of "Tue, 30 Oct 2007 12:21:22 +0100") References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> <472713B2.3000207@linux.vnet.ibm.com> Message-ID: <878x5ku3sl.fsf@theine.beaverton.ibm.com> HE> What is your intention behind defining HE> Xen/KVM_ResourceAllocationSettingData in separate mof files and HE> adding the additional registration script register_base.sh ? HE> Especially the registration script introduces additional HE> maintenance effort, while the registration process is already HE> solved by provider_register.sh. When I put the Xen_RASD.mof in the MOFS make target, sfcb worked fine, but the pegasus registration process failed. If you know of a better way to do this, I'm more than happy to revert what I've done so far. -- 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 Tue Oct 30 13:34:52 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 06:34:52 -0700 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid In-Reply-To: <4726F2B9.1000306@linux.vnet.ibm.com> (Heidi Eckhart's message of "Tue, 30 Oct 2007 10:00:41 +0100") References: <4726F2B9.1000306@linux.vnet.ibm.com> Message-ID: <874pg8u3nn.fsf@theine.beaverton.ibm.com> HE> In regard to DMTF's DSP200 the return code should be HE> CMPI_RC_ERR_NOT_FOUND, as "the CIM Class does exist, but the requested HE> CIM Instance does not exist in the specified namespace". Yep, as far as I can tell, almost everything in the tree right now returns CMPI_RC_ERR_FAILED as a generic failure code. We'll have to spend some time going back to tweak all of those at some point. However, since you've identified this one, I'll tweak and re-send my patch. -- 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 Tue Oct 30 14:05:14 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 07:05:14 -0700 Subject: [Libvirt-cim] [PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid Message-ID: # HG changeset patch # User Dan Smith # Date 1193849716 25200 # Node ID dde11a85b5c04cfe4c3028fe48dc5e383a80f946 # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 Fix VSMS instance code to refuse to return an instance if ref is invalid Tweaked to include the proper NOT_FOUND error code and fix the build order. Signed-off-by: Dan Smith diff -r bf5ad6924b99 -r dde11a85b5c0 src/Makefile.am --- a/src/Makefile.am Mon Oct 29 15:39:52 2007 -0400 +++ b/src/Makefile.am Wed Oct 31 09:55:16 2007 -0700 @@ -29,13 +29,13 @@ provider_LTLIBRARIES = libVirt_ComputerS libVirt_SystemDevice.la \ libVirt_ComputerSystemIndication.la \ libVirt_RASD.la \ + libVirt_HostSystem.la \ libVirt_VirtualSystemManagementService.la \ libVirt_VirtualSystemManagementCapabilities.la \ libVirt_EnabledLogicalElementCapabilities.la \ libVirt_AllocationCapabilities.la \ libVirt_SettingsDefineCapabilities.la \ libVirt_VSSD.la \ - libVirt_HostSystem.la \ libVirt_HostedDependency.la \ libVirt_RegisteredProfile.la \ libVirt_ElementConformsToProfile.la \ @@ -56,7 +56,7 @@ libVirt_ComputerSystemIndication_la_LIBA libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lpthread -lrt libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c -libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD +libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c diff -r bf5ad6924b99 -r dde11a85b5c0 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Oct 29 15:39:52 2007 -0400 +++ b/src/Virt_VirtualSystemManagementService.c Wed Oct 31 09:55:16 2007 -0700 @@ -44,6 +44,7 @@ #include "Virt_ComputerSystem.h" #include "Virt_ComputerSystemIndication.h" #include "Virt_RASD.h" +#include "Virt_HostSystem.h" #include "svpc_types.h" const static CMPIBroker *_BROKER; @@ -896,18 +897,24 @@ STDIM_MethodMIStub(, Virt_VirtualSystemM STDIM_MethodMIStub(, Virt_VirtualSystemManagementService, _BROKER, CMNoHook, my_handlers); - -static CMPIStatus return_vsms(const CMPIObjectPath *reference, - const CMPIResult *results, - int name_only) +static CMPIStatus _get_vsms(const CMPIObjectPath *reference, + CMPIInstance **_inst, + int name_only) { CMPIStatus s; CMPIInstance *inst; + CMPIInstance *host; + char *val = NULL; + + s = get_host_cs(_BROKER, reference, &host); + if (s.rc != CMPI_RC_OK) + goto out; inst = get_typed_instance(_BROKER, "VirtualSystemManagementService", NAMESPACE(reference)); if (inst == NULL) { + CU_DEBUG("Failed to get typed instance"); cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Failed to create instance"); @@ -916,6 +923,46 @@ static CMPIStatus return_vsms(const CMPI CMSetProperty(inst, "Name", (CMPIValue *)"Management Service", CMPI_chars); + + if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get name of System"); + goto out; + } + + CMSetProperty(inst, "SystemName", + (CMPIValue *)val, CMPI_chars); + free(val); + + if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get creation class of system"); + goto out; + } + + CMSetProperty(inst, "SystemCreationClassName", + (CMPIValue *)val, CMPI_chars); + free(val); + + CMSetStatus(&s, CMPI_RC_OK); + + *_inst = inst; + out: + return s; +} + +static CMPIStatus return_vsms(const CMPIObjectPath *reference, + const CMPIResult *results, + int name_only) +{ + CMPIInstance *inst; + CMPIStatus s; + + s = _get_vsms(reference, &inst, name_only); + if (s.rc != CMPI_RC_OK) + goto out; if (name_only) cu_return_instance_name(results, inst); @@ -923,7 +970,6 @@ static CMPIStatus return_vsms(const CMPI CMReturnInstance(results, inst); CMSetStatus(&s, CMPI_RC_OK); - out: return s; } @@ -946,13 +992,58 @@ static CMPIStatus EnumInstances(CMPIInst return return_vsms(reference, results, 0); } +static int compare_prop(const CMPIObjectPath *ref, + const CMPIInstance *inst, + const char *name, + int mandatory) +{ + char *prop = NULL; + char *key = NULL; + int rc = 0; + + key = cu_get_str_path(ref, name); + if (key == NULL) { + rc = !mandatory; + goto out; + } + + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK) + goto out; + + rc = STREQ(key, prop); + out: + free(prop); + free(key); + + return rc; +} + static CMPIStatus GetInstance(CMPIInstanceMI *self, const CMPIContext *context, const CMPIResult *results, - const CMPIObjectPath *reference, + const CMPIObjectPath *ref, const char **properties) { - return return_vsms(reference, results, 0); + CMPIInstance *inst; + CMPIStatus s; + + s = _get_vsms(ref, &inst, 0); + if (s.rc != CMPI_RC_OK) + return s; + + if (!compare_prop(ref, inst, "CreationClassName", 0) || + !compare_prop(ref, inst, "SystemName", 0) || + !compare_prop(ref, inst, "Name", 1) || + !compare_prop(ref, inst, "SystemCreationClassName", 0)) + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + else { + CMSetStatus(&s, CMPI_RC_OK); + CMReturnInstance(results, inst); + } + + return s; } DEFAULT_CI(); From grendel at linux.vnet.ibm.com Tue Oct 30 15:35:08 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 30 Oct 2007 11:35:08 -0400 Subject: [Libvirt-cim] [PATCH] add RPM packaging for libvirt-cim, and cleanups In-Reply-To: <87y7dmuijd.fsf@theine.beaverton.ibm.com> References: <20071029112915.GC16694@redhat.com> <87y7dmuijd.fsf@theine.beaverton.ibm.com> Message-ID: <47274F2C.7070006@linux.vnet.ibm.com> Dan Smith wrote: > DV> # HG changeset patch > DV> # User Daniel Veillard > DV> # Date 1193656844 -3600 > DV> # Node ID 5b601a0035127544c54feaf086fb7065f873e9f9 > DV> # Parent aaad430ea766d9a3bc0be035e595d8da17ee2122 > DV> RPM Packaging changes and associated cleanups: > DV> - Augment some Makefiles variables with missing files > DV> - add a spec file template > DV> - extend the configure script to generate the spec file > DV> - add a 'make rpm' target > DV> - fix src/Makefile.am to use late binding of providerdir variable > > Works for me. +1 > > DV> There is still one thing missing I guess in the spec file: the > DV> registration step, which I think should be run as a post-install > DV> script. The spec file saves the provider-register.sh and > DV> register_base.sh scripts in /usr/share/libvirt-cim/ so they are > DV> available at that point, but I don't understand how to best call > DV> them, so it will need some attention by someone who knows how that > DV> process should work. > > I *think* the rpm needs to do that in the postinstall step, although > I'm not sure if/how the determination of which CIMOM is to be used > should be made. If the rpm assumes pegasus is installed, then perhaps > it should be hard-coded and the user can re-run the provider > registration if they are using something non-standard? > > Heidi would probably be the one to comment on the convention here. > > Anyone have a problem with putting this in the tree now and fixing up > the registration step in a subsequent patch? > > > I'm all for "mostly works" over "not in the tree at all," especially given how relatively immature the code is. It's not like we've got a finished and polished product yet; we've got a little time to straighten out the postinstall, and having the rpm stuff in there would be nice. :) -- -Jay From grendel at linux.vnet.ibm.com Tue Oct 30 16:13:33 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 30 Oct 2007 12:13:33 -0400 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> Message-ID: <4727582D.1090800@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193673965 25200 > # Node ID 07b9be7502efdeead8b1ab83df2d13bcb5398548 > # Parent 82ff2daf1ddb72c0bd8a83588a03bd7a37ea110b > Make RASD not dependent on ResourceType key > I have tested DefineSystem() and some of the ResourcePool associations. > It would be good to get a quick smoke test of the AllocationCapabilities > stuff as well, just to make sure I didn't break anything. > > Signed-off-by: Dan Smith > > > @@ -315,13 +316,11 @@ static CMPIStatus alloc_cap_to_rasd(cons > struct inst_list *list) > { > CMPIStatus s = {CMPI_RC_OK}; > - int ret; > uint16_t type; > > CU_DEBUG("Getting ResourceType.\n"); > > - ret = cu_get_u16_path(ref, "ResourceType", &type); > - if (ret != 1) { > + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { > CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, > "Could not get ResourceType."); > goto out; > I think you got a little overzealous with this one. That ref it's getting ResourceType from is an AllocationCapabilites reference, not a RASD. If we need to make the same change for AllocationCapabilities, we can do that, but as is right now that's definitely going to cause some problems. -- -Jay From danms at us.ibm.com Tue Oct 30 16:24:02 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 09:24:02 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <4727582D.1090800@linux.vnet.ibm.com> (Jay Gagnon's message of "Tue, 30 Oct 2007 12:13:33 -0400") References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> <4727582D.1090800@linux.vnet.ibm.com> Message-ID: <87prywr2ot.fsf@theine.beaverton.ibm.com> JG> I think you got a little overzealous with this one. That ref it's JG> getting ResourceType from is an AllocationCapabilites reference, JG> not a RASD. If we need to make the same change for JG> AllocationCapabilities, we can do that, but as is right now that's JG> definitely going to cause some problems. Heh, good catch, I'll revert that hunk. I *knew* I'd break something in there :) -- 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 Tue Oct 30 16:27:48 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 09:27:48 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key Message-ID: <02556a928bf33c5f7960.1193761668@localhost.localdomain> # HG changeset patch # User Dan Smith # Date 1193761666 25200 # Node ID 02556a928bf33c5f796009ae4ad2fb1cd37d6283 # Parent 6f68b7da0f6bfa6f1c709f56b2879c62e8831639 Make RASD not dependent on ResourceType key I have tested DefineSystem() and some of the ResourcePool associations. (removed the AllocationCapabilities changes) Signed-off-by: Dan Smith diff -r 6f68b7da0f6b -r 02556a928bf3 schema/KVM_ResourceAllocationSettingData.mof --- a/schema/KVM_ResourceAllocationSettingData.mof Tue Oct 30 09:25:06 2007 -0700 +++ b/schema/KVM_ResourceAllocationSettingData.mof Tue Oct 30 09:27:46 2007 -0700 @@ -1,9 +1,4 @@ // Copyright IBM Corp. 2007 class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - }; diff -r 6f68b7da0f6b -r 02556a928bf3 schema/Xen_ResourceAllocationSettingData.mof --- a/schema/Xen_ResourceAllocationSettingData.mof Tue Oct 30 09:25:06 2007 -0700 +++ b/schema/Xen_ResourceAllocationSettingData.mof Tue Oct 30 09:27:46 2007 -0700 @@ -1,9 +1,4 @@ // Copyright IBM Corp. 2007 class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - }; diff -r 6f68b7da0f6b -r 02556a928bf3 src/Makefile.am --- a/src/Makefile.am Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Makefile.am Tue Oct 30 09:27:46 2007 -0700 @@ -83,8 +83,10 @@ libVirt_ElementCapabilities_la_LIBADD = -lVirt_HostSystem libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c +libVirt_AllocationCapabilities_la_LIBADD = -lVirt_RASD libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c +libVirt_SettingsDefineCapabilities_la_LIBADD = -lVirt_RASD libVirt_RegisteredProfile_la_SOURCES = Virt_RegisteredProfile.c diff -r 6f68b7da0f6b -r 02556a928bf3 src/Virt_RASD.c --- a/src/Virt_RASD.c Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Virt_RASD.c Tue Oct 30 09:27:46 2007 -0700 @@ -205,10 +205,38 @@ static CMPIInstance *get_rasd_instance(c return inst; } +CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type) +{ + char *base = NULL; + CMPIrc rc = CMPI_RC_ERR_FAILED; + + base = class_base_name(cn); + if (base == NULL) + goto out; + + if (STREQ(base, "DiskResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_DISK; + else if (STREQ(base, "NetResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_NET; + else if (STREQ(base, "ProcResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_PROC; + else if (STREQ(base, "MemResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_MEM; + else + goto out; + + rc = CMPI_RC_OK; + + out: + free(base); + + return rc; +} + static CMPIStatus GetInstance(CMPIInstanceMI *self, const CMPIContext *context, const CMPIResult *results, - const CMPIObjectPath *reference, + const CMPIObjectPath *ref, const char **properties) { CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -216,7 +244,7 @@ static CMPIStatus GetInstance(CMPIInstan char *id = NULL; uint16_t type; - id = cu_get_str_path(reference, "InstanceID"); + id = cu_get_str_path(ref, "InstanceID"); if (id == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -224,14 +252,14 @@ static CMPIStatus GetInstance(CMPIInstan goto out; } - if (!cu_get_u16_path(reference, "ResourceType", &type)) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Missing or invalid ResourceType"); - goto out; - } - - inst = get_rasd_instance(context, reference, id, type); + "Unable to determine RASD type"); + goto out; + } + + inst = get_rasd_instance(context, ref, id, type); if (inst != NULL) CMReturnInstance(results, inst); diff -r 6f68b7da0f6b -r 02556a928bf3 src/Virt_RASD.h --- a/src/Virt_RASD.h Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Virt_RASD.h Tue Oct 30 09:27:46 2007 -0700 @@ -27,6 +27,7 @@ int rasds_for_domain(const CMPIBroker *b const uint16_t type, const char *ns, struct inst_list *_list); +CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); #endif diff -r 6f68b7da0f6b -r 02556a928bf3 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Virt_ResourceAllocationFromPool.c Tue Oct 30 09:27:46 2007 -0700 @@ -42,7 +42,6 @@ static CMPIStatus rasd_to_pool(const CMP struct inst_list *list) { CMPIStatus s; - int ret; uint16_t type; char *id = NULL; char *poolid = NULL; @@ -52,11 +51,10 @@ static CMPIStatus rasd_to_pool(const CMP inst_list_init(&_list); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (!ret) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing ResourceType"); + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); goto out; } @@ -113,8 +111,16 @@ static int filter_by_pool(struct inst_li for (i = 0; i < src->cur; i++) { CMPIInstance *inst = src->list[i]; - - cu_get_u16_prop(inst, "ResourceType", &type); + CMPIObjectPath *op; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) + continue; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != + CMPI_RC_OK) + continue; + cu_get_str_prop(inst, "InstanceID", &rasd_id); poolid = pool_member_of(_BROKER, type, rasd_id); diff -r 6f68b7da0f6b -r 02556a928bf3 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Tue Oct 30 09:27:46 2007 -0700 @@ -37,6 +37,7 @@ #include "svpc_types.h" #include "Virt_SettingsDefineCapabilities.h" +#include "Virt_RASD.h" const static CMPIBroker *_BROKER; @@ -315,13 +316,11 @@ static CMPIStatus alloc_cap_to_rasd(cons struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK}; - int ret; uint16_t type; CU_DEBUG("Getting ResourceType.\n"); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (ret != 1) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, "Could not get ResourceType."); goto out; diff -r 6f68b7da0f6b -r 02556a928bf3 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Virt_SettingsDefineState.c Tue Oct 30 09:27:46 2007 -0700 @@ -162,7 +162,6 @@ static CMPIStatus rasd_to_dev(const CMPI CMPIStatus s; CMPIInstance *dev = NULL; char *id = NULL; - int ret; uint16_t type; ASSOC_MATCH(info->provider_name, CLASSNAME(ref)); @@ -175,8 +174,7 @@ static CMPIStatus rasd_to_dev(const CMPI goto out; } - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (!ret) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Missing ResourceType"); diff -r 6f68b7da0f6b -r 02556a928bf3 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Tue Oct 30 09:25:06 2007 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Tue Oct 30 09:27:46 2007 -0700 @@ -158,9 +158,15 @@ static int rasd_to_vdev(CMPIInstance *in char *id = NULL; char *name = NULL; char *devid = NULL; - - if (cu_get_u16_prop(inst, "ResourceType", &type) != CMPI_RC_OK) + CMPIObjectPath *op; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) goto err; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) + goto err; + dev->type = (int)type; if (cu_get_str_prop(inst, "InstanceID", &id) != CMPI_RC_OK) @@ -207,7 +213,6 @@ static int classify_resources(struct ins static int classify_resources(struct inst_list *all, struct domain *domain) { - int ret; int i; uint16_t type; @@ -220,8 +225,14 @@ static int classify_resources(struct ins domain->dev_net = calloc(all->cur, sizeof(struct virt_device)); for (i = 0; i < all->cur; i++) { - ret = cu_get_u16_prop(all->list[i], "ResourceType", &type); - if (ret != CMPI_RC_OK) + CMPIObjectPath *op; + + op = CMGetObjectPath(all->list[i], NULL); + if (op == NULL) + return 0; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != + CMPI_RC_OK) return 0; if (type == CIM_RASD_TYPE_PROC) @@ -682,6 +693,7 @@ static CMPIStatus _update_resources_for( struct domain *dominfo = NULL; uint16_t type; char *xml = NULL; + CMPIObjectPath *op; if (!get_dominfo(dom, &dominfo)) { cu_statusf(_BROKER, &s, @@ -690,10 +702,18 @@ static CMPIStatus _update_resources_for( goto out; } - if (cu_get_u16_prop(rasd, "ResourceType", &type) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing ResourceType"); + op = CMGetObjectPath(rasd, NULL); + if (op == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get RASD path"); + goto out; + } + + if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); goto out; } From danms at us.ibm.com Tue Oct 30 18:11:38 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 11:11:38 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key Message-ID: # HG changeset patch # User Dan Smith # Date 1193767892 25200 # Node ID babb2ffdc4c2c3f11a3281af4fb33cc3257127f8 # Parent e385d591fa6f8bbe135434117a16039d5693f5b4 Make RASD not dependent on ResourceType key I have tested DefineSystem() and some of the ResourcePool associations. (replaced the AllocationCapabilities changes) (removed the SettingsDefineCapabilities changes) Signed-off-by: Dan Smith diff -r e385d591fa6f -r babb2ffdc4c2 schema/KVM_ResourceAllocationSettingData.mof --- a/schema/KVM_ResourceAllocationSettingData.mof Tue Oct 30 09:39:29 2007 -0700 +++ b/schema/KVM_ResourceAllocationSettingData.mof Tue Oct 30 11:11:32 2007 -0700 @@ -1,9 +1,4 @@ // Copyright IBM Corp. 2007 class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - }; diff -r e385d591fa6f -r babb2ffdc4c2 schema/Xen_ResourceAllocationSettingData.mof --- a/schema/Xen_ResourceAllocationSettingData.mof Tue Oct 30 09:39:29 2007 -0700 +++ b/schema/Xen_ResourceAllocationSettingData.mof Tue Oct 30 11:11:32 2007 -0700 @@ -1,9 +1,4 @@ // Copyright IBM Corp. 2007 class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - }; diff -r e385d591fa6f -r babb2ffdc4c2 src/Makefile.am --- a/src/Makefile.am Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Makefile.am Tue Oct 30 11:11:32 2007 -0700 @@ -83,8 +83,10 @@ libVirt_ElementCapabilities_la_LIBADD = -lVirt_HostSystem libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c +libVirt_AllocationCapabilities_la_LIBADD = -lVirt_RASD libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c +libVirt_SettingsDefineCapabilities_la_LIBADD = -lVirt_RASD libVirt_RegisteredProfile_la_SOURCES = Virt_RegisteredProfile.c diff -r e385d591fa6f -r babb2ffdc4c2 src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_AllocationCapabilities.c Tue Oct 30 11:11:32 2007 -0700 @@ -29,6 +29,7 @@ #include "misc_util.h" #include "Virt_AllocationCapabilities.h" +#include "Virt_RASD.h" const static CMPIBroker *_BROKER; @@ -44,8 +45,7 @@ CMPIStatus get_alloc_cap(const CMPIBroke *inst = get_typed_instance(broker, "AllocationCapabilities", NAMESPACE(ref)); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (ret != 1) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { CMSetStatusWithChars(broker, &s, CMPI_RC_ERR_FAILED, "Could not get ResourceType."); goto out; diff -r e385d591fa6f -r babb2ffdc4c2 src/Virt_RASD.c --- a/src/Virt_RASD.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_RASD.c Tue Oct 30 11:11:32 2007 -0700 @@ -205,10 +205,38 @@ static CMPIInstance *get_rasd_instance(c return inst; } +CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type) +{ + char *base = NULL; + CMPIrc rc = CMPI_RC_ERR_FAILED; + + base = class_base_name(cn); + if (base == NULL) + goto out; + + if (STREQ(base, "DiskResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_DISK; + else if (STREQ(base, "NetResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_NET; + else if (STREQ(base, "ProcResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_PROC; + else if (STREQ(base, "MemResourceAllocationSettingData")) + *type = CIM_RASD_TYPE_MEM; + else + goto out; + + rc = CMPI_RC_OK; + + out: + free(base); + + return rc; +} + static CMPIStatus GetInstance(CMPIInstanceMI *self, const CMPIContext *context, const CMPIResult *results, - const CMPIObjectPath *reference, + const CMPIObjectPath *ref, const char **properties) { CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -216,7 +244,7 @@ static CMPIStatus GetInstance(CMPIInstan char *id = NULL; uint16_t type; - id = cu_get_str_path(reference, "InstanceID"); + id = cu_get_str_path(ref, "InstanceID"); if (id == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -224,14 +252,14 @@ static CMPIStatus GetInstance(CMPIInstan goto out; } - if (!cu_get_u16_path(reference, "ResourceType", &type)) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Missing or invalid ResourceType"); - goto out; - } - - inst = get_rasd_instance(context, reference, id, type); + "Unable to determine RASD type"); + goto out; + } + + inst = get_rasd_instance(context, ref, id, type); if (inst != NULL) CMReturnInstance(results, inst); diff -r e385d591fa6f -r babb2ffdc4c2 src/Virt_RASD.h --- a/src/Virt_RASD.h Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_RASD.h Tue Oct 30 11:11:32 2007 -0700 @@ -27,6 +27,7 @@ int rasds_for_domain(const CMPIBroker *b const uint16_t type, const char *ns, struct inst_list *_list); +CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); #endif diff -r e385d591fa6f -r babb2ffdc4c2 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_ResourceAllocationFromPool.c Tue Oct 30 11:11:32 2007 -0700 @@ -42,7 +42,6 @@ static CMPIStatus rasd_to_pool(const CMP struct inst_list *list) { CMPIStatus s; - int ret; uint16_t type; char *id = NULL; char *poolid = NULL; @@ -52,11 +51,10 @@ static CMPIStatus rasd_to_pool(const CMP inst_list_init(&_list); - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (!ret) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing ResourceType"); + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); goto out; } @@ -113,8 +111,16 @@ static int filter_by_pool(struct inst_li for (i = 0; i < src->cur; i++) { CMPIInstance *inst = src->list[i]; - - cu_get_u16_prop(inst, "ResourceType", &type); + CMPIObjectPath *op; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) + continue; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != + CMPI_RC_OK) + continue; + cu_get_str_prop(inst, "InstanceID", &rasd_id); poolid = pool_member_of(_BROKER, type, rasd_id); diff -r e385d591fa6f -r babb2ffdc4c2 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_SettingsDefineState.c Tue Oct 30 11:11:32 2007 -0700 @@ -162,7 +162,6 @@ static CMPIStatus rasd_to_dev(const CMPI CMPIStatus s; CMPIInstance *dev = NULL; char *id = NULL; - int ret; uint16_t type; ASSOC_MATCH(info->provider_name, CLASSNAME(ref)); @@ -175,8 +174,7 @@ static CMPIStatus rasd_to_dev(const CMPI goto out; } - ret = cu_get_u16_path(ref, "ResourceType", &type); - if (!ret) { + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Missing ResourceType"); diff -r e385d591fa6f -r babb2ffdc4c2 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Tue Oct 30 09:39:29 2007 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Tue Oct 30 11:11:32 2007 -0700 @@ -161,9 +161,15 @@ static int rasd_to_vdev(CMPIInstance *in char *id = NULL; char *name = NULL; char *devid = NULL; - - if (cu_get_u16_prop(inst, "ResourceType", &type) != CMPI_RC_OK) + CMPIObjectPath *op; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) goto err; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) + goto err; + dev->type = (int)type; if (cu_get_str_prop(inst, "InstanceID", &id) != CMPI_RC_OK) @@ -210,7 +216,6 @@ static int classify_resources(struct ins static int classify_resources(struct inst_list *all, struct domain *domain) { - int ret; int i; uint16_t type; @@ -223,8 +228,14 @@ static int classify_resources(struct ins domain->dev_net = calloc(all->cur, sizeof(struct virt_device)); for (i = 0; i < all->cur; i++) { - ret = cu_get_u16_prop(all->list[i], "ResourceType", &type); - if (ret != CMPI_RC_OK) + CMPIObjectPath *op; + + op = CMGetObjectPath(all->list[i], NULL); + if (op == NULL) + return 0; + + if (rasd_type_from_classname(CLASSNAME(op), &type) != + CMPI_RC_OK) return 0; if (type == CIM_RASD_TYPE_PROC) @@ -692,6 +703,7 @@ static CMPIStatus _update_resources_for( struct domain *dominfo = NULL; uint16_t type; char *xml = NULL; + CMPIObjectPath *op; if (!get_dominfo(dom, &dominfo)) { cu_statusf(_BROKER, &s, @@ -700,10 +712,18 @@ static CMPIStatus _update_resources_for( goto out; } - if (cu_get_u16_prop(rasd, "ResourceType", &type) != CMPI_RC_OK) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Missing ResourceType"); + op = CMGetObjectPath(rasd, NULL); + if (op == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to get RASD path"); + goto out; + } + + if (rasd_type_from_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); goto out; } From danms at us.ibm.com Tue Oct 30 18:14:09 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 11:14:09 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: (Dan Smith's message of "Tue, 30 Oct 2007 11:11:38 -0700") References: Message-ID: <87lk9kqxla.fsf@theine.beaverton.ibm.com> DS> (replaced the AllocationCapabilities changes) DS> (removed the SettingsDefineCapabilities changes) Whoops. Reverted the wrong hunk last time (although in my defense, they looked almost identical!). This updated patch should be 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 Tue Oct 30 18:16:55 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Tue, 30 Oct 2007 14:16:55 -0400 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: References: Message-ID: <47277517.8030702@linux.vnet.ibm.com> Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193767892 25200 > # Node ID babb2ffdc4c2c3f11a3281af4fb33cc3257127f8 > # Parent e385d591fa6f8bbe135434117a16039d5693f5b4 > Make RASD not dependent on ResourceType key > I have tested DefineSystem() and some of the ResourcePool associations. > > (replaced the AllocationCapabilities changes) > (removed the SettingsDefineCapabilities changes) > > Signed-off-by: Dan Smith > > > Looks good now, +1. -- -Jay From danms at us.ibm.com Tue Oct 30 22:39:22 2007 From: danms at us.ibm.com (Dan Smith) Date: Tue, 30 Oct 2007 22:39:22 -0000 Subject: [Libvirt-cim] [PATCH] Fix the XML we generate for an incoming system to include the block Message-ID: <5789eadba6e6f7182249.1423944601@s10sp1sfcb> # HG changeset patch # User Dan Smith # Date 1423944550 28800 # Node ID 5789eadba6e6f71822493043214c3a8749ebb2f6 # Parent babb2ffdc4c2c3f11a3281af4fb33cc3257127f8 Fix the XML we generate for an incoming system to include the block which seems to be required. Without it, libvirt-0.2.0 seems to break. Signed-off-by: Dan Smith diff -r babb2ffdc4c2 -r 5789eadba6e6 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Oct 30 11:11:32 2007 -0700 +++ b/libxkutil/xmlgen.c Sat Feb 14 12:09:10 2015 -0800 @@ -33,7 +33,6 @@ #include "cmpimacs.h" #endif -#if 0 static char *__tag_attr(struct kv *attrs, int count) { char *result = strdup(""); @@ -94,7 +93,6 @@ static char *tagify(char *tagname, char return result; } -#endif static char *disk_block_xml(const char *path, const char *vdev) { @@ -265,11 +263,55 @@ static char *system_xml(struct domain *d return xml; } +static char *os_xml(struct domain *domain) +{ + struct os_info *os = &domain->os_info; + int ret; + char *xml; + char *type = NULL; + char *kernel = NULL; + char *initrd = NULL; + char *cmdline = NULL; + + if (os->type == NULL) + os->type = strdup("linux"); + + if (os->kernel == NULL) + os->kernel = strdup("/dev/null"); + + type = tagify("type", os->type, NULL, 0); + kernel = tagify("kernel", os->kernel, NULL, 0); + initrd = tagify("initrd", os->initrd, NULL, 0); + cmdline = tagify("cmdline", os->cmdline, NULL, 0); + + ret = asprintf(&xml, + "\n" + " %s\n" + " %s\n" + " %s\n" + " %s\n" + "\n", + type, + kernel, + initrd, + cmdline); + if (ret == -1) + xml = NULL; + + free(type); + free(kernel); + free(initrd); + free(cmdline); + + return xml; +} + char *system_to_xml(struct domain *dominfo) { char *devxml = strdup(""); char *sysdevxml = strdup(""); char *sysxml = NULL; + char *osxml = NULL; char *xml = NULL; int ret; uint8_t uuid[16]; @@ -285,18 +327,21 @@ char *system_to_xml(struct domain *domin concat_devxml(&sysdevxml, dominfo->dev_vcpu, dominfo->dev_vcpu_ct); sysxml = system_xml(dominfo); + osxml = os_xml(dominfo); ret = asprintf(&xml, "\n" "%s\n" - "%s\n" - "%s\n" + "%s" + "%s" + "%s" "\n" - "%s\n" + "%s" "\n" "\n", uuidstr, sysxml, + osxml, sysdevxml, devxml); if (ret == -1) @@ -304,6 +349,7 @@ char *system_to_xml(struct domain *domin free(devxml); free(sysdevxml); + free(osxml); free(sysxml); return xml; From heidieck at linux.vnet.ibm.com Wed Oct 31 09:18:27 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 31 Oct 2007 10:18:27 +0100 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <878x5ku3sl.fsf@theine.beaverton.ibm.com> References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> <472713B2.3000207@linux.vnet.ibm.com> <878x5ku3sl.fsf@theine.beaverton.ibm.com> Message-ID: <47284863.10703@linux.vnet.ibm.com> Dan Smith wrote: > HE> What is your intention behind defining > HE> Xen/KVM_ResourceAllocationSettingData in separate mof files and > HE> adding the additional registration script register_base.sh ? > HE> Especially the registration script introduces additional > HE> maintenance effort, while the registration process is already > HE> solved by provider_register.sh. > > When I put the Xen_RASD.mof in the MOFS make target, sfcb worked fine, > but the pegasus registration process failed. If you know of a better > way to do this, I'm more than happy to revert what I've done so far. > > I suggest the following patch: - removes schema/KVM_ResourceAllocationSettingData.mof, schema/Xen_ResourceAllocationSettingData.mof and register_base.sh - adds definition of KVM/Xen_ResourceAllocationSettingData to schema/ResourceAllocationSettingData.mof diff -r c94a9d6b36d9 Makefile.am --- a/Makefile.am Tue Oct 30 12:42:10 2007 +0100 +++ b/Makefile.am Tue Oct 30 12:48:24 2007 +0100 @@ -71,12 +71,8 @@ INTEROP_REGS = \ schema/RegisteredProfile.registration \ schema/ElementConformsToProfile.registration -EXTRA_BASE_MOFS = \ - schema/Xen_ResourceAllocationSettingData.mof \ - schema/KVM_ResourceAllocationSettingData.mof - pkgdata_DATA = $(MOFS) $(REGS) -pkgdata_SCRIPTS = provider-register.sh register_base.sh +pkgdata_SCRIPTS = provider-register.sh EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) \ libvirt-cim.spec.in libvirt-cim.spec \ @@ -85,7 +81,6 @@ EXTRA_DIST = schema $(pkgdata_DATA) $(pk # Un/Register the providers and class definitions from/to the current CIMOM. # @CIMSERVER@ is set by the configure script postinstall: - sh register_base.sh @CIMSERVER@ $(EXTRA_BASE_MOFS) sh provider-register.sh -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS) sh provider-register.sh -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS) diff -r c94a9d6b36d9 register_base.sh --- a/register_base.sh Tue Oct 30 12:42:10 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#!/bin/bash -# -# A script to register base classes with the CIMOM -# -# Copyright IBM Corp. 2007 -# Author: Dan Smith -# -# Usage: -# -# $ register_base.sh (sfcb|pegasus) [MOF...] -# -# FIXME: Need to make pegasus location and namespace variable - -CIMOM=$1 - -if [ -z "$CIMOM" ]; then - echo "Usage: $0 (pegasus|sfcb)" - exit 1 -fi - -shift - -if [ "$CIMOM" = "pegasus" ]; then - for i in $*; do - cimmofl -W -uc -aEV -R/var/lib/Pegasus -n /root/ibmsd $i - done -elif [ "$CIMOM" = "sfcb" ]; then - for i in $*; do - sfcbstage -n /root/ibmsd $i - done -else - echo "Unknown CIMOM type: $CIMOM" -fi diff -r c94a9d6b36d9 schema/KVM_ResourceAllocationSettingData.mof --- a/schema/KVM_ResourceAllocationSettingData.mof Tue Oct 30 12:42:10 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -// Copyright IBM Corp. 2007 -class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - -}; diff -r c94a9d6b36d9 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue Oct 30 12:42:10 2007 +0100 +++ b/schema/ResourceAllocationSettingData.mof Tue Oct 30 12:44:57 2007 +0100 @@ -1,4 +1,12 @@ // Copyright IBM Corp. 2007 +class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { + +}; + +class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { + +}; + [Description ("Xen virtual disk configuration")] class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData{ diff -r c94a9d6b36d9 schema/Xen_ResourceAllocationSettingData.mof --- a/schema/Xen_ResourceAllocationSettingData.mof Tue Oct 30 12:42:10 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -// Copyright IBM Corp. 2007 -class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData { - - [Key, - Description ("The type of allocated resource"), - Override ("ResourceType")] - uint16 ResourceType; - -}; -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck at linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From zli at linux.vnet.ibm.com Wed Oct 31 09:34:45 2007 From: zli at linux.vnet.ibm.com (Zhengang Li) Date: Wed, 31 Oct 2007 17:34:45 +0800 Subject: [Libvirt-cim] [PATCH] Fix the XML we generate for an incoming system to include the block In-Reply-To: <5789eadba6e6f7182249.1423944601@s10sp1sfcb> References: <5789eadba6e6f7182249.1423944601@s10sp1sfcb> Message-ID: <47284C35.2040703@linux.vnet.ibm.com> +1 for the patch. With this patch applied, I can see that the domain is successfully defined. Now the method provider (VSMS.DefineSystem) blocks with pegasus on the trigger_indication() call. Details here: define_system() --> trigger_indication() --> stdi_trigger_indication() --> CBInvokeMethod() Pegasus's provider agent (cimprovagt) got a SIGSEGV when calling CBInvokeMethod(). -- - Zhengang From heidieck at linux.vnet.ibm.com Wed Oct 31 08:34:17 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 31 Oct 2007 10:34:17 +0200 Subject: [Libvirt-cim] [PATCH] Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1193744530 -3600 # Node ID c94a9d6b36d9bd39e85c16805cdc8e525dd585cd # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus diff -r bf5ad6924b99 -r c94a9d6b36d9 schema/ElementConformsToProfile.registration --- a/schema/ElementConformsToProfile.registration Mon Oct 29 15:39:52 2007 -0400 +++ b/schema/ElementConformsToProfile.registration Tue Oct 30 12:42:10 2007 +0100 @@ -1,7 +1,7 @@ # Copyright IBM Corp. 2007 # Classname Namespace ProviderName ProviderModule ProviderTypes ... -Xen_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association +#Xen_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association Xen_ElementConformsToProfile root/interop Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association # Classname Namespace ProviderName ProviderModule ProviderTypes ... -KVM_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association +#KVM_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association KVM_ElementConformsToProfile root/interop Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association From heidieck at linux.vnet.ibm.com Wed Oct 31 11:21:57 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 31 Oct 2007 12:21:57 +0100 Subject: [Libvirt-cim] [PATCH] Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus In-Reply-To: References: Message-ID: <47286555.6050603@linux.vnet.ibm.com> This patch avoids the registration of the assoc ECTP for two namespaces. This is currently only a workaround to avoid registration errors with Pegasus. The problem needs to be fixed in register_provider.sh. -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck at linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From heidieck at linux.vnet.ibm.com Wed Oct 31 10:23:03 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 31 Oct 2007 12:23:03 +0200 Subject: [Libvirt-cim] [PATCH 0 of 2] Updates to RegisteredProfile and ElementConformsToProfile Message-ID: From heidieck at linux.vnet.ibm.com Wed Oct 31 10:23:04 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 31 Oct 2007 12:23:04 +0200 Subject: [Libvirt-cim] [PATCH 1 of 2] Enhance RegisteredProfile to support getInstance and gets static ID In-Reply-To: Message-ID: # HG changeset patch # User Heidi Eckhart # Date 1193820858 -3600 # Node ID bd925f5f9fdacc3ed34b34eb17e348e8304ec382 # Parent 53903e7822dde586f073ffe469c544c1a37954a4 Enhance RegisteredProfile to support getInstance and gets static ID Signed-off-by: Heidi Eckhart diff -r 53903e7822dd -r bd925f5f9fda src/Virt_RegisteredProfile.c --- a/src/Virt_RegisteredProfile.c Tue Oct 30 12:48:28 2007 +0100 +++ b/src/Virt_RegisteredProfile.c Wed Oct 31 09:54:18 2007 +0100 @@ -38,27 +38,12 @@ const static CMPIBroker *_BROKER; -static bool reg_prof_set_id(CMPIInstance *instance, - struct reg_prof *profile) -{ - char *id; - - if (asprintf(&id, "%s_%s", profile->reg_name, - profile->reg_version) == -1) - id = NULL; - - if(id) - CMSetProperty(instance, "InstanceID", - (CMPIValue *)id, CMPI_chars); - - return id != NULL; -} - CMPIInstance *reg_prof_instance(const CMPIBroker *broker, - const CMPIObjectPath *ref, + const char *namespace, + const char **properties, struct reg_prof *profile) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIObjectPath *op; CMPIInstance *instance = NULL; char *classname; @@ -70,7 +55,7 @@ CMPIInstance *reg_prof_instance(const CM goto out; } - op = CMNewObjectPath(broker, NAMESPACE(ref), classname, &s); + op = CMNewObjectPath(broker, namespace, classname, &s); if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) goto out; @@ -78,10 +63,16 @@ CMPIInstance *reg_prof_instance(const CM if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) goto out; - reg_prof_set_id(instance, profile); - - CMSetProperty(instance, "CreationClassName", - (CMPIValue *)classname, CMPI_chars); + if (properties) { + s = CMSetPropertyFilter(instance, properties, NULL); + if (s.rc != CMPI_RC_OK) { + printf("Setting of property filter failed\n"); + goto out; + } + } + + CMSetProperty(instance, "InstanceID", + (CMPIValue *)profile->reg_id, CMPI_chars); CMSetProperty(instance, "RegisteredOrganization", (CMPIValue *)&profile->reg_org, CMPI_uint16); @@ -103,27 +94,17 @@ static CMPIStatus enum_profs(const CMPIO const char **properties, bool names_only) { + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance; int i; - CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; for (i = 0; profiles[i] != NULL; i++) { - instance = reg_prof_instance(_BROKER, ref, profiles[i]); + instance = reg_prof_instance(_BROKER, NAMESPACE(ref), properties, profiles[i]); if (instance == NULL) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, "Can't create profile instance."); goto out; } - - if (properties) { - s = CMSetPropertyFilter(instance, properties, NULL); - if (s.rc != CMPI_RC_OK) { - CMSetStatusWithChars(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Property filter failed."); - goto out; - } - } if (names_only) cu_return_instance_name(results, instance); @@ -132,6 +113,41 @@ static CMPIStatus enum_profs(const CMPIO } out: + return s; +} + +static CMPIStatus get_prof(const CMPIObjectPath *ref, + const CMPIResult *results, + const char **properties) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *instance = NULL; + char* id; + int i; + + id = cu_get_str_path(ref, "InstanceID"); + if (id == NULL) { + CMSetStatusWithChars(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "No InstanceID specified"); + return s; + } + + for (i = 0; profiles[i] != NULL; i++) { + if(STREQ(id, profiles[i]->reg_id)) { + instance = reg_prof_instance(_BROKER, NAMESPACE(ref), properties, profiles[i]); + break; + } + } + + if(instance) + CMReturnInstance(results, instance); + else + CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND); + + + free(id); + return s; } @@ -152,7 +168,15 @@ static CMPIStatus EnumInstances(CMPIInst return enum_profs(reference, results, properties, false); } -DEFAULT_GI(); +static CMPIStatus GetInstance(CMPIInstanceMI *self, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *reference, + const char **properties) +{ + return get_prof(reference, results, properties); +} + DEFAULT_CI(); DEFAULT_MI(); DEFAULT_DI(); diff -r 53903e7822dd -r bd925f5f9fda src/Virt_RegisteredProfile.h --- a/src/Virt_RegisteredProfile.h Tue Oct 30 12:48:28 2007 +0100 +++ b/src/Virt_RegisteredProfile.h Wed Oct 31 09:54:18 2007 +0100 @@ -22,7 +22,8 @@ #define __VIRT_REGISTERED_PROFILE_H CMPIInstance *reg_prof_instance(const CMPIBroker *broker, - const CMPIObjectPath *ref, + const char *namespace, + const char **properties, struct reg_prof *profile); #endif diff -r 53903e7822dd -r bd925f5f9fda src/profiles.h --- a/src/profiles.h Tue Oct 30 12:48:28 2007 +0100 +++ b/src/profiles.h Wed Oct 31 09:54:18 2007 +0100 @@ -20,6 +20,7 @@ */ struct reg_prof { uint16_t reg_org; // Valid: 1 = Other, 2 = DMTF + char *reg_id; char *reg_name; char *reg_version; int ad_types; @@ -28,49 +29,27 @@ struct reg_prof { char *provider_name; }; -struct reg_prof Processor = { +struct reg_prof SystemVirtualization = { .reg_org = 2, - .reg_name = "Processor Profile", - .reg_version = "2.15", - .provider_name = "Processor" + .reg_id = "DSP1042-1.0.0a", + .reg_name = "System Virtualization Profile", + .reg_version = "1.0.0a", + .provider_name = "HostSystem" }; -struct reg_prof LogicalDisk = { +struct reg_prof VirtualSystem = { .reg_org = 2, - .reg_name = "Logical Disk Profile", - .reg_version = "2.15", - .provider_name = "LogicalDisk" -}; - -struct reg_prof NetworkPort = { - .reg_org = 2, - .reg_name = "Network Port Profile", - .reg_version = "2.15", - .provider_name = "NetworkPort" -}; - -struct reg_prof ComputerSystem = { - .reg_org = 2, - .reg_name = "Computer System Profile", - .reg_version = "2.15", + .reg_id = "DSP1057-1.0.0a", + .reg_name = "Virtual System Profile", + .reg_version = "1.0.0a", .provider_name = "ComputerSystem" }; -struct reg_prof SVP = { - .reg_org = 2, - .reg_name = "System Virtualization Profile", - .reg_version = "2.15", - .provider_name = "VirtualSystemManagementService" -}; - // Make sure to add pointer to your reg_prof struct here. struct reg_prof *profiles[] = { - &Processor, - &LogicalDisk, - &NetworkPort, - &ComputerSystem, - &SVP, + &SystemVirtualization, + &VirtualSystem, NULL }; From heidieck at linux.vnet.ibm.com Wed Oct 31 10:23:05 2007 From: heidieck at linux.vnet.ibm.com (Heidi Eckhart) Date: Wed, 31 Oct 2007 12:23:05 +0200 Subject: [Libvirt-cim] [PATCH 2 of 2] Adoption of changes in RegisteredProfile to association ElementConformsToProfile; ECTP uses upcalls to retrieve ManagedElements and minor bug fixes In-Reply-To: Message-ID: <0ce33a5e92a12929eb73.1193829785@localhost.localdomain> # HG changeset patch # User Heidi Eckhart # Date 1193825279 -3600 # Node ID 0ce33a5e92a12929eb73497189f1ac574e689d39 # Parent bd925f5f9fdacc3ed34b34eb17e348e8304ec382 Adoption of changes in RegisteredProfile to association ElementConformsToProfile; ECTP uses upcalls to retrieve ManagedElements and minor bug fixes Signed-off-by: Heidi Eckhart diff -r bd925f5f9fda -r 0ce33a5e92a1 src/Makefile.am --- a/src/Makefile.am Wed Oct 31 09:54:18 2007 +0100 +++ b/src/Makefile.am Wed Oct 31 11:07:59 2007 +0100 @@ -7,7 +7,6 @@ noinst_HEADERS = profiles.h svpc_types.h Virt_ComputerSystemIndication.h \ Virt_Device.h \ Virt_DevicePool.h \ - Virt_ElementConformsToProfile.h \ Virt_EnabledLogicalElementCapabilities.h \ Virt_HostSystem.h \ Virt_RASD.h \ diff -r bd925f5f9fda -r 0ce33a5e92a1 src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Wed Oct 31 09:54:18 2007 +0100 +++ b/src/Virt_ElementConformsToProfile.c Wed Oct 31 11:07:59 2007 +0100 @@ -35,7 +35,6 @@ #include "std_association.h" #include "Virt_RegisteredProfile.h" -#include "Virt_ElementConformsToProfile.h" /* Associate an XXX_RegisteredProfile to the proper XXX_ManagedElement. * @@ -46,75 +45,52 @@ const static CMPIBroker *_BROKER; -static CMPIStatus prof_from_ref(struct reg_prof *prof, - const CMPIObjectPath *ref) -{ - CMPIStatus s = {CMPI_RC_OK, NULL}; - char *tmp_str; - int tmp_int; - - memset(prof, 0, sizeof(*prof)); - - prof->reg_name = cu_get_str_path(ref, "RegisteredName"); - prof->reg_version = cu_get_str_path(ref, "RegisteredVersion"); - prof->other_reg_org = cu_get_str_path(ref, "OtherRegisteredOrganization"); - - tmp_str = cu_get_str_path(ref, "RegisteredOrganization"); - if (tmp_str) { - sscanf(tmp_str, "%d", &tmp_int); - prof->reg_org = (uint16_t)tmp_int; - } - - free(tmp_str); - return s; - -} - -static bool compare_profiles(struct reg_prof *target, - struct reg_prof *candidate) -{ - if (!STREQC(target->reg_name, candidate->reg_name)) - return false; - - COMPARE_OPT_STR(target, candidate, reg_version); - COMPARE_OPT_NUM(target, candidate, reg_org); - //COMPARE_OPT_NUM(target, candidate, ad_types); - COMPARE_OPT_STR(target, candidate, other_reg_org); - //COMPARE_OPT_STR(target, candidate, ad_type_descriptions); - - return true; -} - -static CMPIInstance *elem_instance(const CMPIObjectPath *ref, - char *provider_name) -{ - CMPIStatus s; +static CMPIStatus elem_instances(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list, + struct reg_prof *profile) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIObjectPath *op; - CMPIInstance *instance = NULL; char *classname; - - classname = get_typed_class(provider_name); + CMPIEnumeration *en = NULL; + CMPIData data ; + + classname = get_typed_class(profile->provider_name); if (classname == NULL) { //TRACE("Can't assemble classname."); printf("Can't assemble classname.\n"); goto out; } - op = CMNewObjectPath(_BROKER, NAMESPACE(ref), classname, &s); + op = CMNewObjectPath(_BROKER, "/root/ibmsd", classname, &s); if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) - goto out; - - instance = CMNewInstance(_BROKER, op, &s); - if ((s.rc != CMPI_RC_OK) || CMIsNullObject(instance)) - goto out; - - CMSetProperty(instance, "CreationClassName", (CMPIValue *)classname, - CMPI_chars); - - out: + goto error; + + en = CBEnumInstances(_BROKER, info->context , op, NULL, &s); + if (en == NULL) { + CMSetStatusWithChars(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Upcall enumInstances to target class failed." ); + goto error; + } + + while (CMHasNext(en, &s)) { + data = CMGetNext(en, &s); + if (CMIsNullObject(data.value.inst)) { + CMSetStatusWithChars(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to retrieve enumeration entry." ); + goto error; + } + + inst_list_add(list, data.value.inst); + } + + error: free(classname); - - return instance; + out: + return s; } static CMPIStatus prof_to_elem(const CMPIObjectPath *ref, @@ -122,25 +98,28 @@ static CMPIStatus prof_to_elem(const CMP struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; - CMPIInstance *instance; - struct reg_prof target; - struct reg_prof *candidate; + char *id; int i; - - s = prof_from_ref(&target, ref); + + id = cu_get_str_path(ref, "InstanceID"); + if (id == NULL) { + CMSetStatusWithChars(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "No InstanceID specified"); + goto out; + } for (i = 0; profiles[i] != NULL; i++) { - candidate = profiles[i]; - if (!compare_profiles(&target, candidate)) - continue; - - instance = elem_instance(ref, candidate->provider_name); - if (instance == NULL) - goto out; - - inst_list_add(list, instance); - } - + if (STREQ(id, profiles[i]->reg_id)) { + s = elem_instances(ref, info, list, profiles[i]); + if ((s.rc != CMPI_RC_OK)) + goto error; + break; + } + } + + error: + free(id); out: return s; } @@ -152,74 +131,64 @@ static CMPIStatus elem_to_prof(const CMP CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *instance; char *classname; - char *provider_name; struct reg_prof *candidate; int i; - classname = cu_get_str_path(ref, "CreationClassName"); + classname = class_base_name(CLASSNAME(ref)); if (classname == NULL) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Can't get class name from element."); - goto error1; - } - - provider_name = class_base_name(classname); - if (provider_name == NULL) { - CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Can't get provider name."); - goto error2; + "Can't get class name."); + goto out; } for (i = 0; profiles[i] != NULL; i++) { candidate = profiles[i]; - if (!STREQC(candidate->provider_name, provider_name)) + if (!STREQC(candidate->provider_name, classname)) continue; - instance = reg_prof_instance(_BROKER, ref, candidate); + instance = reg_prof_instance(_BROKER, "/root/interop", NULL, candidate); if (instance == NULL) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, "Can't create profile instance."); - goto error3; + goto error; } inst_list_add(list, instance); } - error3: - free(provider_name); - error2: + error: free(classname); - error1: - return s; -} - -static CMPIInstance *make_ref(const CMPIObjectPath *ref, - const CMPIInstance *inst, + out: + return s; +} + +static CMPIInstance *make_ref(const CMPIObjectPath *source_op, + const CMPIInstance *target_inst, struct std_assoc_info *info, struct std_assoc *assoc) { - CMPIInstance *refinst; - char *base; - - base = class_base_name(assoc->target_class); - - refinst = get_typed_instance(_BROKER, - base, - NAMESPACE(ref)); - if (refinst != NULL) { - CMPIObjectPath *instop; - - instop = CMGetObjectPath(inst, NULL); - - CMSetProperty(refinst, assoc->source_prop, - (CMPIValue *)ref, CMPI_ref); - CMSetProperty(refinst, assoc->target_prop, - (CMPIValue *)instop, CMPI_ref); - } - - free(base); - - return refinst; + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *assoc_inst; + + assoc_inst = get_typed_instance(_BROKER, + "ElementConformsToProfile", + NAMESPACE(source_op)); + + if (!CMIsNullObject(assoc_inst)) { + CMPIObjectPath *target_op; + + target_op = CMGetObjectPath(target_inst, NULL); + + CMSetProperty(assoc_inst, assoc->source_prop, + (CMPIValue *)&(source_op), CMPI_ref); + CMSetProperty(assoc_inst, assoc->target_prop, + (CMPIValue *)&(target_op), CMPI_ref); + + fprintf(stderr,"Virt_ElementConformsToProfile: assoc_inst with data\n %s\n", + CMGetCharPtr(CDToString(_BROKER, assoc_inst, &s))); + } + + return assoc_inst; } struct std_assoc forward = { diff -r bd925f5f9fda -r 0ce33a5e92a1 src/Virt_ElementConformsToProfile.h --- a/src/Virt_ElementConformsToProfile.h Wed Oct 31 09:54:18 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright IBM Corp. 2007 - * - * Authors: - * Heidi Eckhart - * Jay Gagnon - * - * 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 - */ -#define COMPARE_OPT_STR(t, c, field) \ - if (t->field && \ - !STREQC(t->field, c->field)) \ - return false; \ - -#define COMPARE_OPT_NUM(t, c, field) \ - if (t->field && \ - t->field != c->field) \ - return false; \ - -/* - * 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 Wed Oct 31 13:40:12 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 06:40:12 -0700 Subject: [Libvirt-cim] [PATCH] Make RASD not dependent on ResourceType key In-Reply-To: <47284863.10703@linux.vnet.ibm.com> (Heidi Eckhart's message of "Wed, 31 Oct 2007 10:18:27 +0100") References: <07b9be7502efdeead8b1.1193673967@localhost.localdomain> <472713B2.3000207@linux.vnet.ibm.com> <878x5ku3sl.fsf@theine.beaverton.ibm.com> <47284863.10703@linux.vnet.ibm.com> Message-ID: <87bqafpflv.fsf@theine.beaverton.ibm.com> HE> I suggest the following patch: HE> - removes schema/KVM_ResourceAllocationSettingData.mof, HE> schema/Xen_ResourceAllocationSettingData.mof and register_base.sh HE> - adds definition of KVM/Xen_ResourceAllocationSettingData to HE> schema/ResourceAllocationSettingData.mof That's what we originally had[1]! Does this work for you? It works fine for me with sfcb, but Pegasus refuses to install the RASD MOF because "One or more classes have children" (or some such similar error). [1] http://libvirt.org/hg/libvirt-cim/file/d41b62edd941/schema/ResourceAllocationSettingData.mof -- 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 Oct 31 13:46:01 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 06:46:01 -0700 Subject: [Libvirt-cim] [PATCH] Fix the XML we generate for an incoming system to include the block In-Reply-To: <47284C35.2040703@linux.vnet.ibm.com> (Zhengang Li's message of "Wed, 31 Oct 2007 17:34:45 +0800") References: <5789eadba6e6f7182249.1423944601@s10sp1sfcb> <47284C35.2040703@linux.vnet.ibm.com> Message-ID: <877il3pfc6.fsf@theine.beaverton.ibm.com> ZL> +1 for the patch. With this patch applied, I can see that the domain ZL> is successfully defined. Excellent! ZL> Now the method provider (VSMS.DefineSystem) blocks with pegasus on ZL> the trigger_indication() call. Details here: define_system() --> ZL> trigger_indication() --> stdi_trigger_indication() --> CBInvokeMethod() Hmm, okay, I'll have to have a look at this. Might be something to do with our use of the mutex in the indication code. Is your pegasus using threads or processes? -- 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 Oct 31 13:58:38 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 31 Oct 2007 09:58:38 -0400 Subject: [Libvirt-cim] [PATCH 1 of 2] Enhance RegisteredProfile to support getInstance and gets static ID In-Reply-To: References: Message-ID: <47288A0E.8050806@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1193820858 -3600 > # Node ID bd925f5f9fdacc3ed34b34eb17e348e8304ec382 > # Parent 53903e7822dde586f073ffe469c544c1a37954a4 > Enhance RegisteredProfile to support getInstance and gets static ID > Signed-off-by: Heidi Eckhart > > > This one is fine now. My previous concerns (non-IBMers, this patch started on the internal list before we had this one) for this part have been addressed, and thanks for splitting it up. +1 -- -Jay From danms at us.ibm.com Wed Oct 31 14:54:55 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 07:54:55 -0700 Subject: [Libvirt-cim] [PATCH 1 of 2] Enhance RegisteredProfile to support getInstance and gets static ID In-Reply-To: (Heidi Eckhart's message of "Wed, 31 Oct 2007 12:23:04 +0200") References: Message-ID: <87y7djnxkw.fsf@theine.beaverton.ibm.com> HE> + instance = reg_prof_instance(_BROKER, NAMESPACE(ref), properties, profiles[i]); Minor nit, but it would be appreciated if you could break this (and other long lines) into less-than-80-columns by putting each parameter on its own line. We're pretty consistent with that style everywhere else. HE> diff -r 53903e7822dd -r bd925f5f9fda src/Virt_RegisteredProfile.h HE> --- a/src/Virt_RegisteredProfile.h Tue Oct 30 12:48:28 2007 +0100 HE> +++ b/src/Virt_RegisteredProfile.h Wed Oct 31 09:54:18 2007 +0100 HE> @@ -22,7 +22,8 @@ HE> #define __VIRT_REGISTERED_PROFILE_H HE> CMPIInstance *reg_prof_instance(const CMPIBroker *broker, HE> - const CMPIObjectPath *ref, HE> + const char *namespace, HE> + const char **properties, HE> struct reg_prof *profile); It looks like the original version had some hard tabs in it. Your "properties" parameter is right, but your "namespace" one still has hard tabs. Other than that, I'll defer this ack to Jay, since he's more familiar with the profile stuff than I. -- 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 Oct 31 15:09:11 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 31 Oct 2007 11:09:11 -0400 Subject: [Libvirt-cim] [PATCH 1 of 2] Enhance RegisteredProfile to support getInstance and gets static ID In-Reply-To: References: Message-ID: <47289A97.9090002@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1193820858 -3600 > # Node ID bd925f5f9fdacc3ed34b34eb17e348e8304ec382 > # Parent 53903e7822dde586f073ffe469c544c1a37954a4 > Enhance RegisteredProfile to support getInstance and gets static ID > Signed-off-by: Heidi Eckhart > > > > -struct reg_prof Processor = { > +struct reg_prof SystemVirtualization = { > .reg_org = 2, > - .reg_name = "Processor Profile", > - .reg_version = "2.15", > - .provider_name = "Processor" > + .reg_id = "DSP1042-1.0.0a", > + .reg_name = "System Virtualization Profile", > + .reg_version = "1.0.0a", > + .provider_name = "HostSystem" > }; > > -struct reg_prof LogicalDisk = { > +struct reg_prof VirtualSystem = { > .reg_org = 2, > - .reg_name = "Logical Disk Profile", > - .reg_version = "2.15", > - .provider_name = "LogicalDisk" > -}; > - > -struct reg_prof NetworkPort = { > - .reg_org = 2, > - .reg_name = "Network Port Profile", > - .reg_version = "2.15", > - .provider_name = "NetworkPort" > -}; > - > -struct reg_prof ComputerSystem = { > - .reg_org = 2, > - .reg_name = "Computer System Profile", > - .reg_version = "2.15", > + .reg_id = "DSP1057-1.0.0a", > + .reg_name = "Virtual System Profile", > + .reg_version = "1.0.0a", > .provider_name = "ComputerSystem" > }; > > -struct reg_prof SVP = { > - .reg_org = 2, > - .reg_name = "System Virtualization Profile", > - .reg_version = "2.15", > - .provider_name = "VirtualSystemManagementService" > -}; > - > > // Make sure to add pointer to your reg_prof struct here. > struct reg_prof *profiles[] = { > - &Processor, > - &LogicalDisk, > - &NetworkPort, > - &ComputerSystem, > - &SVP, > + &SystemVirtualization, > + &VirtualSystem, > NULL > }; > > One thing I forgot to ask about. Many of the profiles we were advertising have been removed. Is this temporary, or is there a reason to not advertise those? Also, I'm not so great at connecting the non-obvious profiles with their providers, could you explain why the System Virtualization Profile is now linked to HostSystem and not VirtualSystemManagementService? -- -Jay From grendel at linux.vnet.ibm.com Wed Oct 31 15:15:32 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 31 Oct 2007 11:15:32 -0400 Subject: [Libvirt-cim] [PATCH 2 of 2] Adoption of changes in RegisteredProfile to association ElementConformsToProfile; ECTP uses upcalls to retrieve ManagedElements and minor bug fixes In-Reply-To: <0ce33a5e92a12929eb73.1193829785@localhost.localdomain> References: <0ce33a5e92a12929eb73.1193829785@localhost.localdomain> Message-ID: <47289C14.1010509@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1193825279 -3600 > # Node ID 0ce33a5e92a12929eb73497189f1ac574e689d39 > # Parent bd925f5f9fdacc3ed34b34eb17e348e8304ec382 > Adoption of changes in RegisteredProfile to association ElementConformsToProfile; ECTP uses upcalls to retrieve ManagedElements and minor bug fixes > Signed-off-by: Heidi Eckhart > > I'm good with most of this, although a little confused about one thing. I've had the wrong idea about how ECTP was supposed to work in the past, so I wouldn't be surprised if I'm just confused again, but I'm afraid I don't understand why you changed the prof_to_elem behavior. I had it so that we would return an essentially empty instance of the provider that matched that profile, as I thought the idea was that the client would check the CreationClassName and know that this provider implements the profile they wanted. You appear to be finding the appropriate provider and invoking its EnumInstances method. I'm not sure why. Also, won't this present a problem for profiles that don't have EnumInstances? -- -Jay From grendel at linux.vnet.ibm.com Wed Oct 31 15:26:30 2007 From: grendel at linux.vnet.ibm.com (Jay Gagnon) Date: Wed, 31 Oct 2007 11:26:30 -0400 Subject: [Libvirt-cim] [PATCH] Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus In-Reply-To: References: Message-ID: <47289EA6.50005@linux.vnet.ibm.com> Heidi Eckhart wrote: > # HG changeset patch > # User Heidi Eckhart > # Date 1193744530 -3600 > # Node ID c94a9d6b36d9bd39e85c16805cdc8e525dd585cd > # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 > Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus > > Since we can only have one or the other (for now), interop seems like the right one to have for ECTP. +1 -- -Jay From danms at us.ibm.com Wed Oct 31 17:45:08 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 10:45:08 -0700 Subject: [Libvirt-cim] [PATCH] Add some starter web content Message-ID: # HG changeset patch # User Dan Smith # Date 1193852665 25200 # Node ID fb92838e55651ca80d2de49344db81312a5ebe8b # Parent 5789eadba6e6f71822493043214c3a8749ebb2f6 Add some starter web content Right now, this is just the flat content (un-transformed), but it should get us started. Comments welcome :) Signed-off-by: Dan Smith diff -r 5789eadba6e6 -r fb92838e5565 Makefile.am --- a/Makefile.am Sat Feb 14 12:09:10 2015 -0800 +++ b/Makefile.am Wed Oct 31 10:44:25 2007 -0700 @@ -1,5 +1,5 @@ # Copyright IBM Corp. 2007 -SUBDIRS = libxkutil src +SUBDIRS = libxkutil src doc MOFS = \ schema/ComputerSystem.mof \ diff -r 5789eadba6e6 -r fb92838e5565 configure.ac --- a/configure.ac Sat Feb 14 12:09:10 2015 -0800 +++ b/configure.ac Wed Oct 31 10:44:25 2007 -0700 @@ -67,6 +67,7 @@ AC_CONFIG_FILES([ libxkutil/tests/Makefile src/Makefile src/tests/Makefile + doc/Makefile Makefile ]) diff -r 5789eadba6e6 -r fb92838e5565 doc/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/Makefile.am Wed Oct 31 10:44:25 2007 -0700 @@ -0,0 +1,9 @@ +XSLTPROC = /usr/bin/xsltproc + +WEB_PAGES = index.html + +$(WEB_PAGES): libvirt-cim.html site.xsl + $(XSLTPROC) --nonet --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/libvirt-cim.html > index.html + +all: $(WEB_PAGES) + diff -r 5789eadba6e6 -r fb92838e5565 doc/libvirt-cim.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/libvirt-cim.html Wed Oct 31 10:44:25 2007 -0700 @@ -0,0 +1,147 @@ + + + + Libvirt-CIM: The CIM provider for libvirt + + + +

Libvirt-CIM: The CIM provider for libvirt

+ +

Note: this is the flat content of the web site

+ +

libvirt-cim

+ +

What is libvirt-cim?

+ +

Libvirt-CIM is a CIM provider for managing linux virtualization + platforms using libvirt. It is written in C and should work in any + CIMOM that supports CMPI 2.0 providers. The intent is to implement + the SVPC virtualization class model currently available in the DMTF + Experimental 2.16 schema. +

+ +

Releases

+ +

There have been no releases to date

+ +

Introduction

+ +

Libvirt-CIM is a CIM provider for managing linux virtualization + platforms using libvirt. It is written in C and should work in any + CIMOM that supports CMPI 2.0 providers. The intent is to implement + the SVPC virtualization class model currently available in the DMTF + Experimental 2.16 schema. +

+ +

The providers are currently under heavy development. Focus is on + Xen support right now, which means some of the providers have some + "shortcuts" hard-coded to Xen right now. The long-term goal is to + support all of the platforms that libvirt supports with minimal + differences. +

+ +

Downloads

+ +

The libvirt-cim development tree can be found in the + libvirt.org/hg repository. +

+ +

To get a copy of the development tree, use + mercurial's + clone feature: +

+ +

$ hg clone http://libvirt.org/hg/libvirt-cim

+ +

Alternatively, you can grab a + tarball or + zip + file snapshot of the repository. +

+ +

Schema Requirements and Installation

+ +

The libvirt-cim provider depends on an installed + DMTF + CIM v2.16 Experimental schema. The package can be obtained +here.

+ +

To install the schema in Pegasus:

+ +

+ $ PEGASUS_REPO=/var/lib/Pegasus # adjust this as needed
+ $ mkdir cim216
+ $ cd cim216
+ $ unzip $PATH_TO_ZIPFILE
+ $ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/ibmsd cimv216.mof
+

+ +

To install the schema in SFCB:

+ +

+ $ SFCB_CIM=/usr/local/share/sfcb/CIM # adjust this as needed
+ $ mkdir cim216
+ $ cd cim216
+ $ unzip $PATH_TO_ZIPFILE
+ $ mv cimv216.mof CIM_Schema.mof
+ $ sudo cp * $SFCB_CIM
+ $ sudo sfcbrepos
+

+ +

Note: in both cases, the CIM v2.16 schema seems to have a + few classes that don't register correctly. You may need to + disable installation of classes with something like the + following: +

+ +

+--- CIM_Schema.mof 2007-10-15 00:15:44.000000000 -0700
++++ cimv216.mof 2007-10-22 10:11:19.000000000 -0700
+@@ -507,3 +507,3 @@
+ #pragma include ("Policy/CIM_SharedSecretAuthentication.mof")
+-#pragma include ("Security/CIM_SecurityIndication.mof")
++//#pragma include ("Security/CIM_SecurityIndication.mof")
+ #pragma include ("Support/PRS_Activity.mof")
+@@ -728,4 +728,4 @@
+ #pragma include ("Policy/CIM_PolicyConditionInPolicyRule.mof")
+-#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof")
+-#pragma include ("Security/CIM_IPPacketFilterIndication.mof")
++//#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof")
++//#pragma include ("Security/CIM_IPPacketFilterIndication.mof")
+ #pragma include ("Support/PRS_ActivityContact.mof")
+

+ +

Platform Support

+ +

Currently, libvirt-cim is targetting Xen as its primary support + platform because is has the largest installed user base. The + long-term plan is to support many others (hopefully any that libvirt + supports). This includes KVM and containers. +

+ +

The code base currently has many Xen-specific "shortcuts" that need + to be resolved and generalized in order to support other platforms. + A short list of these may include:

+
    +
  • The XML generation and parsing code and the related device + modeling code.
  • +
  • The libvirt connection logic. Right now, (in most places) we + detect the current hypervisor in use and connect to libvirt + appropriately. This may or may not be the correct behavior in a + situation where you could need to support containers and QEMU + virtual machines.
  • +
  • Some lingering hard-coded "Xen_Foo" class names.
  • +
+ +

Further, supporting new platforms have some registration and + modeling implications:

+
    +
  • Additions to the MOF and registration files for "branded" + classes (Xen_Foo, KVM_Foo, etc)
  • +
  • Modifications to some of the association providers that register + separate CMPI provider structures for each class type they handle + (to avoid duplicate results in the general case)
  • +
+ + + From danms at us.ibm.com Wed Oct 31 18:10:22 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 11:10:22 -0700 Subject: [Libvirt-cim] [PATCH] Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus In-Reply-To: (Heidi Eckhart's message of "Wed, 31 Oct 2007 10:34:17 +0200") References: Message-ID: <87pryvnoj5.fsf@theine.beaverton.ibm.com> HE> # HG changeset patch HE> # User Heidi Eckhart HE> # Date 1193744530 -3600 HE> # Node ID c94a9d6b36d9bd39e85c16805cdc8e525dd585cd HE> # Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9 HE> Registration of ElementConformsToProfile for two namespaces causes HE> errors with Pegasus Thanks, I think this is fine for now. Can you resubmit with your Signed-off-by line 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 veillard at redhat.com Wed Oct 31 21:36:32 2007 From: veillard at redhat.com (Daniel Veillard) Date: Wed, 31 Oct 2007 17:36:32 -0400 Subject: [Libvirt-cim] [PATCH] Add some starter web content In-Reply-To: References: Message-ID: <20071031213632.GR8217@redhat.com> On Wed, Oct 31, 2007 at 10:45:08AM -0700, Dan Smith wrote: > # HG changeset patch > # User Dan Smith > # Date 1193852665 25200 > # Node ID fb92838e55651ca80d2de49344db81312a5ebe8b > # Parent 5789eadba6e6f71822493043214c3a8749ebb2f6 > Add some starter web content > Right now, this is just the flat content (un-transformed), but it should get > us started. Comments welcome :) > > Signed-off-by: Dan Smith Looks fine to me but I think you need a site.xsl here is one enclosed coming from libvirt.org :-) Signed-off-by: Daniel Veillard 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/ -------------- next part -------------- A non-text attachment was scrubbed... Name: site.xsl Type: text/xml Size: 15454 bytes Desc: not available URL: From danms at us.ibm.com Wed Oct 31 21:58:54 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 14:58:54 -0700 Subject: [Libvirt-cim] [PATCH] Fix a crash when std_invokemethod handlers return nonzero Message-ID: <05b01d03f0b801afe266.1193867934@localhost.localdomain> # HG changeset patch # User Dan Smith # Date 1424066513 28800 # Node ID 05b01d03f0b801afe266d8d012bc464be6a2d165 # Parent 8d634949f520faafd42c3d59add7c20fac39bb88 Fix a crash when std_invokemethod handlers return nonzero Signed-off-by: Dan Smith diff -r 8d634949f520 -r 05b01d03f0b8 std_invokemethod.c --- a/std_invokemethod.c Fri Oct 26 08:58:03 2007 -0700 +++ b/std_invokemethod.c Sun Feb 15 22:01:53 2015 -0800 @@ -112,7 +112,7 @@ CMPIStatus _std_invokemethod(CMPIMethodM CU_DEBUG("Executing handler for method `%s'", methodname); s = h->handler(self, context, results, reference, argsin, argsout); - CU_DEBUG("Method `%s' returned %i", s.rc); + CU_DEBUG("Method `%s' returned %i", methodname, s.rc); exit: CMReturnDone(results); From karupert at us.ibm.com Wed Oct 31 22:09:14 2007 From: karupert at us.ibm.com (Kaitlin Rupert) Date: Wed, 31 Oct 2007 15:09:14 -0700 Subject: [Libvirt-cim] [PATCH] Fix a crash when std_invokemethod handlers return nonzero In-Reply-To: <05b01d03f0b801afe266.1193867934@localhost.localdomain> Message-ID: >Fix a crash when std_invokemethod handlers return nonzero Not much to say. Looks good. +1. --------- Kaitlin Rupert -------------- next part -------------- An HTML attachment was scrubbed... URL: From danms at us.ibm.com Wed Oct 31 23:55:54 2007 From: danms at us.ibm.com (Dan Smith) Date: Wed, 31 Oct 2007 16:55:54 -0700 Subject: [Libvirt-cim] [PATCH] Add some starter web content In-Reply-To: <20071031213632.GR8217@redhat.com> (Daniel Veillard's message of "Wed, 31 Oct 2007 17:36:32 -0400") References: <20071031213632.GR8217@redhat.com> Message-ID: <87zlxyn8j9.fsf@theine.beaverton.ibm.com> DV> Looks fine to me but I think you need a site.xsl DV> here is one enclosed coming from libvirt.org :-) Thanks :) I'll put this in the tree and then update it in my patch to make the generated content look reasonable. -- 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: