[PATCH] Make RASD not dependent on ResourceType key
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# 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 <danms(a)us.ibm.com>
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;
}
17 years, 1 month
[PATCH] Add some starter web content
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1193884206 25200
# Node ID b698e473b09ff77c24ff87db74ef112cd726a177
# Parent d349e62b888f0dda3577ff0e55f4dbe7681a5d57
Add some starter web content
I have added a couple of new content sections since last time. I also
trimmed and tweaked site.xsl a bit. I think this is probably close to
"good enough" for a project announcement.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r d349e62b888f -r b698e473b09f Makefile.am
--- a/Makefile.am Wed Oct 31 17:04:17 2007 -0700
+++ b/Makefile.am Wed Oct 31 19:30:06 2007 -0700
@@ -1,5 +1,5 @@
# Copyright IBM Corp. 2007
-SUBDIRS = libxkutil src
+SUBDIRS = libxkutil src doc
MOFS = \
schema/ComputerSystem.mof \
diff -r d349e62b888f -r b698e473b09f configure.ac
--- a/configure.ac Wed Oct 31 17:04:17 2007 -0700
+++ b/configure.ac Wed Oct 31 19:30:06 2007 -0700
@@ -67,6 +67,7 @@ AC_CONFIG_FILES([
libxkutil/tests/Makefile
src/Makefile
src/tests/Makefile
+ doc/Makefile
Makefile
])
diff -r d349e62b888f -r b698e473b09f doc/Makefile.am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/Makefile.am Wed Oct 31 19:30:06 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 d349e62b888f -r b698e473b09f doc/libvirt-cim.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/libvirt-cim.html Wed Oct 31 19:30:06 2007 -0700
@@ -0,0 +1,172 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="">
+ <title>Libvirt-CIM: The CIM provider for libvirt</title>
+</head>
+
+<body bgcolor="#ffffff">
+<h1 align="center">Libvirt-CIM: The CIM provider for libvirt</h1>
+
+<h1>Note: this is the flat content of the <a href="index.html">web site</a></h1>
+
+<h1 style="text-align: center">libvirt-cim</h1>
+
+<h3>What is <span class="style1">libvirt-cim?</span></h3>
+
+<p>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.
+</p>
+
+<h2><a name="News">Releases</a></h2>
+
+<p>There have been no releases to date</p>
+
+<h2><a name="Introducti">Introduction</a></h2>
+
+<p>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.
+</p>
+
+<p>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.
+</p>
+
+<h2><a name="Downloads">Downloads</a></h2>
+
+<p>The libvirt-cim development tree can be found in the
+ <a href="http://libvirt.org/hg">libvirt.org/hg</a> repository.
+</p>
+
+<p>To get a copy of the development tree, use
+ <a href="http://www.selenic.com/mercurial/wiki/">mercurial</a>'s
+ clone feature:
+</p>
+
+<p><code>$ hg clone http://libvirt.org/hg/libvirt-cim</code></p>
+
+<p>Alternatively, you can grab a
+ <a href="http://libvirt.org/hg/libvirt-cim/archive/tip.tar.gz">tarball</a> or
+ <a href="http://libvirt.org/hg/libvirt-cim/archive/tip.zip">zip</a>
+ file snapshot of the repository.
+</p>
+
+<h2><a name="Schema">Schema</a></h2>
+
+<p>The libvirt-cim provider depends on an installed
+ <a href="http://www.dmtf.org/standards/cim/cim_schema_v216/">DMTF
+ CIM v2.16</a> Experimental schema. The package can be obtained
+<a href="http://www.dmtf.org/standards/cim/cim_schema_v216/cimv216Experimental-MOF...">here</a>.</p>
+
+<h4>To install the schema in Pegasus:</h4>
+
+<p><code>
+ $ PEGASUS_REPO=/var/lib/Pegasus # adjust this as needed<br/>
+ $ mkdir cim216<br/>
+ $ cd cim216<br/>
+ $ unzip $PATH_TO_ZIPFILE<br/>
+ $ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/ibmsd cimv216.mof<br/>
+ $ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/ibmsd qualifiers.mof<br/>
+ $ sudo cimmofl -uc -aEV -R$PEGASUS_REPO -n /root/ibmsd qualifiers_optional.mof<br/>
+</code></p>
+
+<h4>To install the schema in SFCB:</h4>
+
+<p><code>
+ $ SFCB_CIM=/usr/local/share/sfcb/CIM # adjust this as needed<br/>
+ $ mkdir cim216<br/>
+ $ cd cim216<br/>
+ $ unzip $PATH_TO_ZIPFILE<br/>
+ $ mv cimv216.mof CIM_Schema.mof<br/>
+ $ sudo cp * $SFCB_CIM<br/>
+ $ sudo sfcbrepos<br/>
+</code></p>
+
+<p><strong>Note:</strong> 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:
+</p>
+
+<p><code>
+--- CIM_Schema.mof 2007-10-15 00:15:44.000000000 -0700<br/>
++++ cimv216.mof 2007-10-22 10:11:19.000000000 -0700<br/>
+@@ -507,3 +507,3 @@<br/>
+ #pragma include ("Policy/CIM_SharedSecretAuthentication.mof")<br/>
+-#pragma include ("Security/CIM_SecurityIndication.mof")<br/>
++//#pragma include ("Security/CIM_SecurityIndication.mof")<br/>
+ #pragma include ("Support/PRS_Activity.mof")<br/>
+@@ -728,4 +728,4 @@<br/>
+ #pragma include ("Policy/CIM_PolicyConditionInPolicyRule.mof")<br/>
+-#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof")<br/>
+-#pragma include ("Security/CIM_IPPacketFilterIndication.mof")<br/>
++//#pragma include ("Security/CIM_IPNetworkSecurityIndication.mof")<br/>
++//#pragma include ("Security/CIM_IPPacketFilterIndication.mof")<br/>
+ #pragma include ("Support/PRS_ActivityContact.mof")<br/>
+</code></p>
+
+<h2><a name="Platforms">Platform Support</a></h2>
+
+<p>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.
+</p>
+
+<p>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:</p>
+<ul>
+ <li>The XML generation and parsing code and the related device
+ modeling code.</li>
+ <li>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.</li>
+ <li>Some lingering hard-coded "Xen_Foo" class names.</li>
+</ul>
+
+<p>Further, supporting new platforms have some registration and
+ modeling implications:</p>
+<ul>
+ <li>Additions to the MOF and registration files for "branded"
+ classes (Xen_Foo, KVM_Foo, etc)</li>
+ <li>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)</li>
+</ul>
+
+<h2><a name="architecture">Architecture</a></h2>
+
+<p>The libvirt-cim provider consists of two major parts:</p>
+
+<ul>
+ <li>The provider classes themselves (<tt>src/</tt>)</li>
+ <li>A helper library of common components (<tt>libxkutil/</tt>)</li>
+</ul>
+
+<p>The provider classes implement the actual CIM class model. Some of
+ the provider libraries implement one CIM class and one providier.
+ However, many of them perform more than one task. For example,
+ the <tt>Virt_Device</tt> and <tt>Virt_DevicePool</tt> providers
+ implement the device and device pool classes for each of the major
+ device types: Memory, Processor, Network, and Disk.
+</p>
+
+<p>The helper library contains common routines that almost all of the
+ providers use, such as libvirt connection type detection and device
+ and system XML parsing.
+</p>
+
+</body>
+
+</html>
diff -r d349e62b888f -r b698e473b09f doc/site.xsl
--- a/doc/site.xsl Wed Oct 31 17:04:17 2007 -0700
+++ b/doc/site.xsl Wed Oct 31 19:30:06 2007 -0700
@@ -19,7 +19,7 @@
<xsl:text>docs.html</xsl:text>
</xsl:when>
<xsl:when test="$name = '#Reporting'">
- <xsl:text>bugs.html</xsl:text>
+ <xsl:text>development.html</xsl:text>
</xsl:when>
<xsl:when test="$name = '#help'">
<xsl:text>help.html</xsl:text>
@@ -37,28 +37,19 @@
<xsl:text>news.html</xsl:text>
</xsl:when>
<xsl:when test="$name = '#Contributi'">
- <xsl:text>contribs.html</xsl:text>
- </xsl:when>
- <xsl:when test="$name = '#Format'">
- <xsl:text>format.html</xsl:text>
+ <xsl:text>development.html</xsl:text>
</xsl:when>
<xsl:when test="$name = '#architecture'">
<xsl:text>architecture.html</xsl:text>
</xsl:when>
- <xsl:when test="$name = '#Python'">
- <xsl:text>python.html</xsl:text>
- </xsl:when>
<xsl:when test="$name = '#FAQ'">
<xsl:text>FAQ.html</xsl:text>
</xsl:when>
- <xsl:when test="$name = '#Remote'">
- <xsl:text>remote.html</xsl:text>
- </xsl:when>
- <xsl:when test="$name = '#uri'">
- <xsl:text>uri.html</xsl:text>
- </xsl:when>
- <xsl:when test="$name = '#HVSupport'">
- <xsl:text>hvsupport.html</xsl:text>
+ <xsl:when test="$name = '#Platforms'">
+ <xsl:text>platforms.html</xsl:text>
+ </xsl:when>
+ <xsl:when test="$name = '#Schema'">
+ <xsl:text>schema.html</xsl:text>
</xsl:when>
<xsl:when test="$name = ''">
<xsl:text>unknown.html</xsl:text>
@@ -77,11 +68,11 @@
the main menu box
-->
<xsl:template name="linkList">
- <div class="linkList">
- <div class="llinks">
- <h3 class="links"><span>main menu</span></h3>
+ <div class="linkList2">
+ <div class="llinks2">
+ <h3 class="links2"><span>main menu</span></h3>
<ul>
- <li>Home</li>
+ <li><a href="{$href_base}index.html">Home</a></li>
<xsl:for-each select="/html/body/h2">
<xsl:variable name="filename">
<xsl:call-template name="filename">
@@ -102,156 +93,20 @@
</li>
</xsl:if>
</xsl:for-each>
- <li><a href="{$href_base}html/index.html">API Menu</a></li>
- <li><a href="{$href_base}examples/index.html">C code examples</a></li>
- <li><a href="{$href_base}ChangeLog.html">Recent Changes</a></li>
-
- </ul>
- </div>
- <div class="llinks">
- <h3 class="links"><span>related links</span></h3>
- <ul>
- <li> <a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li>
- <li> <a href="https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&...">Open bugs</a></li>
- <li> <a href="http://virt-manager.et.redhat.com/">virt-manager</a></li>
- <li> <a href="http://search.cpan.org/~danberr/Sys-Virt-0.1.0/">Perl bindings</a></li>
- <li> <a href="http://et.redhat.com/~rjones/ocaml-libvirt/">OCaml bindings</a></li>
- <li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li>
- <li><form action="{$href_base}search.php" enctype="application/x-www-form-urlencoded" method="get">
- <input name="query" type="text" size="12" value="Search..." /><input name="submit" type="submit" value="Go" />
- </form></li>
- <li><a href="http://xmlsoft.org/"> <img src="{$href_base}Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></li>
- </ul>
- <p class='credits'>Graphics and design by <a href="mail:dfong@redhat.com">Diana Fong</a></p>
- </div>
- </div>
- </xsl:template>
- <xsl:template name="linkList2">
- <div class="linkList2">
- <div class="llinks2">
- <h3 class="links2"><span>main menu</span></h3>
- <ul>
- <li><a href="{$href_base}index.html">Home</a></li>
- <xsl:for-each select="/html/body/h2">
- <xsl:variable name="filename">
- <xsl:call-template name="filename">
- <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="$filename != ''">
- <li>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="$filename"/>
- </xsl:attribute>
- <xsl:if test="$filename = 'docs.html'">
- <xsl:attribute name="style">font-weight:bold</xsl:attribute>
- </xsl:if>
- <xsl:value-of select="."/>
- </xsl:element>
- </li>
- </xsl:if>
- </xsl:for-each>
- <li><a href="{$href_base}html/index.html">API Menu</a></li>
- <li><a href="{$href_base}examples/index.html">C code examples</a></li>
- <li><a href="{$href_base}ChangeLog.html">Recent Changes</a></li>
-
</ul>
</div>
<div class="llinks2">
<h3 class="links2"><span>related links</span></h3>
<ul>
- <li> <a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li>
- <li> <a href="https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&...">Open bugs</a></li>
- <li> <a href="http://virt-manager.et.redhat.com/">virt-manager</a></li>
- <li> <a href="http://search.cpan.org/~danberr/Sys-Virt-0.1.0/">Perl bindings</a></li>
- <li> <a href="http://et.redhat.com/~rjones/ocaml-libvirt/">OCaml bindings</a></li>
- <li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li>
- <li><form action="{$href_base}search.php" enctype="application/x-www-form-urlencoded" method="get">
- <input name="query" type="text" size="12" value="Search..." /><input name="submit" type="submit" value="Go" />
- </form></li>
- <li><a href="http://xmlsoft.org/"> <img src="{$href_base}Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></li>
+ <li> <a href="https://www.redhat.com/mailman/listinfo/libvirt-cim/">Mailing list</a></li>
+ <li> <a href="http://libvirt.org/">libvirt</a></li>
+ <li><a href="http://xmlsoft.org/"> <img src="http://libvirt.org/Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></li>
</ul>
<p class='credits'>Graphics and design by <a href="mail:dfong@redhat.com">Diana Fong</a></p>
</div>
</div>
</xsl:template>
-<!--
- the main menu box
- -->
- <xsl:template name="develtoc">
- <div class="left">
- <form action="{$href_base}search.php"
- enctype="application/x-www-form-urlencoded" method="get">
- <input name="query" type="text" size="20" value=""/>
- <input name="submit" type="submit" value="Search ..."/>
- </form>
- <div class="box">
- <h2 class="box_title">API menu</h2>
- </div>
- <p><a href="{$href_base}index.html">Main menu</a></p>
- <p><a href="{$href_base}/html/index.html">API menu</a></p>
- <p><a href="{$href_base}ChangeLog.html">ChangeLog</a></p>
- <div class="box">
- <h2 class="box_title">API Indexes</h2>
- </div>
- <p><a href="{$href_base}APIchunk0.html">Alphabetic</a></p>
- <p><a href="{$href_base}APIconstructors.html">Constructors</a></p>
- <p><a href="{$href_base}APIfunctions.html">Functions/Types</a></p>
- <p><a href="{$href_base}APIfiles.html">Modules</a></p>
- <p><a href="{$href_base}APIsymbols.html">Symbols</a></p>
- <div class="box">
- <h2 class="box_title">related links</h2>
- </div>
- <p><a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></p>
- <p> <a href="https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&...">Open bugs</a></p>
- <p> <a href="http://virt-manager.et.redhat.com/">virt-manager</a></p>
- <p> <a href="http://search.cpan.org/~danberr/Sys-Virt-0.1.0/">Perl bindings</a></p>
- <p> <a href="http://et.redhat.com/~rjones/ocaml-libvirt/">OCaml bindings</a></p>
- <p><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></p>
- <a href="http://xmlsoft.org/"><img src="{$href_base}Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo"/></a>
- </div>
- <div class="linkList2">
- <div class="llinks2">
- <h3 class="links2"><span>API menu</span></h3>
- <ul>
- <li><a href="{$href_base}index.html">Main menu</a></li>
- <li><a href="{$href_base}/html/index.html">API menu</a></li>
- <li><a href="{$href_base}ChangeLog.html">ChangeLog</a></li>
- </ul>
- </div>
- <div class="llinks2">
- <h3 class="links2"><span>API indexes</span></h3>
- <ul>
- <li><a href="{$href_base}APIchunk0.html">Alphabetic</a></li>
- <li><a href="{$href_base}APIconstructors.html">Constructors</a></li>
- <li><a href="{$href_base}APIfunctions.html">Functions/Types</a></li>
- <li><a href="{$href_base}APIfiles.html">Modules</a></li>
- <li><a href="{$href_base}APIsymbols.html">Symbols</a></li>
- </ul>
- </div>
- <div class="llinks2">
- <h3 class="links2"><span>related links</span></h3>
- <ul>
- <li> <a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li>
- <li> <a href="https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&...">Open bugs</a></li>
- <li> <a href="http://virt-manager.et.redhat.com/">virt-manager</a></li>
- <li> <a href="http://search.cpan.org/~danberr/Sys-Virt-0.1.0/">Perl bindings</a></li>
- <li> <a href="http://et.redhat.com/~rjones/ocaml-libvirt/">OCaml bindings</a></li>
- <li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li>
- <li><form action="{$href_base}search.php" enctype="application/x-www-form-urlencoded" method="get">
- <input name="query" type="text" size="12" value="Search..." /><input name="submit" type="submit" value="Go" />
- </form></li>
- <li><a href="http://xmlsoft.org/"> <img src="Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></li>
- </ul>
- </div>
- </div>
- </xsl:template>
-
-<!--
- the menu box for developper's pages
- -->
<!--
the page title
-->
@@ -265,7 +120,7 @@
- Write the styles in the head
-->
<xsl:template name="style">
- <link rel="stylesheet" type="text/css" href="{$href_base}libvirt.css" />
+ <link rel="stylesheet" type="text/css" href="http://libvirt.org/libvirt.css" />
<link rel="SHORTCUT ICON" href="/32favicon.png" />
</xsl:template>
@@ -332,7 +187,7 @@
<xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
</div>
</div>
- <xsl:call-template name="linkList2"/>
+ <xsl:call-template name="linkList"/>
<xsl:call-template name="bottom"/>
</div>
</body>
17 years, 1 month
[PATCH] Fix VSMS instance code to refuse to return an instance if ref is invalid
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# 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 <danms(a)us.ibm.com>
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();
17 years, 1 month
[PATCH] Fix a crash when std_invokemethod handlers return nonzero
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1424066513 28800
# Node ID 05b01d03f0b801afe266d8d012bc464be6a2d165
# Parent 8d634949f520faafd42c3d59add7c20fac39bb88
Fix a crash when std_invokemethod handlers return nonzero
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
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);
17 years, 1 month