[PATCH] Update author field on CSI
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1202241964 18000
# Node ID c286514082efd898f008a21fc8f27d299bd95fa4
# Parent c24b2e6d1bce44af234d379cfc8b7ee116621109
Update author field on CSI
How's this for an egocentric patch?
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r c24b2e6d1bce -r c286514082ef src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c Tue Feb 05 10:18:38 2008 -0500
+++ b/src/Virt_ComputerSystemIndication.c Tue Feb 05 15:06:04 2008 -0500
@@ -3,6 +3,7 @@
*
* Authors:
* Dan Smith <danms(a)us.ibm.com>
+ * Jay Gagnon <grendel(a)linux.vnet.ibm.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
16 years, 10 months
[PATCH] Make the ProcRASD show CPU pinning information
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202243439 28800
# Node ID e6d442b5bf122889708e9ad24545ae0b42b8c3bb
# Parent f8ee9b04d92abf1d74bf4c72fac1f3a4128923dd
Make the ProcRASD show CPU pinning information
This is done by embedding instances of the physical processor objects into
the HostResource[] field of the ProcRASD (per the MOF).
In order for the linkage to be present, you need sblim-cmpi-base.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r f8ee9b04d92a -r e6d442b5bf12 src/Virt_RASD.c
--- a/src/Virt_RASD.c Tue Feb 05 13:37:51 2008 +0100
+++ b/src/Virt_RASD.c Tue Feb 05 12:30:39 2008 -0800
@@ -23,6 +23,7 @@
#include <string.h>
#include <inttypes.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <cmpidt.h>
#include <cmpift.h>
@@ -91,6 +92,158 @@ char *rasd_to_xml(CMPIInstance *rasd)
{
/* FIXME: Remove this */
return NULL;
+}
+
+static bool proc_set_physical_ref(const CMPIBroker *broker,
+ uint32_t physnum,
+ CMPIInstance *rasd)
+{
+ CMPIObjectPath *op = NULL;
+ CMPIStatus s;
+ char hostname[255];
+ char *devid = NULL;
+ CMPIArray *array;
+ CMPIInstance *inst;
+ bool result = false;
+
+ if (asprintf(&devid, "%i", physnum) == -1) {
+ CU_DEBUG("Failed to create DeviceID string");
+ goto out;
+ }
+
+ if (gethostname(hostname, sizeof(hostname)) == -1) {
+ CU_DEBUG("Hostname overflow");
+ goto out;
+ }
+
+ op = CMNewObjectPath(broker, "root/cimv2", "Linux_Processor", &s);
+ if ((op == NULL) || (s.rc != CMPI_RC_OK)) {
+ CU_DEBUG("Failed to get ObjectPath for processor");
+ goto out;
+ }
+
+ CMAddKey(op, "CreationClassName",
+ (CMPIValue *)"Linux_Processor",
+ CMPI_chars);
+ CMAddKey(op, "SystemName",
+ (CMPIValue *)hostname,
+ CMPI_chars);
+ CMAddKey(op, "SystemCreationClassName",
+ (CMPIValue *)"Linux_ComputerSystem",
+ CMPI_chars);
+ CMAddKey(op, "DeviceID",
+ (CMPIValue *)devid,
+ CMPI_chars);
+
+ inst = CMNewInstance(broker, op, &s);
+ if ((inst == NULL) || (s.rc != CMPI_RC_OK)) {
+ CU_DEBUG("Failed to make instance");
+ goto out;
+ }
+
+ array = CMNewArray(broker, 1, CMPI_instance, &s);
+ if ((array == NULL) || (s.rc != CMPI_RC_OK)) {
+ CU_DEBUG("Failed to make array");
+ goto out;
+ }
+
+ CMSetArrayElementAt(array, 0, (CMPIValue *)&inst, CMPI_instance);
+ CMSetProperty(rasd, "HostResource",
+ (CMPIValue *)&array, CMPI_instanceA);
+
+ result = true;
+ out:
+ free(devid);
+
+ return result;
+}
+
+static uint32_t proc_get_cpu(const CMPIBroker *broker,
+ virDomainPtr dom,
+ struct virt_device *dev)
+{
+ virVcpuInfoPtr vinfo = NULL;
+ virDomainInfo info;
+ int ret;
+ uint32_t cpu = -1;
+
+ ret = virDomainGetInfo(dom, &info);
+ if (ret == -1) {
+ CU_DEBUG("Failed to get info for domain `%s'",
+ virDomainGetName(dom));
+ goto out;
+ }
+
+ if (dev->dev.vcpu.number >= info.nrVirtCpu) {
+ CU_DEBUG("VCPU %i higher than max of %i for %s",
+ dev->dev.vcpu.number,
+ info.nrVirtCpu,
+ virDomainGetName(dom));
+ goto out;
+ }
+
+ vinfo = calloc(info.nrVirtCpu, sizeof(*vinfo));
+ if (vinfo == NULL) {
+ CU_DEBUG("Failed to allocate memory for %i virVcpuInfo",
+ info.nrVirtCpu);
+ goto out;
+ }
+
+ ret = virDomainGetVcpus(dom, vinfo, info.nrVirtCpu, NULL, 0);
+ if (ret < info.nrVirtCpu) {
+ CU_DEBUG("Failed to get VCPU info for %s",
+ virDomainGetName(dom));
+ goto out;
+ }
+
+ cpu = vinfo[dev->dev.vcpu.number].cpu;
+
+ CU_DEBUG("VCPU %i is pinned to CPU %i",
+ dev->dev.vcpu.number,
+ cpu);
+ out:
+ free(vinfo);
+
+ return cpu;
+}
+
+static CMPIStatus proc_rasd_from_vdev(const CMPIBroker *broker,
+ struct virt_device *dev,
+ const char *host,
+ const CMPIObjectPath *ref,
+ CMPIInstance *inst)
+{
+ virConnectPtr conn = NULL;
+ virDomainPtr dom = NULL;
+ CMPIStatus s;
+ uint32_t pcpu;
+
+ conn = connect_by_classname(broker, CLASSNAME(ref), &s);
+ if (conn == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to connect for ProcRASD (%s)",
+ CLASSNAME(ref));
+ goto out;
+ }
+
+ dom = virDomainLookupByName(conn, host);
+ if (dom == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Unable to get domain for ProcRASD: %s", host);
+ goto out;
+ }
+
+ pcpu = proc_get_cpu(broker, dom, dev);
+ if (pcpu >= 0)
+ proc_set_physical_ref(broker, pcpu, inst);
+
+ out:
+ virDomainFree(dom);
+ virConnectClose(conn);
+
+ return s;
}
static CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
@@ -159,6 +312,8 @@ static CMPIInstance *rasd_from_vdev(cons
(CMPIValue *)&dev->dev.mem.size, CMPI_uint64);
CMSetProperty(inst, "Limit",
(CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64);
+ } else if (dev->type == VIRT_DEV_VCPU) {
+ proc_rasd_from_vdev(broker, dev, host, ref, inst);
}
/* FIXME: Put the HostResource in place */
16 years, 10 months
[PATCH 0 of 2] SD: check client given object path
by Heidi Eckhart
To enable the check of the client's given object path for Devices, the first tiny reorg in the Device provider is necessary. Thereby the get_device() function is made available for external use.
The second patch fixes the missing check of the client's given object in SystemDevice provider - for both directions.
16 years, 10 months
[PATCH 0 of 4] #3 - RPCS and RPCC ignores supported hypervisor type and wrong object path, adopt changes to HS
by Heidi Eckhart
This patch set is now the combination of the one patch against RPCS and the two patches against RPCC, I sent out on friday. The reason to combine these three patches in one patch set is, that both provider - RPCS and RPCC - look very similar now. This brought me to the idea, that it is possible to also define a common interface for instances providers - as this is already done for associations -, where the common functions could do a main part of the error handling (which is currently done again and again in each single provider itself).
In addition patch 4 updates HS (thanks to Kaitlin) with the new interface of RPCS.
diff to patch set 2:
- renamed parameter getInstance to is_get_inst for style conformance
16 years, 10 months
[PATCH] HostSystem: fix style issue with parameter naming
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1202203758 -3600
# Node ID 083ff6db76d5b5efd04d094bc4f9736b1c11c50c
# Parent bd791ff33ba623d1355ca26b3876df0b32ad2d4b
HostSystem: fix style issue with parameter naming
renamed getInstance to is_get_inst for style conformance
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r bd791ff33ba6 -r 083ff6db76d5 src/Virt_HostSystem.c
--- a/src/Virt_HostSystem.c Tue Feb 05 10:22:53 2008 +0100
+++ b/src/Virt_HostSystem.c Tue Feb 05 10:29:18 2008 +0100
@@ -107,7 +107,7 @@ static CMPIStatus return_host_cs(const C
static CMPIStatus return_host_cs(const CMPIObjectPath *reference,
const CMPIResult *results,
bool name_only,
- bool getInstance)
+ bool is_get_inst)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *instance;
@@ -117,14 +117,14 @@ static CMPIStatus return_host_cs(const C
goto out;
if (instance == NULL) {
- if (getInstance)
+ if (is_get_inst)
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_NOT_FOUND,
"No such instance");
goto out;
}
- if (getInstance) {
+ if (is_get_inst) {
s = cu_validate_ref(_BROKER, reference, instance);
if (s.rc != CMPI_RC_OK)
goto out;
16 years, 10 months
[PATCH 0 of 2] MigrationIndications
by Jay Gagnon
These two patches together are dependent on some libcmpiutil changes I'll be sending out shortly; one for dup_instance, and another for raise functionality.
The four patches together give us Migration Indications. Any time VSMigrationService is used to trigger a migration, the appropriate indications will be fired.
The big caveat for these patches is that migration is still a bit flaky on my system, so while I have tested that the "started" and "failed" indications work I haven't had a chance to see "succeeded" fire. I have no reason to believe it won't, because of the way the raising happens, but it would be good to confirm.
16 years, 10 months
[PATCH] (#2) Set additional attribute values in Virt_ComputerSystem.c
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1202142903 28800
# Node ID b0e81f29cb255066f588931c4630225836e448cc
# Parent 70eeb1d09fab3c596e2aae395802b8cf428a4da9
(#2) Set additional attribute values in Virt_ComputerSystem.c
Update from patch 1 to patch 2:
-Condensed the functions for OtherIdentifyingInfo and IdentifyingDescriptions into one function
-Added a return variable to catch the return value of the functions called in instance_from_dom() - added a goto out in case of error.
-In the out: block, free the uuid.
OtherIdentifyingInfo property and IdentifyingDescriptions. Modify instance_from_dom() to take a prefix parameter.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 70eeb1d09fab -r b0e81f29cb25 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Mon Feb 04 07:35:29 2008 -0800
+++ b/src/Virt_ComputerSystem.c Mon Feb 04 08:35:03 2008 -0800
@@ -71,7 +71,9 @@ static int set_name_from_dom(virDomainPt
}
/* Set the "UUID" property of an instance from a domain */
-static int set_uuid_from_dom(virDomainPtr dom, CMPIInstance *instance)
+static int set_uuid_from_dom(virDomainPtr dom,
+ CMPIInstance *instance,
+ char **out_uuid)
{
char uuid[VIR_UUID_STRING_BUFLEN];
int ret;
@@ -82,6 +84,8 @@ static int set_uuid_from_dom(virDomainPt
CMSetProperty(instance, "UUID",
(CMPIValue *)uuid, CMPI_chars);
+
+ *out_uuid = strdup(uuid);
return 1;
}
@@ -239,39 +243,114 @@ static int set_creation_class(CMPIInstan
return 1;
}
+static int set_other_id_info(const CMPIBroker *broker,
+ char *uuid,
+ const char *prefix,
+ CMPIInstance *instance)
+{
+ CMPIStatus s;
+ CMPIArray *id_info;
+ CMPIArray *id_desc;
+ char *desc[3] = {"Type", "Model", "UUID"};
+ char *info[3];
+ int count = 3;
+ char *type = "Virtual System";
+ char *model;
+ int i;
+
+ id_info = CMNewArray(broker,
+ count,
+ CMPI_string,
+ &s);
+
+ if (s.rc != CMPI_RC_OK)
+ return 0;
+
+ id_desc = CMNewArray(broker,
+ count,
+ CMPI_string,
+ &s);
+
+ if (s.rc != CMPI_RC_OK)
+ return 0;
+
+ if (asprintf(&model, "%s%s", prefix, type) == -1)
+ return 0;
+
+ info[0] = uuid;
+ info[1] = model;
+ info[2] = type;
+
+ for (i = 0; i < count; i++) {
+ CMPIString *tmp = CMNewString(broker, info[i], NULL);
+ CMSetArrayElementAt(id_info, i,
+ &tmp,
+ CMPI_string);
+
+ tmp = CMNewString(broker, desc[i], NULL);
+ CMSetArrayElementAt(id_desc, i,
+ &tmp,
+ CMPI_string);
+ }
+
+ CMSetProperty(instance, "OtherIdentifyingInfo",
+ &id_info, CMPI_stringA);
+
+ CMSetProperty(instance, "IdentifyingDescriptions",
+ (CMPIValue *)&id_desc, CMPI_stringA);
+ return 1;
+}
+
/* Populate an instance with information from a domain */
static int instance_from_dom(const CMPIBroker *broker,
virDomainPtr dom,
+ const char *prefix,
CMPIInstance *instance)
{
+ char *uuid = NULL;
+ int ret = 1;
+
if (!set_name_from_dom(dom, instance)) {
/* Print trace error */
return 0;
}
- if (!set_uuid_from_dom(dom, instance)) {
+ if (!set_uuid_from_dom(dom, instance, &uuid)) {
/* Print trace error */
- return 0;
+ ret = 0;
+ goto out;
}
if (!set_capdesc_from_dom(dom, instance)) {
/* Print trace error */
- return 0;
+ ret = 0;
+ goto out;
}
if (!set_state_from_dom(broker, dom, instance)) {
/* Print trace error */
- return 0;
+ ret = 0;
+ goto out;
}
if (!set_creation_class(instance)) {
/* Print trace error */
- return 0;
+ ret = 0;
+ goto out;
+ }
+
+ if (!set_other_id_info(broker, uuid, prefix, instance)) {
+ /* Print trace error */
+ ret = 0;
+ goto out;
}
/* More attributes here, of course */
- return 1;
+ out:
+ free(uuid);
+
+ return ret;
}
/* Given a hypervisor connection and a domain name, return an instance */
@@ -294,7 +373,10 @@ CMPIInstance *instance_from_name(const C
if (instance == NULL)
goto out;
- if (!instance_from_dom(broker, dom, instance))
+ if (!instance_from_dom(broker,
+ dom,
+ pfx_from_conn(conn),
+ instance))
instance = NULL;
out:
@@ -327,7 +409,10 @@ int enum_domains(const CMPIBroker *broke
if (inst == NULL)
goto end;
- if (instance_from_dom(broker, list[i], inst))
+ if (instance_from_dom(broker,
+ list[i],
+ pfx_from_conn(conn),
+ inst))
inst_list_add(instlist, inst);
end:
16 years, 10 months