[PATCH] Add ASSOC_MATCH() to HostedService to prevent duplicate classes from being returned if CIM_HostedService is used as the association class option during an association related query
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1195253640 28800
# Node ID 92c1de7f036cf77048be756ddc79c0b2fd88b79e
# Parent 006c7d27c968fb509fc667f4d5513cd79a9c197a
Add ASSOC_MATCH() to HostedService to prevent duplicate classes from being returned if CIM_HostedService is used as the association class option during an association related query.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 006c7d27c968 -r 92c1de7f036c src/Virt_HostedService.c
--- a/src/Virt_HostedService.c Thu Nov 15 09:49:45 2007 -0800
+++ b/src/Virt_HostedService.c Fri Nov 16 14:54:00 2007 -0800
@@ -43,6 +43,8 @@ static CMPIStatus service_to_host(const
CMPIStatus s;
CMPIInstance *instance;
+ ASSOC_MATCH(info->provider_name, CLASSNAME(ref));
+
s = get_host_cs(_BROKER, ref, &instance);
if (s.rc == CMPI_RC_OK)
inst_list_add(list, instance);
@@ -56,6 +58,8 @@ static CMPIStatus host_to_service(const
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *inst;
+
+ ASSOC_MATCH(info->provider_name, CLASSNAME(ref));
s = rpcs_instance(ref, &inst, _BROKER);
if (s.rc != CMPI_RC_OK)
17 years, 1 month
[PATCH] Make libcmpiutil spec include %{release} in BuildRoot
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195231755 28800
# Node ID 18403e085eaab25596f65d3273ad56befeb46463
# Parent dde4ae874d36a23fb3f4e1ec6ffea308aa0e7daa
Make libcmpiutil spec include %{release} in BuildRoot
Per the Fedora packaging guidelines.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r dde4ae874d36 -r 18403e085eaa libcmpiutil.spec.in
--- a/libcmpiutil.spec.in Fri Nov 16 08:04:48 2007 -0800
+++ b/libcmpiutil.spec.in Fri Nov 16 08:49:15 2007 -0800
@@ -7,7 +7,7 @@ License: LGPL
License: LGPL
Group: Development/Libraries
Source: libcmpiutil-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
URL: http://libvirt.org/CIM/
BuildRequires: tog-pegasus-devel
BuildRequires: flex
17 years, 1 month
[PATCH] Add installation instructions for root/interop namespace
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1195117117 -3600
# Node ID 937ed1f28893f71163de1b673ffaf587d1169db9
# Parent c9e977e820e99070f0c0c0397061229f7382ac7b
Add installation instructions for root/interop namespace
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r c9e977e820e9 -r 937ed1f28893 doc/libvirt-cim.html
--- a/doc/libvirt-cim.html Wed Nov 14 13:06:06 2007 +0100
+++ b/doc/libvirt-cim.html Thu Nov 15 09:58:37 2007 +0100
@@ -76,6 +76,7 @@
$ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/virt cimv216.mof<br/>
$ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/virt qualifiers.mof<br/>
$ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/virt qualifiers_optional.mof<br/>
+ $ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/interop cimv216-interop.mof<<br />
</code></p>
<h4>To install the schema in SFCB:</h4>
@@ -111,6 +112,23 @@
+//#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof")<br/>
+//#pragma include ("Security/CIM_IPPacketFilterIndication.mof")<br/>
#pragma include ("Support/PRS_ActivityContact.mof")<br/>
+</code></p>
+
+<p><strong>cimv216-interop.mof</strong> is not part of the official DMTF
+ CIM v2.16 schema package. Please create with the folloing content:
+</p>
+
+<p><code>
+#pragma locale ("en_US")<br/>
+#pragma include ("qualifiers.mof")<br/>
+#pragma include ("qualifiers_optional.mof")<br/>
+#pragma include ("Core/CIM_ManagedElement.mof")<br/>
+#pragma include ("Interop/CIM_RegisteredProfile.mof")<br/>
+#pragma include ("Interop/CIM_RegisteredSubProfile.mof")<br/>
+#pragma include ("Core/CIM_Dependency.mof")<br/>
+#pragma include ("Interop/CIM_ElementConformsToProfile.mof")<br/>
+#pragma include ("Interop/CIM_ReferencedProfile.mof")<br/>
+#pragma include ("Interop/CIM_SubProfileRequiresProfile.mof")<br/>
</code></p>
<h2><a name="Platforms">Platform Support</a></h2>
17 years, 1 month
[PATCH] Add bridge network type
by lizg@cn.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1195194642 -28800
# Node ID fcc119ccdfa54df6f6296d2174670042b7b6d75a
# Parent 99988c7788133e216451cc0c1f3440260e996fbf
Add bridge network type
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 99988c778813 -r fcc119ccdfa5 src/Virt_Device.c
--- a/src/Virt_Device.c Fri Nov 16 14:24:36 2007 +0800
+++ b/src/Virt_Device.c Fri Nov 16 14:30:42 2007 +0800
@@ -47,7 +47,8 @@ static int net_set_type(CMPIInstance *in
{
uint16_t cim_type;
- if (STREQC(dev->type, "ethernet"))
+ if (STREQC(dev->type, "ethernet") ||
+ STREQC(dev->type, "bridge"))
cim_type = CIM_NET_ETHERNET;
else
cim_type = CIM_NET_UNKNOWN;
17 years, 1 month
[PATCH] Add function to parse InstanceIDs
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1195172367 28800
# Node ID 499034149a6bc4072ad76f06d107059613277d6a
# Parent ae4810e6764b1ea14df6f429eab972593e919e37
Add function to parse InstanceIDs.
This function currently supports InstanceIDs in the format <Org>:<LocalID>, such as "Xen:Domain-0" for VSSD.
The functionality is based on the parsing from VSSDComponent, so the code for parsing the InstanceID is replaced by the function.
Updated function so that it can return both the InstanceID prefix (org) and the localID. The call has the option of supplying NULL for either argument.
Also added a wrapper function that takes a CMPIObjectPath ref, grabs the instanceID, and then calls the parse_id() function.
Fixed memory leak.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r ae4810e6764b -r 499034149a6b libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Thu Nov 15 09:49:47 2007 -0800
+++ b/libxkutil/misc_util.c Thu Nov 15 16:19:27 2007 -0800
@@ -371,6 +371,55 @@ bool domain_online(virDomainPtr dom)
(info.state == VIR_DOMAIN_RUNNING);
}
+int parse_id(char *id,
+ char **pfx,
+ char **name)
+{
+ int ret;
+ char *tmp_pfx;
+ char *tmp_name;
+
+ ret = sscanf(id, "%a[^:]:%as", &tmp_pfx, &tmp_name);
+ if (ret != 2) {
+ ret = 0;
+ goto out;
+ }
+
+ if (pfx)
+ *pfx = strdup(tmp_pfx);
+
+ if (name)
+ *name = strdup(tmp_name);
+
+ ret = 1;
+
+ out:
+ free(tmp_pfx);
+ free(tmp_name);
+
+ return ret;
+}
+
+bool parse_instanceid(const CMPIObjectPath *ref,
+ char **pfx,
+ char **name)
+{
+ int ret;
+ char *id = NULL;
+
+ id = cu_get_str_path(ref, "InstanceID");
+ if (id == NULL)
+ return false;
+
+ ret = parse_id(id, pfx, name);
+
+ free(id);
+
+ if (!ret)
+ return false;
+
+ return true;
+}
/*
* Local Variables:
diff -r ae4810e6764b -r 499034149a6b libxkutil/misc_util.h
--- a/libxkutil/misc_util.h Thu Nov 15 09:49:47 2007 -0800
+++ b/libxkutil/misc_util.h Thu Nov 15 16:19:27 2007 -0800
@@ -89,6 +89,9 @@ char *association_prefix(const char *pro
char *association_prefix(const char *provider_name);
bool match_pn_to_cn(const char *pn, const char *cn);
+int parse_id(char *id, char **pfx, char **name);
+bool parse_instanceid(const CMPIObjectPath *ref, char **pfx, char **name);
+
#define ASSOC_MATCH(pn, cn) \
if (!match_pn_to_cn((pn), (cn))) { \
return (CMPIStatus){CMPI_RC_OK, NULL}; \
diff -r ae4810e6764b -r 499034149a6b src/Virt_VSSDComponent.c
--- a/src/Virt_VSSDComponent.c Thu Nov 15 09:49:47 2007 -0800
+++ b/src/Virt_VSSDComponent.c Thu Nov 15 16:19:27 2007 -0800
@@ -41,10 +41,7 @@ static CMPIStatus vssd_to_rasd(const CMP
struct inst_list *list)
{
CMPIStatus s;
- char *id = NULL;
- char *pfx = NULL;
char *name = NULL;
- int ret;
int i = 0;
int types[] = {
CIM_RASD_TYPE_PROC,
@@ -56,19 +53,10 @@ static CMPIStatus vssd_to_rasd(const CMP
ASSOC_MATCH(info->provider_name, CLASSNAME(ref));
- id = cu_get_str_path(ref, "InstanceID");
- if (id == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Missing InstanceID");
- goto out;
- }
-
- ret = sscanf(id, "%a[^:]:%as", &pfx, &name);
- if (ret != 2) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Invalid InstanceID");
+ if (!parse_instanceid(ref, NULL, &name)) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get system name");
goto out;
}
@@ -83,8 +71,6 @@ static CMPIStatus vssd_to_rasd(const CMP
CMSetStatus(&s, CMPI_RC_OK);
out:
- free(id);
- free(pfx);
free(name);
return s;
17 years, 1 month
[PATCH] Make configure check for broken sblim-cmpi-devel version
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195078948 28800
# Node ID 9cfd20d3be0e65d695f6b1ea5b4104c695219aab
# Parent 6e221b0af2f4a16fee34213bb6d46a0a3eec4227
Make configure check for broken sblim-cmpi-devel version
The sblim version of cmpift.h is broken. We can detect this by checking
that the size of the structure on 64-bit platforms meets the CMPI standard
of 160 bytes. When sblim fixes their version, this test will start to pass.
Testing of this would be appreciated, especially if someone with a 32-bit
machine could give it a whirl.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 6e221b0af2f4 -r 9cfd20d3be0e acinclude.m4
--- a/acinclude.m4 Wed Nov 14 11:04:52 2007 +0100
+++ b/acinclude.m4 Wed Nov 14 14:22:28 2007 -0800
@@ -71,3 +71,24 @@ AC_DEFUN([CHECK_CMPI],
fi
]
)
+
+AC_DEFUN([CHECK_BROKEN_CMPIFT],
+ [
+ AC_MSG_CHECKING(for a broken cmpift.h)
+ AC_RUN_IFELSE([
+ #include <cmpift.h>
+
+ int main(void) {
+ if ((sizeof(unsigned long) == 8) &&
+ (sizeof(struct _CMPIBrokerFT) != 160))
+ return 1;
+ else
+ return 0;
+ }
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_ERROR(You have a broken cmpift.h header. Is a broken version of sblim-cmpi-devel installed?)
+ ]
+)])
+
diff -r 6e221b0af2f4 -r 9cfd20d3be0e configure.ac
--- a/configure.ac Wed Nov 14 11:04:52 2007 +0100
+++ b/configure.ac Wed Nov 14 14:22:28 2007 -0800
@@ -57,6 +57,8 @@ CFLAGS_STRICT="-Werror"
CFLAGS_STRICT="-Werror"
AC_SUBST(CFLAGS_STRICT)
+CHECK_BROKEN_CMPIFT
+
echo ""
echo "Build Embedded Object parser: $eoparser"
echo ""
17 years, 1 month
[PATCH 0 of 3] Adding ElementSettingData.
by Kaitlin Rupert
Cleaned up previous patch - removed buggy InstanceID parsing code from ElementSettingData. Created a new function in libxutil/misc_util.c based on the InstanceID parsing of VSSDComponent.
Enhanced parse_id() functionality to return both pfx and name. Added a parse_instanceid() wrapper function.
17 years, 1 month
[PATCH] [RFC] Transition back to connect_by_classname()
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195080791 28800
# Node ID cfb48c67f1e611f10003a6c17ba458080f9d76f4
# Parent c9e977e820e99070f0c0c0397061229f7382ac7b
[RFC] Transition back to connect_by_classname()
Previously, we used the incoming reference for all operations to determine
the URI to pass to libvirt during a connect operation. For some reason,
we transitioned away from that to a detection-based mechanism, which would
not support multiple technologies to be managed from the provider
simultaneously.
I think that we have enough other infrastructure in place now that this is
no longer a problem. As a test, I offer this patch with a few key instances
of lv_connect() replaced with connect_by_classname() for discussion.
I have tested that enumeration of Xen_ComputerSystem, KVM_ComputerSystem,
and CIM_ComputerSystem are exclusive, and do not return any duplicate
results.
Further, I have confirmed that resolving Xen_SystemDevice against a
KVM_ComputerSystem instance does not work, and that no duplicate results
are returned in the case of CIM_SystemDevice.
If this looks okay to people (and wider testing supports my findings),
I propose we start to convert uses of lv_connect() back to per-class
connections until we encounter a problem.
Comments welcome.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r c9e977e820e9 -r cfb48c67f1e6 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Wed Nov 14 13:06:06 2007 +0100
+++ b/libxkutil/misc_util.c Wed Nov 14 14:53:11 2007 -0800
@@ -64,6 +64,8 @@ virConnectPtr connect_by_classname(const
return NULL;
}
+ CU_DEBUG("Connecting to libvirt with uri `%s'", uri);
+
conn = virConnectOpen(uri);
if (!conn) {
CMSetStatusWithChars(broker, s,
@@ -334,28 +336,21 @@ bool provider_is_responsible(const CMPIB
const CMPIObjectPath *reference,
CMPIStatus *status)
{
- const char *dft_pfx;
char *pfx;
- bool rc = false;
+ bool rc = true;
CMSetStatus(status, CMPI_RC_OK);
pfx = class_prefix_name(CLASSNAME(reference));
- if (STREQC(pfx, "CIM"))
+ if (STREQC(pfx, "CIM")) {
cu_statusf(broker, status,
CMPI_RC_ERR_FAILED,
"Please exactly specify the class (check CIMOM behavior!): %s",
CLASSNAME(reference));
-
- dft_pfx = default_prefix();
- if (dft_pfx == NULL)
- goto out;
-
- if (STREQC(pfx, dft_pfx))
- rc = true;
-
- out:
+ rc = false;
+ }
+
free(pfx);
return rc;
}
diff -r c9e977e820e9 -r cfb48c67f1e6 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Nov 14 13:06:06 2007 +0100
+++ b/src/Virt_ComputerSystem.c Wed Nov 14 14:53:11 2007 -0800
@@ -346,7 +346,7 @@ static CMPIStatus return_enum_domains(co
if (!provider_is_responsible(_BROKER, reference, &s))
return s;
- conn = lv_connect(_BROKER, &s);
+ conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s);
if (conn == NULL)
return s;
@@ -386,7 +386,7 @@ static CMPIStatus get_domain(const CMPIO
return s;
}
- conn = lv_connect(_BROKER, &s);
+ conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s);
if (conn == NULL)
return s;
@@ -609,7 +609,7 @@ static CMPIStatus __state_change(char *n
virDomainPtr dom = NULL;
virDomainInfo info;
- conn = lv_connect(_BROKER, &s);
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
if (conn == NULL)
goto out;
diff -r c9e977e820e9 -r cfb48c67f1e6 src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c Wed Nov 14 13:06:06 2007 +0100
+++ b/src/Virt_SystemDevice.c Wed Nov 14 14:53:11 2007 -0800
@@ -61,6 +61,7 @@ static int get_dom_devices(const char *n
static int get_dom_devices(const char *name,
struct inst_list *list,
int type,
+ const char *host_cn,
const char *ns)
{
virConnectPtr conn = NULL;
@@ -68,7 +69,7 @@ static int get_dom_devices(const char *n
CMPIStatus s;
int ret = 0;
- conn = lv_connect(_BROKER, &s);
+ conn = connect_by_classname(_BROKER, host_cn, &s);
if (conn == NULL)
goto out;
@@ -87,17 +88,19 @@ static int get_dom_devices(const char *n
static int get_all_devices(const char *name,
struct inst_list *list,
- char *ns)
+ const char *host_cn,
+ const char *ns)
{
int i;
for (i = 0; i < DEV_TYPE_COUNT; i++)
- get_dom_devices(name, list, device_types[i], ns);
+ get_dom_devices(name, list, device_types[i], host_cn, ns);
return i;
}
static CMPIInstance *host_instance(char *name,
+ const char *host_cn,
const char *ns)
{
CMPIInstance *inst = NULL;
@@ -114,7 +117,7 @@ static CMPIInstance *host_instance(char
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op))
goto out;
- conn = lv_connect(_BROKER, &s);
+ conn = connect_by_classname(_BROKER, host_cn, &s);
if (conn == NULL)
goto out;
@@ -173,9 +176,16 @@ static CMPIStatus sys_to_dev(const CMPIO
type = device_type_from_classname(info->result_class);
- ret = get_dom_devices(host, list, type, NAMESPACE(ref));
+ ret = get_dom_devices(host,
+ list,
+ type,
+ CLASSNAME(ref),
+ NAMESPACE(ref));
} else {
- ret = get_all_devices(host, list, NAMESPACE(ref));
+ ret = get_all_devices(host,
+ list,
+ CLASSNAME(ref),
+ NAMESPACE(ref));
}
if (ret >= 0) {
@@ -218,6 +228,7 @@ static CMPIStatus dev_to_sys(const CMPIO
}
sys = host_instance(host,
+ CLASSNAME(ref),
NAMESPACE(ref));
if (sys == NULL)
17 years, 1 month
[PATCH 0 of 3] Adding ElementSettingData.
by Kaitlin Rupert
Cleaned up previous patch - removed buggy InstanceID parsing code from ElementSettingData. Created a new function in libxutil/misc_util.c based on the InstanceID parsing of VSSDComponent.
Cleaned up other bugs / style issues as well.
17 years, 1 month