diff --git a/SOURCES/libvirt-cim-0.6.3-0a742856.patch b/SOURCES/libvirt-cim-0.6.3-0a742856.patch new file mode 100644 index 0000000..61415e6 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-0a742856.patch @@ -0,0 +1,141 @@ +From 0a742856490bfdcb02c2af48a2a849593cccf1c7 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Thu, 29 Aug 2013 17:18:49 +0200 +Subject: [PATCH 08/48] libxkutil: Improve domain.os_info cleanup + +The union fields in os_info were set by means of XML parsing which +doesn't take into account that certain fields are depending on the +virtualization type. +This could lead both to memory overwrites and memory leaks. +Fixed by using temporary variables and type-based setting of fields + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 73 +++++++++++++++++++++++++++++++++------------- + 1 file changed, 52 insertions(+), 21 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 542e4e9..ad0f19c 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -1103,23 +1103,37 @@ int parse_fq_devid(const char *devid, char **host, char **device) + return 1; + } + ++static void cleanup_bootlist(char **blist, unsigned blist_ct) ++{ ++ while (blist_ct > 0) { ++ free(blist[--blist_ct]); ++ } ++ free(blist); ++} ++ + static int parse_os(struct domain *dominfo, xmlNode *os) + { + xmlNode *child; + char **blist = NULL; + unsigned bl_size = 0; ++ char *kernel = NULL; ++ char *initrd = NULL; ++ char *cmdline = NULL; ++ char *loader = NULL; ++ char *boot = NULL; ++ char *init = NULL; + + for (child = os->children; child != NULL; child = child->next) { +- if (XSTREQ(child->name, "type")) ++ if (XSTREQ(child->name, "type")) { + STRPROP(dominfo, os_info.pv.type, child); +- else if (XSTREQ(child->name, "kernel")) +- STRPROP(dominfo, os_info.pv.kernel, child); ++ } else if (XSTREQ(child->name, "kernel")) ++ kernel = get_node_content(child); + else if (XSTREQ(child->name, "initrd")) +- STRPROP(dominfo, os_info.pv.initrd, child); ++ initrd = get_node_content(child); + else if (XSTREQ(child->name, "cmdline")) +- STRPROP(dominfo, os_info.pv.cmdline, child); ++ cmdline = get_node_content(child); + else if (XSTREQ(child->name, "loader")) +- STRPROP(dominfo, os_info.fv.loader, child); ++ loader = get_node_content(child); + else if (XSTREQ(child->name, "boot")) { + char **tmp_list = NULL; + +@@ -1137,7 +1151,7 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + blist[bl_size] = get_attr_value(child, "dev"); + bl_size++; + } else if (XSTREQ(child->name, "init")) +- STRPROP(dominfo, os_info.lxc.init, child); ++ init = get_node_content(child); + } + + if ((STREQC(dominfo->os_info.fv.type, "hvm")) && +@@ -1154,17 +1168,39 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + else + dominfo->type = -1; + +- if (STREQC(dominfo->os_info.fv.type, "hvm")) { ++ switch (dominfo->type) { ++ case DOMAIN_XENFV: ++ case DOMAIN_KVM: ++ case DOMAIN_QEMU: ++ dominfo->os_info.fv.loader = loader; + dominfo->os_info.fv.bootlist_ct = bl_size; + dominfo->os_info.fv.bootlist = blist; +- } else { +- int i; +- +- for (i = 0; i < bl_size; i++) +- free(blist[i]); +- free(blist); ++ loader = NULL; ++ blist = NULL; ++ bl_size = 0; ++ break; ++ case DOMAIN_XENPV: ++ dominfo->os_info.pv.kernel = kernel; ++ dominfo->os_info.pv.initrd = initrd; ++ dominfo->os_info.pv.cmdline = cmdline; ++ kernel = NULL; ++ initrd = NULL; ++ cmdline = NULL; ++ break; ++ case DOMAIN_LXC: ++ dominfo->os_info.lxc.init = init; ++ init = NULL; ++ break; ++ default: ++ break; + } + ++ free(kernel); ++ free(initrd); ++ free(cmdline); ++ free(boot); ++ free(init); ++ cleanup_bootlist(blist, bl_size); + return 1; + } + +@@ -1360,15 +1396,10 @@ void cleanup_dominfo(struct domain **dominfo) + free(dom->os_info.pv.cmdline); + } else if ((dom->type == DOMAIN_XENFV) || + (dom->type == DOMAIN_KVM) || (dom->type == DOMAIN_QEMU)) { +- int i; +- + free(dom->os_info.fv.type); + free(dom->os_info.fv.loader); +- +- for (i = 0; i < dom->os_info.fv.bootlist_ct; i++) { +- free(dom->os_info.fv.bootlist[i]); +- } +- free(dom->os_info.fv.bootlist); ++ cleanup_bootlist(dom->os_info.fv.bootlist, ++ dom->os_info.fv.bootlist_ct); + } else if (dom->type == DOMAIN_LXC) { + free(dom->os_info.lxc.type); + free(dom->os_info.lxc.init); +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-117dabb9.patch b/SOURCES/libvirt-cim-0.6.3-117dabb9.patch new file mode 100644 index 0000000..ad340fb --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-117dabb9.patch @@ -0,0 +1,241 @@ +From 117dabb96ff85f41d05ab841df02c02a09ff73d7 Mon Sep 17 00:00:00 2001 +From: Boris Fiuczynski +Date: Thu, 29 Aug 2013 17:18:53 +0200 +Subject: [PATCH 11/60] VSSM: Set default values based on libvirt capabilities + on DefineSystem calls + +In the DefineSystem call the architecture, machine and emulator for KVM are set +to the hypervisor-specific default values if they did not get provided. +This now allows architecture based decision making in the CIM providers to +work for all platforms. + +Signed-off-by: Boris Fiuczynski +Reviewed-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 162 +++++++++++++++--------------- + 1 file changed, 79 insertions(+), 83 deletions(-) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 301f046..79dec73 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -35,6 +35,7 @@ + #include "cs_util.h" + #include "misc_util.h" + #include "device_parsing.h" ++#include "capability_parsing.h" + #include "xmlgen.h" + + #include +@@ -388,59 +389,6 @@ static bool fv_set_emulator(struct domain *domain, + return true; + } + +-static bool system_has_kvm(const char *pfx) +-{ +- CMPIStatus s; +- virConnectPtr conn = NULL; +- char *caps = NULL; +- bool disable_kvm = get_disable_kvm(); +- xmlDocPtr doc = NULL; +- xmlNodePtr node = NULL; +- int len; +- bool kvm = false; +- +- /* sometimes disable KVM to avoid problem in nested KVM */ +- if (disable_kvm) { +- CU_DEBUG("Enter disable kvm mode!"); +- goto out; +- } +- +- conn = connect_by_classname(_BROKER, pfx, &s); +- if ((conn == NULL) || (s.rc != CMPI_RC_OK)) { +- goto out; +- } +- +- caps = virConnectGetCapabilities(conn); +- if (caps != NULL) { +- len = strlen(caps) + 1; +- +- doc = xmlParseMemory(caps, len); +- if (doc == NULL) { +- CU_DEBUG("xmlParseMemory() call failed!"); +- goto out; +- } +- +- node = xmlDocGetRootElement(doc); +- if (node == NULL) { +- CU_DEBUG("xmlDocGetRootElement() call failed!"); +- goto out; +- } +- +- if (has_kvm_domain_type(node)) { +- CU_DEBUG("The system support kvm!"); +- kvm = true; +- } +- } +- +-out: +- free(caps); +- free(doc); +- +- virConnectClose(conn); +- +- return kvm; +-} +- + static int bootord_vssd_to_domain(CMPIInstance *inst, + struct domain *domain) + { +@@ -511,53 +459,90 @@ static int bootord_vssd_to_domain(CMPIInstance *inst, + + static int fv_vssd_to_domain(CMPIInstance *inst, + struct domain *domain, +- const char *pfx) ++ const char *pfx, ++ virConnectPtr conn) + { +- int ret; ++ int ret = 1; ++ int retr; + const char *val; ++ const char *domtype = NULL; ++ const char *ostype = "hvm"; ++ struct capabilities *capsinfo = NULL; ++ ++ get_capabilities(conn, &capsinfo); + + if (STREQC(pfx, "KVM")) { +- if (system_has_kvm(pfx)) ++ if (use_kvm(capsinfo)) { + domain->type = DOMAIN_KVM; +- else ++ domtype = "kvm"; ++ } else { + domain->type = DOMAIN_QEMU; ++ domtype = "qemu"; ++ } + } else if (STREQC(pfx, "Xen")) { + domain->type = DOMAIN_XENFV; + } else { + CU_DEBUG("Unknown fullvirt domain type: %s", pfx); +- return 0; ++ ret = 0; ++ goto out; + } + +- ret = bootord_vssd_to_domain(inst, domain); +- if (ret != 1) +- return 0; +- +- ret = cu_get_str_prop(inst, "Emulator", &val); +- if (ret != CMPI_RC_OK) +- val = NULL; +- else if (disk_type_from_file(val) == DISK_UNKNOWN) { +- CU_DEBUG("Emulator path does not exist: %s", val); +- return 0; ++ retr = bootord_vssd_to_domain(inst, domain); ++ if (retr != 1) { ++ ret = 0; ++ goto out; + } + +- if (!fv_set_emulator(domain, val)) +- return 0; +- + free(domain->os_info.fv.arch); +- ret = cu_get_str_prop(inst, "Arch", &val); +- if (ret == CMPI_RC_OK) ++ retr = cu_get_str_prop(inst, "Arch", &val); ++ if (retr != CMPI_RC_OK) { ++ if (capsinfo != NULL) { /* set default */ ++ val = get_default_arch(capsinfo, ostype); ++ CU_DEBUG("Set Arch to default: %s", val); ++ } else ++ val = NULL; ++ } ++ if (val != NULL) + domain->os_info.fv.arch = strdup(val); +- else +- domain->os_info.fv.arch = NULL; + + free(domain->os_info.fv.machine); +- ret = cu_get_str_prop(inst, "Machine", &val); +- if (ret == CMPI_RC_OK) ++ retr = cu_get_str_prop(inst, "Machine", &val); ++ if (retr != CMPI_RC_OK) { ++ if (capsinfo != NULL && domtype != NULL) { /* set default */ ++ val = get_default_machine(capsinfo, ostype, ++ domain->os_info.fv.arch, ++ domtype); ++ CU_DEBUG("Set Machine to default: %s", val); ++ } else ++ val = NULL; ++ } ++ if (val != NULL) + domain->os_info.fv.machine = strdup(val); +- else +- domain->os_info.fv.machine = NULL; + +- return 1; ++ retr = cu_get_str_prop(inst, "Emulator", &val); ++ if (retr != CMPI_RC_OK) { ++ if (capsinfo != NULL && domtype != NULL) { /* set default */ ++ val = get_default_emulator(capsinfo, ostype, ++ domain->os_info.fv.arch, ++ domtype); ++ CU_DEBUG("Set Emulator to default: %s", val); ++ } else ++ val = NULL; ++ } ++ if (val != NULL && disk_type_from_file(val) == DISK_UNKNOWN) { ++ CU_DEBUG("Emulator path does not exist: %s", val); ++ ret = 0; ++ goto out; ++ } ++ ++ if (!fv_set_emulator(domain, val)) { ++ ret = 0; ++ goto out; ++ } ++ ++ out: ++ cleanup_capabilities(&capsinfo); ++ return ret; + } + + static int lxc_vssd_to_domain(CMPIInstance *inst, +@@ -663,6 +648,8 @@ static int vssd_to_domain(CMPIInstance *inst, + bool bool_val; + bool fullvirt; + CMPIObjectPath *opathp = NULL; ++ virConnectPtr conn = NULL; ++ CMPIStatus s = { CMPI_RC_OK, NULL }; + + + opathp = CMGetObjectPath(inst, NULL); +@@ -748,9 +735,18 @@ static int vssd_to_domain(CMPIInstance *inst, + } + } + +- if (fullvirt || STREQC(pfx, "KVM")) +- ret = fv_vssd_to_domain(inst, domain, pfx); +- else if (STREQC(pfx, "Xen")) ++ if (fullvirt || STREQC(pfx, "KVM")) { ++ conn = connect_by_classname(_BROKER, cn, &s); ++ if (conn == NULL) { ++ cu_statusf(_BROKER, &s, ++ CMPI_RC_ERR_FAILED, ++ "Error connecting to libvirt"); ++ ret = 0; ++ goto out; ++ } ++ ret = fv_vssd_to_domain(inst, domain, pfx, conn); ++ virConnectClose(conn); ++ } else if (STREQC(pfx, "Xen")) + ret = xenpv_vssd_to_domain(inst, domain); + else if (STREQC(pfx, "LXC")) + ret = lxc_vssd_to_domain(inst, domain); +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-14883f33.patch b/SOURCES/libvirt-cim-0.6.3-14883f33.patch new file mode 100644 index 0000000..59807b8 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-14883f33.patch @@ -0,0 +1,31 @@ +From 14883f33cb82bb5d3dcdf1c8931a51eae672f408 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 11 Oct 2013 13:47:35 +0200 +Subject: [PATCH 36/60] libxkutil: clean entire device structure to avoid + memory corruption + +If cleanup_virt_device is called twice (e.g. during modify resource) +a double free can occur because only the dev substructure has +been memset to zero. Now zeroing the entire structure. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 8a90653..56e39c7 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -326,7 +326,7 @@ void cleanup_virt_device(struct virt_device *dev) + + free(dev->id); + +- memset(&dev->dev, 0, sizeof(dev->dev)); ++ memset(dev, 0, sizeof(*dev)); + } + + void cleanup_virt_devices(struct virt_device **_devs, int count) +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-19ffef8e.patch b/SOURCES/libvirt-cim-0.6.3-19ffef8e.patch new file mode 100644 index 0000000..e892e61 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-19ffef8e.patch @@ -0,0 +1,43 @@ +From 19ffef8e60a3cb90b41043ebda3063355896b6a7 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Thu, 8 Aug 2013 11:49:25 +0200 +Subject: [PATCH 03/48] libvirt-cim.spec.in: Don't install open-pegasus' + specific providers + +https://bugzilla.redhat.com/show_bug.cgi?id=859122 + +libvirt-cim installs open-pegasus' specific providers in sblim-sfcb +repository staging directory and causing problem when creating sfcb +repository. + +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index 7b6221e..a027246 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -133,9 +133,6 @@ then + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true + %{_datadir}/%{name}/provider-register.sh -t sfcb \ +- -n root/PG_InterOp \ +- -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/cimv2\ + -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true + fi +@@ -165,9 +162,6 @@ then + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true + %{_datadir}/%{name}/provider-register.sh -d -t sfcb \ +- -n root/PG_InterOp \ +- -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ + -n root/cimv2 \ + -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true + fi +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-1a91ecd3.patch b/SOURCES/libvirt-cim-0.6.3-1a91ecd3.patch new file mode 100644 index 0000000..41eb91e --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-1a91ecd3.patch @@ -0,0 +1,129 @@ +From 1a91ecd304d0a9cfb4e2d07c60f134ce8265ea22 Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Mon, 3 Mar 2014 09:04:19 +0800 +Subject: [PATCH 49/60] Add sgio property support + +Add the 'sgio' property to the DiskRASD and parse/save it correctly + +Once installed on the target system, use: + +wbemcli gcd http://root:password@localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData | grep sgio + +to determine if property exists in MOF. Using 'wbemcli ei' will determine +whether or not it shows up in the enumarated instance(s) - if there are +any on the system + +Signed-off-by: Xu Wang +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 4 ++++ + libxkutil/device_parsing.h | 1 + + libxkutil/xmlgen.c | 2 ++ + schema/ResourceAllocationSettingData.mof | 3 +++ + src/Virt_RASD.c | 6 ++++++ + src/Virt_VirtualSystemManagementService.c | 5 +++++ + 6 files changed, 21 insertions(+) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 6b29a2d..d2d3859 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -93,6 +93,7 @@ static void cleanup_disk_device(struct disk_device *dev) + free(dev->virtual_dev); + free(dev->bus_type); + free(dev->rawio); ++ free(dev->sgio); + free(dev->access_mode); + cleanup_device_address(&dev->address); + } +@@ -515,6 +516,8 @@ static int parse_block_device(xmlNode *dnode, struct virt_device **vdevs) + + ddev->rawio = get_attr_value(dnode, "rawio"); + ++ ddev->sgio = get_attr_value(dnode, "sgio"); ++ + for (child = dnode->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "driver")) { + ddev->driver = get_attr_value(child, "name"); +@@ -1319,6 +1322,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + DUP_FIELD(dev, _dev, dev.disk.driver); + DUP_FIELD(dev, _dev, dev.disk.driver_type); + DUP_FIELD(dev, _dev, dev.disk.rawio); ++ DUP_FIELD(dev, _dev, dev.disk.sgio); + DUP_FIELD(dev, _dev, dev.disk.cache); + DUP_FIELD(dev, _dev, dev.disk.source); + DUP_FIELD(dev, _dev, dev.disk.virtual_dev); +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index a8cf7aa..a92e223 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -57,6 +57,7 @@ struct disk_device { + char *source; + char *virtual_dev; + char *rawio; ++ char *sgio; + enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type; + bool readonly; + bool shareable; +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 2f0f475..18c4765 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -214,6 +214,8 @@ static char *disk_block_xml(xmlNodePtr root, struct disk_device *dev) + xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device); + if (dev->rawio) + xmlNewProp(disk, BAD_CAST "rawio", BAD_CAST dev->rawio); ++ if (dev->sgio) ++ xmlNewProp(disk, BAD_CAST "sgio", BAD_CAST dev->sgio); + + if (dev->driver) { + tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL); +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index 5228f4b..6b649de 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -68,6 +68,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData + [Description ("rawio value of lun device")] + string rawio; + ++ [Description ("sgio value of lun device")] ++ string sgio; ++ + [Description ("if device is shareable")] + boolean shareable; + +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index 0800311..abfb09f 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -488,6 +488,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, + (CMPIValue *)dev->dev.disk.rawio, + CMPI_chars); + ++ if(dev->dev.disk.sgio) ++ CMSetProperty(inst, ++ "sgio", ++ (CMPIValue *)dev->dev.disk.sgio, ++ CMPI_chars); ++ + if(dev->dev.disk.shareable) + CMSetProperty(inst, + "shareable", +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index a9f7ae0..e146470 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1189,6 +1189,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + else + dev->dev.disk.rawio = strdup(val); + ++ if (cu_get_str_prop(inst, "sgio", &val) != CMPI_RC_OK) ++ dev->dev.disk.sgio = NULL; ++ else ++ dev->dev.disk.sgio = strdup(val); ++ + if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK) + dev->dev.disk.shareable = false; + else +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-1c7dfda2.patch b/SOURCES/libvirt-cim-0.6.3-1c7dfda2.patch new file mode 100644 index 0000000..ec12422 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-1c7dfda2.patch @@ -0,0 +1,210 @@ +From 1c7dfda2b543da27ea092a7cb9deab8b2917acba Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Tue, 5 Nov 2013 10:03:31 +0100 +Subject: [PATCH 32/48] build: Fix incorrect provider registration in upgrade + path + +The scriplet logic was incorrectly assuming that the superseded package's +%postun script would be called before the superceding packages %pre/%post. +This effectively broke upgrades of libvirt-cim because all the providers +were deregistered. +We are now checking whether we are in an upgrade situation and if so +will not deregister the providers in postun. +Another enhancement is that we do a full deregistration in the %post +section for tog-pegasus now. This should make installs and upgrades more +robust against potentially damaged repositories (e.g., on development +systems). + +As a reminder here's a short description of RPM's scriptlet processing. + +action: install upgrade uninstall + %pre 1 >1 - + %post 1 >1 - + %preun - 1 0 + %postun - 1 0 + +Scriptlet invocation order on upgrade +1. %pre(new_package) +2. %post(new_package) +3. %preun(old_package) +4. %postun(old_package) + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 115 +++++++++++++++++++++++++++++++--------------------- + 1 file changed, 68 insertions(+), 47 deletions(-) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index 459650c..b50cbd1 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -64,7 +64,6 @@ mkdir -p $RPM_BUILD_ROOT@INFO_STORE@ + %clean + rm -fr $RPM_BUILD_ROOT + +-%pre + %define REGISTRATION %{_datadir}/%{name}/*.registration + %define SCHEMA %{_datadir}/%{name}/*.mof + +@@ -77,24 +76,46 @@ rm -fr $RPM_BUILD_ROOT + %define CIMV2_REG %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,ElementConformsToProfile,HostedAccessPoint}.registration + %define CIMV2_MOF %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,RegisteredProfile,ComputerSystem,ElementConformsToProfile,HostedAccessPoint}.mof + ++%pre + # _If_ there is already a version of this installed, we must deregister + # the classes we plan to install in post, otherwise we may corrupt + # the pegasus repository. This is convention in other provider packages +-%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ +- -n @CIM_VIRT_NS@ \ +- -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true ++if [ $1 -gt 1 ] ++then ++ if [ -x /usr/sbin/cimserver ] ++ then ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n @CIM_VIRT_NS@ \ ++ -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/interop \ ++ -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/PG_InterOp \ ++ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/cimv2\ ++ -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true ++ fi + + # Remove open-pegasus-specific providers installed in sfcb repository + # by older libvirt-cim packages +-%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ +- -n root/PG_InterOp \ +- -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true +- ++ if [ -x /usr/sbin/sfcbd ] ++ then ++ %{_datadir}/%{name}/provider-register.sh -d -t sfcb \ ++ -n root/PG_InterOp \ ++ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true ++ fi ++fi + + %post + /sbin/ldconfig + +-%{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} ++if [ $1 -eq 1 ] ++then ++# Install the CIM base schema if this is the initial install ++ %{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} ++fi + + %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 + if [ "`systemctl is-active tog-pegasus.service`" = "active" ] +@@ -112,65 +133,65 @@ rm -fr $RPM_BUILD_ROOT + + if [ -x /usr/sbin/cimserver ] + then +-%{_datadir}/%{name}/provider-register.sh -t pegasus \ ++ %{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n @CIM_VIRT_NS@ \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t pegasus \ +- -n @CIM_VIRT_NS@ \ +- -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t pegasus \ ++ %{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t pegasus \ ++ %{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/PG_InterOp \ + -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t pegasus \ ++ %{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/cimv2\ + -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true + fi + if [ -x /usr/sbin/sfcbd ] + then +-%{_datadir}/%{name}/provider-register.sh -t sfcb \ +- -n root/virt \ +- -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t sfcb \ ++ %{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t sfcb \ ++ %{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -t sfcb \ ++ %{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/cimv2\ + -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true + fi + + %preun +-if [ -x /usr/sbin/cimserver ] ++# The uninstall scriptlets are called after the install scriptlets ++# in the upgrade case. Therefore we must only deregister the providers ++# when $1 == 0 (final remove). ++if [ $1 -eq 0 ] + then +-%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ +- -n root/virt \ +- -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ +- -n root/interop \ +- -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ +- -n root/PG_InterOp \ +- -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ +- -n root/cimv2 \ +- -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true +-fi +-if [ -x /usr/sbin/sfcbd ] +-then +-%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ +- -n root/virt \ +- -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ +- -n root/interop \ +- -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true +-%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ +- -n root/cimv2 \ +- -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true ++ if [ -x /usr/sbin/cimserver ] ++ then ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/virt \ ++ -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/interop \ ++ -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/PG_InterOp \ ++ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t pegasus \ ++ -n root/cimv2 \ ++ -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true ++ fi ++ if [ -x /usr/sbin/sfcbd ] ++ then ++ %{_datadir}/%{name}/provider-register.sh -d -t sfcb \ ++ -n root/virt \ ++ -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t sfcb \ ++ -n root/interop \ ++ -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true ++ %{_datadir}/%{name}/provider-register.sh -d -t sfcb \ ++ -n root/cimv2 \ ++ -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true ++ fi + fi + + %postun -p /sbin/ldconfig +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-1fae439d.patch b/SOURCES/libvirt-cim-0.6.3-1fae439d.patch new file mode 100644 index 0000000..73e75ea --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-1fae439d.patch @@ -0,0 +1,49 @@ +From 1fae439d0d06622d0f303c82c8b98f0a580c7774 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Thu, 29 Aug 2013 17:18:51 +0200 +Subject: [PATCH 09/60] S390: Avoid the generation of default input and + graphics + +KVM guests for the s390 architecture do not support graphics +and input devices. We use the os_info.fv.arch property to +recognize such guests and skip the default device generation +for those. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 3df878f..301f046 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -583,6 +583,12 @@ static bool default_graphics_device(struct domain *domain) + if (domain->type == DOMAIN_LXC) + return true; + ++ if ((domain->type == DOMAIN_KVM || domain->type == DOMAIN_QEMU) && ++ domain->os_info.fv.arch != NULL && ++ (XSTREQ(domain->os_info.fv.arch, "s390") || ++ XSTREQ(domain->os_info.fv.arch, "s390x" ))) ++ return true; ++ + free(domain->dev_graphics); + domain->dev_graphics = calloc(1, sizeof(*domain->dev_graphics)); + if (domain->dev_graphics == NULL) { +@@ -605,6 +611,12 @@ static bool default_input_device(struct domain *domain) + if (domain->type == DOMAIN_LXC) + return true; + ++ if ((domain->type == DOMAIN_KVM || domain->type == DOMAIN_QEMU) && ++ domain->os_info.fv.arch != NULL && ++ (XSTREQ(domain->os_info.fv.arch, "s390") || ++ XSTREQ(domain->os_info.fv.arch, "s390x" ))) ++ return true; ++ + free(domain->dev_input); + domain->dev_input = calloc(1, sizeof(*domain->dev_input)); + if (domain->dev_input == NULL) { +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-21dea212.patch b/SOURCES/libvirt-cim-0.6.3-21dea212.patch new file mode 100644 index 0000000..ea805d5 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-21dea212.patch @@ -0,0 +1,458 @@ +From 21dea2121ee1602e0b546b3e61b5a46c1ae2f54c Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Wed, 11 Sep 2013 16:45:40 +0200 +Subject: [PATCH 20/60] VSMS: Support for domains with console devices + +An instance of KVM_ConsoleResourceAllocationSettingData can be added to +domain specification for VSMS DefineSystem() to define a console for a domain. +A console definition can not be modified or deleted. +It only can be added at system definition and deleted at system deletion. +If a KVM_ConsoleRASD is specified on a system definition, +no default graphics adapter definition is done. + +Signed-off-by: Thilo Boehm +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 314 +++++++++++++++++++++++++++--- + 1 file changed, 291 insertions(+), 23 deletions(-) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 6629b35..d626691 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007, 2013 + * + * Authors: + * Dan Smith +@@ -626,7 +626,8 @@ static bool default_input_device(struct domain *domain) + + static bool add_default_devs(struct domain *domain) + { +- if (domain->dev_graphics_ct < 1) { ++ if (domain->dev_graphics_ct < 1 && ++ domain->dev_console_ct < 1) { + if (!default_graphics_device(domain)) + return false; + } +@@ -1339,47 +1340,294 @@ static int parse_sdl_address(const char *id, + return ret; + } + +-static int parse_vnc_address(const char *id, +- char **ip, +- char **port) ++static int parse_ip_address(const char *id, ++ char **ip, ++ char **port) + { + int ret; + char *tmp_ip = NULL; + char *tmp_port = NULL; + +- CU_DEBUG("Entering parse_vnc_address, address is %s", id); ++ CU_DEBUG("Entering parse_ip_address, address is %s", id); + if (strstr(id, "[") != NULL) { + /* its an ipv6 address */ + ret = sscanf(id, "%a[^]]]:%as", &tmp_ip, &tmp_port); +- strcat(tmp_ip, "]"); ++ if (tmp_ip != NULL) { ++ tmp_ip = realloc(tmp_ip, strlen(tmp_ip) + 2); ++ if (tmp_ip == NULL) { ++ ret = 0; ++ goto out; ++ } ++ strcat(tmp_ip, "]"); ++ } + } else { + ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port); + } + +- if (ret != 2) { ++ /* ret == 2: address and port, ret == 1: address only */ ++ if (ret < 1) { + ret = 0; + goto out; + } + +- if (ip) ++ if (ip) { + *ip = strdup(tmp_ip); ++ CU_DEBUG("IP = '%s'",*ip); ++ } + +- if (port) ++ if (port && tmp_port) { + *port = strdup(tmp_port); +- +- ret = 1; ++ CU_DEBUG("Port = '%s'",*port); ++ } + + out: +- if (ip && port) +- CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s", +- *ip, *port); +- + free(tmp_ip); + free(tmp_port); + + return ret; + } + ++static bool parse_console_url(const char *url, ++ char **protocol, ++ char **host, ++ char **port) ++{ ++ bool success = false; ++ char *tmp_protocol = NULL; ++ char *tmp_address = NULL; ++ ++ CU_DEBUG("Entering parse_console_url:'%s'", url); ++ ++ if (sscanf(url,"%a[^:]://%as", &tmp_protocol, &tmp_address) != 2) ++ goto out; ++ ++ if (parse_ip_address(tmp_address, host, port) < 1) ++ goto out; ++ ++ if (protocol) { ++ *protocol = strdup(tmp_protocol); ++ CU_DEBUG("Protocol = '%s'", *protocol); ++ } ++ ++ success = true; ++ ++ out: ++ free(tmp_protocol); ++ free(tmp_address); ++ ++ return success; ++} ++ ++static const char *_unixsock_console_rasd_to_vdev(CMPIInstance *inst, ++ struct console_device *cdev) ++{ ++ const char *val = NULL; ++ const char *val2 = NULL; ++ char* protocol = NULL; ++ ++ cdev->source_dev.unixsock.mode = NULL; ++ if (cu_get_str_prop(inst,"ConnectURL", &val) == CMPI_RC_OK) { ++ CU_DEBUG("ConnectURL = '%s'", val); ++ cdev->source_dev.unixsock.mode = strdup("connect"); ++ } ++ ++ if (cu_get_str_prop(inst, "BindURL", &val2) == CMPI_RC_OK) { ++ if (cdev->source_dev.unixsock.mode != NULL) ++ return "ConsoleRASD: Only one of ConnectURL or BindURL " ++ "is allowed for UNIX domain sockets."; ++ CU_DEBUG("BindURL = '%s'", val2); ++ cdev->source_dev.unixsock.mode = strdup("bind"); ++ val = val2; ++ } ++ ++ if (val) { ++ if (!parse_console_url(val, &protocol, &cdev->source_dev.unixsock.path, NULL)) ++ return "ConsoleRASD: Invalid ConnectURL or BindURL for " ++ "UNIX domain socket client/server."; ++ ++ if (protocol != NULL && !STREQC("file", protocol)) { ++ CU_DEBUG("Wrong ConsoleRASD protocol specified: '%s'", protocol); ++ free(protocol); ++ return "ConsoleRASD: Protocol 'file' was not specified for " ++ "ConnectURL or BindURL for UNIX domain socket client/server."; ++ } ++ free(protocol); ++ } else { ++ return "ConsoleRASD: ConnectURL or BindURL not specified for " ++ "UNIX domain socket client/server."; ++ } ++ ++ return NULL; ++} ++ ++static const char *_udp_console_rasd_to_vdev(CMPIInstance *inst, ++ struct console_device *cdev) ++{ ++ const char *val = NULL; ++ char* protocol = NULL; ++ ++ if (cu_get_str_prop(inst, "ConnectURL", &val) != CMPI_RC_OK) ++ return "ConsoleRASD: ConnectURL not specified for UDP network console."; ++ ++ if (!parse_console_url(val, &protocol, ++ &cdev->source_dev.udp.connect_host, ++ &cdev->source_dev.udp.connect_service)) ++ return "ConsoleRASD: Invalid ConnectURL specified for UDP network console."; ++ ++ if (protocol != NULL && !STREQC("udp", protocol)) { ++ CU_DEBUG("Wrong ConsoleRASD protocol specified: '%s'", protocol); ++ free(protocol); ++ return "ConsoleRASD: Protocol 'udp' was not specified at " ++ "ConnectURL for UDP network console."; ++ } ++ ++ free(protocol); ++ ++ if (cu_get_str_prop(inst, "BindURL", &val) != CMPI_RC_OK) ++ return "ConsoleRASD: BindURL not specified for UDP network console."; ++ ++ if (!parse_console_url(val, &protocol, ++ &cdev->source_dev.udp.bind_host, ++ &cdev->source_dev.udp.bind_service)) ++ return "ConsoleRASD: Invalid BindURL specified for UDP network console."; ++ ++ if (protocol != NULL && !STREQC("udp", protocol)) { ++ CU_DEBUG("Wrong ConsoleRASD protocol specified: '%s'", protocol); ++ free(protocol); ++ return "ConsoleRASD: Protocol 'udp' was not specified at BindURL " ++ "for UDP network console."; ++ } ++ ++ free(protocol); ++ return NULL; ++} ++ ++static const char *_tcp_console_rasd_to_vdev(CMPIInstance *inst, ++ struct console_device *cdev) ++{ ++ const char *val = NULL; ++ const char *val2 = NULL; ++ ++ cdev->source_dev.tcp.mode = NULL; ++ if (cu_get_str_prop(inst, "ConnectURL", &val) == CMPI_RC_OK) { ++ CU_DEBUG("ConnectURL = '%s'", val); ++ cdev->source_dev.tcp.mode = strdup("connect"); ++ } ++ ++ if (cu_get_str_prop(inst, "BindURL", &val2) == CMPI_RC_OK) { ++ if (cdev->source_dev.tcp.mode != NULL) ++ return "ConsoleRASD: Only one of ConnectURL or BindURL " ++ "is allowed for TCP sockets."; ++ CU_DEBUG("BindURL = '%s'", val2); ++ cdev->source_dev.tcp.mode = strdup("bind"); ++ val = val2; ++ } ++ ++ if (val) { ++ if (!parse_console_url(val, ++ &cdev->source_dev.tcp.protocol, ++ &cdev->source_dev.tcp.host, ++ &cdev->source_dev.tcp.service)) ++ return "ConsoleRASD: Invalid ConnectURL or BindURL for " ++ "TCP client/server console."; ++ if (cdev->source_dev.tcp.service == NULL) ++ return "ConsoleRASD: Missing TCP port for TCP client/server console."; ++ } else { ++ return "ConsoleRASD: ConnectURL or BindURL not specified for " ++ "TCP client/server console."; ++ } ++ ++ if (cdev->source_dev.tcp.protocol != NULL) { ++ if (STREQC("udp", cdev->source_dev.tcp.protocol)) { ++ CU_DEBUG("Wrong ConsoleRASD protocol specified: '%s'", ++ cdev->source_dev.tcp.protocol); ++ return "ConsoleRASD: Invalid protocol 'udp' was specified at " ++ "TCP client/server console."; ++ } else if (STREQC("file", cdev->source_dev.tcp.protocol)) { ++ CU_DEBUG("Wrong ConsoleRASD protocol specified: '%s'", ++ cdev->source_dev.tcp.protocol); ++ return "ConsoleRASD: Invalid protocol 'file' was specified at " ++ "TCP client/server console."; ++ } ++ } ++ ++ return NULL; ++} ++ ++static const char *console_rasd_to_vdev(CMPIInstance *inst, ++ struct virt_device *dev) ++{ ++ int rc = 0; ++ const char *msg = NULL; ++ const char *val = NULL; ++ struct console_device *cdev = &dev->dev.console; ++ uint16_t tmp; ++ ++ rc = cu_get_u16_prop(inst, "SourceType", &tmp); ++ if (rc != CMPI_RC_OK) ++ return "ConsoleRASD: SourceType field not specified."; ++ ++ if (tmp >= CIM_CHARDEV_SOURCE_TYPE_INVALIDTYPE) ++ return "ConsoleRASD: Invalid SourceType value"; ++ ++ cdev->source_type = tmp; ++ CU_DEBUG("Processing SourceType: %d", cdev->source_type); ++ ++ /* property not required */ ++ if (cu_get_str_prop(inst, "TargetType", &val) == CMPI_RC_OK) ++ cdev->target_type = strdup(val); ++ CU_DEBUG("TargetType is '%s'", cdev->target_type ? : "NULL" ); ++ ++ switch (cdev->source_type) { ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ /* property not required */ ++ if (cu_get_str_prop(inst, "SourcePath", &val) == CMPI_RC_OK) ++ cdev->source_dev.pty.path = strdup(val); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ if (cu_get_str_prop(inst, "SourcePath", &val) != CMPI_RC_OK) ++ return "ConsoleRASD: SourcePath not specified for Host device proxy."; ++ cdev->source_dev.dev.path = strdup(val); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ if (cu_get_str_prop(inst, "SourcePath", &val) != CMPI_RC_OK) ++ return "ConsoleRASD: SourcePath not specified for Device logfile."; ++ cdev->source_dev.file.path = strdup(val); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ if (cu_get_str_prop(inst, "SourcePath", &val) != CMPI_RC_OK) ++ return "ConsoleRASD: SourcePath not specified for Named pipe."; ++ cdev->source_dev.pipe.path = strdup(val); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ msg = _unixsock_console_rasd_to_vdev(inst, cdev); ++ if (msg != NULL) ++ return msg; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ msg = _udp_console_rasd_to_vdev(inst, cdev); ++ if (msg != NULL) ++ return msg; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ msg = _tcp_console_rasd_to_vdev(inst, cdev); ++ if (msg != NULL) ++ return msg; ++ break; ++ ++ default: ++ /* Nothing to do for : ++ CIM_CHARDEV_SOURCE_TYPE_STDIO ++ CIM_CHARDEV_SOURCE_TYPE_NULL ++ CIM_CHARDEV_SOURCE_TYPE_VC ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC ++ */ ++ break; ++ } ++ ++ return NULL; ++} ++ + static const char *graphics_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev) + { +@@ -1394,7 +1642,7 @@ static const char *graphics_rasd_to_vdev(CMPIInstance *inst, + } + dev->dev.graphics.type = strdup(val); + +- CU_DEBUG("graphics type = %s", dev->dev.graphics.type); ++ CU_DEBUG("graphics type = %s", dev->dev.graphics.type ? : "NULL"); + + /* FIXME: Add logic to prevent address:port collisions */ + if (STREQC(dev->dev.graphics.type, "vnc")) { +@@ -1411,10 +1659,10 @@ static const char *graphics_rasd_to_vdev(CMPIInstance *inst, + val = "127.0.0.1:-1"; + } + +- ret = parse_vnc_address(val, ++ ret = parse_ip_address(val, + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); +- if (ret != 1) { ++ if (ret != 2) { + msg = "GraphicsRASD field Address not valid"; + goto out; + } +@@ -1540,6 +1788,8 @@ static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, + return proc_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_GRAPHICS) { + return graphics_rasd_to_vdev(inst, dev); ++ } else if (type == CIM_RES_TYPE_CONSOLE) { ++ return console_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_INPUT) { + return input_rasd_to_vdev(inst, dev); + } +@@ -1601,7 +1851,7 @@ static const char *rasd_to_vdev(CMPIInstance *inst, + return msg; + } + +-static char *add_device_nodup(struct virt_device *dev, ++static const char *add_device_nodup(struct virt_device *dev, + struct virt_device *list, + int max, + int *index) +@@ -1663,6 +1913,9 @@ static const char *classify_resources(CMPIArray *resources, + if (!make_space(&domain->dev_graphics, domain->dev_graphics_ct, count)) + return "Failed to alloc graphics list"; + ++ if (!make_space(&domain->dev_console, domain->dev_console_ct, count)) ++ return "Failed to alloc console list"; ++ + if (!make_space(&domain->dev_input, domain->dev_input_ct, count)) + return "Failed to alloc input list"; + +@@ -1765,6 +2018,14 @@ static const char *classify_resources(CMPIArray *resources, + domain->dev_graphics, + gcount, + &domain->dev_graphics_ct); ++ } else if (type == CIM_RES_TYPE_CONSOLE) { ++ msg = rasd_to_vdev(inst, ++ domain, ++ &domain->dev_console[domain->dev_console_ct], ++ ns, ++ p_error); ++ if (msg == NULL) ++ domain->dev_console_ct+=1; + } else if (type == CIM_RES_TYPE_INPUT) { + domain->dev_input_ct = 1; + msg = rasd_to_vdev(inst, +@@ -2570,6 +2831,9 @@ static struct virt_device **find_list(struct domain *dominfo, + } else if (type == CIM_RES_TYPE_GRAPHICS) { + list = &dominfo->dev_graphics; + *count = &dominfo->dev_graphics_ct; ++ } else if (type == CIM_RES_TYPE_CONSOLE) { ++ list = &dominfo->dev_console; ++ *count = &dominfo->dev_console_ct; + } else if (type == CIM_RES_TYPE_INPUT) { + list = &dominfo->dev_input; + *count = &dominfo->dev_input_ct; +@@ -2693,7 +2957,8 @@ static CMPIStatus resource_del(struct domain *dominfo, + + if (STREQ(dev->id, devid)) { + if ((type == CIM_RES_TYPE_GRAPHICS) || +- (type == CIM_RES_TYPE_INPUT)) ++ (type == CIM_RES_TYPE_CONSOLE) || ++ (type == CIM_RES_TYPE_INPUT)) + cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); + else { + s = _resource_dynamic(dominfo, +@@ -2774,7 +3039,9 @@ static CMPIStatus resource_add(struct domain *dominfo, + goto out; + } + +- if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT)) { ++ if ((type == CIM_RES_TYPE_GRAPHICS) || ++ (type == CIM_RES_TYPE_INPUT) || ++ (type == CIM_RES_TYPE_CONSOLE)) { + (*count)++; + cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); + goto out; +@@ -2850,7 +3117,8 @@ static CMPIStatus resource_mod(struct domain *dominfo, + } + + if ((type == CIM_RES_TYPE_GRAPHICS) || +- (type == CIM_RES_TYPE_INPUT)) ++ (type == CIM_RES_TYPE_INPUT) || ++ (type == CIM_RES_TYPE_CONSOLE)) + cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); + else { + #if LIBVIR_VERSION_NUMBER < 9000 +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-222a3219.patch b/SOURCES/libvirt-cim-0.6.3-222a3219.patch new file mode 100644 index 0000000..4bac115 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-222a3219.patch @@ -0,0 +1,80 @@ +From 222a32198b3584ae221474a6d7288c91b8e76578 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Thu, 27 Mar 2014 16:36:32 -0400 +Subject: [PATCH 56/60] Add MOFS and change install for ControllerPools + +Add the new MOF and modify the build/install to handle. + +Signed-off-by: John Ferlan +--- + Makefile.am | 2 ++ + libvirt-cim.spec.in | 2 ++ + schema/ControllerPool.mof | 6 ++++++ + schema/ControllerPool.registration | 3 +++ + 4 files changed, 13 insertions(+) + create mode 100644 schema/ControllerPool.mof + create mode 100644 schema/ControllerPool.registration + +diff --git a/Makefile.am b/Makefile.am +index 24b11af..e332b5a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -56,6 +56,7 @@ MOFS = \ + $(top_srcdir)/schema/PointingDevice.mof \ + $(top_srcdir)/schema/GraphicsPool.mof \ + $(top_srcdir)/schema/InputPool.mof \ ++ $(top_srcdir)/schema/ControllerPool.mof \ + $(top_srcdir)/schema/HostedAccessPoint.mof \ + $(top_srcdir)/schema/ServiceAccessBySAP.mof \ + $(top_srcdir)/schema/SAPAvailableForElement.mof \ +@@ -147,6 +148,7 @@ REGS = \ + $(top_srcdir)/schema/PointingDevice.registration \ + $(top_srcdir)/schema/GraphicsPool.registration \ + $(top_srcdir)/schema/InputPool.registration \ ++ $(top_srcdir)/schema/ControllerPool.registration \ + $(top_srcdir)/schema/HostedAccessPoint.registration \ + $(top_srcdir)/schema/ServiceAccessBySAP.registration \ + $(top_srcdir)/schema/SAPAvailableForElement.registration \ +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index f4e4fcf..d876b81 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -114,6 +114,7 @@ rm -fr $RPM_BUILD_ROOT + %{_datadir}/%{name}/PointingDevice.registration \\\ + %{_datadir}/%{name}/GraphicsPool.registration \\\ + %{_datadir}/%{name}/InputPool.registration \\\ ++ %{_datadir}/%{name}/ControllerPool.registration \\\ + %{_datadir}/%{name}/HostedAccessPoint.registration \\\ + %{_datadir}/%{name}/ServiceAccessBySAP.registration \\\ + %{_datadir}/%{name}/SAPAvailableForElement.registration \\\ +@@ -176,6 +177,7 @@ rm -fr $RPM_BUILD_ROOT + %{_datadir}/%{name}/PointingDevice.mof \\\ + %{_datadir}/%{name}/GraphicsPool.mof \\\ + %{_datadir}/%{name}/InputPool.mof \\\ ++ %{_datadir}/%{name}/ControllerPool.mof \\\ + %{_datadir}/%{name}/HostedAccessPoint.mof \\\ + %{_datadir}/%{name}/ServiceAccessBySAP.mof \\\ + %{_datadir}/%{name}/SAPAvailableForElement.mof \\\ +diff --git a/schema/ControllerPool.mof b/schema/ControllerPool.mof +new file mode 100644 +index 0000000..6dbb8a8 +--- /dev/null ++++ b/schema/ControllerPool.mof +@@ -0,0 +1,6 @@ ++// Copyright Red Hat Corp. 2014 ++ ++[Provider("cmpi::Virt_DevicePool")] ++class KVM_ControllerPool : CIM_ResourcePool ++{ ++}; +diff --git a/schema/ControllerPool.registration b/schema/ControllerPool.registration +new file mode 100644 +index 0000000..0785f83 +--- /dev/null ++++ b/schema/ControllerPool.registration +@@ -0,0 +1,3 @@ ++# Copyright Red Hat Corp. 2014 ++# Classname Namespace ProviderName ProviderModule ProviderTypes ++KVM_ControllerPool root/virt Virt_DevicePool Virt_DevicePool instance +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-242ddaa6.patch b/SOURCES/libvirt-cim-0.6.3-242ddaa6.patch new file mode 100644 index 0000000..ed0d9ba --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-242ddaa6.patch @@ -0,0 +1,90 @@ +From 242ddaa613c4d41cbdd063b73d20292049944b47 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 7 Oct 2013 16:02:37 +0200 +Subject: [PATCH 24/60] KVMRedirectionSAP: Only return redirection SAPs for VNC + graphics + +Since pty consoles still show up as GraphicsRASDs the check for +VNC redirection proved to be too rigid. Instead of failing the +associator call, PTY consoles will just be ignored now. +This is an old bug, but will be exposed when cimtest is extended +to handle consoles. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Daniel Hansel +Signed-off-by: John Ferlan +--- + src/Virt_KVMRedirectionSAP.c | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/src/Virt_KVMRedirectionSAP.c b/src/Virt_KVMRedirectionSAP.c +index 708b0d1..1533e52 100644 +--- a/src/Virt_KVMRedirectionSAP.c ++++ b/src/Virt_KVMRedirectionSAP.c +@@ -264,28 +264,31 @@ static CMPIStatus get_vnc_sessions(const CMPIBroker *broker, + return s; + } + +-static bool check_graphics(virDomainPtr dom, +- struct domain **dominfo) ++static int check_graphics(virDomainPtr dom, ++ struct domain **dominfo) + { + int ret = 0; ++ int i; + + ret = get_dominfo(dom, dominfo); + if (!ret) { + CU_DEBUG("Unable to get domain info"); +- return false; ++ return -1; + } + + if ((*dominfo)->dev_graphics == NULL) { + CU_DEBUG("No graphics device associated with guest"); +- return false; ++ return -1; + } + +- if (!STREQC((*dominfo)->dev_graphics->dev.graphics.type, "vnc")) { +- CU_DEBUG("Only vnc devices have console redirection sessions"); +- return false; ++ for (i = 0; i < (*dominfo)->dev_graphics_ct; i++) { ++ if (STREQC((*dominfo)->dev_graphics[i].dev.graphics.type, "vnc")) { ++ return i; ++ } + } + +- return true; ++ CU_DEBUG("Only vnc devices have console redirection sessions"); ++ return -1; + } + + static CMPIStatus return_console_sap(const CMPIObjectPath *ref, +@@ -362,12 +365,13 @@ CMPIStatus enum_console_sap(const CMPIBroker *broker, + } + + for (i = 0; i < count; i++) { +- if (!check_graphics(domain_list[i], &dominfo)) { ++ int pos = check_graphics(domain_list[i], &dominfo); ++ if (pos < 0) { + cleanup_dominfo(&dominfo); + continue; + } + +- ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port, ++ ret = sscanf(dominfo->dev_graphics[pos].dev.graphics.dev.vnc.port, + "%d", + &lport); + if (ret != 1) { +@@ -449,7 +453,7 @@ CMPIStatus get_console_sap_by_name(const CMPIBroker *broker, + goto out; + } + +- if (!check_graphics(dom, &dominfo)) { ++ if (check_graphics(dom, &dominfo) < 0) { + virt_set_status(broker, &s, + CMPI_RC_ERR_FAILED, + conn, +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-2cbbac52.patch b/SOURCES/libvirt-cim-0.6.3-2cbbac52.patch new file mode 100644 index 0000000..fe20804 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-2cbbac52.patch @@ -0,0 +1,29 @@ +From 2cbbac52e45e0a21ed052adf79ec0e011f9e3b83 Mon Sep 17 00:00:00 2001 +From: Pavel Hrdina +Date: Wed, 7 May 2014 12:52:15 +0200 +Subject: [PATCH 58/60] xmlgen: fix build issue + +Function controller_protocol_type_IDToStr() returns a const char +and we should abide that. + +Signed-off-by: Pavel Hrdina +Signed-off-by: John Ferlan +--- + libxkutil/xmlgen.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 3174ca9..a9a672d 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -807,7 +807,7 @@ static const char *controller_xml(xmlNodePtr root, struct domain *dominfo) + for (i = 0; i < dominfo->dev_controller_ct; i++) { + xmlNodePtr ctlr; + xmlNodePtr tmp; +- char *type_str; ++ const char *type_str; + + struct virt_device *_dev = &dominfo->dev_controller[i]; + if (_dev->type == CIM_RES_TYPE_UNKNOWN) +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-2e9c18d6.patch b/SOURCES/libvirt-cim-0.6.3-2e9c18d6.patch new file mode 100644 index 0000000..4eaa83e --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-2e9c18d6.patch @@ -0,0 +1,207 @@ +From 2e9c18d6dc04f79fab9ce46e16d69635d2ace48f Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Wed, 13 Nov 2013 19:07:10 +0100 +Subject: [PATCH 37/60] FilterEntry: Fix endianness issues + +A number of CIM properties was set in an endianness-unsafe manner +leading to failures on big endian systems. + +Signed-off-by: Thilo Boehm +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_FilterEntry.c | 53 ++++++++++++++++++++++++++------------------------ + src/Virt_FilterEntry.h | 2 +- + src/Virt_FilterList.c | 3 ++- + 3 files changed, 31 insertions(+), 27 deletions(-) + +diff --git a/src/Virt_FilterEntry.c b/src/Virt_FilterEntry.c +index b7042da..ab4a512 100644 +--- a/src/Virt_FilterEntry.c ++++ b/src/Virt_FilterEntry.c +@@ -59,8 +59,8 @@ struct rule_data_t { + const char *dstportend; + }; + +-static int octets_from_mac(const char * s, unsigned int *buffer, +- unsigned int size) ++static int octets_from_mac(const char * s, uint8_t *buffer, ++ unsigned int size) + { + unsigned int _buffer[6]; + unsigned int i, n = 0; +@@ -86,8 +86,8 @@ static int octets_from_mac(const char * s, unsigned int *buffer, + return n; + } + +-static int octets_from_ip(const char * s, unsigned int *buffer, +- unsigned int size) ++static int octets_from_ip(const char * s, uint8_t *buffer, ++ unsigned int size) + { + struct in6_addr addr; + unsigned int family = 0; +@@ -116,7 +116,8 @@ static int octets_from_ip(const char * s, unsigned int *buffer, + return n; + } + +-static CMPIArray *octets_to_cmpi(const CMPIBroker *broker, unsigned int *bytes, int size) ++static CMPIArray *octets_to_cmpi(const CMPIBroker *broker, uint8_t *bytes, ++ int size) + { + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIArray *array = NULL; +@@ -173,7 +174,7 @@ static char *cidr_to_str(const char *cidr) + return ret; + } + +-static int convert_direction(const char *s) ++static uint16_t convert_direction(const char *s) + { + enum {NOT_APPLICABLE, INPUT, OUTPUT, BOTH} direction = NOT_APPLICABLE; + +@@ -189,7 +190,7 @@ static int convert_direction(const char *s) + return direction; + } + +-int convert_priority(const char *s) ++int16_t convert_priority(const char *s) + { + if (s == NULL) + return 0; +@@ -197,7 +198,7 @@ int convert_priority(const char *s) + return atoi(s); + } + +-static int convert_action(const char *s) ++static uint16_t convert_action(const char *s) + { + enum {NONE=0, ACCEPT, DENY, REJECT, RETURN, CONTINUE} action = NONE; + +@@ -216,7 +217,7 @@ static int convert_action(const char *s) + return action; + } + +-static unsigned long convert_protocol_id(const char *s) ++static uint16_t convert_protocol_id(const char *s) + { + enum {NONE = 0, IPV4 = 2048, ARP = 2054, RARP = 32821, IPV6 = 34525} id = NONE; + +@@ -239,7 +240,7 @@ static void convert_mac_rule_to_instance( + CMPIInstance *inst, + const CMPIBroker *broker) + { +- unsigned int bytes[48]; ++ uint8_t bytes[48]; + unsigned int size = 0; + CMPIArray *array = NULL; + +@@ -280,7 +281,7 @@ static void convert_mac_rule_to_instance( + (CMPIValue *)&array, CMPI_uint8A); + + if (rule->var.mac.protocol_id != NULL) { +- unsigned long n = convert_protocol_id(rule->var.mac.protocol_id); ++ uint16_t n = convert_protocol_id(rule->var.mac.protocol_id); + + /* Unknown protocolid string. Try converting from hexadecimal value */ + if (n == 0) +@@ -366,18 +367,19 @@ static void convert_ip_rule_to_instance( + CMPIInstance *inst, + const CMPIBroker *broker) + { +- unsigned int bytes[48]; ++ uint8_t bytes[48]; + unsigned int size = 0; +- unsigned int n = 0; ++ uint8_t ipver_num = 0; ++ uint16_t port_num = 0; + CMPIArray *array = NULL; + struct rule_data_t rule_data; + + if (strstr(rule->protocol_id, "v6")) +- n = 6; ++ ipver_num = 6; + else +- n = 4; ++ ipver_num = 4; + +- CMSetProperty(inst, "HdrIPVersion",(CMPIValue *)&n, CMPI_uint8); ++ CMSetProperty(inst, "HdrIPVersion",(CMPIValue *)&ipver_num, CMPI_uint8); + + fill_rule_data(rule, &rule_data); + +@@ -480,27 +482,27 @@ static void convert_ip_rule_to_instance( + } + + if (rule_data.srcportstart) { +- n = atoi(rule_data.srcportstart); ++ port_num = atoi(rule_data.srcportstart); + CMSetProperty(inst, "HdrSrcPortStart", +- (CMPIValue *)&n, CMPI_uint16); ++ (CMPIValue *)&port_num, CMPI_uint16); + } + + if (rule_data.srcportend) { +- n = atoi(rule_data.srcportend); ++ port_num = atoi(rule_data.srcportend); + CMSetProperty(inst, "HdrSrcPortEnd", +- (CMPIValue *)&n, CMPI_uint16); ++ (CMPIValue *)&port_num, CMPI_uint16); + } + + if (rule_data.dstportstart) { +- n = atoi(rule_data.dstportstart); ++ port_num = atoi(rule_data.dstportstart); + CMSetProperty(inst, "HdrDestPortStart", +- (CMPIValue *)&n, CMPI_uint16); ++ (CMPIValue *)&port_num, CMPI_uint16); + } + + if (rule_data.dstportend) { +- n = atoi(rule_data.dstportend); ++ port_num = atoi(rule_data.dstportend); + CMSetProperty(inst, "HdrDestPortEnd", +- (CMPIValue *)&n, CMPI_uint16); ++ (CMPIValue *)&port_num, CMPI_uint16); + } + } + +@@ -515,7 +517,8 @@ static CMPIInstance *convert_rule_to_instance( + const char *sys_name = NULL; + const char *sys_ccname = NULL; + const char *basename = NULL; +- int action, direction, priority = 0; ++ uint16_t action, direction; ++ int16_t priority; + + void (*convert_f)(struct acl_rule*, CMPIInstance*, const CMPIBroker*); + +diff --git a/src/Virt_FilterEntry.h b/src/Virt_FilterEntry.h +index 5057fb0..0589aa0 100644 +--- a/src/Virt_FilterEntry.h ++++ b/src/Virt_FilterEntry.h +@@ -77,7 +77,7 @@ CMPIStatus instance_from_rule( + * + * @param s A pointer to a string representing the priority + */ +-int convert_priority(const char *s); ++int16_t convert_priority(const char *s); + #endif + + /* +diff --git a/src/Virt_FilterList.c b/src/Virt_FilterList.c +index 7026d8b..b248004 100644 +--- a/src/Virt_FilterList.c ++++ b/src/Virt_FilterList.c +@@ -45,7 +45,8 @@ static CMPIInstance *convert_filter_to_instance( + CMPIInstance *inst = NULL; + const char *sys_name = NULL; + const char *sys_ccname = NULL; +- int direction = 0, priority; ++ uint16_t direction = 0; ++ int16_t priority; + + inst = get_typed_instance(broker, + CLASSNAME(reference), +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-3c3a541d.patch b/SOURCES/libvirt-cim-0.6.3-3c3a541d.patch new file mode 100644 index 0000000..2d721a3 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-3c3a541d.patch @@ -0,0 +1,28 @@ +From 3c3a541db6824849d330930efb7c30f89cf826fa Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Thu, 8 Aug 2013 15:46:48 -0400 +Subject: [PATCH 06/48] spec: Replace the path to the tar.gz file + +Commit '07adabc2' seems to have inadvertently removed the path +to the source ftp file added by commit '5412bf11'. + +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index cd399b1..98f2a75 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -6,7 +6,7 @@ Version: @PACKAGE_VERSION@ + Release: 1%{?dist}%{?extra_release} + License: LGPLv2+ + Group: Development/Libraries +-Source: libvirt-cim-%{version}.tar.gz ++Source: ftp://libvirt.org/libvirt-cim/libvirt-cim-%{version}.tar.gz + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + URL: http://libvirt.org/CIM/ + Requires: libxml2 >= 2.6.0 +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-3e6f1489.patch b/SOURCES/libvirt-cim-0.6.3-3e6f1489.patch new file mode 100644 index 0000000..807f709 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-3e6f1489.patch @@ -0,0 +1,1042 @@ +From 3e6f148988ad7d0e61cdc821bd972dec7b9a5300 Mon Sep 17 00:00:00 2001 +From: Boris Fiuczynski +Date: Thu, 29 Aug 2013 17:18:52 +0200 +Subject: [PATCH 10/60] libxkutil: Provide easy access to the libvirt + capabilities + +Introspecting the libvirt capabilities and creating an internal capabilities +data structure. Methods are provided for retrieving default values regarding +architecture, machine and emulator for easy of use in the provider code. + +Changed the KVM detection to use the capabilities instead of unique +XML parsing. + +Further, xml_parse_test was extendend to display hypervisor capabilities +and defaults. + +Signed-off-by: Boris Fiuczynski +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/Makefile.am | 2 + + libxkutil/capability_parsing.c | 551 +++++++++++++++++++++++++++++++++++++++++ + libxkutil/capability_parsing.h | 97 ++++++++ + libxkutil/device_parsing.c | 29 --- + libxkutil/device_parsing.h | 2 - + libxkutil/xml_parse_test.c | 201 ++++++++++++++- + 6 files changed, 848 insertions(+), 34 deletions(-) + create mode 100644 libxkutil/capability_parsing.c + create mode 100644 libxkutil/capability_parsing.h + +diff --git a/libxkutil/Makefile.am b/libxkutil/Makefile.am +index 8d436ad..dd7be55 100644 +--- a/libxkutil/Makefile.am ++++ b/libxkutil/Makefile.am +@@ -7,6 +7,7 @@ noinst_HEADERS = \ + cs_util.h \ + misc_util.h \ + device_parsing.h \ ++ capability_parsing.h \ + xmlgen.h \ + infostore.h \ + pool_parsing.h \ +@@ -20,6 +21,7 @@ libxkutil_la_SOURCES = \ + cs_util_instance.c \ + misc_util.c \ + device_parsing.c \ ++ capability_parsing.c \ + xmlgen.c \ + infostore.c \ + pool_parsing.c \ +diff --git a/libxkutil/capability_parsing.c b/libxkutil/capability_parsing.c +new file mode 100644 +index 0000000..2acd45b +--- /dev/null ++++ b/libxkutil/capability_parsing.c +@@ -0,0 +1,551 @@ ++/* ++ * Copyright IBM Corp. 2013 ++ * ++ * Authors: ++ * Boris Fiuczynski ++ * ++ * 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, see ++ * . ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "misc_util.h" ++#include "capability_parsing.h" ++#include "xmlgen.h" ++#include "../src/svpc_types.h" ++ ++static void cleanup_cap_machine(struct cap_machine *machine) ++{ ++ if (machine == NULL) ++ return; ++ free(machine->name); ++ free(machine->canonical_name); ++} ++ ++static void cleanup_cap_domain_info(struct cap_domain_info *cgdi) ++{ ++ int i; ++ if (cgdi == NULL) ++ return; ++ free(cgdi->emulator); ++ free(cgdi->loader); ++ for (i = 0; i < cgdi->num_machines; i++) ++ cleanup_cap_machine(&cgdi->machines[i]); ++ free(cgdi->machines); ++} ++ ++static void cleanup_cap_domain(struct cap_domain *cgd) ++{ ++ if (cgd == NULL) ++ return; ++ free(cgd->typestr); ++ cleanup_cap_domain_info(&cgd->guest_domain_info); ++} ++ ++static void cleanup_cap_arch(struct cap_arch *cga) ++{ ++ int i; ++ if (cga == NULL) ++ return; ++ free(cga->name); ++ cleanup_cap_domain_info(&cga->default_domain_info); ++ for (i = 0; i < cga->num_domains; i++) ++ cleanup_cap_domain(&cga->domains[i]); ++ free(cga->domains); ++} ++ ++static void cleanup_cap_guest(struct cap_guest *cg) ++{ ++ if (cg == NULL) ++ return; ++ free(cg->ostype); ++ cleanup_cap_arch(&cg->arch); ++} ++ ++static void cleanup_cap_host(struct cap_host *ch) ++{ ++ if (ch == NULL) ++ return; ++ free(ch->cpu_arch); ++} ++ ++void cleanup_capabilities(struct capabilities **caps) ++{ ++ int i; ++ struct capabilities *cap; ++ ++ if ((caps == NULL) || (*caps == NULL)) ++ return; ++ ++ cap = *caps; ++ cleanup_cap_host(&cap->host); ++ for (i = 0; i < cap->num_guests; i++) ++ cleanup_cap_guest(&cap->guests[i]); ++ ++ free(cap->guests); ++ free(cap); ++ *caps = NULL; ++} ++ ++static void extend_cap_machines(struct cap_domain_info *cg_domaininfo, ++ char *name, char *canonical_name) ++{ ++ struct cap_machine *tmp_list = NULL; ++ tmp_list = realloc(cg_domaininfo->machines, ++ (cg_domaininfo->num_machines + 1) * ++ sizeof(struct cap_machine)); ++ ++ if (tmp_list == NULL) { ++ /* Nothing you can do. Just go on. */ ++ CU_DEBUG("Could not alloc space for " ++ "guest domain info list"); ++ return; ++ } ++ cg_domaininfo->machines = tmp_list; ++ ++ struct cap_machine *cap_gm = ++ &cg_domaininfo->machines[cg_domaininfo->num_machines]; ++ cap_gm->name = name; ++ cap_gm->canonical_name = canonical_name; ++ cg_domaininfo->num_machines++; ++} ++ ++static void parse_cap_domain_info(struct cap_domain_info *cg_domaininfo, ++ xmlNode *domain_child_node) ++{ ++ CU_DEBUG("Capabilities guest domain info element node: %s", ++ domain_child_node->name); ++ ++ if (XSTREQ(domain_child_node->name, "emulator")) { ++ cg_domaininfo->emulator = ++ get_node_content(domain_child_node); ++ } else if (XSTREQ(domain_child_node->name, "loader")) { ++ cg_domaininfo->loader = ++ get_node_content(domain_child_node); ++ } else if (XSTREQ(domain_child_node->name, "machine")) { ++ extend_cap_machines(cg_domaininfo, ++ get_node_content(domain_child_node), ++ get_attr_value(domain_child_node, ++ "canonical")); ++ } ++} ++ ++static void parse_cap_domain(struct cap_domain *cg_domain, ++ xmlNode *guest_dom) ++{ ++ CU_DEBUG("Capabilities guest domain node: %s", guest_dom->name); ++ ++ xmlNode *child; ++ ++ cg_domain->typestr = get_attr_value(guest_dom, "type"); ++ ++ for (child = guest_dom->children; child != NULL; child = child->next) ++ parse_cap_domain_info(&cg_domain->guest_domain_info, child); ++} ++ ++static void parse_cap_arch(struct cap_arch *cg_archinfo, ++ xmlNode *arch) ++{ ++ CU_DEBUG("Capabilities arch node: %s", arch->name); ++ ++ xmlNode *child; ++ ++ cg_archinfo->name = get_attr_value(arch, "name"); ++ ++ for (child = arch->children; child != NULL; child = child->next) { ++ if (XSTREQ(child->name, "wordsize")) { ++ char *wordsize_str; ++ unsigned int wordsize; ++ wordsize_str = get_node_content(child); ++ /* Default to 0 wordsize if garbage */ ++ if (wordsize_str == NULL || ++ sscanf(wordsize_str, "%i", &wordsize) != 1) ++ wordsize = 0; ++ free(wordsize_str); ++ cg_archinfo->wordsize = wordsize; ++ } else if (XSTREQ(child->name, "domain")) { ++ struct cap_domain *tmp_list = NULL; ++ tmp_list = realloc(cg_archinfo->domains, ++ (cg_archinfo->num_domains + 1) * ++ sizeof(struct cap_domain)); ++ if (tmp_list == NULL) { ++ /* Nothing you can do. Just go on. */ ++ CU_DEBUG("Could not alloc space for " ++ "guest domain"); ++ continue; ++ } ++ memset(&tmp_list[cg_archinfo->num_domains], ++ 0, sizeof(struct cap_domain)); ++ cg_archinfo->domains = tmp_list; ++ parse_cap_domain(&cg_archinfo-> ++ domains[cg_archinfo->num_domains], ++ child); ++ cg_archinfo->num_domains++; ++ } else { ++ /* Check for the default domain child nodes */ ++ parse_cap_domain_info(&cg_archinfo->default_domain_info, ++ child); ++ } ++ } ++} ++ ++static void parse_cap_guests(xmlNodeSet *nsv, struct cap_guest *cap_guests) ++{ ++ xmlNode **nodes = nsv->nodeTab; ++ xmlNode *child; ++ int numGuestNodes = nsv->nodeNr; ++ int i; ++ ++ for (i = 0; i < numGuestNodes; i++) { ++ for (child = nodes[i]->children; child != NULL; ++ child = child->next) { ++ if (XSTREQ(child->name, "os_type")) { ++ STRPROP((&cap_guests[i]), ostype, child); ++ } else if (XSTREQ(child->name, "arch")) { ++ parse_cap_arch(&cap_guests[i].arch, child); ++ } ++ } ++ } ++} ++ ++static int parse_cap_host_cpu(struct cap_host *cap_host, xmlNode *cpu) ++{ ++ xmlNode *child; ++ ++ for (child = cpu->children; child != NULL; child = child->next) { ++ if (XSTREQ(child->name, "arch")) { ++ cap_host->cpu_arch = get_node_content(child); ++ if (cap_host->cpu_arch != NULL) ++ return 1; /* success - host arch node found */ ++ else { ++ CU_DEBUG("Host architecture is not defined"); ++ break; ++ } ++ } ++ } ++ return 0; /* error - no arch node or empty arch node */ ++} ++ ++static int parse_cap_host(xmlNodeSet *nsv, struct cap_host *cap_host) ++{ ++ xmlNode **nodes = nsv->nodeTab; ++ xmlNode *child; ++ if (nsv->nodeNr < 1) ++ return 0; /* error no node below host */ ++ ++ for (child = nodes[0]->children; child != NULL; child = child->next) { ++ if (XSTREQ(child->name, "cpu")) ++ return parse_cap_host_cpu(cap_host, child); ++ } ++ return 0; /* error - no cpu node */ ++} ++ ++static void compare_copy_domain_info_machines( ++ struct cap_domain_info *def_gdomi, ++ struct cap_domain_info *cap_gadomi) ++{ ++ int i,j; ++ int org_l = cap_gadomi->num_machines; ++ char *cp_name = NULL; ++ char *cp_canonical_name = NULL; ++ bool found; ++ ++ for (i = 0; i < def_gdomi->num_machines; i++) { ++ found = false; ++ for (j = 0; j < org_l; j++) { ++ if (STREQC(def_gdomi->machines[i].name, ++ cap_gadomi->machines[j].name)) { ++ found = true; ++ continue; ++ /* found match => check next default */ ++ } ++ } ++ if (!found) { /* no match => insert default */ ++ cp_name = NULL; ++ cp_canonical_name = NULL; ++ if (def_gdomi->machines[i].name != NULL) ++ cp_name = strdup(def_gdomi->machines[i].name); ++ if (def_gdomi->machines[i].canonical_name != NULL) ++ cp_canonical_name = ++ strdup(def_gdomi-> ++ machines[i].canonical_name); ++ ++ extend_cap_machines(cap_gadomi, ++ cp_name, ++ cp_canonical_name); ++ } ++ } ++} ++ ++static void extend_defaults_cap_guests(struct capabilities *caps) ++{ ++ struct cap_arch *cap_garch; ++ struct cap_domain_info *cap_gadomi; ++ struct cap_domain_info *def_gdomi; ++ int i,j; ++ ++ if (caps == NULL) ++ return; ++ ++ for (i = 0; i < caps->num_guests; i++) { ++ cap_garch = &caps->guests[i].arch; ++ def_gdomi = &cap_garch->default_domain_info; ++ ++ for (j = 0; j < cap_garch->num_domains; j++) { ++ /* compare guest_domain_info */ ++ cap_gadomi = &cap_garch->domains[j].guest_domain_info; ++ if (cap_gadomi->emulator == NULL && ++ def_gdomi->emulator != NULL) ++ cap_gadomi->emulator = ++ strdup(def_gdomi->emulator); ++ if (cap_gadomi->loader == NULL && ++ def_gdomi->loader != NULL) ++ cap_gadomi->loader = strdup(def_gdomi->loader); ++ ++ compare_copy_domain_info_machines(def_gdomi, ++ cap_gadomi); ++ } ++ } ++} ++ ++static int _get_capabilities(const char *xml, struct capabilities *caps) ++{ ++ int len; ++ int ret = 0; ++ ++ xmlDoc *xmldoc = NULL; ++ xmlXPathContext *xpathctx = NULL; ++ xmlXPathObject *xpathobj = NULL; ++ const xmlChar *xpathhoststr = (xmlChar *)"//capabilities//host"; ++ const xmlChar *xpathgueststr = (xmlChar *)"//capabilities//guest"; ++ xmlNodeSet *nsv; ++ ++ len = strlen(xml) + 1; ++ ++ if ((xmldoc = xmlParseMemory(xml, len)) == NULL) ++ goto err; ++ ++ if ((xpathctx = xmlXPathNewContext(xmldoc)) == NULL) ++ goto err; ++ ++ /* host node */ ++ if ((xpathobj = xmlXPathEvalExpression(xpathhoststr, xpathctx)) == NULL) ++ goto err; ++ if (xmlXPathNodeSetIsEmpty(xpathobj->nodesetval)) { ++ CU_DEBUG("No capabilities host node found!"); ++ goto err; ++ } ++ ++ nsv = xpathobj->nodesetval; ++ if (!parse_cap_host(nsv, &caps->host)) ++ goto err; ++ xmlXPathFreeObject(xpathobj); ++ ++ /* all guest nodes */ ++ if ((xpathobj = xmlXPathEvalExpression(xpathgueststr, xpathctx)) == NULL) ++ goto err; ++ if (xmlXPathNodeSetIsEmpty(xpathobj->nodesetval)) { ++ CU_DEBUG("No capabilities guest nodes found!"); ++ goto err; ++ } ++ ++ nsv = xpathobj->nodesetval; ++ caps->guests = calloc(nsv->nodeNr, sizeof(struct cap_guest)); ++ if (caps->guests == NULL) ++ goto err; ++ caps->num_guests = nsv->nodeNr; ++ ++ parse_cap_guests(nsv, caps->guests); ++ extend_defaults_cap_guests(caps); ++ ret = 1; ++ ++ err: ++ xmlXPathFreeObject(xpathobj); ++ xmlXPathFreeContext(xpathctx); ++ xmlFreeDoc(xmldoc); ++ return ret; ++} ++ ++int get_caps_from_xml(const char *xml, struct capabilities **caps) ++{ ++ CU_DEBUG("In get_caps_from_xml"); ++ ++ free(*caps); ++ *caps = calloc(1, sizeof(struct capabilities)); ++ if (*caps == NULL) ++ goto err; ++ ++ if (_get_capabilities(xml, *caps) == 0) ++ goto err; ++ ++ return 1; ++ ++ err: ++ free(*caps); ++ *caps = NULL; ++ return 0; ++} ++ ++int get_capabilities(virConnectPtr conn, struct capabilities **caps) ++{ ++ char *caps_xml = NULL; ++ int ret = 0; ++ ++ if (conn == NULL) { ++ CU_DEBUG("Unable to connect to libvirt."); ++ return 0; ++ } ++ ++ caps_xml = virConnectGetCapabilities(conn); ++ ++ if (caps_xml == NULL) { ++ CU_DEBUG("Unable to get capabilities xml."); ++ return 0; ++ } ++ ++ ret = get_caps_from_xml(caps_xml, caps); ++ ++ free(caps_xml); ++ ++ return ret; ++} ++ ++struct cap_domain_info *findDomainInfo(struct capabilities *caps, ++ const char *os_type, ++ const char *arch, ++ const char *domain_type) ++{ ++ int i,j; ++ struct cap_arch *ar; ++ ++ for (i = 0; i < caps->num_guests; i++) { ++ if (os_type == NULL || ++ STREQC(caps->guests[i].ostype, os_type)) { ++ ar = &caps->guests[i].arch; ++ if (arch == NULL || STREQC(ar->name,arch)) ++ for (j = 0; j < ar->num_domains; j++) ++ if (domain_type == NULL || ++ STREQC(ar->domains[j].typestr, ++ domain_type)) ++ return &ar->domains[j]. ++ guest_domain_info; ++ } ++ } ++ return NULL; ++} ++ ++static char *_findDefArch(struct capabilities *caps, ++ const char *os_type, ++ const char *host_arch) ++{ ++ char *ret = NULL; ++ int i; ++ ++ for (i = 0; i < caps->num_guests; i++) { ++ if (STREQC(caps->guests[i].ostype, os_type) && ++ (host_arch == NULL || (host_arch != NULL && ++ STREQC(caps->guests[i].arch.name, host_arch)))) { ++ ret = caps->guests[i].arch.name; ++ break; ++ } ++ } ++ return ret; ++} ++ ++char *get_default_arch(struct capabilities *caps, ++ const char *os_type) ++{ ++ char *ret = NULL; ++ ++ if (caps != NULL && os_type != NULL) { ++ /* search first guest matching os_type and host arch */ ++ ret = _findDefArch(caps, os_type, caps->host.cpu_arch); ++ if (ret == NULL) /* search first matching guest */ ++ ret = _findDefArch(caps, os_type, NULL); ++ } ++ return ret; ++} ++ ++char *get_default_machine( ++ struct capabilities *caps, ++ const char *os_type, ++ const char *arch, ++ const char *domain_type) ++{ ++ char *ret = NULL; ++ struct cap_domain_info *di; ++ ++ if (caps != NULL) { ++ di = findDomainInfo(caps, os_type, arch, domain_type); ++ if (di != NULL && di->num_machines > 0) { ++ ret = di->machines[0].canonical_name ? ++ di->machines[0].canonical_name : ++ di->machines[0].name; ++ } ++ } ++ return ret; ++} ++ ++char *get_default_emulator(struct capabilities *caps, ++ const char *os_type, ++ const char *arch, ++ const char *domain_type) ++{ ++ char *ret = NULL; ++ struct cap_domain_info *di; ++ ++ if (caps != NULL) { ++ di = findDomainInfo(caps, os_type, arch, domain_type); ++ if (di != NULL) ++ ret = di->emulator; ++ } ++ return ret; ++} ++ ++bool use_kvm(struct capabilities *caps) { ++ if (host_supports_kvm(caps) && !get_disable_kvm()) ++ return true; ++ return false; ++} ++ ++bool host_supports_kvm(struct capabilities *caps) ++{ ++ bool kvm = false; ++ if (caps != NULL) { ++ if (findDomainInfo(caps, NULL, NULL, "kvm") != NULL) ++ kvm = true; ++ } ++ return kvm; ++} ++/* ++ * Local Variables: ++ * mode: C ++ * c-set-style: "K&R" ++ * tab-width: 8 ++ * c-basic-offset: 8 ++ * indent-tabs-mode: nil ++ * End: ++ */ +diff --git a/libxkutil/capability_parsing.h b/libxkutil/capability_parsing.h +new file mode 100644 +index 0000000..41a4933 +--- /dev/null ++++ b/libxkutil/capability_parsing.h +@@ -0,0 +1,97 @@ ++/* ++ * Copyright IBM Corp. 2013 ++ * ++ * Authors: ++ * Boris Fiuczynski ++ * ++ * 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, see ++ * . ++ */ ++#ifndef __CAPABILITY_PARSING_H ++#define __CAPABILITY_PARSING_H ++ ++#include ++#include ++ ++struct cap_host { ++ char *cpu_arch; ++}; ++ ++struct cap_machine { ++ char *name; ++ char *canonical_name; ++}; ++ ++struct cap_domain_info { ++ char *emulator; ++ char *loader; ++ int num_machines; ++ struct cap_machine *machines; ++}; ++ ++struct cap_domain { ++ char *typestr; ++ struct cap_domain_info guest_domain_info; ++}; ++ ++struct cap_arch { ++ char *name; ++ unsigned int wordsize; ++ struct cap_domain_info default_domain_info; ++ int num_domains; ++ struct cap_domain *domains; ++}; ++ ++struct cap_guest { ++ char *ostype; ++ struct cap_arch arch; ++}; ++ ++struct capabilities { ++ struct cap_host host; ++ int num_guests; ++ struct cap_guest *guests; ++}; ++ ++int get_caps_from_xml(const char *xml, struct capabilities **caps); ++int get_capabilities(virConnectPtr conn, struct capabilities **caps); ++char *get_default_arch(struct capabilities *caps, ++ const char *os_type); ++char *get_default_machine(struct capabilities *caps, ++ const char *os_type, ++ const char *arch, ++ const char *domain_type); ++char *get_default_emulator(struct capabilities *caps, ++ const char *os_type, ++ const char *arch, ++ const char *domain_type); ++struct cap_domain_info *findDomainInfo(struct capabilities *caps, ++ const char *os_type, ++ const char *arch, ++ const char *domain_type); ++bool use_kvm(struct capabilities *caps); ++bool host_supports_kvm(struct capabilities *caps); ++void cleanup_capabilities(struct capabilities **caps); ++ ++#endif ++ ++/* ++ * Local Variables: ++ * mode: C ++ * c-set-style: "K&R" ++ * tab-width: 8 ++ * c-basic-offset: 8 ++ * indent-tabs-mode: nil ++ * End: ++ */ +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 7af3953..fa9f998 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -397,35 +397,6 @@ err: + return 0; + } + +-bool has_kvm_domain_type(xmlNodePtr node) +-{ +- xmlNodePtr child = NULL; +- char *type = NULL; +- bool ret = false; +- +- child = node->children; +- while (child != NULL) { +- if (XSTREQ(child->name, "domain")) { +- type = get_attr_value(child, "type"); +- if (XSTREQ(type, "kvm")) { +- ret = true; +- goto out; +- } +- } +- +- if (has_kvm_domain_type(child) == 1) { +- ret = true; +- goto out; +- } +- +- child = child->next; +- } +- +- out: +- free(type); +- return ret; +-} +- + static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) + { + struct virt_device *vdev = NULL; +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index df5080c..14e49b8 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -226,8 +226,6 @@ int attach_device(virDomainPtr dom, struct virt_device *dev); + int detach_device(virDomainPtr dom, struct virt_device *dev); + int change_device(virDomainPtr dom, struct virt_device *dev); + +-bool has_kvm_domain_type(xmlNodePtr node); +- + #define XSTREQ(x, y) (STREQ((char *)x, y)) + #define STRPROP(d, p, n) (d->p = get_node_content(n)) + +diff --git a/libxkutil/xml_parse_test.c b/libxkutil/xml_parse_test.c +index 384593d..af5e508 100644 +--- a/libxkutil/xml_parse_test.c ++++ b/libxkutil/xml_parse_test.c +@@ -6,6 +6,7 @@ + #include + + #include "device_parsing.h" ++#include "capability_parsing.h" + #include "xmlgen.h" + + static void print_value(FILE *d, const char *name, const char *val) +@@ -25,6 +26,36 @@ static void print_u32(FILE *d, const char *name, uint32_t val) + } + #endif + ++static char *get_ostype(struct domain *dom) ++{ ++ if (dom->type == DOMAIN_XENPV) { ++ return dom->os_info.pv.type; ++ } else if ((dom->type == DOMAIN_XENFV) || ++ (dom->type == DOMAIN_KVM) || ++ (dom->type == DOMAIN_QEMU)) { ++ return dom->os_info.fv.type; ++ } else if (dom->type == DOMAIN_LXC) { ++ return dom->os_info.lxc.type; ++ } else { ++ return NULL; ++ } ++} ++ ++static char *get_domaintype(struct domain *dom) ++{ ++ if (dom->type == DOMAIN_XENPV || dom->type == DOMAIN_XENFV) { ++ return "xen"; ++ } else if (dom->type == DOMAIN_KVM) { ++ return "kvm"; ++ } else if (dom->type == DOMAIN_QEMU) { ++ return "qemu"; ++ } else if (dom->type == DOMAIN_LXC) { ++ return "lxc"; ++ } else { ++ return NULL; ++ } ++} ++ + static void print_os(struct domain *dom, + FILE *d) + { +@@ -183,6 +214,98 @@ static char *read_from_file(FILE *file) + return xml; + } + ++static void print_cap_domain_info(struct cap_domain_info *capgdiinfo, ++ FILE *d) ++{ ++ struct cap_machine capgminfo; ++ int i; ++ ++ if (capgdiinfo == NULL) ++ return; ++ ++ if (capgdiinfo->emulator != NULL) ++ print_value(d, " Emulator", capgdiinfo->emulator); ++ if (capgdiinfo->loader != NULL) ++ print_value(d, " Loader", capgdiinfo->loader); ++ for (i = 0; i < capgdiinfo->num_machines; i++) { ++ capgminfo = capgdiinfo->machines[i]; ++ fprintf(d, " Machine name : %-15s canonical name : %s\n", ++ capgminfo.name, capgminfo.canonical_name); ++ } ++ fprintf(d, "\n"); ++} ++ ++static void print_cap_domains(struct cap_arch caparchinfo, ++ FILE *d) ++{ ++ struct cap_domain capgdinfo; ++ int i; ++ for (i = 0; i < caparchinfo.num_domains; i++) { ++ capgdinfo = caparchinfo.domains[i]; ++ print_value(d, " Type", capgdinfo.typestr); ++ print_cap_domain_info(&capgdinfo.guest_domain_info, d); ++ } ++} ++ ++static void print_cap_arch(struct cap_arch caparchinfo, ++ FILE *d) ++{ ++ print_value(d, " Arch name", caparchinfo.name); ++ fprintf(d, " Arch wordsize : %i\n", caparchinfo.wordsize); ++ fprintf(d, "\n -- Default guest domain settings --\n"); ++ print_cap_domain_info(&caparchinfo.default_domain_info, d); ++ fprintf(d, " -- Guest domains (%i) --\n", caparchinfo.num_domains); ++ print_cap_domains(caparchinfo, d); ++} ++ ++static void print_cap_guest(struct cap_guest *capginfo, ++ FILE *d) ++{ ++ print_value(d, "Guest OS type", capginfo->ostype); ++ print_cap_arch(capginfo->arch, d); ++} ++ ++static void print_cap_host(struct cap_host *caphinfo, ++ FILE *d) ++{ ++ print_value(d, "Host CPU architecture", caphinfo->cpu_arch); ++} ++ ++static void print_capabilities(struct capabilities *capsinfo, ++ FILE *d) ++{ ++ int i; ++ fprintf(d, "\n### Capabilities ###\n"); ++ fprintf(d, "-- Host --\n"); ++ print_cap_host(&capsinfo->host, d); ++ fprintf(d, "\n-- Guest (%i) --\n", capsinfo->num_guests); ++ for (i = 0; i < capsinfo->num_guests; i++) ++ print_cap_guest(&capsinfo->guests[i], d); ++} ++ ++static int capinfo_for_dom(const char *uri, ++ struct domain *dominfo, ++ struct capabilities **capsinfo) ++{ ++ virConnectPtr conn = NULL; ++ char *caps_xml = NULL; ++ int ret = 0; ++ ++ conn = virConnectOpen(uri); ++ if (conn == NULL) { ++ printf("Unable to connect to libvirt\n"); ++ goto out; ++ } ++ ++ ret = get_capabilities(conn, capsinfo); ++ ++ out: ++ free(caps_xml); ++ virConnectClose(conn); ++ ++ return ret; ++} ++ + static int dominfo_from_dom(const char *uri, + const char *domain, + struct domain **d) +@@ -246,12 +369,13 @@ static int dominfo_from_file(const char *fname, struct domain **d) + static void usage(void) + { + printf("xml_parse_test -f [FILE | -] [--xml]\n" +- "xml_parse_test -d domain [--uri URI] [--xml]\n" ++ "xml_parse_test -d domain [--uri URI] [--xml] [--cap]\n" + "\n" + "-f,--file FILE Parse domain XML from file (or stdin if -)\n" + "-d,--domain DOM Display dominfo for a domain from libvirt\n" + "-u,--uri URI Connect to libvirt with URI\n" + "-x,--xml Dump generated XML instead of summary\n" ++ "-c,--cap Display the libvirt default capability values for the specified domain\n" + "-h,--help Display this help message\n"); + } + +@@ -262,7 +386,10 @@ int main(int argc, char **argv) + char *uri = "xen"; + char *file = NULL; + bool xml = false; ++ bool cap = false; + struct domain *dominfo = NULL; ++ struct capabilities *capsinfo = NULL; ++ struct cap_domain_info *capgdinfo = NULL; + int ret; + + static struct option lopts[] = { +@@ -270,13 +397,14 @@ int main(int argc, char **argv) + {"uri", 1, 0, 'u'}, + {"xml", 0, 0, 'x'}, + {"file", 1, 0, 'f'}, ++ {"cap", 0, 0, 'c'}, + {"help", 0, 0, 'h'}, + {0, 0, 0, 0}}; + + while (1) { + int optidx = 0; + +- c = getopt_long(argc, argv, "d:u:f:xh", lopts, &optidx); ++ c = getopt_long(argc, argv, "d:u:f:xch", lopts, &optidx); + if (c == -1) + break; + +@@ -297,11 +425,14 @@ int main(int argc, char **argv) + xml = true; + break; + ++ case 'c': ++ cap = true; ++ break; ++ + case '?': + case 'h': + usage(); + return c == '?'; +- + }; + } + +@@ -326,6 +457,70 @@ int main(int argc, char **argv) + print_devices(dominfo, stdout); + } + ++ if (cap && file == NULL) { ++ ret = capinfo_for_dom(uri, dominfo, &capsinfo); ++ if (ret == 0) { ++ printf("Unable to get capsinfo\n"); ++ return 3; ++ } else { ++ print_capabilities(capsinfo, stdout); ++ const char *os_type = get_ostype(dominfo); ++ const char *dom_type = get_domaintype(dominfo); ++ const char *def_arch = get_default_arch(capsinfo, os_type); ++ ++ fprintf(stdout, "-- KVM is used: %s\n\n", (use_kvm(capsinfo)?"true":"false")); ++ fprintf(stdout, "-- For all following default OS type=%s\n", os_type); ++ fprintf(stdout, "-- Default Arch : %s\n", def_arch); ++ ++ fprintf(stdout, ++ "-- Default Machine for arch=NULL : %s\n", ++ get_default_machine(capsinfo, os_type, NULL, NULL)); ++ fprintf(stdout, ++ "-- Default Machine for arch=%s and domain type=NULL : %s\n", ++ def_arch, ++ get_default_machine(capsinfo, os_type, def_arch, NULL)); ++ fprintf(stdout, ++ "-- Default Machine for arch=%s and domain type=%s : %s\n", ++ def_arch, dom_type, ++ get_default_machine(capsinfo, os_type, def_arch, dom_type)); ++ fprintf(stdout, ++ "-- Default Machine for arch=NULL and domain type=%s : %s\n", ++ dom_type, ++ get_default_machine(capsinfo, os_type, NULL, dom_type)); ++ ++ fprintf(stdout, ++ "-- Default Emulator for arch=NULL : %s\n", ++ get_default_emulator(capsinfo, os_type, NULL, NULL)); ++ fprintf(stdout, ++ "-- Default Emulator for arch=%s and domain type=NULL : %s\n", ++ def_arch, ++ get_default_emulator(capsinfo, os_type, def_arch, NULL)); ++ fprintf(stdout, ++ "-- Default Emulator for arch=%s and domain type=%s : %s\n", ++ def_arch, dom_type, ++ get_default_emulator(capsinfo, os_type, def_arch, dom_type)); ++ fprintf(stdout, ++ "-- Default Emulator for arch=NULL and domain type=%s : %s\n", ++ dom_type, ++ get_default_emulator(capsinfo, os_type, NULL, dom_type)); ++ ++ fprintf(stdout, "\n-- Default Domain Search for: \n" ++ "guest type=hvm - guest arch=* - guest domain type=kvm\n"); ++ capgdinfo = findDomainInfo(capsinfo, "hvm", NULL, "kvm"); ++ print_cap_domain_info(capgdinfo, stdout); ++ ++ fprintf(stdout, "-- Default Domain Search for: \n" ++ "guest type=* - guest arch=* - guest domain type=*\n"); ++ capgdinfo = findDomainInfo(capsinfo, NULL, NULL, NULL); ++ print_cap_domain_info(capgdinfo, stdout); ++ ++ cleanup_capabilities(&capsinfo); ++ } ++ } else if (cap) { ++ printf("Need a data source (--domain) to get default capabilities\n"); ++ return 4; ++ } ++ + return 0; + } + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-4013f9a0.patch b/SOURCES/libvirt-cim-0.6.3-4013f9a0.patch new file mode 100644 index 0000000..216288d --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-4013f9a0.patch @@ -0,0 +1,149 @@ +From 4013f9a0d205be6c7edff9b1263ab350d781c4cc Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Wed, 22 Jan 2014 11:15:11 -0500 +Subject: [PATCH 42/60] libxkutil:device_parsing: Coverity cleanups + +A new version of Coverity found a number of issues: + +parse_os(): RESOURCE_LEAK + - A benign issue due to using a for() loop in order to process the + XML fields. Although it's not possible to have a second entry with + the same text, Coverity doesn't know that so flagged each of the + get_attr_value() calls with a possible overwrite of allocated memory. + In order to "fix' that - just check for each being NULL prior to + the setting - a benign fix that shuts Coverity up + + - A real issue was found - the 'loader' variable wasn't free()'d + +parse_console_device(): RESOURCE_LEAK + + - A benign issue due to using a for() loop in order to process the + XML fields results in 'target_port_ID' and 'udp_source_mode' being + flagged for possible overwrites. For the 'udp_source_mode' changed + the code to declare, use, free only within the scope of the case. + +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 41 +++++++++++++++++++++++------------------ + 1 file changed, 23 insertions(+), 18 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 56e39c7..4dd9e58 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -853,7 +853,6 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) + struct console_device *cdev = NULL; + char *source_type_str = NULL; + char *target_port_ID = NULL; +- char *udp_source_mode = NULL; + + xmlNode *child = NULL; + +@@ -875,7 +874,7 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) + CU_DEBUG("console device type ID = %d", cdev->source_type); + + for (child = node->children; child != NULL; child = child->next) { +- if (XSTREQ(child->name, "target")) { ++ if (XSTREQ(child->name, "target") && target_port_ID == NULL) { + cdev->target_type = get_attr_value(child, "type"); + CU_DEBUG("Console device target type = '%s'", + cdev->target_type ? : "NULL"); +@@ -910,7 +909,9 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) + get_attr_value(child, "path"); + break; + case CIM_CHARDEV_SOURCE_TYPE_UDP: +- udp_source_mode = get_attr_value(child, "mode"); ++ { ++ char *udp_source_mode = get_attr_value(child, ++ "mode"); + if (udp_source_mode == NULL) + goto err; + if (STREQC(udp_source_mode, "bind")) { +@@ -925,10 +926,13 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) + get_attr_value(child, "service"); + } else { + CU_DEBUG("unknown udp mode: %s", +- udp_source_mode ? : "NULL"); ++ udp_source_mode); ++ free(udp_source_mode); + goto err; + } ++ free(udp_source_mode); + break; ++ } + case CIM_CHARDEV_SOURCE_TYPE_TCP: + cdev->source_dev.tcp.mode = + get_attr_value(child, "mode"); +@@ -965,14 +969,12 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) + *vdevs = vdev; + free(source_type_str); + free(target_port_ID); +- free(udp_source_mode); + + return 1; + + err: + free(source_type_str); + free(target_port_ID); +- free(udp_source_mode); + cleanup_console_device(cdev); + free(vdev); + +@@ -1500,33 +1502,35 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + for (child = os->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "type")) { + STRPROP(dominfo, os_info.pv.type, child); +- arch = get_attr_value(child, "arch"); +- machine = get_attr_value(child, "machine"); +- } else if (XSTREQ(child->name, "kernel")) ++ if (arch == NULL) ++ arch = get_attr_value(child, "arch"); ++ if (machine == NULL) ++ machine = get_attr_value(child, "machine"); ++ } else if (XSTREQ(child->name, "kernel") && kernel == NULL) + kernel = get_node_content(child); +- else if (XSTREQ(child->name, "initrd")) ++ else if (XSTREQ(child->name, "initrd") && initrd == NULL) + initrd = get_node_content(child); +- else if (XSTREQ(child->name, "cmdline")) ++ else if (XSTREQ(child->name, "cmdline") && cmdline == NULL) + cmdline = get_node_content(child); +- else if (XSTREQ(child->name, "loader")) ++ else if (XSTREQ(child->name, "loader") && loader == NULL) + loader = get_node_content(child); +- else if (XSTREQ(child->name, "boot")) { ++ else if (XSTREQ(child->name, "boot") && boot == NULL) { + char **tmp_list = NULL; + +- tmp_list = (char **)realloc(blist, +- (bl_size + 1) * ++ tmp_list = (char **)realloc(blist, ++ (bl_size + 1) * + sizeof(char *)); + if (tmp_list == NULL) { + // Nothing you can do. Just go on. + CU_DEBUG("Could not alloc space for " + "boot device"); +- continue; ++ continue; + } + blist = tmp_list; +- ++ + blist[bl_size] = get_attr_value(child, "dev"); + bl_size++; +- } else if (XSTREQ(child->name, "init")) ++ } else if (XSTREQ(child->name, "init") && init == NULL) + init = get_node_content(child); + } + +@@ -1580,6 +1584,7 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + free(kernel); + free(initrd); + free(cmdline); ++ free(loader); + free(boot); + free(init); + cleanup_bootlist(blist, bl_size); +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-43ea7135.patch b/SOURCES/libvirt-cim-0.6.3-43ea7135.patch new file mode 100644 index 0000000..be66ccf --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-43ea7135.patch @@ -0,0 +1,98 @@ +From 43ea7135654413b50601612ab0ab18cd8c47d84c Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Mon, 26 May 2014 17:00:35 +0800 +Subject: [PATCH 60/60] Complete the support for dumpCore + +Add API support for dumpCore field of Memory devices and fix issue in +parse_mem_device() when parsing dumpCore field. + +Signed-off-by: Xu Wang +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 5 +++-- + schema/ResourceAllocationSettingData.mof | 3 +++ + src/Virt_RASD.c | 8 ++++++++ + src/Virt_VirtualSystemManagementService.c | 11 +++++++++++ + 4 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index f863cc5..815feea 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -850,9 +850,9 @@ static int parse_mem_device(xmlNode *node, struct virt_device **vdevs) + else if (XSTREQ(node->name, "memory")) { + sscanf(content, "%" PRIu64, &mdev->maxsize); + tmpval = get_attr_value(node, "dumpCore"); +- if (tmpval && XSTREQ(tmpval, "on")) { ++ if (tmpval && STREQC(tmpval, "on")) { + mdev->dumpCore = MEM_DUMP_CORE_ON; +- } else if (tmpval && XSTREQ(content, "off")) { ++ } else if (tmpval && STREQC(tmpval, "off")) { + mdev->dumpCore = MEM_DUMP_CORE_OFF; + } else { + mdev->dumpCore = MEM_DUMP_CORE_NOT_SET; +@@ -1438,6 +1438,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + } else if (dev->type == CIM_RES_TYPE_MEM) { + dev->dev.mem.size = _dev->dev.mem.size; + dev->dev.mem.maxsize = _dev->dev.mem.maxsize; ++ dev->dev.mem.dumpCore = _dev->dev.mem.dumpCore; + } else if (dev->type == CIM_RES_TYPE_PROC) { + dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; + } else if (dev->type == CIM_RES_TYPE_EMU) { +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index f78d423..ba57b55 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -229,6 +229,9 @@ class Xen_MemResourceAllocationSettingData : Xen_ResourceAllocationSettingData + ] + class KVM_MemResourceAllocationSettingData : KVM_ResourceAllocationSettingData + { ++ [Description ("dumpCore could be set as 'on' or 'off'. " ++ "it also could be leave null.")] ++ boolean dumpCore; + }; + + [Description ("LXC virtual memory"), +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index 761d053..9a028bd 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -1047,6 +1047,14 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, + (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); + CMSetProperty(inst, "Limit", + (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64); ++ ++ if (dev->dev.mem.dumpCore != MEM_DUMP_CORE_NOT_SET) { ++ bool dumpCore = true; ++ if (dev->dev.mem.dumpCore == MEM_DUMP_CORE_OFF) ++ dumpCore = false; ++ CMSetProperty(inst, "dumpCore", ++ (CMPIValue *)&dumpCore, CMPI_boolean); ++ } + } else if (dev->type == CIM_RES_TYPE_PROC) { + set_proc_rasd_params(broker, ref, dev, host, inst); + } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index c640360..bf96afe 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1239,6 +1239,17 @@ static const char *mem_rasd_to_vdev(CMPIInstance *inst, + const char *units; + CMPIrc ret; + int shift; ++ bool dumpCore; ++ ++ ret = cu_get_bool_prop(inst, "dumpCore", &dumpCore); ++ if (ret != CMPI_RC_OK) { ++ dev->dev.mem.dumpCore = MEM_DUMP_CORE_NOT_SET; ++ } else { ++ if (dumpCore) ++ dev->dev.mem.dumpCore = MEM_DUMP_CORE_ON; ++ else ++ dev->dev.mem.dumpCore = MEM_DUMP_CORE_OFF; ++ } + + ret = cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size); + if (ret != CMPI_RC_OK) +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-48b28b6a.patch b/SOURCES/libvirt-cim-0.6.3-48b28b6a.patch new file mode 100644 index 0000000..e015846 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-48b28b6a.patch @@ -0,0 +1,400 @@ +From 48b28b6aec23b82c0239aee60af2a470c06dde1a Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Mon, 17 Mar 2014 19:21:23 -0400 +Subject: [PATCH 51/60] Parse/Store controller XML tags + +Parse and store the XML tags. The generated DeviceID will +be a combination of "controller" + XML device "name" + XML Index "value". +This should be unique enough now and generates "controller:pci:0" or +"controller:usb:0" DeviceID's. + +In the future, if support is added for the "" XML child a new +mechanism will need to be put in place since one of those controllers is +designed to have the same name and index - what changes is the function +for the device. + +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 119 ++++++++++++++++++++++++++++++++++++++++++++- + libxkutil/xmlgen.c | 74 +++++++++++++++++++++++++++- + 2 files changed, 191 insertions(+), 2 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index d2d3859..f863cc5 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007, 2013 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -49,6 +49,7 @@ + #define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics | "\ + "/domain/devices/console" + #define INPUT_XPATH (xmlChar *)"/domain/devices/input" ++#define CONTROLLER_XPATH (xmlChar *)"/domain/devices/controller" + + #define DEFAULT_BRIDGE "xenbr0" + #define DEFAULT_NETWORK "default" +@@ -69,6 +70,7 @@ static void cleanup_device_address(struct device_address *addr) + if (addr == NULL) + return; + ++ CU_DEBUG("Cleanup %d addresses", addr->ct); + for (i = 0; i < addr->ct; i++) { + free(addr->key[i]); + free(addr->value[i]); +@@ -84,6 +86,7 @@ static void cleanup_disk_device(struct disk_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean Disk type %s", dev->type); + free(dev->type); + free(dev->device); + free(dev->driver); +@@ -103,6 +106,7 @@ static void cleanup_vsi_device(struct vsi_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean VSI type %s", dev->vsi_type); + free(dev->vsi_type); + free(dev->manager_id); + free(dev->type_id); +@@ -117,6 +121,7 @@ static void cleanup_net_device(struct net_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean net type %s", dev->type); + free(dev->type); + free(dev->mac); + free(dev->source); +@@ -134,6 +139,7 @@ static void cleanup_emu_device(struct emu_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean emu %s", dev->path); + free(dev->path); + } + +@@ -157,6 +163,7 @@ static void cleanup_graphics_device(struct graphics_device *dev) + if (dev == NULL || dev->type == NULL) + return; + ++ CU_DEBUG("Clean graphics type %s", dev->type); + if (STREQC(dev->type, "sdl")) + cleanup_sdl_device(dev); + else +@@ -170,6 +177,7 @@ static void cleanup_path_device(struct path_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean path device %s", dev->path); + free(dev->path); + + } +@@ -179,6 +187,7 @@ static void cleanup_unixsock_device(struct unixsock_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean unixsock device"); + free(dev->path); + free(dev->mode); + +@@ -189,6 +198,7 @@ static void cleanup_tcp_device(struct tcp_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean tcp device"); + free(dev->mode); + free(dev->protocol); + free(dev->host); +@@ -201,6 +211,7 @@ static void cleanup_udp_device(struct udp_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean udb bind device"); + free(dev->bind_host); + free(dev->bind_service); + free(dev->connect_host); +@@ -212,6 +223,7 @@ static void cleanup_console_device(struct console_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean console source_type %d", dev->source_type); + switch (dev->source_type) + { + case CIM_CHARDEV_SOURCE_TYPE_PTY: +@@ -304,10 +316,24 @@ static void cleanup_input_device(struct input_device *dev) + if (dev == NULL) + return; + ++ CU_DEBUG("Clean input device %s", dev->type); + free(dev->type); + free(dev->bus); + } + ++static void cleanup_controller_device(struct controller_device *dev) ++{ ++ if (dev == NULL) ++ return; ++ ++ CU_DEBUG("Clean controller device %d", dev->type); ++ free(dev->model); ++ free(dev->queues); ++ free(dev->ports); ++ free(dev->vectors); ++ cleanup_device_address(&dev->address); ++} ++ + void cleanup_virt_device(struct virt_device *dev) + { + if (dev == NULL) +@@ -325,6 +351,8 @@ void cleanup_virt_device(struct virt_device *dev) + cleanup_input_device(&dev->dev.input); + else if (dev->type == CIM_RES_TYPE_CONSOLE) + cleanup_console_device(&dev->dev.console); ++ else if (dev->type == CIM_RES_TYPE_CONTROLLER) ++ cleanup_controller_device(&dev->dev.controller); + + free(dev->id); + +@@ -339,6 +367,7 @@ void cleanup_virt_devices(struct virt_device **_devs, int count) + for (i = 0; i < count; i++) + cleanup_virt_device(&devs[i]); + ++ CU_DEBUG("All devices cleaned"); + free(devs); + *_devs = NULL; + } +@@ -1107,6 +1136,75 @@ static int parse_input_device(xmlNode *node, struct virt_device **vdevs) + return 0; + } + ++static int parse_controller_device(xmlNode *cnode, struct virt_device **vdevs) ++{ ++ struct virt_device *vdev = NULL; ++ struct controller_device *cdev = NULL; ++ char *type_str = NULL; ++ xmlNode *child = NULL; ++ char *index = NULL; ++ int ret; ++ ++ vdev = calloc(1, sizeof(*vdev)); ++ if (vdev == NULL) ++ goto err; ++ ++ cdev = &(vdev->dev.controller); ++ ++ type_str = get_attr_value(cnode, "type"); ++ if (type_str == NULL) { ++ CU_DEBUG("No type"); ++ goto err; ++ } ++ CU_DEBUG("controller device type = %s", type_str); ++ cdev->type = controller_protocol_type_StrToID(type_str); ++ if (cdev->type == CIM_CONTROLLER_PROTOCOL_TYPE_UNKNOWN) { ++ CU_DEBUG("Unknown controller protocol type (%d)", cdev->type); ++ goto err; ++ } ++ ++ index = get_attr_value(cnode, "index"); ++ if (index != NULL) { ++ sscanf(index, "%" PRIu64, &cdev->index); ++ free(index); ++ } else { ++ CU_DEBUG("No index"); ++ goto err; ++ } ++ ++ cdev->model = get_attr_value(cnode, "model"); ++ cdev->ports = get_attr_value(cnode, "ports"); ++ cdev->vectors = get_attr_value(cnode, "vectors"); ++ ++ for (child = cnode->children; child != NULL; child = child->next) { ++ if (XSTREQ(child->name, "address")) { ++ parse_device_address(child, &cdev->address); ++ } else if (XSTREQ(child->name, "driver")) { ++ cdev->queues = get_attr_value(child, "queues"); ++ } ++ } ++ vdev->type = CIM_RES_TYPE_CONTROLLER; ++ ++ ret = asprintf(&vdev->id, "controller:%s:%" PRIu64, ++ type_str, cdev->index); ++ if (ret == -1) { ++ CU_DEBUG("Failed to create controller id string"); ++ goto err; ++ } ++ CU_DEBUG("Controller id is %s", vdev->id); ++ free(type_str); ++ ++ *vdevs = vdev; ++ ++ return 1; ++ err: ++ free(type_str); ++ cleanup_controller_device(cdev); ++ free(vdev); ++ ++ return 0; ++} ++ + static bool resize_devlist(struct virt_device **list, int newsize) + { + struct virt_device *_list; +@@ -1230,6 +1328,11 @@ static int parse_devices(const char *xml, struct virt_device **_list, int type) + func = &parse_input_device; + break; + ++ case CIM_RES_TYPE_CONTROLLER: ++ xpathstr = CONTROLLER_XPATH; ++ func = &parse_controller_device; ++ break; ++ + default: + CU_DEBUG("Unrecognized device type. Returning."); + goto err1; +@@ -1351,7 +1454,17 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + } else if (dev->type == CIM_RES_TYPE_CONSOLE) { + console_device_dup(&dev->dev.console, + &_dev->dev.console); ++ } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { ++ dev->dev.controller.type = _dev->dev.controller.type; ++ dev->dev.controller.index = _dev->dev.controller.index; ++ DUP_FIELD(dev, _dev, dev.controller.model); ++ DUP_FIELD(dev, _dev, dev.controller.ports); ++ DUP_FIELD(dev, _dev, dev.controller.vectors); ++ DUP_FIELD(dev, _dev, dev.controller.queues); ++ duplicate_device_address(&dev->dev.controller.address, ++ &_dev->dev.controller.address); + } ++ + return dev; + } + +@@ -1731,6 +1844,9 @@ int get_dominfo_from_xml(const char *xml, struct domain **dominfo) + (*dominfo)->dev_vcpu_ct = parse_devices(xml, + &(*dominfo)->dev_vcpu, + CIM_RES_TYPE_PROC); ++ (*dominfo)->dev_controller_ct = parse_devices(xml, ++ &(*dominfo)->dev_controller, ++ CIM_RES_TYPE_CONTROLLER); + + return ret; + +@@ -1819,6 +1935,7 @@ void cleanup_dominfo(struct domain **dominfo) + cleanup_virt_devices(&dom->dev_graphics, dom->dev_graphics_ct); + cleanup_virt_devices(&dom->dev_input, dom->dev_input_ct); + cleanup_virt_devices(&dom->dev_console, dom->dev_console_ct); ++ cleanup_virt_devices(&dom->dev_controller, dom->dev_controller_ct); + + free(dom); + +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 18c4765..3174ca9 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007, 2013 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -798,6 +798,72 @@ static const char *input_xml(xmlNodePtr root, struct domain *dominfo) + return NULL; + } + ++static const char *controller_xml(xmlNodePtr root, struct domain *dominfo) ++{ ++ int i; ++ const char *msg = NULL; ++ ++ CU_DEBUG("Found %d controllers", dominfo->dev_controller_ct); ++ for (i = 0; i < dominfo->dev_controller_ct; i++) { ++ xmlNodePtr ctlr; ++ xmlNodePtr tmp; ++ char *type_str; ++ ++ struct virt_device *_dev = &dominfo->dev_controller[i]; ++ if (_dev->type == CIM_RES_TYPE_UNKNOWN) ++ continue; ++ ++ struct controller_device *cdev = &_dev->dev.controller; ++ ++ ctlr = xmlNewChild(root, NULL, BAD_CAST "controller", NULL); ++ if (ctlr == NULL) ++ return XML_ERROR; ++ ++ ++ type_str = controller_protocol_type_IDToStr(cdev->type); ++ if (type_str == NULL) ++ return XML_ERROR; ++ ++ CU_DEBUG("Type=%s Index=%" PRIu64, type_str, cdev->index); ++ xmlNewProp(ctlr, BAD_CAST "type", ++ BAD_CAST type_str); ++ ++ /* If index is missing, let libvirt generate it */ ++ if (cdev->index != CONTROLLER_INDEX_NOT_SET) { ++ char *index; ++ if (asprintf(&index, "%" PRIu64, cdev->index) == -1) ++ return XML_ERROR; ++ xmlNewProp(ctlr, BAD_CAST "index", BAD_CAST index); ++ free(index); ++ } ++ ++ /* Optional */ ++ if (cdev->model) ++ xmlNewProp(ctlr, BAD_CAST "model", ++ BAD_CAST cdev->model); ++ if (cdev->ports) ++ xmlNewProp(ctlr, BAD_CAST "ports", ++ BAD_CAST cdev->ports); ++ if (cdev->vectors) ++ xmlNewProp(ctlr, BAD_CAST "vectors", ++ BAD_CAST cdev->vectors); ++ if (cdev->queues) { ++ tmp = xmlNewChild(ctlr, NULL, BAD_CAST "driver", NULL); ++ xmlNewProp(tmp, BAD_CAST "queueus", ++ BAD_CAST cdev->queues); ++ } ++ if (cdev->address.ct > 0) { ++ msg = device_address_xml(ctlr, &cdev->address); ++ if (msg != NULL) { ++ CU_DEBUG("Failed to set the address"); ++ return msg; ++ } ++ } ++ } ++ ++ return NULL; ++} ++ + static char *system_xml(xmlNodePtr root, struct domain *domain) + { + xmlNodePtr tmp; +@@ -1129,6 +1195,11 @@ char *device_to_xml(struct virt_device *_dev) + dominfo->dev_input_ct = 1; + dominfo->dev_input = dev; + break; ++ case CIM_RES_TYPE_CONTROLLER: ++ func = controller_xml; ++ dominfo->dev_controller_ct = 1; ++ dominfo->dev_controller = dev; ++ break; + default: + cleanup_virt_devices(&dev, 1); + goto out; +@@ -1167,6 +1238,7 @@ char *system_to_xml(struct domain *dominfo) + &console_xml, + &graphics_xml, + &emu_xml, ++ &controller_xml, + NULL + }; + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-4954aa8c.patch b/SOURCES/libvirt-cim-0.6.3-4954aa8c.patch new file mode 100644 index 0000000..436cf07 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-4954aa8c.patch @@ -0,0 +1,222 @@ +From 4954aa8c9e659fe593cf368c82a62124754d4c9c Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Tue, 18 Mar 2014 08:52:53 -0400 +Subject: [PATCH 50/60] Add virtual controller device types + +Add data and strutures for a virtual controller device + +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.h | 17 +++++- + src/svpc_types.h | 129 ++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 144 insertions(+), 2 deletions(-) + +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index a92e223..afddc1d 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007, 2013 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -163,6 +163,17 @@ struct input_device { + char *bus; + }; + ++#define CONTROLLER_INDEX_NOT_SET -1 ++struct controller_device { ++ uint16_t type; ++ uint64_t index; ++ char *model; ++ char *ports; ++ char *vectors; ++ char *queues; ++ struct device_address address; ++}; ++ + struct virt_device { + uint16_t type; + union { +@@ -174,6 +185,7 @@ struct virt_device { + struct graphics_device graphics; + struct console_device console; + struct input_device input; ++ struct controller_device controller; + } dev; + char *id; + }; +@@ -249,6 +261,9 @@ struct domain { + + struct virt_device *dev_vcpu; + int dev_vcpu_ct; ++ ++ struct virt_device *dev_controller; ++ int dev_controller_ct; + }; + + struct virt_device *virt_device_dup(struct virt_device *dev); +diff --git a/src/svpc_types.h b/src/svpc_types.h +index 404e428..d9f8032 100644 +--- a/src/svpc_types.h ++++ b/src/svpc_types.h +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007, 2013 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -24,6 +24,9 @@ + + #define CIM_OPERATIONAL_STATUS 2 + ++/* From the ResourceType list for CIM_ResourceAllocationSettingData.html ++ * Found on http://schemas.dmtf.org/wbem/cim-html/2.31.0 ++ */ + #define CIM_RES_TYPE_ALL 0 + #define CIM_RES_TYPE_OTHER 1 + #define CIM_RES_TYPE_PROC 3 +@@ -33,9 +36,11 @@ + #define CIM_RES_TYPE_GRAPHICS 24 + #define CIM_RES_TYPE_INPUT 13 + #define CIM_RES_TYPE_UNKNOWN 1000 ++/* libvirt-cim specific values can start here */ + #define CIM_RES_TYPE_IMAGE 32768 + #define CIM_RES_TYPE_CONSOLE 32769 + #define CIM_RES_TYPE_EMU 32770 ++#define CIM_RES_TYPE_CONTROLLER 32771 + + #define CIM_RES_TYPE_COUNT 7 + const static int cim_res_types[CIM_RES_TYPE_COUNT] = +@@ -266,4 +271,126 @@ static inline const char* chardev_source_type_IDToStr(int type) + return type_str; + } + ++/* enum for Controller ProtocolSupported values ++ * ++ * From the ProtocolSupported list for CIM_Controller.html ++ * Found on http://schemas.dmtf.org/wbem/cim-html/2.31.0 ++ */ ++enum CIM_controller_protocol_type { ++ CIM_CONTROLLER_PROTOCOL_TYPE_OTHER = 1, ++ CIM_CONTROLLER_PROTOCOL_TYPE_UNKNOWN = 2, ++ CIM_CONTROLLER_PROTOCOL_TYPE_EISA = 3, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ISA = 4, ++ CIM_CONTROLLER_PROTOCOL_TYPE_PCI = 5, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ATA = 6, ++ CIM_CONTROLLER_PROTOCOL_TYPE_FD = 7, ++ CIM_CONTROLLER_PROTOCOL_TYPE_1496 = 8, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_PI = 9, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_FC = 10, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_SB = 11, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_SB2 = 12, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_SSA = 13, ++ CIM_CONTROLLER_PROTOCOL_TYPE_VESA = 14, ++ CIM_CONTROLLER_PROTOCOL_TYPE_PCMCIA = 15, ++ CIM_CONTROLLER_PROTOCOL_TYPE_USB = 16, ++ CIM_CONTROLLER_PROTOCOL_TYPE_PP = 17, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ESCON = 18, ++ CIM_CONTROLLER_PROTOCOL_TYPE_DIAG = 19, ++ CIM_CONTROLLER_PROTOCOL_TYPE_I2C = 20, ++ CIM_CONTROLLER_PROTOCOL_TYPE_POWER = 21, ++ CIM_CONTROLLER_PROTOCOL_TYPE_HIPPI = 22, ++ CIM_CONTROLLER_PROTOCOL_TYPE_MULTIBUS = 23, ++ CIM_CONTROLLER_PROTOCOL_TYPE_VME = 24, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IPI = 25, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IEEE488 = 26, ++ CIM_CONTROLLER_PROTOCOL_TYPE_RS232 = 27, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IEEE8023_10BASE5 = 28, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IEEE8023_10BASE2 = 29, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IEEE8023_1BASE5 = 30, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IEEE8023_10BROAD36 = 31, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IEEE8023_100BASEVG = 32, ++ CIM_CONTROLLER_PROTOCOL_TYPE_TOKENRING = 33, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ANSIX3T9 = 34, ++ CIM_CONTROLLER_PROTOCOL_TYPE_MCA = 35, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ESDI = 36, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IDE = 37, ++ CIM_CONTROLLER_PROTOCOL_TYPE_CMD = 38, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ST506 = 39, ++ CIM_CONTROLLER_PROTOCOL_TYPE_DSSI = 40, ++ CIM_CONTROLLER_PROTOCOL_TYPE_QIC2 = 41, ++ CIM_CONTROLLER_PROTOCOL_TYPE_ENH_ATA = 42, ++ CIM_CONTROLLER_PROTOCOL_TYPE_AGP = 43, ++ CIM_CONTROLLER_PROTOCOL_TYPE_TWIRP = 44, ++ CIM_CONTROLLER_PROTOCOL_TYPE_FIR = 45, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SIR = 46, ++ CIM_CONTROLLER_PROTOCOL_TYPE_IRBUS = 47, ++ CIM_CONTROLLER_PROTOCOL_TYPE_SATA = 48, ++ /* libvirt specific */ ++ CIM_CONTROLLER_PROTOCOL_TYPE_CCID = 32678, ++ CIM_CONTROLLER_PROTOCOL_TYPE_VIRTIO_SERIAL = 32769, ++}; ++ ++static inline int controller_protocol_type_StrToID(const char *type_str) ++{ ++ int rc = CIM_CONTROLLER_PROTOCOL_TYPE_UNKNOWN; ++ ++ if (type_str == NULL) ++ return rc; ++ ++ if (STREQC(type_str, "ide")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_IDE; ++ else if (STREQC(type_str, "fdc")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_FD; ++ else if (STREQC(type_str, "scsi")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_SSA; /* REVISIT */ ++ else if (STREQC(type_str, "sata")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_SATA; ++ else if (STREQC(type_str, "ccid")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_CCID; ++ else if (STREQC(type_str, "virtio-serial")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_VIRTIO_SERIAL; ++ else if (STREQC(type_str, "pci")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_PCI; ++ else if (STREQC(type_str, "usb")) ++ rc = CIM_CONTROLLER_PROTOCOL_TYPE_USB; ++ ++ return rc; ++} ++ ++static inline const char* controller_protocol_type_IDToStr(int type) ++{ ++ char *type_str = NULL; ++ ++ switch (type) ++ { ++ case CIM_CONTROLLER_PROTOCOL_TYPE_IDE: ++ type_str = "ide"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_FD: ++ type_str = "fdc"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_SCSI_SSA: ++ type_str = "scsi"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_SATA: ++ type_str = "sata"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_CCID: ++ type_str = "ccid"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_VIRTIO_SERIAL: ++ type_str = "virtio-serial"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_PCI: ++ type_str = "pci"; ++ break; ++ case CIM_CONTROLLER_PROTOCOL_TYPE_USB: ++ type_str = "usb"; ++ break; ++ default: ++ break; ++ } ++ return type_str; ++} ++ + #endif +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-4f74864c.patch b/SOURCES/libvirt-cim-0.6.3-4f74864c.patch new file mode 100644 index 0000000..b6368a7 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-4f74864c.patch @@ -0,0 +1,309 @@ +From 4f74864c72ffbb05c8b02ab9d12c581e22da359f Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 14 Oct 2013 17:29:41 +0200 +Subject: [PATCH 26/60] libxkutil: Support for device addresses + +New data type for device addresses based on the generic +"address" element of the libvirt domain XML. +Contains XML parsing and generation code for device addresses. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 113 +++++++++++++++++++++++++++++++++++++++++++++ + libxkutil/device_parsing.h | 11 +++++ + libxkutil/xmlgen.c | 28 +++++++++++ + 3 files changed, 152 insertions(+) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index aecca4c..97419d2 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -63,6 +63,22 @@ + /* Device parse function */ + typedef int (*dev_parse_func_t)(xmlNode *, struct virt_device **); + ++static void cleanup_device_address(struct device_address *addr) ++{ ++ int i; ++ if (addr == NULL) ++ return; ++ ++ for (i = 0; i < addr->ct; i++) { ++ free(addr->key[i]); ++ free(addr->value[i]); ++ } ++ ++ free(addr->key); ++ free(addr->value); ++ addr->ct = 0; ++} ++ + static void cleanup_disk_device(struct disk_device *dev) + { + if (dev == NULL) +@@ -77,6 +93,7 @@ static void cleanup_disk_device(struct disk_device *dev) + free(dev->virtual_dev); + free(dev->bus_type); + free(dev->access_mode); ++ cleanup_device_address(&dev->address); + } + + static void cleanup_vsi_device(struct vsi_device *dev) +@@ -107,6 +124,7 @@ static void cleanup_net_device(struct net_device *dev) + free(dev->filter_ref); + free(dev->poolid); + cleanup_vsi_device(&dev->vsi); ++ cleanup_device_address(&dev->address); + } + + static void cleanup_emu_device(struct emu_device *dev) +@@ -351,6 +369,67 @@ char *get_node_content(xmlNode *node) + return buf; + } + ++int add_device_address_property(struct device_address *devaddr, ++ const char *key, ++ const char *value) ++{ ++ char *k = NULL; ++ char *v = NULL; ++ char **list = NULL; ++ ++ if (key != NULL && value != NULL) { ++ k = strdup(key); ++ v = strdup(value); ++ if (k == NULL || v == NULL) ++ goto err; ++ ++ list = realloc(devaddr->key, sizeof(char*) * (devaddr->ct+1)); ++ if (list == NULL) ++ goto err; ++ devaddr->key = list; ++ ++ list = realloc(devaddr->value, sizeof(char*) * (devaddr->ct+1)); ++ if (list == NULL) ++ goto err; ++ devaddr->value = list; ++ ++ devaddr->key[devaddr->ct] = k; ++ devaddr->value[devaddr->ct] = v; ++ devaddr->ct += 1; ++ return 1; ++ } ++ ++ err: ++ free(k); ++ free(v); ++ free(list); ++ return 0; ++} ++ ++ ++static int parse_device_address(xmlNode *anode, struct device_address *devaddr) ++{ ++ xmlAttr *attr = NULL; ++ char *name = NULL; ++ char *value = NULL; ++ ++ for (attr = anode->properties; attr != NULL; attr = attr->next) { ++ name = (char*) attr->name; ++ value = get_attr_value(anode, name); ++ if (!add_device_address_property(devaddr, name, value)) ++ goto err; ++ free(value); ++ } ++ ++ return 1; ++ ++ err: ++ cleanup_device_address(devaddr); ++ free(value); ++ ++ return 0; ++} ++ + static int parse_fs_device(xmlNode *dnode, struct virt_device **vdevs) + { + struct virt_device *vdev = NULL; +@@ -386,6 +465,8 @@ static int parse_fs_device(xmlNode *dnode, struct virt_device **vdevs) + } + } else if (XSTREQ(child->name, "driver")) { + ddev->driver_type = get_attr_value(child, "type"); ++ } else if (XSTREQ(child->name, "address")) { ++ parse_device_address(child, &ddev->address); + } + } + +@@ -459,6 +540,8 @@ static int parse_block_device(xmlNode *dnode, struct virt_device **vdevs) + ddev->readonly = true; + } else if (XSTREQ(child->name, "shareable")) { + ddev->shareable = true; ++ } else if (XSTREQ(child->name, "address")) { ++ parse_device_address(child, &ddev->address); + } + } + +@@ -598,6 +681,8 @@ static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) + ndev->filter_ref = get_attr_value(child, "filter"); + } else if (XSTREQ(child->name, "virtualport")) { + parse_vsi_device(child, ndev); ++ } else if (XSTREQ(child->name, "address")) { ++ parse_device_address(child, &ndev->address); + #if LIBVIR_VERSION_NUMBER >= 9000 + } else if (XSTREQ(child->name, "bandwidth")) { + /* Network QoS bandwidth support */ +@@ -1167,6 +1252,32 @@ static int parse_devices(const char *xml, struct virt_device **_list, int type) + return count; + } + ++static void duplicate_device_address(struct device_address *to, const struct device_address *from) ++{ ++ int i; ++ ++ if (from == NULL || to == NULL || from->ct == 0) ++ return; ++ ++ to->ct = from->ct; ++ to->key = calloc(from->ct, sizeof(char*)); ++ to->value = calloc(from->ct, sizeof(char*)); ++ if (to->key == NULL || to->value == NULL) ++ goto err; ++ ++ for (i = 0; i < from->ct; i++) { ++ to->key[i] = strdup(from->key[i]); ++ to->value[i] = strdup(from->value[i]); ++ if (to->key[i] == NULL || to->value[i] == NULL) ++ goto err; ++ } ++ ++ return; ++ ++ err: ++ cleanup_device_address(to); ++} ++ + struct virt_device *virt_device_dup(struct virt_device *_dev) + { + struct virt_device *dev; +@@ -1196,6 +1307,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + DUP_FIELD(dev, _dev, dev.net.vsi.profile_id); + dev->dev.net.reservation = _dev->dev.net.reservation; + dev->dev.net.limit = _dev->dev.net.limit; ++ duplicate_device_address(&dev->dev.net.address, &_dev->dev.net.address); + } else if (dev->type == CIM_RES_TYPE_DISK) { + DUP_FIELD(dev, _dev, dev.disk.type); + DUP_FIELD(dev, _dev, dev.disk.device); +@@ -1209,6 +1321,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + dev->dev.disk.disk_type = _dev->dev.disk.disk_type; + dev->dev.disk.readonly = _dev->dev.disk.readonly; + dev->dev.disk.shareable = _dev->dev.disk.shareable; ++ duplicate_device_address(&dev->dev.disk.address, &_dev->dev.disk.address); + } else if (dev->type == CIM_RES_TYPE_MEM) { + dev->dev.mem.size = _dev->dev.mem.size; + dev->dev.mem.maxsize = _dev->dev.mem.maxsize; +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index 2803d6a..531703d 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -33,6 +33,12 @@ + + #include "../src/svpc_types.h" + ++struct device_address { ++ uint32_t ct; ++ char **key; ++ char **value; ++}; ++ + struct vsi_device { + char *vsi_type; + char *manager_id; +@@ -56,6 +62,7 @@ struct disk_device { + char *bus_type; + char *cache; + char *access_mode; /* access modes for DISK_FS (filesystem) type */ ++ struct device_address address; + }; + + struct net_device { +@@ -70,6 +77,7 @@ struct net_device { + uint64_t reservation; + uint64_t limit; + struct vsi_device vsi; ++ struct device_address address; + }; + + struct mem_device { +@@ -257,6 +265,9 @@ int get_devices(virDomainPtr dom, struct virt_device **list, int type, + void cleanup_virt_device(struct virt_device *dev); + void cleanup_virt_devices(struct virt_device **devs, int count); + ++int add_device_address_property(struct device_address *devaddr, ++ const char *key, const char *value); ++ + char *get_node_content(xmlNode *node); + char *get_attr_value(xmlNode *node, char *attrname); + +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 7e8801d..40e2905 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -178,6 +178,26 @@ static const char *console_xml(xmlNodePtr root, struct domain *dominfo) + BAD_CAST cdev->target_type); + } + } ++ ++ return NULL; ++} ++ ++static char *device_address_xml(xmlNodePtr root, struct device_address *addr) ++{ ++ int i; ++ xmlNodePtr address; ++ ++ if (addr == NULL || addr->ct == 0) ++ return NULL; ++ ++ address = xmlNewChild(root, NULL, BAD_CAST "address", NULL); ++ if (address == NULL) ++ return XML_ERROR; ++ ++ for (i = 0; i < addr->ct; i++) { ++ xmlNewProp(address, BAD_CAST addr->key[i] , BAD_CAST addr->value[i]); ++ } ++ + return NULL; + } + +@@ -225,6 +245,9 @@ static char *disk_block_xml(xmlNodePtr root, struct disk_device *dev) + if (dev->shareable) + xmlNewChild(disk, NULL, BAD_CAST "shareable", NULL); + ++ if (dev->address.ct > 0) ++ return device_address_xml(disk, &dev->address); ++ + return NULL; + } + +@@ -279,6 +302,8 @@ static const char *disk_file_xml(xmlNodePtr root, struct disk_device *dev) + if (dev->shareable) + xmlNewChild(disk, NULL, BAD_CAST "shareable", NULL); + ++ if (dev->address.ct > 0) ++ return device_address_xml(disk, &dev->address); + + return NULL; + } +@@ -520,6 +545,9 @@ static const char *net_xml(xmlNodePtr root, struct domain *dominfo) + } + #endif + ++ if (dev->dev.net.address.ct > 0) ++ msg = device_address_xml(nic, &dev->dev.net.address); ++ + if (STREQ(dev->dev.net.type, "network")) { + msg = set_net_source(nic, net, "network"); + } else if (STREQ(dev->dev.net.type, "bridge")) { +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-53a4dff9.patch b/SOURCES/libvirt-cim-0.6.3-53a4dff9.patch new file mode 100644 index 0000000..e505959 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-53a4dff9.patch @@ -0,0 +1,162 @@ +From 53a4dff9797a9d36918ec14fa560efde4d5142e5 Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Fri, 4 Apr 2014 11:16:47 -0400 +Subject: [PATCH 55/60] Controller: Add associations for KVM_Controller + +Add the various associations to make the KVM_Controller work + +Signed-off-by: John Ferlan +--- + src/Virt_ElementAllocatedFromPool.c | 4 +++- + src/Virt_ElementSettingData.c | 3 ++- + src/Virt_ServiceAffectsElement.c | 8 +++++--- + src/Virt_SettingsDefineState.c | 4 +++- + src/Virt_SystemDevice.c | 3 ++- + src/Virt_VSSDComponent.c | 3 ++- + 6 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c +index 2c2f2d1..262c9b9 100644 +--- a/src/Virt_ElementAllocatedFromPool.c ++++ b/src/Virt_ElementAllocatedFromPool.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -275,6 +275,7 @@ static char* device[] = { + "KVM_LogicalDisk", + "KVM_DisplayController", + "KVM_PointingDevice", ++ "KVM_Controller", + "LXC_Processor", + "LXC_Memory", + "LXC_NetworkPort", +@@ -297,6 +298,7 @@ static char* device_or_pool[] = { + "KVM_LogicalDisk", + "KVM_DisplayController", + "KVM_PointingDevice", ++ "KVM_Controller", + "LXC_Processor", + "LXC_Memory", + "LXC_NetworkPort", +diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c +index c088e49..5845c86 100644 +--- a/src/Virt_ElementSettingData.c ++++ b/src/Virt_ElementSettingData.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Kaitlin Rupert +@@ -137,6 +137,7 @@ static char* resource_allocation_setting_data[] = { + "KVM_GraphicsResourceAllocationSettingData", + "KVM_ConsoleResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", ++ "KVM_ControllerResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", +diff --git a/src/Virt_ServiceAffectsElement.c b/src/Virt_ServiceAffectsElement.c +index 9810e02..d64a877 100644 +--- a/src/Virt_ServiceAffectsElement.c ++++ b/src/Virt_ServiceAffectsElement.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2008 ++ * Copyright IBM Corp. 2008-2014 + * + * Authors: + * Kaitlin Rupert +@@ -101,9 +101,10 @@ static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context, + + if (STREQC(classname, "ComputerSystem")) { + s = get_domain_by_ref(_BROKER, ref, &inst); +- } else if ((STREQC(classname, "PointingDevice")) || ++ } else if ((STREQC(classname, "PointingDevice")) || ++ (STREQC(classname, "Controller")) || + (STREQC(classname, "DisplayController"))) { +- s = get_device_by_ref(_BROKER, ref, &inst); ++ s = get_device_by_ref(_BROKER, ref, &inst); + } + + free(classname); +@@ -146,6 +147,7 @@ static char* affected_ele[] = { + "Xen_DisplayController", + "KVM_DisplayController", + "LXC_DisplayController", ++ "KVM_Controller", + NULL + }; + +diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c +index c8cda97..6338d7c 100644 +--- a/src/Virt_SettingsDefineState.c ++++ b/src/Virt_SettingsDefineState.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -336,6 +336,7 @@ static char* logical_device[] = { + "KVM_DisplayController", + "KVM_ConsoleDisplayController", + "KVM_PointingDevice", ++ "KVM_Controller", + "LXC_Processor", + "LXC_Memory", + "LXC_NetworkPort", +@@ -361,6 +362,7 @@ static char* resource_allocation_setting_data[] = { + "KVM_GraphicsResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", + "KVM_ConsoleResourceAllocationSettingData", ++ "KVM_ControllerResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", +diff --git a/src/Virt_SystemDevice.c b/src/Virt_SystemDevice.c +index d2e526d..ae13ecb 100644 +--- a/src/Virt_SystemDevice.c ++++ b/src/Virt_SystemDevice.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -144,6 +144,7 @@ static char* part_component[] = { + "KVM_DisplayController", + "KVM_ConsoleDisplayController", + "KVM_PointingDevice", ++ "KVM_Controller", + "LXC_Processor", + "LXC_Memory", + "LXC_NetworkPort", +diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c +index 35bffde..fc223c2 100644 +--- a/src/Virt_VSSDComponent.c ++++ b/src/Virt_VSSDComponent.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -141,6 +141,7 @@ static char* part_component[] = { + "KVM_GraphicsResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", + "KVM_ConsoleResourceAllocationSettingData", ++ "KVM_ControllerResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-54778c78.patch b/SOURCES/libvirt-cim-0.6.3-54778c78.patch new file mode 100644 index 0000000..ba78cbc --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-54778c78.patch @@ -0,0 +1,63 @@ +From 54778c7811594a731254e086a46dcc5f25ad2ee7 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Tue, 21 Jan 2014 16:23:16 -0500 +Subject: [PATCH 40/48] spec: Fix docs/*.html packaging issue + +Using a more recent rpmbuild on f20, I found that the 'make rpm' was failing: + + Installed (but unpackaged) file(s) found: + /usr/share/doc/libvirt-cim-0.6.3/html/architecture.html + /usr/share/doc/libvirt-cim-0.6.3/html/downloads.html + /usr/share/doc/libvirt-cim-0.6.3/html/index.html + /usr/share/doc/libvirt-cim-0.6.3/html/intro.html + /usr/share/doc/libvirt-cim-0.6.3/html/libvirt-cim.html + /usr/share/doc/libvirt-cim-0.6.3/html/news.html + /usr/share/doc/libvirt-cim-0.6.3/html/patches.html + /usr/share/doc/libvirt-cim-0.6.3/html/platforms.html + /usr/share/doc/libvirt-cim-0.6.3/html/schema.html + make: *** [rpm] Error 1 + +After a bit of research - I found the following page that describes a +workaround to add "%define _unpackaged_files_terminate_build 0" to the +spec file: + +http://www.oldrpm.org/hintskinks/unpackaged/ + +However, figuring that wasn't a great solution - I found a libvirt change +that provided a way to work around what was being seen, see: + +http://www.redhat.com/archives/libvir-list/2013-November/msg00441.html + +It seems as though having that %doc doc/*.html is not proper any more. +With this change I can once again build RPM packages + +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index c96451b..24ef280 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -60,6 +60,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libxkutil.so + mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d + echo %{_libdir}/cmpi > $RPM_BUILD_ROOT/etc/ld.so.conf.d/libvirt-cim.%{_arch}.conf + mkdir -p $RPM_BUILD_ROOT@INFO_STORE@ ++mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-cim-%{version} libvirt-cim-docs + + %clean + rm -fr $RPM_BUILD_ROOT +@@ -347,9 +348,8 @@ fi + %defattr(-, root, root) + %{_sysconfdir}/libvirt/cim + +-%doc README COPYING doc/CodingStyle doc/SubmittingPatches ++%doc README COPYING doc/CodingStyle doc/SubmittingPatches libvirt-cim-docs/* + %doc base_schema/README.DMTF +-%doc doc/*.html + %{_libdir}/lib*.so* + %{_libdir}/cmpi/lib*.so* + %{_datadir}/libvirt-cim +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-55d3f9fc.patch b/SOURCES/libvirt-cim-0.6.3-55d3f9fc.patch new file mode 100644 index 0000000..3c8ae0c --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-55d3f9fc.patch @@ -0,0 +1,39 @@ +From 55d3f9fc5b9b0e45ed843a40a70b24d168d83d86 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Wed, 22 Jan 2014 13:21:17 -0500 +Subject: [PATCH 44/60] RAFP: Coverity cleanup + +A new version of Coverity found: + +filter_by_pool(): RESOURCE_LEAK + - Because the code is run within a for() loop Coverity complains + that the returned 'poolid' is not free'd during each pass through + the loop. So even though it may not be fetched again, just free() + and reinitialize 'poolid' after usage + +Signed-off-by: John Ferlan +--- + src/Virt_ResourceAllocationFromPool.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/Virt_ResourceAllocationFromPool.c b/src/Virt_ResourceAllocationFromPool.c +index 7088900..7bee729 100644 +--- a/src/Virt_ResourceAllocationFromPool.c ++++ b/src/Virt_ResourceAllocationFromPool.c +@@ -120,9 +120,12 @@ static int filter_by_pool(struct inst_list *dest, + poolid = pool_member_of(_BROKER, CLASSNAME(op), type, rasd_id); + if ((poolid != NULL) && STREQ(poolid, _poolid)) + inst_list_add(dest, inst); +- } + +- free(poolid); ++ if (poolid != NULL) { ++ free(poolid); ++ poolid = NULL; ++ } ++ } + + return dest->cur; + } +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-5787acc15.patch b/SOURCES/libvirt-cim-0.6.3-5787acc15.patch new file mode 100644 index 0000000..936da99 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-5787acc15.patch @@ -0,0 +1,115 @@ +From 5787acc1531d32b13223d8804c88142ed188e753 Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Tue, 27 May 2014 16:14:10 +0800 +Subject: [PATCH 59/60] Add disk device='lun' support + +Besides 'disk', 'cdrom', 'floppy' and 'filesystem', there is one +more value 'lun' should be supported by value of device field in +the disk device. So this patch adds it into libvirt-cim. Now device +like could be operated by class. + +Signed-off-by: Xu Wang +Signed-off-by: John Ferlan +--- + schema/ResourceAllocationSettingData.mof | 8 ++++---- + src/Virt_RASD.c | 3 +++ + src/Virt_RASD.h | 1 + + src/Virt_SettingsDefineCapabilities.c | 5 ++++- + src/Virt_VirtualSystemManagementService.c | 5 ++++- + 5 files changed, 16 insertions(+), 6 deletions(-) + +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index 9c387f0..f78d423 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -10,8 +10,8 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData + string VirtualDevice; + + [Description ("Device emulation type"), +- ValueMap {"0", "1", "2"}, +- Values {"Disk", "CDROM", "floppy"}] ++ ValueMap {"0", "1", "2", "4"}, ++ Values {"Disk", "CDROM", "floppy", "lun"}] + uint16 EmulatedType; + + [Description ("Bus type of the device")] +@@ -43,8 +43,8 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData + string VirtualDevice; + + [Description ("Device emulation type"), +- ValueMap {"0", "1", "2", "3"}, +- Values {"Disk", "CDROM", "floppy", "filesystem"}] ++ ValueMap {"0", "1", "2", "3", "4"}, ++ Values {"Disk", "CDROM", "floppy", "filesystem", "lun"}] + uint16 EmulatedType; + + [Description ("Bus type of the device")] +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index 3c62c2d..761d053 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -444,6 +444,9 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, + else if ((dev->dev.disk.device != NULL) && + STREQ(dev->dev.disk.device, "floppy")) + type = VIRT_DISK_TYPE_FLOPPY; ++ else if ((dev->dev.disk.device != NULL) && ++ STREQ(dev->dev.disk.device, "lun")) ++ type = VIRT_DISK_TYPE_LUN; + else + type = VIRT_DISK_TYPE_DISK; + +diff --git a/src/Virt_RASD.h b/src/Virt_RASD.h +index 400143f..49d7195 100644 +--- a/src/Virt_RASD.h ++++ b/src/Virt_RASD.h +@@ -27,6 +27,7 @@ + #define VIRT_DISK_TYPE_CDROM 1 + #define VIRT_DISK_TYPE_FLOPPY 2 + #define VIRT_DISK_TYPE_FS 3 ++#define VIRT_DISK_TYPE_LUN 4 + + char *rasd_to_xml(CMPIInstance *rasd); + +diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c +index 756e46b..85cb27a 100644 +--- a/src/Virt_SettingsDefineCapabilities.c ++++ b/src/Virt_SettingsDefineCapabilities.c +@@ -1071,9 +1071,12 @@ static CMPIStatus set_disk_props(int type, + (CMPIValue *)"FV disk", CMPI_chars); + } + +- if (emu_type == VIRT_DISK_TYPE_DISK) { ++ if (emu_type == VIRT_DISK_TYPE_DISK || ++ emu_type == VIRT_DISK_TYPE_LUN) { + CMSetProperty(inst, "VirtualQuantity", + (CMPIValue *)&disk_size, CMPI_uint64); ++ if (emu_type == VIRT_DISK_TYPE_LUN) ++ dev = "sda"; + } else if (emu_type == VIRT_DISK_TYPE_CDROM) { + dev = "hdc"; + } else if (emu_type == VIRT_DISK_TYPE_FLOPPY) { +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index f673c38..c640360 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1114,7 +1114,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + type = VIRT_DISK_TYPE_DISK; + + if ((type == VIRT_DISK_TYPE_DISK) || +- (type == VIRT_DISK_TYPE_FS)){ ++ (type == VIRT_DISK_TYPE_FS) || ++ (type == VIRT_DISK_TYPE_LUN)){ + if (dev->dev.disk.disk_type == DISK_UNKNOWN) { + /* on success or fail caller should try free it */ + rc = asprintf(p_error, "Device %s, Address %s, " +@@ -1149,6 +1150,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + dev->dev.disk.device = strdup("floppy"); + else if (type == VIRT_DISK_TYPE_FS) + dev->dev.disk.device = strdup("filesystem"); ++ else if (type == VIRT_DISK_TYPE_LUN) ++ dev->dev.disk.device = strdup("lun"); + else + return "Invalid value for EmulatedType"; + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-583ea685.patch b/SOURCES/libvirt-cim-0.6.3-583ea685.patch new file mode 100644 index 0000000..56d80f3 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-583ea685.patch @@ -0,0 +1,74 @@ +From 583ea68595acd012c1a99328302fd16b6fe04caf Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Wed, 11 Sep 2013 16:45:41 +0200 +Subject: [PATCH 21/60] VSMS: add default console + +A new function to add a default console has been added. As with +the default graphics and default input device, the default device +generation is optional and depends on the domain type and +architecture. +Initially, we only create an s390 console, which is necessary to +define a runnable guest. + +Signed-off-by: Thilo Boehm +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 34 +++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index d626691..d51f230 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -592,6 +592,38 @@ static bool default_graphics_device(struct domain *domain) + return true; + } + ++static bool default_console_device(struct domain *domain) ++{ ++ /* currently only taking care for s390 guests */ ++ if ((domain->type == DOMAIN_KVM || domain->type == DOMAIN_QEMU) && ++ domain->os_info.fv.arch != NULL && ++ (XSTREQ(domain->os_info.fv.arch, "s390") || ++ XSTREQ(domain->os_info.fv.arch, "s390x" ))) { ++ char * consoletype = NULL; ++ if (domain->os_info.fv.machine != NULL && ++ XSTREQ(domain->os_info.fv.machine, "s390-ccw-virtio")) { ++ consoletype = "sclp"; ++ } else { ++ consoletype = "virtio"; ++ } ++ free(domain->dev_console); ++ domain->dev_console = calloc(1, sizeof(*domain->dev_console)); ++ if (domain->dev_console == NULL) { ++ CU_DEBUG("Failed to allocate default console device."); ++ return false; ++ } ++ CU_DEBUG("Defining default console device for s390."); ++ domain->dev_console->type = CIM_RES_TYPE_CONSOLE; ++ domain->dev_console->dev.console.source_type = ++ CIM_CHARDEV_SOURCE_TYPE_PTY; ++ domain->dev_console->dev.console.target_type = ++ strdup(consoletype); ++ domain->dev_console_ct = 1; ++ } ++ ++ return true; ++} ++ + static bool default_input_device(struct domain *domain) + { + if (domain->type == DOMAIN_LXC) +@@ -628,6 +660,8 @@ static bool add_default_devs(struct domain *domain) + { + if (domain->dev_graphics_ct < 1 && + domain->dev_console_ct < 1) { ++ if (!default_console_device(domain)) ++ return false; + if (!default_graphics_device(domain)) + return false; + } +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-58d6e308.patch b/SOURCES/libvirt-cim-0.6.3-58d6e308.patch new file mode 100644 index 0000000..214882a --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-58d6e308.patch @@ -0,0 +1,236 @@ +From 58d6e30844573de15aa597ab184e5720a08528ba Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Thu, 27 Mar 2014 16:39:47 -0400 +Subject: [PATCH 57/60] Add code and associations for ControllerPool + +Add the code and make adjustments to have ControllerPool support + +Signed-off-by: John Ferlan +--- + src/Virt_DevicePool.c | 55 +++++++++++++++++++++++- + src/Virt_ElementAllocatedFromPool.c | 2 + + src/Virt_ElementCapabilities.c | 4 +- + src/Virt_HostedResourcePool.c | 3 +- + src/Virt_ResourceAllocationFromPool.c | 2 + + src/Virt_ResourcePoolConfigurationCapabilities.c | 2 +- + src/Virt_ResourcePoolConfigurationService.c | 2 + + 7 files changed, 66 insertions(+), 4 deletions(-) + +diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c +index aae7ed4..6c61b64 100644 +--- a/src/Virt_DevicePool.c ++++ b/src/Virt_DevicePool.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -797,6 +797,8 @@ char *pool_member_of(const CMPIBroker *broker, + poolid = strdup("GraphicsPool/0"); + else if (type == CIM_RES_TYPE_INPUT) + poolid = strdup("InputPool/0"); ++ else if (type == CIM_RES_TYPE_CONTROLLER) ++ poolid = strdup("ControllerPool/0"); + else + return NULL; + +@@ -817,6 +819,8 @@ uint16_t res_type_from_pool_classname(const char *classname) + return CIM_RES_TYPE_GRAPHICS; + else if (strstr(classname, "InputPool")) + return CIM_RES_TYPE_INPUT; ++ else if (strstr(classname, "ControllerPool")) ++ return CIM_RES_TYPE_CONTROLLER; + else + return CIM_RES_TYPE_UNKNOWN; + } +@@ -835,6 +839,8 @@ uint16_t res_type_from_pool_id(const char *id) + return CIM_RES_TYPE_GRAPHICS; + else if (strstr(id, "InputPool")) + return CIM_RES_TYPE_INPUT; ++ else if (strstr(id, "ControllerPool")) ++ return CIM_RES_TYPE_CONTROLLER; + else + return CIM_RES_TYPE_UNKNOWN; + } +@@ -1502,6 +1508,43 @@ static CMPIStatus inputpool_instance(virConnectPtr conn, + return s; + } + ++static CMPIStatus controllerpool_instance(virConnectPtr conn, ++ struct inst_list *list, ++ const char *ns, ++ const char *_id, ++ const CMPIBroker *broker) ++{ ++ const char *id = "ControllerPool/0"; ++ CMPIInstance *inst; ++ CMPIStatus s = {CMPI_RC_OK, NULL}; ++ ++ if ((_id != NULL) && (!STREQC(_id, "0"))) { ++ cu_statusf(broker, &s, ++ CMPI_RC_ERR_FAILED, ++ "No such controller pool `%s'", id); ++ return s; ++ } ++ ++ inst = get_typed_instance(broker, ++ pfx_from_conn(conn), ++ "ControllerPool", ++ ns, ++ false); ++ if (inst == NULL) { ++ cu_statusf(broker, &s, ++ CMPI_RC_ERR_FAILED, ++ "Failed to get instance of %s_ControllerPool", ++ pfx_from_conn(conn)); ++ return s; ++ } ++ ++ set_params(inst, CIM_RES_TYPE_CONTROLLER, id, NULL, NULL, true); ++ ++ inst_list_add(list, inst); ++ ++ return s; ++} ++ + static CMPIStatus _get_pools(const CMPIBroker *broker, + const CMPIObjectPath *reference, + const uint16_t type, +@@ -1563,6 +1606,14 @@ static CMPIStatus _get_pools(const CMPIBroker *broker, + id, + broker); + ++ if ((type == CIM_RES_TYPE_CONTROLLER) || ++ (type == CIM_RES_TYPE_ALL)) ++ s = controllerpool_instance(conn, ++ list, ++ NAMESPACE(reference), ++ id, ++ broker); ++ + if (type == CIM_RES_TYPE_UNKNOWN) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, +@@ -1712,6 +1763,8 @@ CMPIInstance *parent_device_pool(const CMPIBroker *broker, + id = "GraphicsPool/0"; + } else if (type == CIM_RES_TYPE_INPUT) { + id = "InputPool/0"; ++ } else if (type == CIM_RES_TYPE_CONTROLLER) { ++ id = "ControllerPool/0"; + } else { + cu_statusf(broker, s, + CMPI_RC_ERR_INVALID_PARAMETER, +diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c +index 262c9b9..a5fef12 100644 +--- a/src/Virt_ElementAllocatedFromPool.c ++++ b/src/Virt_ElementAllocatedFromPool.c +@@ -253,6 +253,7 @@ static char* pool[] = { + "KVM_DiskPool", + "KVM_GraphicsPool", + "KVM_InputPool", ++ "KVM_ControllerPool", + "LXC_ProcessorPool", + "LXC_MemoryPool", + "LXC_NetworkPool", +@@ -317,6 +318,7 @@ static char* device_or_pool[] = { + "KVM_DiskPool", + "KVM_GraphicsPool", + "KVM_InputPool", ++ "KVM_ControllerPool", + "LXC_ProcessorPool", + "LXC_MemoryPool", + "LXC_NetworkPool", +diff --git a/src/Virt_ElementCapabilities.c b/src/Virt_ElementCapabilities.c +index 77aad9a..0cb3e1e 100644 +--- a/src/Virt_ElementCapabilities.c ++++ b/src/Virt_ElementCapabilities.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -416,6 +416,7 @@ static char* host_sys_and_service_and_rp[] = { + "KVM_DiskPool", + "KVM_GraphicsPool", + "KVM_InputPool", ++ "KVM_ControllerPool", + "LXC_ProcessorPool", + "LXC_MemoryPool", + "LXC_NetworkPool", +@@ -553,6 +554,7 @@ static char* resource_pool[] = { + "KVM_DiskPool", + "KVM_GraphicsPool", + "KVM_InputPool", ++ "KVM_ControllerPool", + "LXC_ProcessorPool", + "LXC_MemoryPool", + "LXC_NetworkPool", +diff --git a/src/Virt_HostedResourcePool.c b/src/Virt_HostedResourcePool.c +index 0863853..e0459c5 100644 +--- a/src/Virt_HostedResourcePool.c ++++ b/src/Virt_HostedResourcePool.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -113,6 +113,7 @@ static char* part_component[] = { + "KVM_DiskPool", + "KVM_GraphicsPool", + "KVM_InputPool", ++ "KVM_ControllerPool", + "LXC_ProcessorPool", + "LXC_MemoryPool", + "LXC_NetworkPool", +diff --git a/src/Virt_ResourceAllocationFromPool.c b/src/Virt_ResourceAllocationFromPool.c +index 7bee729..98bd24e 100644 +--- a/src/Virt_ResourceAllocationFromPool.c ++++ b/src/Virt_ResourceAllocationFromPool.c +@@ -194,6 +194,7 @@ static char* antecedent[] = { + "KVM_DiskPool", + "KVM_GraphicsPool", + "KVM_InputPool", ++ "KVM_ControllerPool", + "LXC_ProcessorPool", + "LXC_MemoryPool", + "LXC_NetworkPool", +@@ -216,6 +217,7 @@ static char* dependent[] = { + "KVM_ProcResourceAllocationSettingData", + "KVM_GraphicsResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", ++ "KVM_ControllerResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", +diff --git a/src/Virt_ResourcePoolConfigurationCapabilities.c b/src/Virt_ResourcePoolConfigurationCapabilities.c +index 63045bf..28a5de2 100644 +--- a/src/Virt_ResourcePoolConfigurationCapabilities.c ++++ b/src/Virt_ResourcePoolConfigurationCapabilities.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +diff --git a/src/Virt_ResourcePoolConfigurationService.c b/src/Virt_ResourcePoolConfigurationService.c +index 02de834..ab83beb 100644 +--- a/src/Virt_ResourcePoolConfigurationService.c ++++ b/src/Virt_ResourcePoolConfigurationService.c +@@ -431,6 +431,8 @@ static char *get_pool_id(int res_type, + pool = "GraphicsPool"; + else if (res_type == CIM_RES_TYPE_INPUT) + pool = "InputPool"; ++ else if (res_type == CIM_RES_TYPE_CONTROLLER) ++ pool = "ControllerPool"; + else + pool = "Unknown"; + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-5940d2c8.patch b/SOURCES/libvirt-cim-0.6.3-5940d2c8.patch new file mode 100644 index 0000000..47cf097 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-5940d2c8.patch @@ -0,0 +1,73 @@ +From 5940d2c8abdf8872b779319fc1f85f066e37c2de Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 14 Oct 2013 17:29:40 +0200 +Subject: [PATCH 25/60] RASD/schema: Add properties for device address + representation + +Certain device types are only identifiable uniquely via a device +address from the guest's perspective. Adding or removing devices +has the potential to change the address of other unrelated devices +and impact the guest's operation. Therefore it is less desirable +to rely on implicit device address allocation but rather to use +persistent device addresses. + +Depending on the device's bus type (PCI, SCSI, USB, CCW ...) the +address specification format can vary, see also the libvirt +domain XML documentation. To account for the various formats +device addresses are specified with two array properties in the +respective RASD classes: AddressProperties and AddressValues. +The former contains a list of address property names and the latter +the values. + +E.g., a PCI address is specified by the properties domain, bus, +slot and function. Therefore, for a PCI device RASD we could +have: + +AddressProperties = ['type', 'domain','bus', 'slot', 'function'] +AddressValues = ['pci', '0x0000', '0x00', '0x01', '0x2'] + +resulting in a libvirt address element: + +
+ +Initially, we support only disk and network devices for KVM guests. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + schema/ResourceAllocationSettingData.mof | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index ebc4806..bf1fbb6 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -67,6 +67,12 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData + + [Description ("if device is shareable")] + boolean shareable; ++ ++ [Description ("Device address property names")] ++ string AddressProperties[]; ++ ++ [Description ("Device address property values")] ++ string AddressValues[]; + }; + + [Description ("LXC virtual disk configuration"), +@@ -167,6 +173,12 @@ class KVM_NetResourceAllocationSettingData : KVM_ResourceAllocationSettingData + + [Description ("Filter REF")] + string FilterRef; ++ ++ [Description ("Device address property names")] ++ string AddressProperties[]; ++ ++ [Description ("Device address property values")] ++ string AddressValues[]; + }; + + [Description ("LXC virtual network configuration"), +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-5d2626f6.patch b/SOURCES/libvirt-cim-0.6.3-5d2626f6.patch new file mode 100644 index 0000000..2a9947d --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-5d2626f6.patch @@ -0,0 +1,38 @@ +From 5d2626f6e743e76b18272ec5e6bf4ee7e46cfee4 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Thu, 8 Aug 2013 15:50:29 -0400 +Subject: [PATCH 07/48] spec: Fix capitalization for version check + +Following seen on rpm -ivh install: + +Preparing... ################################# [100%] +Updating / installing... + 1:libvirt-cim-0.6.3-1.fc19 ################################# [100%] + /var/tmp/rpm-tmp.uY5oGu: line 5: /etc/init.d/tog-pegasus: No such file or directory + +Turns out commit id '8480cc79' inadvertently capitalized Fedora when replacing +a check that got removed by commit id '07adabc2'. + +"Fedora" shouldn't have been capitalized in the check to use +systemctl instead of /etc/init.d/tog-pegasus + +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index 98f2a75..459650c 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -96,7 +96,7 @@ rm -fr $RPM_BUILD_ROOT + + %{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} + +-%if 0%{?Fedora} >= 17 || 0%{?rhel} >= 7 ++%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 + if [ "`systemctl is-active tog-pegasus.service`" = "active" ] + then + systemctl restart tog-pegasus.service +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-6024403e.patch b/SOURCES/libvirt-cim-0.6.3-6024403e.patch new file mode 100644 index 0000000..faeb86d --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-6024403e.patch @@ -0,0 +1,169 @@ +From 6024403e02643db81555e3333463b2f0e1b206b5 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Thu, 29 Aug 2013 17:18:50 +0200 +Subject: [PATCH 09/48] VSSD: Add properties for arch and machine + +For architectures like s390 the machine type is relevant for +the proper guest construction. We add the necessary properties +to the schema and the C structures and the necessary code +for CIM-to-libvirt mapping. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 12 ++++++++++++ + libxkutil/device_parsing.h | 2 ++ + libxkutil/xmlgen.c | 6 ++++++ + schema/VSSD.mof | 6 ++++++ + src/Virt_VSSD.c | 9 +++++++++ + src/Virt_VirtualSystemManagementService.c | 14 ++++++++++++++ + 6 files changed, 49 insertions(+) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index ad0f19c..7af3953 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -1116,6 +1116,8 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + xmlNode *child; + char **blist = NULL; + unsigned bl_size = 0; ++ char *arch = NULL; ++ char *machine = NULL; + char *kernel = NULL; + char *initrd = NULL; + char *cmdline = NULL; +@@ -1126,6 +1128,8 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + for (child = os->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "type")) { + STRPROP(dominfo, os_info.pv.type, child); ++ arch = get_attr_value(child, "arch"); ++ machine = get_attr_value(child, "machine"); + } else if (XSTREQ(child->name, "kernel")) + kernel = get_node_content(child); + else if (XSTREQ(child->name, "initrd")) +@@ -1173,9 +1177,13 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + case DOMAIN_KVM: + case DOMAIN_QEMU: + dominfo->os_info.fv.loader = loader; ++ dominfo->os_info.fv.arch = arch; ++ dominfo->os_info.fv.machine = machine; + dominfo->os_info.fv.bootlist_ct = bl_size; + dominfo->os_info.fv.bootlist = blist; + loader = NULL; ++ arch = NULL; ++ machine = NULL; + blist = NULL; + bl_size = 0; + break; +@@ -1195,6 +1203,8 @@ static int parse_os(struct domain *dominfo, xmlNode *os) + break; + } + ++ free(arch); ++ free(machine); + free(kernel); + free(initrd); + free(cmdline); +@@ -1398,6 +1408,8 @@ void cleanup_dominfo(struct domain **dominfo) + (dom->type == DOMAIN_KVM) || (dom->type == DOMAIN_QEMU)) { + free(dom->os_info.fv.type); + free(dom->os_info.fv.loader); ++ free(dom->os_info.fv.arch); ++ free(dom->os_info.fv.machine); + cleanup_bootlist(dom->os_info.fv.bootlist, + dom->os_info.fv.bootlist_ct); + } else if (dom->type == DOMAIN_LXC) { +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index 979b792..df5080c 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -139,6 +139,8 @@ struct pv_os_info { + + struct fv_os_info { + char *type; /* Should always be 'hvm' */ ++ char *arch; ++ char *machine; + char *loader; + unsigned bootlist_ct; + char **bootlist; +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 30e9a5e..2ca2341 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -811,6 +811,12 @@ static char *_kvm_os_xml(xmlNodePtr root, struct domain *domain) + if (tmp == NULL) + return XML_ERROR; + ++ if (os->arch) ++ xmlNewProp(tmp, BAD_CAST "arch", BAD_CAST os->arch); ++ ++ if (os->machine) ++ xmlNewProp(tmp, BAD_CAST "machine", BAD_CAST os->machine); ++ + ret = _fv_bootlist_xml(root, os); + if (ret == 0) + return XML_ERROR; +diff --git a/schema/VSSD.mof b/schema/VSSD.mof +index 0359d67..2734d8e 100644 +--- a/schema/VSSD.mof ++++ b/schema/VSSD.mof +@@ -48,6 +48,12 @@ class KVM_VirtualSystemSettingData : Virt_VirtualSystemSettingData + [Description ("The emulator the guest should use during runtime.")] + string Emulator; + ++ [Description ("The guest's architecture.")] ++ string Arch; ++ ++ [Description ("The guest's machine type")] ++ string Machine; ++ + }; + + [Description ( +diff --git a/src/Virt_VSSD.c b/src/Virt_VSSD.c +index 3363b38..67e56aa 100644 +--- a/src/Virt_VSSD.c ++++ b/src/Virt_VSSD.c +@@ -121,6 +121,15 @@ static CMPIStatus _set_fv_prop(const CMPIBroker *broker, + goto out; + } + ++ if (dominfo->os_info.fv.arch != NULL) ++ CMSetProperty(inst, "Arch", ++ (CMPIValue *)dominfo->os_info.fv.arch, ++ CMPI_chars); ++ ++ if (dominfo->os_info.fv.machine != NULL) ++ CMSetProperty(inst, "Machine", ++ (CMPIValue *)dominfo->os_info.fv.machine, ++ CMPI_chars); + out: + return s; + } +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 8ced2d6..3df878f 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -543,6 +543,20 @@ static int fv_vssd_to_domain(CMPIInstance *inst, + if (!fv_set_emulator(domain, val)) + return 0; + ++ free(domain->os_info.fv.arch); ++ ret = cu_get_str_prop(inst, "Arch", &val); ++ if (ret == CMPI_RC_OK) ++ domain->os_info.fv.arch = strdup(val); ++ else ++ domain->os_info.fv.arch = NULL; ++ ++ free(domain->os_info.fv.machine); ++ ret = cu_get_str_prop(inst, "Machine", &val); ++ if (ret == CMPI_RC_OK) ++ domain->os_info.fv.machine = strdup(val); ++ else ++ domain->os_info.fv.machine = NULL; ++ + return 1; + } + +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-605090b6.patch b/SOURCES/libvirt-cim-0.6.3-605090b6.patch new file mode 100644 index 0000000..42e6f54 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-605090b6.patch @@ -0,0 +1,29 @@ +From 605090b6a0a025afa3b1c1588c33fca68a30fa17 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 6 Sep 2013 14:09:56 +0200 +Subject: [PATCH 14/60] xml_parse_test: Call cleanup_dominfo before exiting + +This avoids misleading valgrind output running xml_parse_test. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + libxkutil/xml_parse_test.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libxkutil/xml_parse_test.c b/libxkutil/xml_parse_test.c +index af5e508..374bcf6 100644 +--- a/libxkutil/xml_parse_test.c ++++ b/libxkutil/xml_parse_test.c +@@ -521,6 +521,8 @@ int main(int argc, char **argv) + return 4; + } + ++ cleanup_dominfo(&dominfo); ++ + return 0; + } + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-63acad05.patch b/SOURCES/libvirt-cim-0.6.3-63acad05.patch new file mode 100644 index 0000000..6312ae9 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-63acad05.patch @@ -0,0 +1,99 @@ +From 63acad058adca7ae2fa7edd57eb0c1e84998a783 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 28 Apr 2015 13:56:00 +0200 +Subject: [PATCH] list_util.h: Drop inline modifiers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There's no need to mark a function as inline in the function +declaration. In fact, it causes a compilation error: + + CC xmlgen.lo +In file included from acl_parsing.h:29:0, + from xmlgen.h:26, + from capability_parsing.c:37: +list_util.h:67:21: error: inline function ‘list_node_prev_node’ declared but never defined [-Werror] + inline list_node_t *list_node_prev_node(list_node_t *node); + ^ +list_util.h:66:14: error: inline function ‘list_node_prev’ declared but never defined [-Werror] + inline void *list_node_prev(list_node_t *node); + ^ +list_util.h:64:21: error: inline function ‘list_node_next_node’ declared but never defined [-Werror] + inline list_node_t *list_node_next_node(list_node_t *node); + ^ +list_util.h:63:14: error: inline function ‘list_node_next’ declared but never defined [-Werror] + inline void *list_node_next(list_node_t *node); + ^ +list_util.h:61:21: error: inline function ‘list_last_node’ declared but never defined [-Werror] + inline list_node_t *list_last_node(list_t *list); + ^ +list_util.h:60:14: error: inline function ‘list_last’ declared but never defined [-Werror] + inline void *list_last(list_t *list); + ^ +list_util.h:58:21: error: inline function ‘list_first_node’ declared but never defined [-Werror] + inline list_node_t *list_first_node(list_t *list); + ^ +list_util.h:57:14: error: inline function ‘list_first’ declared but never defined [-Werror] + inline void *list_first(list_t *list); + ^ +list_util.h:55:13: error: inline function ‘list_node_data_set’ declared but never defined [-Werror] + inline void list_node_data_set(list_node_t *node, void *data); + ^ +list_util.h:54:14: error: inline function ‘list_node_data_get’ declared but never defined [-Werror] + inline void *list_node_data_get(list_node_t *node); + ^ +list_util.h:52:21: error: inline function ‘list_count’ declared but never defined [-Werror] + inline unsigned int list_count(list_t *list); + ^ +cc1: all warnings being treated as errors +Makefile:499: recipe for target 'capability_parsing.lo' failed +make[2]: *** [capability_parsing.lo] Error 1 +make[2]: *** Waiting for unfinished jobs.... + +Signed-off-by: Michal Privoznik +Signed-off-by: John Ferlan +--- + libxkutil/list_util.h | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/libxkutil/list_util.h b/libxkutil/list_util.h +index 6510272..6582dfe 100644 +--- a/libxkutil/list_util.h ++++ b/libxkutil/list_util.h +@@ -49,22 +49,22 @@ void list_remove_node(list_t *list, list_node_t *node); + + bool list_foreach(list_t *list, list_foreach_cb cb, void *user_data); + +-inline unsigned int list_count(list_t *list); ++unsigned int list_count(list_t *list); + +-inline void *list_node_data_get(list_node_t *node); +-inline void list_node_data_set(list_node_t *node, void *data); ++void *list_node_data_get(list_node_t *node); ++void list_node_data_set(list_node_t *node, void *data); + +-inline void *list_first(list_t *list); +-inline list_node_t *list_first_node(list_t *list); ++void *list_first(list_t *list); ++list_node_t *list_first_node(list_t *list); + +-inline void *list_last(list_t *list); +-inline list_node_t *list_last_node(list_t *list); ++void *list_last(list_t *list); ++list_node_t *list_last_node(list_t *list); + +-inline void *list_node_next(list_node_t *node); +-inline list_node_t *list_node_next_node(list_node_t *node); ++void *list_node_next(list_node_t *node); ++list_node_t *list_node_next_node(list_node_t *node); + +-inline void *list_node_prev(list_node_t *node); +-inline list_node_t *list_node_prev_node(list_node_t *node); ++void *list_node_prev(list_node_t *node); ++list_node_t *list_node_prev_node(list_node_t *node); + + #ifdef __cplusplus + } /* extern "C" */ +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-6a13c463.patch b/SOURCES/libvirt-cim-0.6.3-6a13c463.patch new file mode 100644 index 0000000..65776ad --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-6a13c463.patch @@ -0,0 +1,32 @@ +From 6a13c463d1599a513ad861c4d814ca836650f88e Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Wed, 20 Nov 2013 19:43:17 +0100 +Subject: [PATCH 38/60] libxkutil: Added missing address element for filesystem + 'disk' + +This was an omission from the original patch series adding +device address support. For disks of type filesystem the addresses +were parsed however not written back. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/xmlgen.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 40e2905..931f0c9 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -342,6 +342,9 @@ static const char *disk_fs_xml(xmlNodePtr root, struct disk_device *dev) + return XML_ERROR; + xmlNewProp(tmp, BAD_CAST "dir", BAD_CAST dev->virtual_dev); + ++ if (dev->address.ct > 0) ++ return device_address_xml(fs, &dev->address); ++ + return NULL; + } + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-6bc7bfdf.patch b/SOURCES/libvirt-cim-0.6.3-6bc7bfdf.patch new file mode 100644 index 0000000..d5d5985 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-6bc7bfdf.patch @@ -0,0 +1,102 @@ +From 6bc7bfdf7a162b0812bfe8e6f73e5fde3925e001 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 14 Oct 2013 17:29:43 +0200 +Subject: [PATCH 28/60] VSMS: Support for device addresses + +This allows to define KVM guests with persistent device addresses +for disks and network interfaces. +The new function rasd_to_device_address extracts the address +properties from the disk or network RASD and fills the +device_address sub-structure of the affected virt_device. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 51 ++++++++++++++++++++++++++++++- + 1 file changed, 50 insertions(+), 1 deletion(-) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index d51f230..b813be6 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -890,6 +890,50 @@ static const char *_net_rand_mac(const CMPIObjectPath *ref) + return _mac; + } + ++static const char *rasd_to_device_address(CMPIInstance *inst, ++ struct device_address *addr) ++{ ++ CMPICount c1; ++ CMPICount c2; ++ CMPIArray *arr_keys; ++ CMPIArray *arr_values; ++ CMPIData data_key; ++ CMPIData data_value; ++ const char *str_key; ++ const char *str_value; ++ int i; ++ const char * msg = NULL; ++ ++ if (cu_get_array_prop(inst, "AddressProperties", &arr_keys) != CMPI_RC_OK || ++ cu_get_array_prop(inst, "AddressValues", &arr_values) != CMPI_RC_OK) ++ goto out; ++ ++ c1 = CMGetArrayCount(arr_keys, NULL); ++ c2 = CMGetArrayCount(arr_values, NULL); ++ ++ if (c1 != c2) { ++ msg = "AddressProperties not matching AddressValues"; ++ goto out; ++ } ++ ++ for (i = 0; i < c1; i++) { ++ data_key = CMGetArrayElementAt(arr_keys, i, NULL); ++ data_value = CMGetArrayElementAt(arr_values, i, NULL); ++ ++ if (!CMIsNullValue(data_key) && !CMIsNullValue(data_key)) { ++ str_key = CMGetCharPtr(data_key.value.string); ++ str_value = CMGetCharPtr(data_value.value.string); ++ if (!add_device_address_property(addr, str_key, str_value)) { ++ msg = "Could not set address properties in vdev"; ++ goto out; ++ } ++ } ++ } ++ ++ out: ++ return msg; ++} ++ + static const char *net_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev, + const char *ns) +@@ -1040,6 +1084,8 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, + &dev->dev.net.limit) != CMPI_RC_OK) + dev->dev.net.limit = 0; + ++ msg = rasd_to_device_address(inst, &dev->dev.net.address); ++ + out: + free(network); + return msg; +@@ -1050,6 +1096,7 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + char **p_error) + { + const char *val = NULL; ++ const char *msg = NULL; + uint16_t type; + bool read = false; + int rc; +@@ -1161,7 +1208,9 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + free(dev->id); + dev->id = strdup(dev->dev.disk.virtual_dev); + +- return NULL; ++ msg = rasd_to_device_address(inst, &dev->dev.disk.address); ++ ++ return msg; + } + + static const char *lxc_disk_rasd_to_vdev(CMPIInstance *inst, +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-6f050582.patch b/SOURCES/libvirt-cim-0.6.3-6f050582.patch new file mode 100644 index 0000000..ec4a50e --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-6f050582.patch @@ -0,0 +1,34 @@ +From 6f050582eb9baad3fc7e3f57b9b4c6c17035afba Mon Sep 17 00:00:00 2001 +From: Daniel Hansel +Date: Tue, 12 Nov 2013 17:28:42 +0100 +Subject: [PATCH 30/60] libvirt-cim: Changed resource type value EMU + +To avoid conflicts with CIM resource type OTHER the value of the +resource type EMU is changed. + +Signed-off-by: Daniel Hansel +Signed-off-by: John Ferlan +--- + src/svpc_types.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/svpc_types.h b/src/svpc_types.h +index 0f46a86..404e428 100644 +--- a/src/svpc_types.h ++++ b/src/svpc_types.h +@@ -30,12 +30,12 @@ + #define CIM_RES_TYPE_MEM 4 + #define CIM_RES_TYPE_NET 10 + #define CIM_RES_TYPE_DISK 17 +-#define CIM_RES_TYPE_EMU 1 + #define CIM_RES_TYPE_GRAPHICS 24 + #define CIM_RES_TYPE_INPUT 13 + #define CIM_RES_TYPE_UNKNOWN 1000 + #define CIM_RES_TYPE_IMAGE 32768 + #define CIM_RES_TYPE_CONSOLE 32769 ++#define CIM_RES_TYPE_EMU 32770 + + #define CIM_RES_TYPE_COUNT 7 + const static int cim_res_types[CIM_RES_TYPE_COUNT] = +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-7e164fbd.patch b/SOURCES/libvirt-cim-0.6.3-7e164fbd.patch new file mode 100644 index 0000000..79c67ba --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-7e164fbd.patch @@ -0,0 +1,71 @@ +From 7e164fbdac05e955fe21c5bacc4aeee171821fd5 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 6 Aug 2013 14:41:33 +0200 +Subject: [PATCH 02/48] get_dominfo: Use VIR_DOMAIN_XML_SECURE more wisely + +Currently, even if we are connected RO to the libvirtd, we try to dump +domain XML with secure information (VIR_DOMAIN_XML_SECURE flag). This +is, however, forbidden in libvirt. With RO connection, we should not use +the SECURE flag at all. + +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 9 +++++++-- + libxkutil/misc_util.c | 2 +- + libxkutil/misc_util.h | 1 + + 3 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 7900e06..ffdf682 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -31,6 +31,7 @@ + #include + + #include "device_parsing.h" ++#include "misc_util.h" + #include "xmlgen.h" + #include "../src/svpc_types.h" + +@@ -1283,8 +1284,12 @@ int get_dominfo(virDomainPtr dom, struct domain **dominfo) + char *xml; + int ret = 0; + int start; +- xml = virDomainGetXMLDesc(dom, +- VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE); ++ int flags = VIR_DOMAIN_XML_INACTIVE; ++ ++ if (!is_read_only()) ++ flags |= VIR_DOMAIN_XML_SECURE; ++ ++ xml = virDomainGetXMLDesc(dom, flags); + + if (xml == NULL) { + CU_DEBUG("Failed to get dom xml with libvirt API."); +diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c +index 9e7e0d5..2164dd0 100644 +--- a/libxkutil/misc_util.c ++++ b/libxkutil/misc_util.c +@@ -219,7 +219,7 @@ static int libvirt_cim_config_get(LibvirtcimConfigProperty *prop) + } + #endif + +-static int is_read_only(void) ++int is_read_only(void) + { + static LibvirtcimConfigProperty prop = { + "readonly", CONFIG_BOOL, {0}, 0}; +diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h +index fd4f191..056c327 100644 +--- a/libxkutil/misc_util.h ++++ b/libxkutil/misc_util.h +@@ -153,6 +153,7 @@ int virt_set_status(const CMPIBroker *broker, + #define REF2STR(r) CMGetCharPtr(CMObjectPathToString(r, NULL)) + + /* get libvirt-cim config */ ++int is_read_only(void); + const char *get_mig_ssh_tmp_key(void); + bool get_disable_kvm(void); + const char *get_lldptool_query_options(void); +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-7e5f561c.patch b/SOURCES/libvirt-cim-0.6.3-7e5f561c.patch new file mode 100644 index 0000000..d06b0aa --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-7e5f561c.patch @@ -0,0 +1,51 @@ +From 7e5f561c35a58a35225fccd6ecd418f2715e2a1a Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 11 Oct 2013 13:47:32 +0200 +Subject: [PATCH 34/60] VSDC: Fix endianess issues + +SetProperty was called with int instead of uint16_t in a few places. +This leads to failures on big-endian systems like s390. Found +by running cimtest. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_SettingsDefineCapabilities.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c +index 78c128c..fe16e3f 100644 +--- a/src/Virt_SettingsDefineCapabilities.c ++++ b/src/Virt_SettingsDefineCapabilities.c +@@ -1349,7 +1349,7 @@ static CMPIStatus _new_volume_template(const CMPIObjectPath *ref, + int ret = 0; + struct virt_pool *pool = NULL; + CMPIInstance *inst = NULL; +- int type = 0; ++ uint16_t type = 0; + const char *name; + const char *path; + uint16_t alloc = 0; +@@ -1712,13 +1712,13 @@ static CMPIStatus disk_pool_template(const CMPIObjectPath *ref, + CMPIArray *array; + CMPIStatus s = {CMPI_RC_OK, NULL}; + const char *path = "/dev/null"; +- int type[7] = {DISK_POOL_DIR, +- DISK_POOL_FS, +- DISK_POOL_NETFS, +- DISK_POOL_DISK, +- DISK_POOL_ISCSI, +- DISK_POOL_LOGICAL, +- DISK_POOL_SCSI}; ++ uint16_t type[7] = {DISK_POOL_DIR, ++ DISK_POOL_FS, ++ DISK_POOL_NETFS, ++ DISK_POOL_DISK, ++ DISK_POOL_ISCSI, ++ DISK_POOL_LOGICAL, ++ DISK_POOL_SCSI}; + int pool_types = 7; + int i; + uint16_t autostart; +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-7f3288be.patch b/SOURCES/libvirt-cim-0.6.3-7f3288be.patch new file mode 100644 index 0000000..74457bb --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-7f3288be.patch @@ -0,0 +1,141 @@ +From 7f3288be65c532f219389d8258b4940bb1e9cc5c Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Tue, 21 Jan 2014 19:41:42 -0500 +Subject: [PATCH 41/60] libxkutil:pool_parsing: Coverity cleanups + +A new version of Coverity found a number of issues: + +get_pool_from_xml(): FORWARD_NULL +parse_disk_pool(): RESOURCE_LEAK + - If parse_disk_pool() returned name == NULL, then the strdup() of + name into pool->id would dereference the NULL pointer leading to + a segfault. + + Furthermore parse_disk_pool() had a few issues. First the 'type_str' + could be NULL, so that needs to be checked. Second, 'type_str' was + never free()'d (the get_attr_value returns a strdup()'d value). + + Realizing all that resulted in a few extra changes to not strdup() + a value that we strdup()'d + + Eventually get_pool_from_xml() will return to get_disk_pool() which + returns to diskpool_set_capacity() or _new_volume_template() which + both error out when return value != 0 (although, I did change the + latter to be more explicit and match the former). + + Finally, even though the parsing of the element will only ever have + one "name" value - Coverity doesn't know that, so as a benign fix be + sure to not overwrite 'name' if "name" isn't already set. + +Signed-off-by: John Ferlan +--- + libxkutil/pool_parsing.c | 39 ++++++++++++++++++----------------- + src/Virt_SettingsDefineCapabilities.c | 2 +- + 2 files changed, 21 insertions(+), 20 deletions(-) + +diff --git a/libxkutil/pool_parsing.c b/libxkutil/pool_parsing.c +index 922ff32..80bd4ca 100644 +--- a/libxkutil/pool_parsing.c ++++ b/libxkutil/pool_parsing.c +@@ -194,15 +194,17 @@ char *get_disk_pool_type(uint16_t type) + + } + +-static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) ++static char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) + { + xmlNode **nodes = nsv->nodeTab; + xmlNode *child; +- const char *type_str = NULL; +- const char *name = NULL; ++ char *type_str = NULL; ++ char *name = NULL; + int type = 0; + + type_str = get_attr_value(nodes[0], "type"); ++ if (type_str == NULL) ++ return NULL; + + if (STREQC(type_str, "dir")) + type = DISK_POOL_DIR; +@@ -220,12 +222,15 @@ static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) + type = DISK_POOL_SCSI; + else + type = DISK_POOL_UNKNOWN; ++ free(type_str); + + pool->pool_type = type; +- ++ + for (child = nodes[0]->children; child != NULL; child = child->next) { +- if (XSTREQ(child->name, "name")) { ++ if (XSTREQ(child->name, "name") && name == NULL) { + name = get_node_content(child); ++ if (name == NULL) ++ return NULL; + } else if (XSTREQ(child->name, "target")) + parse_disk_target(child, pool); + else if (XSTREQ(child->name, "source")) +@@ -238,14 +243,18 @@ static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) + int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type) + { + int len; +- int ret = 0; ++ int ret = 1; + xmlDoc *xmldoc; + xmlXPathContext *xpathctx; + xmlXPathObject *xpathobj; + const xmlChar *xpathstr = (xmlChar *)"/pool"; +- const char *name; + + CU_DEBUG("Pool XML : %s", xml); ++ ++ /* FIXME: Add support for parsing network pools */ ++ if (type == CIM_RES_TYPE_NET) ++ return 0; ++ + len = strlen(xml) + 1; + + if ((xmldoc = xmlParseMemory(xml, len)) == NULL) +@@ -257,22 +266,14 @@ int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type) + if ((xpathobj = xmlXPathEvalExpression(xpathstr, xpathctx)) == NULL) + goto err3; + +- /* FIXME: Add support for parsing network pools */ +- if (type == CIM_RES_TYPE_NET) { +- ret = 0; +- goto err1; +- } +- + memset(pool, 0, sizeof(*pool)); + +- pool->type = CIM_RES_TYPE_DISK; +- name = parse_disk_pool(xpathobj->nodesetval, +- &(pool)->pool_info.disk); +- if (name == NULL) ++ pool->type = CIM_RES_TYPE_DISK; ++ pool->id = parse_disk_pool(xpathobj->nodesetval, ++ &(pool)->pool_info.disk); ++ if (pool->id != NULL) + ret = 0; + +- pool->id = strdup(name); +- + xmlXPathFreeObject(xpathobj); + err3: + xmlXPathFreeContext(xpathctx); +diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c +index fe16e3f..756e46b 100644 +--- a/src/Virt_SettingsDefineCapabilities.c ++++ b/src/Virt_SettingsDefineCapabilities.c +@@ -1376,7 +1376,7 @@ static CMPIStatus _new_volume_template(const CMPIObjectPath *ref, + } + + ret = get_disk_pool(poolptr, &pool); +- if (ret == 1) { ++ if (ret != 0) { + virt_set_status(_BROKER, &s, + CMPI_RC_ERR_FAILED, + virStoragePoolGetConnect(poolptr), +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-8a060e0d.patch b/SOURCES/libvirt-cim-0.6.3-8a060e0d.patch new file mode 100644 index 0000000..942def3 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-8a060e0d.patch @@ -0,0 +1,516 @@ +From 8a060e0d178fd88c78fa2aad147492b4949ff63b Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Wed, 11 Sep 2013 16:45:38 +0200 +Subject: [PATCH 18/60] RASD: Schema and Provider Support for Console RASDs + +Representing console devices was very limited with the previous +approach using a special graphical display. For instance it +was not possible to define different target types (serial, virtio, +sclp) nor to exploit all source types (pty, file, tcp, ...) +available in libvirt. + +With the following new RASD classes it is possible to define +real console resources: + KVM_ConsoleResouceAllocationSettingData + Xen_ConsoleResouceAllocationSettingData + LXC_ConsoleResouceAllocationSettingData + +The ResourceType of the returned instances is is '1' (Other) and the +OtherResourceType is 'console'. + +Implemented CIM operations: + enumerate instances + enumerate instance names + get instance + +Signed-off-by: Thilo Boehm +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + schema/ResourceAllocationSettingData.mof | 246 +++++++++++++++++++++- + schema/ResourceAllocationSettingData.registration | 5 +- + src/Virt_RASD.c | 149 ++++++++++++- + 3 files changed, 397 insertions(+), 3 deletions(-) + +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index 871ab04..ebc4806 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -1,4 +1,4 @@ +-// Copyright IBM Corp. 2007 ++// Copyright IBM Corp. 2007, 2013 + + [Description ("Xen virtual disk configuration"), + Provider("cmpi::Virt_RASD") +@@ -445,3 +445,247 @@ class KVM_StorageVolumeResourceAllocationSettingData : KVM_ResourceAllocationSet + string AllocationUnits; + }; + ++[Description ("KVM virtual character device"), ++ Provider("cmpi::Virt_RASD") ++] ++class KVM_CharacterResourceAllocationSettingData : KVM_ResourceAllocationSettingData ++{ ++ [Description ("The type of resource in the source/host environment."), ++ ValueMap {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, ++ Values {"null", "vc", "pty", "dev", "file", "pipe", ++ "stdio", "udp", "tcp", "unix", "spicevmc"}, ++ ModelCorrespondence {"KVM_CharacterResourceAllocationSettingData.SourcePath", ++ "KVM_CharacterResourceAllocationSettingData.ConnectURL", ++ "KVM_CharacterResourceAllocationSettingData.BindURL"}] ++ uint16 SourceType; ++ ++ [Description ("If SourceType=4 ('file'),this is the full qualified file path. " ++ "The file is opened and all data sent to the character device " ++ "is written to the file. " ++ "If SourceType=2 ('pty'),this is the full qualified Pseudo TTY path. " ++ "A Pseudo TTY is allocated using /dev/ptmx. " ++ "If SourceType=3 ('dev'), this is the full qualified file path " ++ "to the underlying phsical character device. The device types must " ++ "match, eg the emulated serial port should only be connected to a " ++ "host serial port - don't connect a serial port to a parallel port. " ++ "If SourceType=5 ('pipe'), this is the full qualified file path " ++ "of a named pipe."), ++ ModelCorrespondence {"KVM_CharacterResourceAllocationSettingData.SourceType"}] ++ string SourcePath; ++ ++ [Description ("This URL describes the connection to a remote or local location " ++ "where the character devices acts as a client." ++ "To use a literal IPv6 address in the URI, the literal address should be " ++ "enclosed in '[' and ']' characters. " ++ "If SourceType=7 ('udp'), this is defines a udp remote host and port connection " ++ "to send packages. That the character device acts as a UDP netconsole service, " ++ "sending and receiving packets, the BindURL property must also be defined. " ++ "This is a lossy service. " ++ "Only 'udp' is valid for the protocol part of the URI. " ++ "Format of the URL: ://:. e.g. udp://0.0.0.0:2245 " ++ "If SourceType=8 ('tcp'), this is defines a remote host and port connection. " ++ "The protocol part of the URI can be: 'raw', 'telnet', 'telnets', 'tls'. " ++ "Format of the URL: ://:. e.g. raw://[3ffe:2a00:100:7031::1]:2245 " ++ "If SourceType=9 ('unix'), this is defined the full qualified file path " ++ "of a Unix domain socket. Only 'file' is valid for the protocol part of the URI. " ++ "Format of the URL: file://. " ++ "e.g. file:///tmp/console-out"), ++ ModelCorrespondence {"KVM_CharacterResourceAllocationSettingData.SourceType"}] ++ string ConnectURL; ++ ++ [Description ("This URL describes the connection to a remote or local location " ++ "where the character devices acts as a server. " ++ "To use a literal IPv6 address in the URI, the literal address should be " ++ "enclosed in '[' and ']' characters. " ++ "If SourceType=7 ('udp'), this is defines a udp remote host and port connection " ++ "to receive packages. That the character device acts as a UDP netconsole service, " ++ "sending and receiving packets, the ConnectURL property must also be defined. " ++ "This is a lossy service. " ++ "Only 'udp' is valid for the protocol part of the URI. " ++ "Format of the URL: ://:. e.g. udp://0.0.0.0:2245 " ++ "If SourceType=8 ('tcp'), this is defines a remote host and port connection. " ++ "The protocol part of the URI can be: 'raw', 'telnet', 'telnets', 'tls'. " ++ "Format of the URL: ://:. e.g. raw://[3ffe:2a00:100:7031::1]:2245 " ++ "If SourceType=9 ('unix'), this is defined the full qualified file path " ++ "of a Unix domain socket. Only 'file' is valid for the protocol part of the URI. " ++ "Format of the URL: file://. " ++ "e.g. file:///tmp/console-in"), ++ ModelCorrespondence {"KVM_CharacterResourceAllocationSettingData.SourceType"}] ++ string BindURL; ++}; ++ ++ ++[Description ("KVM virtual console device. It is identified by: " ++ "CIM_ResourceAllocationSettingData.ResourceType=1 ( 'Other' ) and " ++ "CIM_ResourceAllocationSettingData.OtherResourceType='console'"), ++ Provider("cmpi::Virt_RASD") ++] ++class KVM_ConsoleResourceAllocationSettingData : KVM_CharacterResourceAllocationSettingData ++{ ++ [Description ("The type of the console in the target/guest environment.")] ++ string TargetType; ++}; ++ ++ ++ ++[Description ("Xen virtual character device"), ++ Provider("cmpi::Virt_RASD") ++] ++class Xen_CharacterResourceAllocationSettingData : Xen_ResourceAllocationSettingData ++{ ++ [Description ("The type of resource in the source/host environment."), ++ ValueMap {"0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, ++ Values {"null", "vc", "pty", "dev", "file", "pipe", ++ "stdio", "udp", "tcp", "unix", "spicevmc"}, ++ ModelCorrespondence {"Xen_CharacterResourceAllocationSettingData.SourcePath", ++ "Xen_CharacterResourceAllocationSettingData.ConnectURL", ++ "Xen_CharacterResourceAllocationSettingData.BindURL"}] ++ uint16 SourceType; ++ ++ [Description ("If SourceType=4 ('file'),this is the full qualified file path. " ++ "The file is opened and all data sent to the character device " ++ "is written to the file. " ++ "If SourceType=2 ('pty'),this is the full qualified Pseudo TTY path. " ++ "A Pseudo TTY is allocated using /dev/ptmx. " ++ "If SourceType=3 ('dev'), this is the full qualified file path " ++ "to the underlying phsical character device. The device types must " ++ "match, eg the emulated serial port should only be connected to a " ++ "host serial port - don't connect a serial port to a parallel port. " ++ "If SourceType=5 ('pipe'), this is the full qualified file path " ++ "of a named pipe."), ++ ModelCorrespondence {"Xen_CharacterResourceAllocationSettingData.SourceType"}] ++ string SourcePath; ++ ++ [Description ("This URL describes the connection to a remote or local location " ++ "where the character devices acts as a client." ++ "To use a literal IPv6 address in the URI, the literal address should be " ++ "enclosed in '[' and ']' characters. " ++ "If SourceType=7 ('udp'), this is defines a udp remote host and port connection " ++ "to send packages. That the character device acts as a UDP netconsole service, " ++ "sending and receiving packets, the BindURL property must also be defined. " ++ "This is a lossy service. " ++ "Only 'udp' is valid for the protocol part of the URI. " ++ "Format of the URL: ://:. e.g. udp://0.0.0.0:2245 " ++ "If SourceType=8 ('tcp'), this is defines a remote host and port connection. " ++ "The protocol part of the URI can be: 'raw', 'telnet', 'telnets', 'tls'. " ++ "Format of the URL: ://:. e.g. raw://[3ffe:2a00:100:7031::1]:2245 " ++ "If SourceType=9 ('unix'), this is defined the full qualified file path " ++ "of a Unix domain socket. Only 'file' is valid for the protocol part of the URI. " ++ "Format of the URL: file://. " ++ "e.g. file:///tmp/console-out"), ++ ModelCorrespondence {"Xen_CharacterResourceAllocationSettingData.SourceType"}] ++ string ConnectURL; ++ ++ [Description ("This URL describes the connection to a remote or local location " ++ "where the character devices acts as a server. " ++ "To use a literal IPv6 address in the URI, the literal address should be " ++ "enclosed in '[' and ']' characters. " ++ "If SourceType=7 ('udp'), this is defines a udp remote host and port connection " ++ "to receive packages. That the character device acts as a UDP netconsole service, " ++ "sending and receiving packets, the ConnectURL property must also be defined. " ++ "This is a lossy service. " ++ "Only 'udp' is valid for the protocol part of the URI. " ++ "Format of the URL: ://:. e.g. udp://0.0.0.0:2245 " ++ "If SourceType=8 ('tcp'), this is defines a remote host and port connection. " ++ "The protocol part of the URI can be: 'raw', 'telnet', 'telnets', 'tls'. " ++ "Format of the URL: ://:. e.g. raw://[3ffe:2a00:100:7031::1]:2245 " ++ "If SourceType=9 ('unix'), this is defined the full qualified file path " ++ "of a Unix domain socket. Only 'file' is valid for the protocol part of the URI. " ++ "Format of the URL: file://. " ++ "e.g. file:///tmp/console-in"), ++ ModelCorrespondence {"Xen_CharacterResourceAllocationSettingData.SourceType"}] ++ string BindURL; ++}; ++ ++ ++[Description ("Xen virtual console device. It is identified by: " ++ "CIM_ResourceAllocationSettingData.ResourceType=1 ( 'Other' ) and " ++ "CIM_ResourceAllocationSettingData.OtherResourceType='console'"), ++ Provider("cmpi::Virt_RASD") ++] ++class Xen_ConsoleResourceAllocationSettingData : Xen_CharacterResourceAllocationSettingData ++{ ++ [Description ( "The type of the console in the target/guest environment.")] ++ string TargetType; ++}; ++ ++[Description ("LXC virtual character device"), ++ Provider("cmpi::Virt_RASD") ++] ++class LXC_CharacterResourceAllocationSettingData : LXC_ResourceAllocationSettingData ++{ ++ [Description ("The type of resource in the source/host environment."), ++ ValueMap {"0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, ++ Values {"null", "vc", "pty", "dev", "file", "pipe", ++ "stdio", "udp", "tcp", "unix", "spicevmc"}, ++ ModelCorrespondence {"LXC_CharacterResourceAllocationSettingData.SourcePath", ++ "LXC_CharacterResourceAllocationSettingData.ConnectURL", ++ "LXC_CharacterResourceAllocationSettingData.BindURL"}] ++ uint16 SourceType; ++ ++ [Description ("If SourceType=4 ('file'),this is the full qualified file path. " ++ "The file is opened and all data sent to the character device " ++ "is written to the file. " ++ "If SourceType=2 ('pty'),this is the full qualified Pseudo TTY path. " ++ "A Pseudo TTY is allocated using /dev/ptmx. " ++ "If SourceType=3 ('dev'), this is the full qualified file path " ++ "to the underlying phsical character device. The device types must " ++ "match, eg the emulated serial port should only be connected to a " ++ "host serial port - don't connect a serial port to a parallel port. " ++ "If SourceType=5 ('pipe'), this is the full qualified file path " ++ "of a named pipe."), ++ ModelCorrespondence {"LXC_CharacterResourceAllocationSettingData.SourceType"}] ++ string SourcePath; ++ ++ [Description ("This URL describes the connection to a remote or local location " ++ "where the character devices acts as a client." ++ "To use a literal IPv6 address in the URI, the literal address should be " ++ "enclosed in '[' and ']' characters. " ++ "If SourceType=7 ('udp'), this is defines a udp remote host and port connection " ++ "to send packages. That the character device acts as a UDP netconsole service, " ++ "sending and receiving packets, the BindURL property must also be defined. " ++ "This is a lossy service. " ++ "Only 'udp' is valid for the protocol part of the URI. " ++ "Format of the URL: ://:. e.g. udp://0.0.0.0:2245 " ++ "If SourceType=8 ('tcp'), this is defines a remote host and port connection. " ++ "The protocol part of the URI can be: 'raw', 'telnet', 'telnets', 'tls'. " ++ "Format of the URL: ://:. e.g. raw://[3ffe:2a00:100:7031::1]:2245 " ++ "If SourceType=9 ('unix'), this is defined the full qualified file path " ++ "of a Unix domain socket. Only 'file' is valid for the protocol part of the URI. " ++ "Format of the URL: file://. " ++ "e.g. file:///tmp/console-out"), ++ ModelCorrespondence {"LXC_CharacterResourceAllocationSettingData.SourceType"}] ++ string ConnectURL; ++ ++ [Description ("This URL describes the connection to a remote or local location " ++ "where the character devices acts as a server. " ++ "To use a literal IPv6 address in the URI, the literal address should be " ++ "enclosed in '[' and ']' characters. " ++ "If SourceType=7 ('udp'), this is defines a udp remote host and port connection " ++ "to receive packages. That the character device acts as a UDP netconsole service, " ++ "sending and receiving packets, the ConnectURL property must also be defined. " ++ "This is a lossy service. " ++ "Only 'udp' is valid for the protocol part of the URI. " ++ "Format of the URL: ://:. e.g. udp://0.0.0.0:2245 " ++ "If SourceType=8 ('tcp'), this is defines a remote host and port connection. " ++ "The protocol part of the URI can be: 'raw', 'telnet', 'telnets', 'tls'. " ++ "Format of the URL: ://:. e.g. raw://[3ffe:2a00:100:7031::1]:2245 " ++ "If SourceType=9 ('unix'), this is defined the full qualified file path " ++ "of a Unix domain socket. Only 'file' is valid for the protocol part of the URI. " ++ "Format of the URL: file://. " ++ "e.g. file:///tmp/console-in"), ++ ModelCorrespondence {"LXC_CharacterResourceAllocationSettingData.SourceType"}] ++ string BindURL; ++}; ++ ++ ++[Description ("LXC virtual console device. It is identified by: " ++ "CIM_ResourceAllocationSettingData.ResourceType=1 ( 'Other' ) and " ++ "CIM_ResourceAllocationSettingData.OtherResourceType='console'"), ++ Provider("cmpi::Virt_RASD") ++] ++class LXC_ConsoleResourceAllocationSettingData : LXC_CharacterResourceAllocationSettingData ++{ ++ [Description ("The type of the console in the target/guest environment.")] ++ string TargetType; ++}; +diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration +index 2747f91..b969bfe 100644 +--- a/schema/ResourceAllocationSettingData.registration ++++ b/schema/ResourceAllocationSettingData.registration +@@ -1,4 +1,4 @@ +-# Copyright IBM Corp. 2007 ++# Copyright IBM Corp. 2007, 2013 + # Classname Namespace ProviderName ProviderModule ProviderTypes + Xen_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + Xen_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +@@ -6,14 +6,17 @@ Xen_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + Xen_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + Xen_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + Xen_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance ++Xen_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance ++KVM_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance ++LXC_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index 150ccd3..e28d4e6 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007, 2013 + * + * Authors: + * Dan Smith +@@ -662,6 +662,143 @@ static CMPIStatus set_graphics_rasd_params(const struct virt_device *dev, + return s; + } + ++static char* _build_console_url(const char *protocol, ++ const char *host, ++ const char *port) ++{ ++ char* result = NULL; ++ ++ if (host == NULL) ++ goto out; ++ ++ if (protocol != NULL && STREQC("file", protocol)) { ++ /* The host string contains the file name. ++ Even if the file name does not start with a '/' ++ it is treated by libvirt as a full qualified path. ++ */ ++ if (host[0] == '/') { ++ if (asprintf(&result, "file://%s", host) < 0) ++ result = NULL; ++ goto out; ++ } else { ++ if (asprintf(&result, "file:///%s", host) < 0) ++ result = NULL; ++ goto out; ++ } ++ } ++ /* The assumption is that the host does not contain a port. ++ If the host string contains a ':', ++ the host is treated as an IPv6 address. ++ */ ++ if (strchr(host, ':') == NULL) { ++ if (port == NULL) { ++ if (asprintf(&result,"%s://%s", protocol, host) < 0) ++ result = NULL; ++ goto out; ++ } else { ++ if (asprintf(&result,"%s://%s:%s", protocol, ++ host,port) < 0) ++ result = NULL; ++ goto out; ++ } ++ } ++ out: ++ return result; ++} ++ ++ ++static CMPIStatus set_console_rasd_params(const struct virt_device *vdev, ++ CMPIInstance *inst) ++{ ++ CMPIStatus s = {CMPI_RC_OK, NULL}; ++ const struct console_device *cdev = NULL; ++ char* tmp = NULL; ++ ++ cdev = &vdev->dev.console; ++ ++ CMSetProperty(inst, "OtherResourceType", "console", CMPI_chars); ++ CMSetProperty(inst, "SourceType", ++ (CMPIValue *)&cdev->source_type, CMPI_uint16); ++ CMSetProperty(inst, "TargetType", ++ (CMPIValue *)cdev->target_type, CMPI_chars); ++ ++ switch (cdev->source_type) { ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ CMSetProperty(inst, "SourcePath", ++ (CMPIValue *)cdev->source_dev.pty.path, ++ CMPI_chars); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ CMSetProperty(inst, "SourcePath", ++ (CMPIValue *)cdev->source_dev.dev.path, ++ CMPI_chars); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ CMSetProperty(inst, "SourcePath", ++ (CMPIValue *)cdev->source_dev.file.path, ++ CMPI_chars); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ CMSetProperty(inst, "SourcePath", ++ (CMPIValue *)cdev->source_dev.pipe.path, ++ CMPI_chars); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ tmp = _build_console_url("file", ++ cdev->source_dev.unixsock.path, NULL); ++ if (cdev->source_dev.unixsock.mode != NULL) { ++ if (STREQC(cdev->source_dev.unixsock.mode, "bind")) ++ CMSetProperty(inst, "BindURL", ++ (CMPIValue *)tmp, CMPI_chars); ++ else if (STREQC(cdev->source_dev.unixsock.mode, ++ "connect")) ++ CMSetProperty(inst, "ConnectURL", ++ (CMPIValue *)tmp, CMPI_chars); ++ } ++ free(tmp); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ tmp = _build_console_url("udp", ++ cdev->source_dev.udp.bind_host, ++ cdev->source_dev.udp.bind_service); ++ CMSetProperty(inst, "BindURL", ++ (CMPIValue *)tmp, CMPI_chars); ++ free(tmp); ++ ++ tmp = _build_console_url("udp", ++ cdev->source_dev.udp.connect_host, ++ cdev->source_dev.udp.connect_service); ++ CMSetProperty(inst, "ConnectURL", (CMPIValue *)tmp, CMPI_chars); ++ free(tmp); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ tmp = _build_console_url(cdev->source_dev.tcp.protocol, ++ cdev->source_dev.tcp.host, ++ cdev->source_dev.tcp.service); ++ if (cdev->source_dev.tcp.mode != NULL) { ++ if (STREQC(cdev->source_dev.tcp.mode, "bind")) ++ CMSetProperty(inst, "BindURL", ++ (CMPIValue *)tmp, CMPI_chars); ++ else if (STREQC(cdev->source_dev.tcp.mode, "connect")) ++ CMSetProperty(inst, "ConnectURL", ++ (CMPIValue *)tmp, CMPI_chars); ++ } ++ free(tmp); ++ break; ++ ++ default: ++ /* Nothing to do for : ++ CIM_CHARDEV_SOURCE_TYPE_STDIO ++ CIM_CHARDEV_SOURCE_TYPE_NULL ++ CIM_CHARDEV_SOURCE_TYPE_VC ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC ++ */ ++ break; ++ } ++ ++ return s; ++} ++ + static CMPIStatus set_input_rasd_params(const struct virt_device *dev, + CMPIInstance *inst) + { +@@ -721,6 +858,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, + } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { + type = CIM_RES_TYPE_GRAPHICS; + base = "GraphicsResourceAllocationSettingData"; ++ } else if (dev->type == CIM_RES_TYPE_CONSOLE) { ++ type = CIM_RES_TYPE_OTHER; ++ base = "ConsoleResourceAllocationSettingData"; + } else if (dev->type == CIM_RES_TYPE_INPUT) { + type = CIM_RES_TYPE_INPUT; + base = "InputResourceAllocationSettingData"; +@@ -777,6 +917,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, + s = set_graphics_rasd_params(dev, inst, host, CLASSNAME(ref)); + } else if (dev->type == CIM_RES_TYPE_INPUT) { + s = set_input_rasd_params(dev, inst); ++ } else if (dev->type == CIM_RES_TYPE_CONSOLE) { ++ s = set_console_rasd_params(dev, inst); + } + + /* FIXME: Put the HostResource in place */ +@@ -909,6 +1051,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) + *type = CIM_RES_TYPE_INPUT; + else if (STREQ(base, "StorageVolumeResourceAllocationSettingData")) + *type = CIM_RES_TYPE_IMAGE; ++ else if (STREQ(base, "ConsoleResourceAllocationSettingData")) ++ *type = CIM_RES_TYPE_CONSOLE; + else + goto out; + +@@ -940,6 +1084,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname) + case CIM_RES_TYPE_GRAPHICS: + *classname = "GraphicsResourceAllocationSettingData"; + break; ++ case CIM_RES_TYPE_CONSOLE: ++ *classname = "ConsoleResourceAllocationSettingData"; ++ break; + case CIM_RES_TYPE_INPUT: + *classname = "InputResourceAllocationSettingData"; + break; +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-8eb5c1e7.patch b/SOURCES/libvirt-cim-0.6.3-8eb5c1e7.patch new file mode 100644 index 0000000..6a9ef47 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-8eb5c1e7.patch @@ -0,0 +1,40 @@ +From 8eb5c1e7b2547ad516aeb97d4407758c27c05a54 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Wed, 22 Jan 2014 13:28:06 -0500 +Subject: [PATCH 45/60] EAFP: Coverity cleanup + +A new version of Coverity found: + +get_dev_from_pool(): RESOURCE_LEAK + - Because the code is run within a for() loop Coverity complains + that the returned 'poolid' is not free'd during each pass through + the loop. So even though it may not be fetched again, just free() + and reinitialize 'poolid' after usage + +Signed-off-by: John Ferlan +--- + src/Virt_ElementAllocatedFromPool.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c +index 03d856a..2c2f2d1 100644 +--- a/src/Virt_ElementAllocatedFromPool.c ++++ b/src/Virt_ElementAllocatedFromPool.c +@@ -124,10 +124,14 @@ static CMPIStatus get_dev_from_pool(const CMPIObjectPath *ref, + poolid = pool_member_of(_BROKER, cn, type, dev_id); + if (poolid && STREQ(poolid, _poolid)) + inst_list_add(list, inst); ++ ++ if (poolid) { ++ free(poolid); ++ poolid = NULL; ++ } + } + + out: +- free(poolid); + inst_list_free(&tmp); + + return s; +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-93ea8130.patch b/SOURCES/libvirt-cim-0.6.3-93ea8130.patch new file mode 100644 index 0000000..6f8bdb7 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-93ea8130.patch @@ -0,0 +1,131 @@ +From 93ea8130081b8450981320c7c4e7b1b65a75f269 Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Wed, 11 Sep 2013 16:45:36 +0200 +Subject: [PATCH 16/60] schema: New SVPC types for chardev/consoles + +C definitions for the console source types, defining the representation +of the consoles in the hypervisor host. Includes mapping from and to +string representations. + +Signed-off-by: Thilo Boehm +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + src/svpc_types.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 96 insertions(+), 1 deletion(-) + +diff --git a/src/svpc_types.h b/src/svpc_types.h +index 99dd56f..2e4d73f 100644 +--- a/src/svpc_types.h ++++ b/src/svpc_types.h +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007, 2013 + * + * Authors: + * Dan Smith +@@ -167,5 +167,100 @@ enum CIM_op_status { + CIM_OP_STATUS_POWER_MODE = 18, + }; + ++/* emum for the Character device Source resource types */ ++enum CIM_chardev_source_type { ++ CIM_CHARDEV_SOURCE_TYPE_NULL = 0, ++ CIM_CHARDEV_SOURCE_TYPE_VC = 1, ++ CIM_CHARDEV_SOURCE_TYPE_PTY = 2, ++ CIM_CHARDEV_SOURCE_TYPE_DEV = 3, ++ CIM_CHARDEV_SOURCE_TYPE_FILE = 4, ++ CIM_CHARDEV_SOURCE_TYPE_PIPE = 5, ++ CIM_CHARDEV_SOURCE_TYPE_STDIO = 6, ++ CIM_CHARDEV_SOURCE_TYPE_UDP = 7, ++ CIM_CHARDEV_SOURCE_TYPE_TCP = 8, ++ CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK = 9, ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC = 10, ++ /* please insert new source types above */ ++ CIM_CHARDEV_SOURCE_TYPE_INVALIDTYPE, ++ CIM_CHARDEV_SOURCE_TYPE_UNKNOWN = 32768, ++}; ++ ++static inline int chardev_source_type_StrToID(const char *type_str) ++{ ++ int rc = CIM_CHARDEV_SOURCE_TYPE_UNKNOWN; ++ ++ if (type_str == NULL) ++ return rc; ++ ++ if (STREQC(type_str, "null")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_NULL; ++ else if (STREQC(type_str, "vc")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_VC; ++ else if (STREQC(type_str, "pty")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_PTY; ++ else if (STREQC(type_str, "dev")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_DEV; ++ else if (STREQC(type_str, "file")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_FILE; ++ else if (STREQC(type_str, "pipe")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_PIPE; ++ else if (STREQC(type_str, "stdio")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_STDIO; ++ else if (STREQC(type_str, "udp")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_UDP; ++ else if (STREQC(type_str, "tcp")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_TCP; ++ else if (STREQC(type_str, "unix")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK; ++ else if (STREQC(type_str, "spicevmc")) ++ rc = CIM_CHARDEV_SOURCE_TYPE_SPICEVMC; ++ ++ return rc; ++} ++ ++static inline const char* chardev_source_type_IDToStr(int type) ++{ ++ char *type_str = NULL; ++ ++ switch (type) ++ { ++ case CIM_CHARDEV_SOURCE_TYPE_NULL: ++ type_str = "null"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_VC: ++ type_str = "vc"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ type_str = "pty"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ type_str = "dev"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ type_str = "file"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ type_str = "pipe"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_STDIO: ++ type_str = "stdio"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ type_str = "udp"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ type_str = "tcp"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ type_str = "unix"; ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_SPICEVMC: ++ type_str = "spicevmc"; ++ break; ++ default: ++ break; ++ } ++ return type_str; ++} + + #endif +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-95f0d418.patch b/SOURCES/libvirt-cim-0.6.3-95f0d418.patch new file mode 100644 index 0000000..9de004c --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-95f0d418.patch @@ -0,0 +1,42 @@ +From 95f0d418fe4240a0ea2706cc400828ec90984844 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Tue, 5 Nov 2013 10:03:33 +0100 +Subject: [PATCH 34/48] schema: Fix class removal with Pegasus + +In provider de-registration step, the provider-register.sh +script is attempting to delete all libvirt-cim classes from +the Pegasus repository. Pegasus refuses to delete classes +if it still has child classes in the repository. +While the MOF files are processed in reverse order, the classes +were still deleted in their original order, which can fail due +to inter-class dependencies. +Changed to reverse the class deletion order on a per MOF +file base. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + provider-register.sh | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/provider-register.sh b/provider-register.sh +index b730ef3..abe8e95 100755 +--- a/provider-register.sh ++++ b/provider-register.sh +@@ -332,8 +332,12 @@ pegasus_uninstall() + echo "Error: wbemexec not found" >&2 + return 1 + fi +- CLASSES=`cat $mymofs 2> /dev/null | grep '^class'| cut -d ' ' -f 2 | uniq` +- ++ for mof in $mymofs ++ do ++ # We must delete the classes in reverse order per MOF file ++ MOFCLASSES=`cat $mof 2> /dev/null | grep '^[[:space:]]*class' | sed 's/ \+/ /g' | tac | cut -d ' ' -f 2` ++ CLASSES="$CLASSES $MOFCLASSES" ++ done + for _TEMPDIR in /var/tmp /tmp + do + if test -w $_TEMPDIR +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-9a4f2a32.patch b/SOURCES/libvirt-cim-0.6.3-9a4f2a32.patch new file mode 100644 index 0000000..7d0df2f --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-9a4f2a32.patch @@ -0,0 +1,78 @@ +From 9a4f2a3219fd8bc9d96353b051fe5853a440e7d5 Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Fri, 11 Oct 2013 13:47:34 +0200 +Subject: [PATCH 35/60] VSSM: Fix endianness issue in domain properties + +The properties for the on_xxx actions must be 16-bit values in +order to avoid failures on big endian systems. + +Signed-off-by: Thilo Boehm +Reviewed-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 2 +- + libxkutil/device_parsing.h | 8 ++++---- + src/Virt_VirtualSystemManagementService.c | 4 ++-- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 97419d2..8a90653 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -1602,7 +1602,7 @@ static int parse_features(struct domain *dominfo, xmlNode *features) + return 1; + } + +-static void set_action(int *val, xmlNode *child) ++static void set_action(uint16_t *val, xmlNode *child) + { + char *action = (char *)xmlNodeGetContent(child); + +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index 531703d..92427c1 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -213,7 +213,7 @@ struct domain { + bool acpi; + bool apic; + bool pae; +- int autostrt; ++ uint16_t autostrt; + + union { + struct pv_os_info pv; +@@ -221,9 +221,9 @@ struct domain { + struct lxc_os_info lxc; + } os_info; + +- int on_poweroff; +- int on_reboot; +- int on_crash; ++ uint16_t on_poweroff; ++ uint16_t on_reboot; ++ uint16_t on_crash; + + struct virt_device *dev_graphics; + int dev_graphics_ct; +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 6548d08..5c7238f 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -719,13 +719,13 @@ static int vssd_to_domain(CMPIInstance *inst, + if (ret != CMPI_RC_OK) + tmp = 0; + +- domain->on_poweroff = (int)tmp; ++ domain->on_poweroff = tmp; + + ret = cu_get_u16_prop(inst, "AutomaticRecoveryAction", &tmp); + if (ret != CMPI_RC_OK) + tmp = CIM_VSSD_RECOVERY_NONE; + +- domain->on_crash = (int)tmp; ++ domain->on_crash = tmp; + + if (cu_get_bool_prop(inst, "IsFullVirt", &fullvirt) != CMPI_RC_OK) + fullvirt = false; +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-9c1d321b.patch b/SOURCES/libvirt-cim-0.6.3-9c1d321b.patch new file mode 100644 index 0000000..eecef15 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-9c1d321b.patch @@ -0,0 +1,217 @@ +From 9c1d321b14334b390ab84a2ff708566037b19130 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Tue, 5 Nov 2013 10:03:32 +0100 +Subject: [PATCH 33/48] build: Fix provider registration issues + +This commit addresses an issue with provider registration during +RPM install or update. +The schema registration by wildcard doesn't take into consideration +that there are dependencies between the MOF files leading to +a partially populated repository and a not working libvirt-cim +provider. +Fixed by explicitly stating the mof and registration files in the +necessary order. + +Further a minor false error message coming from the systemd service +detection was bound to cause irritation. This is suppressed now. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 167 ++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 157 insertions(+), 10 deletions(-) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index b50cbd1..c96451b 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -64,17 +64,164 @@ mkdir -p $RPM_BUILD_ROOT@INFO_STORE@ + %clean + rm -fr $RPM_BUILD_ROOT + +-%define REGISTRATION %{_datadir}/%{name}/*.registration +-%define SCHEMA %{_datadir}/%{name}/*.mof ++%define REGISTRATION %{_datadir}/%{name}/ComputerSystem.registration \\\ ++ %{_datadir}/%{name}/LogicalDisk.registration \\\ ++ %{_datadir}/%{name}/NetworkPort.registration \\\ ++ %{_datadir}/%{name}/Memory.registration \\\ ++ %{_datadir}/%{name}/Processor.registration \\\ ++ %{_datadir}/%{name}/SystemDevice.registration \\\ ++ %{_datadir}/%{name}/VSSD.registration \\\ ++ %{_datadir}/%{name}/HostSystem.registration \\\ ++ %{_datadir}/%{name}/HostedDependency.registration \\\ ++ %{_datadir}/%{name}/VirtualSystemManagementService.registration \\\ ++ %{_datadir}/%{name}/VirtualSystemManagementCapabilities.registration \\\ ++ %{_datadir}/%{name}/EnabledLogicalElementCapabilities.registration \\\ ++ %{_datadir}/%{name}/AllocationCapabilities.registration \\\ ++ %{_datadir}/%{name}/SettingsDefineCapabilities.registration \\\ ++ %{_datadir}/%{name}/MemoryPool.registration \\\ ++ %{_datadir}/%{name}/ElementCapabilities.registration \\\ ++ %{_datadir}/%{name}/ProcessorPool.registration \\\ ++ %{_datadir}/%{name}/DiskPool.registration \\\ ++ %{_datadir}/%{name}/HostedResourcePool.registration \\\ ++ %{_datadir}/%{name}/ComputerSystemIndication.registration \\\ ++ %{_datadir}/%{name}/ResourceAllocationSettingDataIndication.registration \\\ ++ %{_datadir}/%{name}/SwitchService.registration \\\ ++ %{_datadir}/%{name}/ComputerSystemMigrationIndication.registration \\\ ++ %{_datadir}/%{name}/ResourceAllocationSettingData.registration \\\ ++ %{_datadir}/%{name}/ResourcePoolConfigurationService.registration \\\ ++ %{_datadir}/%{name}/ResourcePoolConfigurationCapabilities.registration \\\ ++ %{_datadir}/%{name}/VSSDComponent.registration \\\ ++ %{_datadir}/%{name}/SettingsDefineState.registration \\\ ++ %{_datadir}/%{name}/NetPool.registration \\\ ++ %{_datadir}/%{name}/ResourceAllocationFromPool.registration \\\ ++ %{_datadir}/%{name}/ElementAllocatedFromPool.registration \\\ ++ %{_datadir}/%{name}/HostedService.registration \\\ ++ %{_datadir}/%{name}/ElementSettingData.registration \\\ ++ %{_datadir}/%{name}/VSMigrationCapabilities.registration \\\ ++ %{_datadir}/%{name}/VSMigrationService.registration \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.registration \\\ ++ %{_datadir}/%{name}/VSMigrationSettingData.registration \\\ ++ %{_datadir}/%{name}/VirtualSystemSnapshotService.registration \\\ ++ %{_datadir}/%{name}/VirtualSystemSnapshotServiceCapabilities.registration \\\ ++ %{_datadir}/%{name}/ConcreteComponent.registration \\\ ++ %{_datadir}/%{name}/ConsoleRedirectionService.registration \\\ ++ %{_datadir}/%{name}/ConsoleRedirectionServiceCapabilities.registration \\\ ++ %{_datadir}/%{name}/ServiceAffectsElement.registration \\\ ++ %{_datadir}/%{name}/KVMRedirectionSAP.registration \\\ ++ %{_datadir}/%{name}/DisplayController.registration \\\ ++ %{_datadir}/%{name}/PointingDevice.registration \\\ ++ %{_datadir}/%{name}/GraphicsPool.registration \\\ ++ %{_datadir}/%{name}/InputPool.registration \\\ ++ %{_datadir}/%{name}/HostedAccessPoint.registration \\\ ++ %{_datadir}/%{name}/ServiceAccessBySAP.registration \\\ ++ %{_datadir}/%{name}/SAPAvailableForElement.registration \\\ ++ %{_datadir}/%{name}/FilterEntry.registration \\\ ++ %{_datadir}/%{name}/FilterList.registration \\\ ++ %{_datadir}/%{name}/EntriesInFilterList.registration \\\ ++ %{_datadir}/%{name}/NestedFilterList.registration \\\ ++ %{_datadir}/%{name}/AppliedFilterList.registration \\\ ++ %{_datadir}/%{name}/HostedFilterList.registration + +-%define INTEROP_REG %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.registration +-%define INTEROP_MOF %{_datadir}/%{name}/{ComputerSystem,HostSystem,RegisteredProfile,DiskPool,MemoryPool,NetPool,ProcessorPool,VSMigrationService,ElementConformsToProfile,ReferencedProfile,AllocationCapabilities}.mof ++%define SCHEMA %{_datadir}/%{name}/ComputerSystem.mof \\\ ++ %{_datadir}/%{name}/LogicalDisk.mof \\\ ++ %{_datadir}/%{name}/NetworkPort.mof \\\ ++ %{_datadir}/%{name}/Memory.mof \\\ ++ %{_datadir}/%{name}/Processor.mof \\\ ++ %{_datadir}/%{name}/SystemDevice.mof \\\ ++ %{_datadir}/%{name}/Virt_VSSD.mof \\\ ++ %{_datadir}/%{name}/VSSD.mof \\\ ++ %{_datadir}/%{name}/HostSystem.mof \\\ ++ %{_datadir}/%{name}/HostedDependency.mof \\\ ++ %{_datadir}/%{name}/VirtualSystemManagementService.mof \\\ ++ %{_datadir}/%{name}/VirtualSystemManagementCapabilities.mof \\\ ++ %{_datadir}/%{name}/EnabledLogicalElementCapabilities.mof \\\ ++ %{_datadir}/%{name}/AllocationCapabilities.mof \\\ ++ %{_datadir}/%{name}/SettingsDefineCapabilities.mof \\\ ++ %{_datadir}/%{name}/MemoryPool.mof \\\ ++ %{_datadir}/%{name}/ElementCapabilities.mof \\\ ++ %{_datadir}/%{name}/ProcessorPool.mof \\\ ++ %{_datadir}/%{name}/DiskPool.mof \\\ ++ %{_datadir}/%{name}/HostedResourcePool.mof \\\ ++ %{_datadir}/%{name}/RegisteredProfile.mof \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.mof \\\ ++ %{_datadir}/%{name}/ComputerSystemIndication.mof \\\ ++ %{_datadir}/%{name}/ResourceAllocationSettingDataIndication.mof \\\ ++ %{_datadir}/%{name}/SwitchService.mof \\\ ++ %{_datadir}/%{name}/ComputerSystemMigrationIndication.mof \\\ ++ %{_datadir}/%{name}/Virt_ResourceAllocationSettingData.mof \\\ ++ %{_datadir}/%{name}/ResourceAllocationSettingData.mof \\\ ++ %{_datadir}/%{name}/ResourcePoolConfigurationService.mof \\\ ++ %{_datadir}/%{name}/ResourcePoolConfigurationCapabilities.mof \\\ ++ %{_datadir}/%{name}/VSSDComponent.mof \\\ ++ %{_datadir}/%{name}/SettingsDefineState.mof \\\ ++ %{_datadir}/%{name}/NetPool.mof \\\ ++ %{_datadir}/%{name}/ResourceAllocationFromPool.mof \\\ ++ %{_datadir}/%{name}/ElementAllocatedFromPool.mof \\\ ++ %{_datadir}/%{name}/HostedService.mof \\\ ++ %{_datadir}/%{name}/ElementSettingData.mof \\\ ++ %{_datadir}/%{name}/VSMigrationCapabilities.mof \\\ ++ %{_datadir}/%{name}/VSMigrationService.mof \\\ ++ %{_datadir}/%{name}/VSMigrationSettingData.mof \\\ ++ %{_datadir}/%{name}/VirtualSystemSnapshotService.mof \\\ ++ %{_datadir}/%{name}/VirtualSystemSnapshotServiceCapabilities.mof \\\ ++ %{_datadir}/%{name}/ConcreteComponent.mof \\\ ++ %{_datadir}/%{name}/ConsoleRedirectionService.mof \\\ ++ %{_datadir}/%{name}/ConsoleRedirectionServiceCapabilities.mof \\\ ++ %{_datadir}/%{name}/ServiceAffectsElement.mof \\\ ++ %{_datadir}/%{name}/KVMRedirectionSAP.mof \\\ ++ %{_datadir}/%{name}/DisplayController.mof \\\ ++ %{_datadir}/%{name}/PointingDevice.mof \\\ ++ %{_datadir}/%{name}/GraphicsPool.mof \\\ ++ %{_datadir}/%{name}/InputPool.mof \\\ ++ %{_datadir}/%{name}/HostedAccessPoint.mof \\\ ++ %{_datadir}/%{name}/ServiceAccessBySAP.mof \\\ ++ %{_datadir}/%{name}/SAPAvailableForElement.mof \\\ ++ %{_datadir}/%{name}/FilterEntry.mof \\\ ++ %{_datadir}/%{name}/FilterList.mof \\\ ++ %{_datadir}/%{name}/EntriesInFilterList.mof \\\ ++ %{_datadir}/%{name}/NestedFilterList.mof \\\ ++ %{_datadir}/%{name}/AppliedFilterList.mof \\\ ++ %{_datadir}/%{name}/HostedFilterList.mof + +-%define PGINTEROP_REG %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.registration +-%define PGINTEROP_MOF %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.mof ++%define INTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.registration \\\ ++ %{_datadir}/%{name}/ReferencedProfile.registration + +-%define CIMV2_REG %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,ElementConformsToProfile,HostedAccessPoint}.registration +-%define CIMV2_MOF %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,RegisteredProfile,ComputerSystem,ElementConformsToProfile,HostedAccessPoint}.mof ++%define INTEROP_MOF %{_datadir}/%{name}/ComputerSystem.mof \\\ ++ %{_datadir}/%{name}/HostSystem.mof \\\ ++ %{_datadir}/%{name}/RegisteredProfile.mof \\\ ++ %{_datadir}/%{name}/DiskPool.mof \\\ ++ %{_datadir}/%{name}/MemoryPool.mof \\\ ++ %{_datadir}/%{name}/NetPool.mof \\\ ++ %{_datadir}/%{name}/ProcessorPool.mof \\\ ++ %{_datadir}/%{name}/VSMigrationService.mof \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.mof \\\ ++ %{_datadir}/%{name}/ReferencedProfile.mof \\\ ++ %{_datadir}/%{name}/AllocationCapabilities.mof ++ ++%define PGINTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.registration \\\ ++ %{_datadir}/%{name}/ReferencedProfile.registration ++ ++%define PGINTEROP_MOF %{_datadir}/%{name}/RegisteredProfile.mof \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.mof \\\ ++ %{_datadir}/%{name}/ReferencedProfile.mof ++ ++%define CIMV2_REG %{_datadir}/%{name}/HostedResourcePool.registration \\\ ++ %{_datadir}/%{name}/ElementCapabilities.registration \\\ ++ %{_datadir}/%{name}/HostedService.registration \\\ ++ %{_datadir}/%{name}/HostedDependency.registration \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.registration \\\ ++ %{_datadir}/%{name}/HostedAccessPoint.registration ++ ++%define CIMV2_MOF %{_datadir}/%{name}/HostedResourcePool.mof \\\ ++ %{_datadir}/%{name}/ElementCapabilities.mof \\\ ++ %{_datadir}/%{name}/HostedService.mof \\\ ++ %{_datadir}/%{name}/HostedDependency.mof \\\ ++ %{_datadir}/%{name}/RegisteredProfile.mof \\\ ++ %{_datadir}/%{name}/ComputerSystem.mof \\\ ++ %{_datadir}/%{name}/ElementConformsToProfile.mof \\\ ++ %{_datadir}/%{name}/HostedAccessPoint.mof + + %pre + # _If_ there is already a version of this installed, we must deregister +@@ -118,12 +265,12 @@ then + fi + + %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 +- if [ "`systemctl is-active tog-pegasus.service`" = "active" ] ++ if [ "`systemctl is-active tog-pegasus.service 2> /dev/null`" = "active" ] + then + systemctl restart tog-pegasus.service + fi + +- if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] ++ if [ "`systemctl is-active sblim-sfcb.service 2> /dev/null`" = "active" ] + then + systemctl restart sblim-sfcb.service + fi +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-a16ca9d0.patch b/SOURCES/libvirt-cim-0.6.3-a16ca9d0.patch new file mode 100644 index 0000000..721c8b0 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-a16ca9d0.patch @@ -0,0 +1,165 @@ +From a16ca9d025005a755cd1e9b353a376333a958f5b Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Thu, 27 Mar 2014 11:08:21 -0400 +Subject: [PATCH 52/60] Add virtual controller object definitions to mofs + +Add the mofs and registration to support the Controller Logical Device +and RASD. The Contoller Logical Device will be a child of the +CIM_Controller class and the Controller RASD will be a child of +the CIM_RASD. + +Install the mofs and definitions, but don't yet link things up + +Signed-off-by: John Ferlan +--- + Makefile.am | 4 ++- + libvirt-cim.spec.in | 2 ++ + schema/Controller.mof | 7 +++++ + schema/Controller.registration | 4 +++ + schema/ResourceAllocationSettingData.mof | 37 ++++++++++++++++++++++- + schema/ResourceAllocationSettingData.registration | 3 +- + 6 files changed, 54 insertions(+), 3 deletions(-) + create mode 100644 schema/Controller.mof + create mode 100644 schema/Controller.registration + +diff --git a/Makefile.am b/Makefile.am +index 69b65cf..24b11af 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,4 +1,4 @@ +-# Copyright IBM Corp. 2007 ++# Copyright IBM Corp. 2007-2014 + AUTOMAKE_OPTIONS=dist-bzip2 + + SUBDIRS = libxkutil src doc base_schema +@@ -52,6 +52,7 @@ MOFS = \ + $(top_srcdir)/schema/ServiceAffectsElement.mof \ + $(top_srcdir)/schema/KVMRedirectionSAP.mof \ + $(top_srcdir)/schema/DisplayController.mof \ ++ $(top_srcdir)/schema/Controller.mof \ + $(top_srcdir)/schema/PointingDevice.mof \ + $(top_srcdir)/schema/GraphicsPool.mof \ + $(top_srcdir)/schema/InputPool.mof \ +@@ -142,6 +143,7 @@ REGS = \ + $(top_srcdir)/schema/ServiceAffectsElement.registration \ + $(top_srcdir)/schema/KVMRedirectionSAP.registration \ + $(top_srcdir)/schema/DisplayController.registration \ ++ $(top_srcdir)/schema/Controller.registration \ + $(top_srcdir)/schema/PointingDevice.registration \ + $(top_srcdir)/schema/GraphicsPool.registration \ + $(top_srcdir)/schema/InputPool.registration \ +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index 01ee329..f4e4fcf 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -110,6 +110,7 @@ rm -fr $RPM_BUILD_ROOT + %{_datadir}/%{name}/ServiceAffectsElement.registration \\\ + %{_datadir}/%{name}/KVMRedirectionSAP.registration \\\ + %{_datadir}/%{name}/DisplayController.registration \\\ ++ %{_datadir}/%{name}/Controller.registration \\\ + %{_datadir}/%{name}/PointingDevice.registration \\\ + %{_datadir}/%{name}/GraphicsPool.registration \\\ + %{_datadir}/%{name}/InputPool.registration \\\ +@@ -171,6 +172,7 @@ rm -fr $RPM_BUILD_ROOT + %{_datadir}/%{name}/ServiceAffectsElement.mof \\\ + %{_datadir}/%{name}/KVMRedirectionSAP.mof \\\ + %{_datadir}/%{name}/DisplayController.mof \\\ ++ %{_datadir}/%{name}/Controller.mof \\\ + %{_datadir}/%{name}/PointingDevice.mof \\\ + %{_datadir}/%{name}/GraphicsPool.mof \\\ + %{_datadir}/%{name}/InputPool.mof \\\ +diff --git a/schema/Controller.mof b/schema/Controller.mof +new file mode 100644 +index 0000000..0805aa9 +--- /dev/null ++++ b/schema/Controller.mof +@@ -0,0 +1,7 @@ ++// Copyright IBM Corp. 2014 ++ ++[ Provider("cmpi::Virt_Device") ++] ++class KVM_Controller : CIM_Controller ++{ ++}; +diff --git a/schema/Controller.registration b/schema/Controller.registration +new file mode 100644 +index 0000000..5f59a20 +--- /dev/null ++++ b/schema/Controller.registration +@@ -0,0 +1,4 @@ ++# Copyright IBM Corp. 2014 ++ ++# Classname Namespace ProviderName ProviderModule ProviderTypes ++KVM_Controller root/virt Virt_Device Virt_Device instance +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index 6b649de..9c387f0 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -1,4 +1,4 @@ +-// Copyright IBM Corp. 2007, 2013 ++// Copyright IBM Corp. 2007-2014 + + [Description ("Xen virtual disk configuration"), + Provider("cmpi::Virt_RASD") +@@ -328,6 +328,41 @@ class LXC_InputResourceAllocationSettingData : LXC_ResourceAllocationSettingData + string BusType; + }; + ++[Description ("KVM virtual controller device. It is identified by: " ++ "CIM_ResourceAllocationSettingData.ResourceType=1 ('Other'), " ++ "CIM_ResourceAllocationSettingData.OtherResourceType='controller'" ++ " and CIM_ResourceAllocationSettingData.ResourceSubType set to " ++ "one of 'ide', 'fdc', 'scsi', 'sata', 'ccid', 'virtio-serial', " ++ "or 'pci'."), ++ Provider("cmpi::Virt_RASD") ++] ++class KVM_ControllerResourceAllocationSettingData : KVM_ResourceAllocationSettingData ++{ ++ [Description ("Order in which the bus controller is encountered. " ++ "The order is controller type scoped.")] ++ uint64 Index; ++ ++ [Description ("Optional string providing a specific model " ++ "information based on the controller type.")] ++ string Model; ++ ++ [Description ("The 'virtio-serial' controller uses the Ports and " ++ "Vectors to control how many devices can be connected " ++ "through the controller.")] ++ string Ports; ++ string Vectors; ++ ++ [Description ("Number of queues for the controller.")] ++ string Queues; ++ ++ [Description ("For controllers that are themselves devices on a " ++ "bus an optional element to specify the exact " ++ "relationship of the controller to its master bus. " ++ "Stored in the property and value arrays.")] ++ string AddressProperties[]; ++ string AddressValues[]; ++}; ++ + [Description ("Xen virtual network pool settings"), + Provider("cmpi::Virt_RASD") + ] +diff --git a/schema/ResourceAllocationSettingData.registration b/schema/ResourceAllocationSettingData.registration +index b969bfe..74df857 100644 +--- a/schema/ResourceAllocationSettingData.registration ++++ b/schema/ResourceAllocationSettingData.registration +@@ -1,4 +1,4 @@ +-# Copyright IBM Corp. 2007, 2013 ++# Copyright IBM Corp. 2007-2014 + # Classname Namespace ProviderName ProviderModule ProviderTypes + Xen_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + Xen_NetResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +@@ -14,6 +14,7 @@ KVM_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_GraphicsResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_InputResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + KVM_ConsoleResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance ++KVM_ControllerResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_MemResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_DiskResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance + LXC_ProcResourceAllocationSettingData root/virt Virt_RASD Virt_RASD instance +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-a3649c21.patch b/SOURCES/libvirt-cim-0.6.3-a3649c21.patch new file mode 100644 index 0000000..7523822 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-a3649c21.patch @@ -0,0 +1,69 @@ +From a3649c210487b86a313bf84043cd1a923397c5d1 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Wed, 11 Sep 2013 16:45:39 +0200 +Subject: [PATCH 19/60] Device: CIM_LogicalDevice for consoles + +Extended the Virt_Device provider to return DisplayController +devices for the consoles found. This mainly for the purpose of +consistency with the other RASD types. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + src/Virt_Device.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/src/Virt_Device.c b/src/Virt_Device.c +index c3b515c..aa47276 100644 +--- a/src/Virt_Device.c ++++ b/src/Virt_Device.c +@@ -251,6 +251,34 @@ static CMPIInstance *graphics_instance(const CMPIBroker *broker, + return inst; + } + ++static CMPIInstance *console_instance(const CMPIBroker *broker, ++ struct console_device *dev, ++ const virDomainPtr dom, ++ const char *ns) ++{ ++ CMPIInstance *inst; ++ virConnectPtr conn; ++ const char *ctype; ++ ++ conn = virDomainGetConnect(dom); ++ inst = get_typed_instance(broker, ++ pfx_from_conn(conn), ++ "DisplayController", ++ ns, ++ true); ++ ++ if (inst == NULL) { ++ CU_DEBUG("Failed to get instance for DisplayController"); ++ return NULL; ++ } ++ ++ ctype = chardev_source_type_IDToStr(dev->source_type); ++ CMSetProperty(inst, "VideoProcessor", ++ (CMPIValue *)ctype, CMPI_chars); ++ ++ return inst; ++} ++ + int get_input_dev_caption(const char *type, + const char *bus, + char **cap) +@@ -483,6 +511,11 @@ static bool device_instances(const CMPIBroker *broker, + &dev->dev.graphics, + dom, + ns); ++ else if (dev->type == CIM_RES_TYPE_CONSOLE) ++ instance = console_instance(broker, ++ &dev->dev.console, ++ dom, ++ ns); + else if (dev->type == CIM_RES_TYPE_INPUT) + instance = input_instance(broker, + &dev->dev.input, +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-a6cbafc6.patch b/SOURCES/libvirt-cim-0.6.3-a6cbafc6.patch new file mode 100644 index 0000000..042a34c --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-a6cbafc6.patch @@ -0,0 +1,29 @@ +From a6cbafc6b4c6b4d1db13006008bda1c3152bbf58 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Wed, 22 Jan 2014 13:13:02 -0500 +Subject: [PATCH 43/60] libxkutil/xml_parse_test: Coverity cleanup + +A new version of Coverity found: + +print_domxml(): RESOURCE_LEAK + - The 'xml' variable needs to be free()'d + +Signed-off-by: John Ferlan +--- + libxkutil/xml_parse_test.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libxkutil/xml_parse_test.c b/libxkutil/xml_parse_test.c +index 374bcf6..303880d 100644 +--- a/libxkutil/xml_parse_test.c ++++ b/libxkutil/xml_parse_test.c +@@ -192,6 +192,7 @@ static void print_domxml(struct domain *dominfo, + printf("Failed to create system XML\n"); + else + printf("%s\n", xml); ++ free(xml); + } + + static char *read_from_file(FILE *file) +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-a72ab39b.patch b/SOURCES/libvirt-cim-0.6.3-a72ab39b.patch new file mode 100644 index 0000000..cf2448f --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-a72ab39b.patch @@ -0,0 +1,115 @@ +From a72ab39ba75702676af64af30d9412f5d7730cd9 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 14 Oct 2013 17:29:42 +0200 +Subject: [PATCH 27/60] RASD: Support for device address properties + +This change allows to enumerate KVM disk and network RASDs containing +device addresses. A new function set_rasd_device_address fills the +CIM instance properties from a device_address structure. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_RASD.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 73 insertions(+) + +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index e28d4e6..df1e921 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -289,6 +289,67 @@ static bool get_vol_size(const CMPIBroker *broker, + } + #endif + ++static CMPIStatus set_rasd_device_address(const CMPIBroker *broker, ++ const CMPIObjectPath *ref, ++ const struct device_address *addr, ++ CMPIInstance *inst) ++{ ++ int i; ++ CMPIArray *arr_key; ++ CMPIArray *arr_value; ++ CMPIString *string; ++ CMPIStatus s = {CMPI_RC_OK, NULL}; ++ ++ arr_key = CMNewArray(broker, ++ addr->ct, ++ CMPI_string, ++ &s); ++ if (s.rc != CMPI_RC_OK) ++ goto out; ++ ++ arr_value = CMNewArray(broker, ++ addr->ct, ++ CMPI_string, ++ &s); ++ if (s.rc != CMPI_RC_OK) ++ goto out; ++ ++ for (i = 0; i < addr->ct; i++) { ++ string = CMNewString(broker, ++ addr->key[i], ++ &s); ++ if (s.rc != CMPI_RC_OK) ++ goto out; ++ ++ CMSetArrayElementAt(arr_key, ++ i, ++ (CMPIValue *)&string, ++ CMPI_string); ++ ++ string = CMNewString(broker, ++ addr->value[i], ++ &s); ++ if (s.rc != CMPI_RC_OK) ++ goto out; ++ ++ CMSetArrayElementAt(arr_value, ++ i, ++ (CMPIValue *)&string, ++ CMPI_string); ++ } ++ ++ CMSetProperty(inst, "AddressProperties", ++ (CMPIValue *)&arr_key, ++ CMPI_stringA); ++ ++ CMSetProperty(inst, "AddressValues", ++ (CMPIValue *)&arr_value, ++ CMPI_stringA); ++ ++ out: ++ return s; ++} ++ + static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const struct virt_device *dev, +@@ -427,6 +488,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, + (CMPIValue *)&(dev->dev.disk.shareable), + CMPI_boolean); + ++ if (dev->dev.disk.address.ct > 0) ++ set_rasd_device_address(broker, ++ ref, ++ &dev->dev.disk.address, ++ inst); ++ + virStoragePoolFree(pool); + virStorageVolFree(vol); + virConnectClose(conn); +@@ -590,6 +657,12 @@ static CMPIStatus set_net_rasd_params(const CMPIBroker *broker, + (CMPIValue *)dev->dev.net.poolid, + CMPI_chars); + ++ if (dev->dev.net.address.ct > 0) ++ set_rasd_device_address(broker, ++ ref, ++ &dev->dev.net.address, ++ inst); ++ + #if LIBVIR_VERSION_NUMBER < 9000 + out: + #endif +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-a8cfd7dc.patch b/SOURCES/libvirt-cim-0.6.3-a8cfd7dc.patch new file mode 100644 index 0000000..6d6bd31 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-a8cfd7dc.patch @@ -0,0 +1,197 @@ +From a8cfd7dc6a4f173c764f02688ff0c8aec00ecec2 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Mon, 13 Jan 2014 14:11:21 -0500 +Subject: [PATCH 48/48] Use of root/interop instead of root/PG_InterOp + +As of tog-pegasus 2.12.1-5 we can no longer use "root/PG_InterOp" namespace +for the CIM provider instead the use of "root/interop" is the preferred +mechanism. + +This patch will adjust where libvirt-cim installs its classes to use the +"root/interop" namespace. + +For more context, see: + + http://www.redhat.com/archives/libvirt-cim/2013-November/msg00083.html + +and + + http://www.redhat.com/archives/libvirt-cim/2013-November/msg00008.html + +This patch does not include the schema changes to FilterList although I +have a suspicion that a bug fix between 2.12.1-8 and 2.12.1-11 has resolved +the issue seen. Cannot find a reference though. + +Signed-off-by: John Ferlan +--- + Makefile.am | 29 ++++++++++++++++++++++++----- + libvirt-cim.spec.in | 27 ++++++++++++++++++++++----- + provider-register.sh | 18 +++++++++++++++++- + 3 files changed, 63 insertions(+), 11 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 9e8e96b..69b65cf 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -78,6 +78,9 @@ INTEROP_MOFS = \ + $(top_srcdir)/schema/ReferencedProfile.mof \ + $(top_srcdir)/schema/AllocationCapabilities.mof + ++# The PGINTEROP_MOFS are used by tog-pegasus up through version 2.12.1 ++# If support for versions prior to 2.12.1 is removed, then these defs ++# can go away + PGINTEROP_MOFS = \ + $(top_srcdir)/schema/RegisteredProfile.mof \ + $(top_srcdir)/schema/ElementConformsToProfile.mof \ +@@ -157,6 +160,9 @@ INTEROP_REGS = \ + $(top_srcdir)/schema/ElementConformsToProfile.registration \ + $(top_srcdir)/schema/ReferencedProfile.registration + ++# The PGINTEROP_REGS are used by tog-pegasus up through version 2.12.1 ++# If support for versions prior to 2.12.1 is removed, then these defs ++# can go away + PGINTEROP_REGS = \ + $(top_srcdir)/schema/RegisteredProfile.registration \ + $(top_srcdir)/schema/ElementConformsToProfile.registration \ +@@ -181,7 +187,8 @@ EXTRA_DIST = schema $(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS) \ + .changeset .revision \ + examples/diskpool.conf + +-# If Pegasus isn't the CIMOM target, then remove the PG_InterOp namespace from the appropriate files ++# If Pegasus isn't the CIMOM target, then remove the PG_InterOp namespace ++# from the appropriate files + install-data-local: + $(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)" + $(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(MOFS) +@@ -189,11 +196,12 @@ install-data-local: + $(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(INTEROP_MOFS) + $(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(INTEROP_REGS) + if [[ @CIMSERVER@ != pegasus ]]; then \ +- sed -i '/^# --/,/^# --!/d' $(subst $(top_srcdir)/schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_REGS)); \ ++ sed -i '/^# --/,/^# --!/d' $(subst $(top_srcdir)/schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_REGS)); \ ++ sed -i '/^# --/,/^# --!/d' $(subst $(top_srcdir)/schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_MOFS)); \ + fi + + uninstall-local: +- @list='$(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS)'; \ ++ @list='$(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS) $(PGINTEROP_REGS) $(PGINTEROP_MOFS)'; \ + for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;'`; \ + echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ +@@ -209,8 +217,19 @@ postinstall: + $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(MOFS)) + $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS)) + $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS)) ++ # ++ # We need to check the version - if we're not yet at 2.12.1, then ++ # we'll register at root/PG_InterOp; otherwise, using just the above ++ # registration should be sufficient. The actual cutoff root/PG_InterOp ++ # not being valid was 2.12.1-5; however, --version doesn't give us that ++ # level of detail. The Pegasus docs imply that usage of root/interop was ++ # valid as of 2.12.0. ++ # + if [[ @CIMSERVER@ = pegasus ]]; then \ +- $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ ++ CIMVER=`@CIMSERVER@ --version | awk -F. '{printf("%02d%02d%02d\n", $1,$2,$3); }'` \ ++ if [[ $CIMVER -lt 021201 ]]; then \ ++ $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ ++ fi \ + fi + virsh -v | grep -q '^0.3' && cp examples/diskpool.conf $(DISK_POOL_CONFIG) || true + mkdir -p $(INFO_STORE) +@@ -220,7 +239,7 @@ preuninstall: + $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS)) + $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS)) + if [[ @CIMSERVER@ = pegasus ]]; then \ +- $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ ++ $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ + fi + + rpm: clean +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index 24ef280..01ee329 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -200,6 +200,10 @@ rm -fr $RPM_BUILD_ROOT + %{_datadir}/%{name}/ReferencedProfile.mof \\\ + %{_datadir}/%{name}/AllocationCapabilities.mof + ++# NOTE: As of Pegasus 2.12.1-5, using root/PG_InterOp will no longer be ++# valid. All mofs can just compile into root/interop. However, we ++# need to keep these here for 'historical purposes'. ++# + %define PGINTEROP_REG %{_datadir}/%{name}/RegisteredProfile.registration \\\ + %{_datadir}/%{name}/ElementConformsToProfile.registration \\\ + %{_datadir}/%{name}/ReferencedProfile.registration +@@ -268,12 +272,12 @@ fi + %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 + if [ "`systemctl is-active tog-pegasus.service 2> /dev/null`" = "active" ] + then +- systemctl restart tog-pegasus.service ++ systemctl restart tog-pegasus.service > /dev/null 2>&1 + fi + + if [ "`systemctl is-active sblim-sfcb.service 2> /dev/null`" = "active" ] + then +- systemctl restart sblim-sfcb.service ++ systemctl restart sblim-sfcb.service > /dev/null 2>&1 + fi + %else + /etc/init.d/tog-pegasus condrestart +@@ -287,9 +291,22 @@ then + %{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true +- %{_datadir}/%{name}/provider-register.sh -t pegasus \ +- -n root/PG_InterOp \ +- -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true ++ # ++ # We need to check the version - if we're not yet at 2.12.1, then ++ # we'll register at root/PG_InterOp; otherwise, using just the above ++ # registration should be sufficient. The actual cutoff root/PG_InterOp ++ # not being valid was 2.12.1-5; however, --version doesn't give us that ++ # level of detail. The Pegasus docs imply that usage of root/interop was ++ # valid as of 2.12.0. ++ # ++ CIMVER=`/usr/sbin/cimserver --version | \ ++ awk -F. '{printf("%02d%02d%02d\n", $1,$2,$3); }'` ++ if [ $CIMVER -lt 021201 ] ++ then ++ %{_datadir}/%{name}/provider-register.sh -t pegasus \ ++ -n root/PG_InterOp \ ++ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true ++ fi + %{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/cimv2\ + -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true +diff --git a/provider-register.sh b/provider-register.sh +index abe8e95..f66fe54 100755 +--- a/provider-register.sh ++++ b/provider-register.sh +@@ -274,7 +274,23 @@ pegasus_install() + chatter Registering providers with $state cimserver '('$version')' + chatter Installing mofs into namespace $namespace from path $mofpath + $CIMMOF -uc -I $mofpath -n $namespace $mymofs && +- $CIMMOF -uc -n root/PG_Interop $_REGFILENAME ++ # ++ # If compare_version returns false here (e.g. $version is less than ++ # "2.12.1", then we will compile into root/PG_InterOp; otherwise, ++ # compile into root/interop. As of 2.12.1-5 using the PG_InterOp ++ # will fail. Since we cannot get that level of detail out of the ++ # --version output, "assume" that 2.12.1 -> 2.12.1-4 will be able ++ # to use the new namespace. The Pegasus docs imply as of 2.12.0 using ++ # root/interop was preferred. ++ # ++ if compare_version "$version" "2.12.1" ++ then ++ chatter Installing $_REGFILENAME into root/PG_InterOp ++ $CIMMOF -uc -n root/PG_Interop $_REGFILENAME ++ else ++ chatter Installing $_REGFILENAME into root/interop ++ $CIMMOF -uc -n root/interop $_REGFILENAME ++ fi + else + echo "Failed to build pegasus registration MOF." >&2 + return 1 +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-ace5e8fd.patch b/SOURCES/libvirt-cim-0.6.3-ace5e8fd.patch new file mode 100644 index 0000000..cb12306 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-ace5e8fd.patch @@ -0,0 +1,214 @@ +From ace5e8fdbad269517b347cc496509ce5ff30f2fe Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 7 Oct 2013 16:02:36 +0200 +Subject: [PATCH 23/60] Virt_Device: Add a device class for consoles + +libvirt-cim has a very strict assumption about the presence +of a CIM_LogicalDevice class being associated to a RASD. +It is practically impossible to extend the cimtest framework +for the ConsoleRASD class without having a matching device class. +Adding a new ConsoleDisplayController class for this purpose. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Daniel Hansel +Signed-off-by: John Ferlan +--- + schema/DisplayController.mof | 14 ++++++++++++++ + schema/DisplayController.registration | 3 +++ + src/Virt_Device.c | 6 ++++-- + src/Virt_ElementSettingData.c | 3 +++ + src/Virt_SettingsDefineState.c | 6 ++++++ + src/Virt_SystemDevice.c | 3 +++ + src/Virt_VSSDComponent.c | 3 +++ + 7 files changed, 36 insertions(+), 2 deletions(-) + +diff --git a/schema/DisplayController.mof b/schema/DisplayController.mof +index b57c9cc..643b024 100644 +--- a/schema/DisplayController.mof ++++ b/schema/DisplayController.mof +@@ -15,3 +15,17 @@ class LXC_DisplayController : CIM_DisplayController + { + }; + ++[ Provider("cmpi::Virt_Device") ] ++class Xen_ConsoleDisplayController : CIM_DisplayController ++{ ++}; ++ ++[ Provider("cmpi::Virt_Device") ] ++class KVM_ConsoleDisplayController : CIM_DisplayController ++{ ++}; ++ ++[ Provider("cmpi::Virt_Device") ] ++class LXC_ConsoleDisplayController : CIM_DisplayController ++{ ++}; +diff --git a/schema/DisplayController.registration b/schema/DisplayController.registration +index de8adc9..e7e9770 100644 +--- a/schema/DisplayController.registration ++++ b/schema/DisplayController.registration +@@ -3,3 +3,6 @@ + Xen_DisplayController root/virt Virt_Device Virt_Device instance + KVM_DisplayController root/virt Virt_Device Virt_Device instance + LXC_DisplayController root/virt Virt_Device Virt_Device instance ++Xen_ConsoleDisplayController root/virt Virt_Device Virt_Device instance ++KVM_ConsoleDisplayController root/virt Virt_Device Virt_Device instance ++LXC_ConsoleDisplayController root/virt Virt_Device Virt_Device instance +diff --git a/src/Virt_Device.c b/src/Virt_Device.c +index aa47276..b93e592 100644 +--- a/src/Virt_Device.c ++++ b/src/Virt_Device.c +@@ -263,12 +263,12 @@ static CMPIInstance *console_instance(const CMPIBroker *broker, + conn = virDomainGetConnect(dom); + inst = get_typed_instance(broker, + pfx_from_conn(conn), +- "DisplayController", ++ "ConsoleDisplayController", + ns, + true); + + if (inst == NULL) { +- CU_DEBUG("Failed to get instance for DisplayController"); ++ CU_DEBUG("Failed to get instance for ConsoleDisplayController"); + return NULL; + } + +@@ -549,6 +549,8 @@ uint16_t res_type_from_device_classname(const char *classname) + return CIM_RES_TYPE_MEM; + else if (strstr(classname, "Processor")) + return CIM_RES_TYPE_PROC; ++ else if (strstr(classname, "ConsoleDisplayController")) ++ return CIM_RES_TYPE_CONSOLE; + else if (strstr(classname, "DisplayController")) + return CIM_RES_TYPE_GRAPHICS; + else if (strstr(classname, "PointingDevice")) +diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c +index c257710..c088e49 100644 +--- a/src/Virt_ElementSettingData.c ++++ b/src/Virt_ElementSettingData.c +@@ -128,18 +128,21 @@ static char* resource_allocation_setting_data[] = { + "Xen_NetResourceAllocationSettingData", + "Xen_ProcResourceAllocationSettingData", + "Xen_GraphicsResourceAllocationSettingData", ++ "Xen_ConsoleResourceAllocationSettingData", + "Xen_InputResourceAllocationSettingData", + "KVM_DiskResourceAllocationSettingData", + "KVM_MemResourceAllocationSettingData", + "KVM_NetResourceAllocationSettingData", + "KVM_ProcResourceAllocationSettingData", + "KVM_GraphicsResourceAllocationSettingData", ++ "KVM_ConsoleResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", + "LXC_ProcResourceAllocationSettingData", + "LXC_GraphicsResourceAllocationSettingData", ++ "LXC_ConsoleResourceAllocationSettingData", + "LXC_InputResourceAllocationSettingData", + NULL + }; +diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c +index f30f45f..be2ded5 100644 +--- a/src/Virt_SettingsDefineState.c ++++ b/src/Virt_SettingsDefineState.c +@@ -327,18 +327,21 @@ static char* logical_device[] = { + "Xen_NetworkPort", + "Xen_LogicalDisk", + "Xen_DisplayController", ++ "Xen_ConsoleDisplayController", + "Xen_PointingDevice", + "KVM_Processor", + "KVM_Memory", + "KVM_NetworkPort", + "KVM_LogicalDisk", + "KVM_DisplayController", ++ "KVM_ConsoleDisplayController", + "KVM_PointingDevice", + "LXC_Processor", + "LXC_Memory", + "LXC_NetworkPort", + "LXC_LogicalDisk", + "LXC_DisplayController", ++ "LXC_ConsoleDisplayController", + "LXC_PointingDevice", + NULL + }; +@@ -350,18 +353,21 @@ static char* resource_allocation_setting_data[] = { + "Xen_ProcResourceAllocationSettingData", + "Xen_GraphicsResourceAllocationSettingData", + "Xen_InputResourceAllocationSettingData", ++ "Xen_ConsoleResourceAllocationSettingData", + "KVM_DiskResourceAllocationSettingData", + "KVM_MemResourceAllocationSettingData", + "KVM_NetResourceAllocationSettingData", + "KVM_ProcResourceAllocationSettingData", + "KVM_GraphicsResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", ++ "KVM_ConsoleResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", + "LXC_ProcResourceAllocationSettingData", + "LXC_GraphicsResourceAllocationSettingData", + "LXC_InputResourceAllocationSettingData", ++ "LXC_ConsoleResourceAllocationSettingData", + NULL + }; + +diff --git a/src/Virt_SystemDevice.c b/src/Virt_SystemDevice.c +index 3a2f7ce..d2e526d 100644 +--- a/src/Virt_SystemDevice.c ++++ b/src/Virt_SystemDevice.c +@@ -135,18 +135,21 @@ static char* part_component[] = { + "Xen_NetworkPort", + "Xen_LogicalDisk", + "Xen_DisplayController", ++ "Xen_ConsoleDisplayController", + "Xen_PointingDevice", + "KVM_Processor", + "KVM_Memory", + "KVM_NetworkPort", + "KVM_LogicalDisk", + "KVM_DisplayController", ++ "KVM_ConsoleDisplayController", + "KVM_PointingDevice", + "LXC_Processor", + "LXC_Memory", + "LXC_NetworkPort", + "LXC_LogicalDisk", + "LXC_DisplayController", ++ "LXC_ConsoleDisplayController", + "LXC_PointingDevice", + NULL + }; +diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c +index 378de96..35bffde 100644 +--- a/src/Virt_VSSDComponent.c ++++ b/src/Virt_VSSDComponent.c +@@ -132,6 +132,7 @@ static char* part_component[] = { + "Xen_NetResourceAllocationSettingData", + "Xen_ProcResourceAllocationSettingData", + "Xen_GraphicsResourceAllocationSettingData", ++ "Xen_ConsoleResourceAllocationSettingData", + "Xen_InputResourceAllocationSettingData", + "KVM_DiskResourceAllocationSettingData", + "KVM_MemResourceAllocationSettingData", +@@ -139,12 +140,14 @@ static char* part_component[] = { + "KVM_ProcResourceAllocationSettingData", + "KVM_GraphicsResourceAllocationSettingData", + "KVM_InputResourceAllocationSettingData", ++ "KVM_ConsoleResourceAllocationSettingData", + "LXC_DiskResourceAllocationSettingData", + "LXC_MemResourceAllocationSettingData", + "LXC_NetResourceAllocationSettingData", + "LXC_ProcResourceAllocationSettingData", + "LXC_GraphicsResourceAllocationSettingData", + "LXC_InputResourceAllocationSettingData", ++ "LXC_ConsoleResourceAllocationSettingData", + NULL + }; + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-ca8e81b3.patch b/SOURCES/libvirt-cim-0.6.3-ca8e81b3.patch new file mode 100644 index 0000000..ac94b15 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-ca8e81b3.patch @@ -0,0 +1,159 @@ +From ca8e81b3a3521c68512b7919d55f1e3b91e36a7e Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Tue, 25 Mar 2014 15:20:58 +0800 +Subject: [PATCH 54/60] VSMS: Support for domains with controller devices + +Signed-off-by: Xu Wang +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 87 ++++++++++++++++++++++++++++++- + 1 file changed, 86 insertions(+), 1 deletion(-) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index e146470..f673c38 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007, 2013 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -1848,6 +1848,56 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, + return NULL; + } + ++static const char *controller_rasd_to_vdev(CMPIInstance *inst, ++ struct virt_device *dev) ++{ ++ const char *type_str = NULL; ++ const char *val = NULL; ++ const char *msg = NULL; ++ int ret; ++ ++ if (cu_get_str_prop(inst, "ResourceSubType", &type_str) != CMPI_RC_OK) { ++ msg = "ControllerRASD ResourceSubType field not valid"; ++ CU_DEBUG("%s", msg); ++ goto out; ++ } ++ dev->dev.controller.type = controller_protocol_type_StrToID(type_str); ++ ++ /* Required fields */ ++ if (cu_get_u64_prop(inst, "Index", ++ &dev->dev.controller.index) != CMPI_RC_OK) { ++ CU_DEBUG("ControllerRASD Index field not set - DEFAULT"); ++ dev->dev.controller.index = CONTROLLER_INDEX_NOT_SET; ++ ret = asprintf(&dev->id, "controller:%s:-1", type_str); ++ } else { ++ /* Formulate our instance id from controller, controller type, ++ * and index value. This should be unique enough. ++ */ ++ ret = asprintf(&dev->id, "controller:%s:%" PRIu64, ++ type_str, dev->dev.controller.index); ++ } ++ if (ret == -1) { ++ msg = "Failed to create controller string"; ++ CU_DEBUG("%s", msg); ++ goto out; ++ } ++ ++ /* Optional fields */ ++ if (cu_get_str_prop(inst, "Model", &val) == CMPI_RC_OK) ++ dev->dev.controller.model = strdup(val); ++ if (cu_get_str_prop(inst, "Ports", &val) == CMPI_RC_OK) ++ dev->dev.controller.ports = strdup(val); ++ if (cu_get_str_prop(inst, "Vectors", &val) == CMPI_RC_OK) ++ dev->dev.controller.vectors = strdup(val); ++ if (cu_get_str_prop(inst, "Queues", &val) == CMPI_RC_OK) ++ dev->dev.controller.queues = strdup(val); ++ msg = rasd_to_device_address(inst, &dev->dev.controller.address); ++ ++ out: ++ ++ return msg; ++} ++ + static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev, + uint16_t type, +@@ -1868,6 +1918,8 @@ static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, + return console_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_INPUT) { + return input_rasd_to_vdev(inst, dev); ++ } else if (type == CIM_RES_TYPE_CONTROLLER) { ++ return controller_rasd_to_vdev(inst, dev); + } + + return "Resource type not supported on this platform"; +@@ -1888,6 +1940,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, + return lxc_proc_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_INPUT) { + return input_rasd_to_vdev(inst, dev); ++ } else if (type == CIM_RES_TYPE_CONTROLLER) { ++ return controller_rasd_to_vdev(inst, dev); + } + + return "Resource type not supported on this platform"; +@@ -1997,6 +2051,10 @@ static const char *classify_resources(CMPIArray *resources, + if (!make_space(&domain->dev_input, domain->dev_input_ct, count)) + return "Failed to alloc input list"; + ++ if (!make_space(&domain->dev_controller, domain->dev_controller_ct, ++ count)) ++ return "Failed to alloc controller list"; ++ + for (i = 0; i < count; i++) { + CMPIObjectPath *op; + CMPIData item; +@@ -2111,7 +2169,23 @@ static const char *classify_resources(CMPIArray *resources, + &domain->dev_input[0], + ns, + p_error); ++ } else if (type == CIM_RES_TYPE_CONTROLLER) { ++ struct virt_device dev; ++ int ccount = count + domain->dev_controller_ct; ++ ++ memset(&dev, 0, sizeof(dev)); ++ msg = rasd_to_vdev(inst, ++ domain, ++ &dev, ++ ns, ++ p_error); ++ if (msg == NULL) ++ msg = add_device_nodup(&dev, ++ domain->dev_controller, ++ ccount, ++ &domain->dev_controller_ct); + } ++ + if (msg != NULL) + return msg; + +@@ -2918,6 +2992,9 @@ static struct virt_device **find_list(struct domain *dominfo, + } else if (type == CIM_RES_TYPE_INPUT) { + list = &dominfo->dev_input; + *count = &dominfo->dev_input_ct; ++ } else if (type == CIM_RES_TYPE_CONTROLLER) { ++ list = &dominfo->dev_controller; ++ *count = &dominfo->dev_controller_ct; + } + + return list; +@@ -3119,6 +3196,14 @@ static CMPIStatus resource_add(struct domain *dominfo, + goto out; + } + ++ if (type == CIM_RES_TYPE_CONTROLLER && ++ dev != NULL && dev->id == NULL) { ++ cu_statusf(_BROKER, &s, ++ CMPI_RC_ERR_FAILED, ++ "Add resource failed: Index property is required."); ++ goto out; ++ } ++ + if ((type == CIM_RES_TYPE_GRAPHICS) || + (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONSOLE)) { +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-d75cae45.patch b/SOURCES/libvirt-cim-0.6.3-d75cae45.patch new file mode 100644 index 0000000..a7e1de2 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-d75cae45.patch @@ -0,0 +1,198 @@ +From d75cae45933638648d772a5e5f140017b83c019c Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 14 Oct 2013 17:29:44 +0200 +Subject: [PATCH 29/60] VSMS: Improve device cleanup + +Use cleanup_virt_device instead of single free's all over +the place in net_rasd_to_vdev and disk_rasd_to_vdev. +Further, make sure that the device type is always set +independent of the implementation of the xxx_rasd_to_vdev +functions. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 35 +++++++------------------------ + 1 file changed, 8 insertions(+), 27 deletions(-) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index b813be6..6548d08 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -964,17 +964,15 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, + } + */ + +- free(dev->dev.net.mac); ++ cleanup_virt_device(dev); ++ + dev->dev.net.mac = strdup(val); + +- free(dev->id); + dev->id = strdup(dev->dev.net.mac); + +- free(dev->dev.net.type); + if (cu_get_str_prop(inst, "NetworkType", &val) != CMPI_RC_OK) + return "No Network Type specified"; + +- free(dev->dev.net.source); + if (STREQC(val, BRIDGE_TYPE)) { + dev->dev.net.type = strdup(BRIDGE_TYPE); + if (cu_get_str_prop(inst, "NetworkName", &val) == CMPI_RC_OK) +@@ -1011,44 +1009,37 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, + else + return "No Source Device specified"; + +- free(dev->dev.net.vsi.vsi_type); + if (cu_get_str_prop(inst, "VSIType", &val) != CMPI_RC_OK) + dev->dev.net.vsi.vsi_type = NULL; + else + dev->dev.net.vsi.vsi_type = strdup(val); + +- free(dev->dev.net.vsi.manager_id); + if (cu_get_str_prop(inst, "VSIManagerID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.manager_id = NULL; + else + dev->dev.net.vsi.manager_id = strdup(val); + +- free(dev->dev.net.vsi.type_id); + if (cu_get_str_prop(inst, "VSITypeID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.type_id = NULL; + else + dev->dev.net.vsi.type_id = strdup(val); + +- free(dev->dev.net.vsi.type_id_version); + if (cu_get_str_prop(inst, "VSITypeIDVersion", &val) != + CMPI_RC_OK) + dev->dev.net.vsi.type_id_version = NULL; + else + dev->dev.net.vsi.type_id_version = strdup(val); + +- free(dev->dev.net.vsi.instance_id); + if (cu_get_str_prop(inst, "VSIInstanceID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.instance_id = NULL; + else + dev->dev.net.vsi.instance_id = strdup(val); + +- free(dev->dev.net.vsi.filter_ref); + if (cu_get_str_prop(inst, "FilterRef", &val) != CMPI_RC_OK) + dev->dev.net.vsi.filter_ref = NULL; + else + dev->dev.net.vsi.filter_ref = strdup(val); + +- free(dev->dev.net.vsi.profile_id); + if (cu_get_str_prop(inst, "ProfileID", &val) != CMPI_RC_OK) + dev->dev.net.vsi.profile_id = NULL; + else +@@ -1057,20 +1048,16 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, + } else + return "Invalid Network Type specified"; + +- free(dev->dev.net.device); + if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) + dev->dev.net.device = NULL; + else + dev->dev.net.device = strdup(val); + +- free(dev->dev.net.net_mode); + if (cu_get_str_prop(inst, "NetworkMode", &val) != CMPI_RC_OK) + dev->dev.net.net_mode = NULL; + else + dev->dev.net.net_mode = strdup(val); + +- free(dev->dev.net.model); +- + if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK) + dev->dev.net.model = NULL; + else +@@ -1106,13 +1093,13 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) + return "Missing `VirtualDevice' property"; + +- free(dev->dev.disk.virtual_dev); ++ cleanup_virt_device(dev); ++ + dev->dev.disk.virtual_dev = strdup(val); + + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) + val = "/dev/null"; + +- free(dev->dev.disk.source); + dev->dev.disk.source = strdup(val); + if (dev->dev.disk.source == NULL) { + return "dev->dev.disk.source is null!"; +@@ -1149,7 +1136,6 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + } + if (XSTREQ(dev->dev.disk.source, "/dev/null")) { + dev->dev.disk.disk_type = DISK_FILE; +- free(dev->dev.disk.source); + dev->dev.disk.source = strdup(""); + } + +@@ -1170,31 +1156,26 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + else + dev->dev.disk.readonly = read; + +- free(dev->dev.disk.bus_type); + if (cu_get_str_prop(inst, "BusType", &val) != CMPI_RC_OK) + dev->dev.disk.bus_type = NULL; + else + dev->dev.disk.bus_type = strdup(val); + +- free(dev->dev.disk.driver); + if (cu_get_str_prop(inst, "DriverName", &val) != CMPI_RC_OK) + dev->dev.disk.driver = NULL; + else + dev->dev.disk.driver = strdup(val); + +- free(dev->dev.disk.driver_type); + if (cu_get_str_prop(inst, "DriverType", &val) != CMPI_RC_OK) + dev->dev.disk.driver_type = NULL; + else + dev->dev.disk.driver_type = strdup(val); + +- free(dev->dev.disk.cache); + if (cu_get_str_prop(inst, "DriverCache", &val) != CMPI_RC_OK) + dev->dev.disk.cache = NULL; + else + dev->dev.disk.cache = strdup(val); + +- free(dev->dev.disk.access_mode); + if (cu_get_str_prop(inst, "AccessMode", &val) != CMPI_RC_OK) + dev->dev.disk.access_mode = NULL; + else +@@ -1205,7 +1186,6 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + else + dev->dev.disk.shareable = shareable; + +- free(dev->id); + dev->id = strdup(dev->dev.disk.virtual_dev); + + msg = rasd_to_device_address(inst, &dev->dev.disk.address); +@@ -1921,12 +1901,14 @@ static const char *rasd_to_vdev(CMPIInstance *inst, + goto out; + } + +- dev->type = (int)type; +- + if (domain->type == DOMAIN_LXC) + msg = _container_rasd_to_vdev(inst, dev, type, ns); + else + msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns, p_error); ++ ++ /* ensure device type is set */ ++ if (msg == NULL) ++ dev->type = type; + out: + if (msg && op) + CU_DEBUG("rasd_to_vdev(%s): %s", CLASSNAME(op), msg); +@@ -3112,7 +3094,6 @@ static CMPIStatus resource_add(struct domain *dominfo, + + dev = &list[*count]; + +- dev->type = type; + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); + if (msg != NULL) { + cu_statusf(_BROKER, &s, +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-d9414e36.patch b/SOURCES/libvirt-cim-0.6.3-d9414e36.patch new file mode 100644 index 0000000..8c94499 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-d9414e36.patch @@ -0,0 +1,129 @@ +From d9414e36cc8e23f938ce10260c6a2a7e68c72739 Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Mon, 3 Mar 2014 09:04:18 +0800 +Subject: [PATCH 48/60] Add rawio property support + +Add the 'rawio' property to the DiskRASD and parse/save it properly + +Once installed on the target system, use: + +wbemcli gcd http://root:password@localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData | grep rawio + +to determine if property exists in MOF. Using 'wbemcli ei' will determine +whether or not it shows up in the enumarated instance(s) - if there are +any on the system + +Signed-off-by: Xu Wang +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 4 ++++ + libxkutil/device_parsing.h | 1 + + libxkutil/xmlgen.c | 2 ++ + schema/ResourceAllocationSettingData.mof | 3 +++ + src/Virt_RASD.c | 6 ++++++ + src/Virt_VirtualSystemManagementService.c | 5 +++++ + 6 files changed, 21 insertions(+) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index c9ae886..6b29a2d 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -92,6 +92,7 @@ static void cleanup_disk_device(struct disk_device *dev) + free(dev->source); + free(dev->virtual_dev); + free(dev->bus_type); ++ free(dev->rawio); + free(dev->access_mode); + cleanup_device_address(&dev->address); + } +@@ -512,6 +513,8 @@ static int parse_block_device(xmlNode *dnode, struct virt_device **vdevs) + if (ddev->device == NULL) + goto err; + ++ ddev->rawio = get_attr_value(dnode, "rawio"); ++ + for (child = dnode->children; child != NULL; child = child->next) { + if (XSTREQ(child->name, "driver")) { + ddev->driver = get_attr_value(child, "name"); +@@ -1315,6 +1318,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + DUP_FIELD(dev, _dev, dev.disk.device); + DUP_FIELD(dev, _dev, dev.disk.driver); + DUP_FIELD(dev, _dev, dev.disk.driver_type); ++ DUP_FIELD(dev, _dev, dev.disk.rawio); + DUP_FIELD(dev, _dev, dev.disk.cache); + DUP_FIELD(dev, _dev, dev.disk.source); + DUP_FIELD(dev, _dev, dev.disk.virtual_dev); +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index 92427c1..a8cf7aa 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -56,6 +56,7 @@ struct disk_device { + char *driver_type; + char *source; + char *virtual_dev; ++ char *rawio; + enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type; + bool readonly; + bool shareable; +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 931f0c9..2f0f475 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -212,6 +212,8 @@ static char *disk_block_xml(xmlNodePtr root, struct disk_device *dev) + xmlNewProp(disk, BAD_CAST "type", BAD_CAST "block"); + if (dev->device) + xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device); ++ if (dev->rawio) ++ xmlNewProp(disk, BAD_CAST "rawio", BAD_CAST dev->rawio); + + if (dev->driver) { + tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL); +diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof +index bf1fbb6..5228f4b 100644 +--- a/schema/ResourceAllocationSettingData.mof ++++ b/schema/ResourceAllocationSettingData.mof +@@ -65,6 +65,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData + [Description ("filesystem access mode")] + string AccessMode; + ++ [Description ("rawio value of lun device")] ++ string rawio; ++ + [Description ("if device is shareable")] + boolean shareable; + +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index df1e921..0800311 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -482,6 +482,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, + (CMPIValue *)dev->dev.disk.access_mode, + CMPI_chars); + ++ if(dev->dev.disk.rawio) ++ CMSetProperty(inst, ++ "rawio", ++ (CMPIValue *)dev->dev.disk.rawio, ++ CMPI_chars); ++ + if(dev->dev.disk.shareable) + CMSetProperty(inst, + "shareable", +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 3e7785e..a9f7ae0 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1184,6 +1184,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, + else + dev->dev.disk.access_mode = strdup(val); + ++ if (cu_get_str_prop(inst, "rawio", &val) != CMPI_RC_OK) ++ dev->dev.disk.rawio = NULL; ++ else ++ dev->dev.disk.rawio = strdup(val); ++ + if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK) + dev->dev.disk.shareable = false; + else +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-de03c66f.patch b/SOURCES/libvirt-cim-0.6.3-de03c66f.patch new file mode 100644 index 0000000..de7d205 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-de03c66f.patch @@ -0,0 +1,111 @@ +From de03c66f06549081fef4d5600eb9a2136664a0fa Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Mon, 19 Aug 2013 17:11:10 +0800 +Subject: [PATCH 05/48] Add dumpCore tag support to memory + +dumpCore tag in the is not supported by libvirt-cim and +it will be dropped during updating any element in the xml definition +of a domain. This patch keep the tag all the time. + +Signed-off-by: Xu Wang +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 28 +++++++++++++++++++++++++++- + libxkutil/device_parsing.h | 3 +++ + libxkutil/xmlgen.c | 9 +++++++++ + 3 files changed, 39 insertions(+), 1 deletion(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index ffdf682..542e4e9 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -606,8 +606,17 @@ static int parse_mem_device(xmlNode *node, struct virt_device **vdevs) + + if (XSTREQ(node->name, "currentMemory")) + sscanf(content, "%" PRIu64, &mdev->size); +- else if (XSTREQ(node->name, "memory")) ++ else if (XSTREQ(node->name, "memory")) { + sscanf(content, "%" PRIu64, &mdev->maxsize); ++ content = get_attr_value(node, "dumpCore"); ++ if (content && XSTREQ(content, "on")) { ++ mdev->dumpCore = MEM_DUMP_CORE_ON; ++ } else if (content && XSTREQ(content, "off")) { ++ mdev->dumpCore = MEM_DUMP_CORE_OFF; ++ } else { ++ mdev->dumpCore = MEM_DUMP_CORE_NOT_SET; ++ } ++ } + + free(content); + +@@ -969,6 +978,7 @@ static int _get_mem_device(const char *xml, struct virt_device **list) + struct virt_device *mdevs = NULL; + struct virt_device *mdev = NULL; + int ret; ++ bool mem_dump_core_set = false; + + ret = parse_devices(xml, &mdevs, CIM_RES_TYPE_MEM); + if (ret <= 0) +@@ -988,10 +998,26 @@ static int _get_mem_device(const char *xml, struct virt_device **list) + mdevs[1].dev.mem.size); + mdev->dev.mem.maxsize = MAX(mdevs[0].dev.mem.maxsize, + mdevs[1].dev.mem.maxsize); ++ /* libvirt dumpCore tag always belong to memory xml node, but ++ * here we may have two mdev for memory node and currentMemory ++ * node. So pick up one value. ++ */ ++ if (mdevs[0].dev.mem.dumpCore != MEM_DUMP_CORE_NOT_SET) { ++ mdev->dev.mem.dumpCore = mdevs[0].dev.mem.dumpCore; ++ mem_dump_core_set = true; ++ } else if (mdevs[1].dev.mem.dumpCore != ++ MEM_DUMP_CORE_NOT_SET) { ++ if (mem_dump_core_set) { ++ CU_DEBUG("WARN: libvirt set memory core dump in" ++ "two nodes!"); ++ } ++ mdev->dev.mem.dumpCore = mdevs[1].dev.mem.dumpCore; ++ } + } else { + mdev->dev.mem.size = MAX(mdevs[0].dev.mem.size, + mdevs[0].dev.mem.maxsize); + mdev->dev.mem.maxsize = mdev->dev.mem.size; ++ mdev->dev.mem.dumpCore = mdevs[0].dev.mem.dumpCore; + } + + mdev->type = CIM_RES_TYPE_MEM; +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index 2b6d3d1..979b792 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -75,6 +75,9 @@ struct net_device { + struct mem_device { + uint64_t size; + uint64_t maxsize; ++ enum { MEM_DUMP_CORE_NOT_SET, ++ MEM_DUMP_CORE_ON, ++ MEM_DUMP_CORE_OFF } dumpCore; + }; + + struct vcpu_device { +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 4287d42..30e9a5e 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -498,6 +498,15 @@ static const char *mem_xml(xmlNodePtr root, struct domain *dominfo) + BAD_CAST string); + + free(string); ++ ++ if (tmp == NULL) ++ return XML_ERROR; ++ if (mem->dumpCore == MEM_DUMP_CORE_ON) { ++ xmlNewProp(tmp, BAD_CAST "dumpCore", BAD_CAST "on"); ++ } else if (mem->dumpCore == MEM_DUMP_CORE_OFF) { ++ xmlNewProp(tmp, BAD_CAST "dumpCore", BAD_CAST "off"); ++ } ++ + out: + if (tmp == NULL) + return XML_ERROR; +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-de34dda2.patch b/SOURCES/libvirt-cim-0.6.3-de34dda2.patch new file mode 100644 index 0000000..9e1d9cb --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-de34dda2.patch @@ -0,0 +1,251 @@ +From de34dda20f1e9d88075202ff3257a10cc87fbca6 Mon Sep 17 00:00:00 2001 +From: Xu Wang +Date: Thu, 27 Mar 2014 11:10:35 -0400 +Subject: [PATCH 53/60] Set fields in mofs for Controller Device/RASD + +Set basic fields for the KVM_Controller instance based on the read XML +from the virtual controller device structure. + +Set the various KVM_ControllerRASD fields based on the read XML from +the virtual controller device structure + +Signed-off-by: John Ferlan +--- + src/Virt_Device.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- + src/Virt_RASD.c | 57 +++++++++++++++++++++++++++++++++++++++++++++- + src/svpc_types.h | 3 ++- + 3 files changed, 124 insertions(+), 4 deletions(-) + +diff --git a/src/Virt_Device.c b/src/Virt_Device.c +index 12ae6bd..60465b7 100644 +--- a/src/Virt_Device.c ++++ b/src/Virt_Device.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -366,6 +366,61 @@ static CMPIInstance *input_instance(const CMPIBroker *broker, + return inst; + } + ++static int controller_set_attr(const CMPIBroker *broker, ++ CMPIInstance *instance, ++ struct controller_device *dev) ++{ ++ const char *type_str; ++ ++ type_str = controller_protocol_type_IDToStr(dev->type); ++ if (type_str == NULL) { ++ CU_DEBUG("controller type=%d fails to return string", dev->type); ++ return 0; ++ } ++ ++ CMSetProperty(instance, "ProtocolSupported", ++ (CMPIValue *)&dev->type, ++ CMPI_uint16); ++ ++ if (dev->model) ++ CMSetProperty(instance, "ProtocolDescription", ++ (CMPIValue *)dev->model, ++ CMPI_chars); ++ ++ return 1; ++} ++ ++static CMPIInstance *controller_instance(const CMPIBroker *broker, ++ struct controller_device *dev, ++ const virDomainPtr dom, ++ const char *ns) ++{ ++ CMPIInstance *inst; ++ virConnectPtr conn; ++ ++ CU_DEBUG("controller_instance"); ++ ++ conn = virDomainGetConnect(dom); ++ inst = get_typed_instance(broker, ++ pfx_from_conn(conn), ++ "Controller", ++ ns, ++ true); ++ if (inst == NULL) { ++ CU_DEBUG("Failed to get instance of %s_Controller", ++ pfx_from_conn(conn)); ++ return NULL; ++ } ++ ++ ++ if (!controller_set_attr(broker, inst, dev)) { ++ CU_DEBUG("Failed to set contoller attributes of %s_Controller", ++ pfx_from_conn(conn)); ++ return NULL; ++ } ++ ++ return inst; ++} + static int device_set_devid(CMPIInstance *instance, + struct virt_device *dev, + const virDomainPtr dom) +@@ -488,6 +543,8 @@ static bool device_instances(const CMPIBroker *broker, + for (i = 0; i < count; i++) { + struct virt_device *dev = &devs[i]; + ++ CU_DEBUG("device_instance dev->type=%d", dev->type); ++ + if (dev->type == CIM_RES_TYPE_NET) + instance = net_instance(broker, + &dev->dev.net, +@@ -516,11 +573,16 @@ static bool device_instances(const CMPIBroker *broker, + &dev->dev.console, + dom, + ns); +- else if (dev->type == CIM_RES_TYPE_INPUT) ++ else if (dev->type == CIM_RES_TYPE_INPUT) + instance = input_instance(broker, + &dev->dev.input, + dom, + ns); ++ else if (dev->type == CIM_RES_TYPE_CONTROLLER) ++ instance = controller_instance(broker, ++ &dev->dev.controller, ++ dom, ++ ns); + else + return false; + +@@ -555,6 +617,8 @@ uint16_t res_type_from_device_classname(const char *classname) + return CIM_RES_TYPE_GRAPHICS; + else if (strstr(classname, "PointingDevice")) + return CIM_RES_TYPE_INPUT; ++ else if (strstr(classname, "Controller")) ++ return CIM_RES_TYPE_CONTROLLER; + else + return CIM_RES_TYPE_UNKNOWN; + } +diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c +index abfb09f..3c62c2d 100644 +--- a/src/Virt_RASD.c ++++ b/src/Virt_RASD.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007, 2013 ++ * Copyright IBM Corp. 2007-2014 + * + * Authors: + * Dan Smith +@@ -915,6 +915,51 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, + return s; + } + ++static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker, ++ const CMPIObjectPath *ref, ++ const struct virt_device *dev, ++ CMPIInstance *inst) ++{ ++ const char *type_str; ++ CMPIStatus s = {CMPI_RC_OK, NULL}; ++ ++ type_str = controller_protocol_type_IDToStr(dev->dev.controller.type); ++ if (type_str == NULL) { ++ CU_DEBUG("controller type=%d fails to return string", ++ dev->type); ++ return s; ++ } ++ CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars); ++ CMSetProperty(inst, "ResourceSubType", ++ (CMPIValue *)type_str, CMPI_chars); ++ CMSetProperty(inst, "Index", ++ (CMPIValue *)&(dev->dev.controller.index), CMPI_uint64); ++ ++ if (dev->dev.controller.model) ++ CMSetProperty(inst, "Model", ++ (CMPIValue *)dev->dev.controller.model, CMPI_chars); ++ ++ if (dev->dev.controller.ports) ++ CMSetProperty(inst, "Ports", ++ (CMPIValue *)dev->dev.controller.ports, CMPI_chars); ++ ++ if (dev->dev.controller.vectors) ++ CMSetProperty(inst, "Vectors", ++ (CMPIValue *)dev->dev.controller.vectors, CMPI_chars); ++ ++ if (dev->dev.controller.queues) ++ CMSetProperty(inst, "Queues", ++ (CMPIValue *)dev->dev.controller.queues, CMPI_chars); ++ ++ if (dev->dev.controller.address.ct > 0) ++ set_rasd_device_address(broker, ++ ref, ++ &dev->dev.controller.address, ++ inst); ++ ++ return s; ++} ++ + CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, + struct virt_device *dev, + const char *host, +@@ -949,6 +994,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, + } else if (dev->type == CIM_RES_TYPE_INPUT) { + type = CIM_RES_TYPE_INPUT; + base = "InputResourceAllocationSettingData"; ++ } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { ++ type = CIM_RES_TYPE_OTHER; ++ base = "ControllerResourceAllocationSettingData"; + } else { + return NULL; + } +@@ -1004,6 +1052,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, + s = set_input_rasd_params(dev, inst); + } else if (dev->type == CIM_RES_TYPE_CONSOLE) { + s = set_console_rasd_params(dev, inst); ++ } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { ++ s = set_controller_rasd_params(broker, ref, dev, inst); + } + + /* FIXME: Put the HostResource in place */ +@@ -1138,6 +1188,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) + *type = CIM_RES_TYPE_IMAGE; + else if (STREQ(base, "ConsoleResourceAllocationSettingData")) + *type = CIM_RES_TYPE_CONSOLE; ++ else if (STREQ(base, "ControllerResourceAllocationSettingData")) ++ *type = CIM_RES_TYPE_CONTROLLER; + else + goto out; + +@@ -1175,6 +1227,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname) + case CIM_RES_TYPE_INPUT: + *classname = "InputResourceAllocationSettingData"; + break; ++ case CIM_RES_TYPE_CONTROLLER: ++ *classname = "ControllerResourceAllocationSettingData"; ++ break; + default: + rc = CMPI_RC_ERR_FAILED; + } +diff --git a/src/svpc_types.h b/src/svpc_types.h +index d9f8032..6270233 100644 +--- a/src/svpc_types.h ++++ b/src/svpc_types.h +@@ -42,7 +42,7 @@ + #define CIM_RES_TYPE_EMU 32770 + #define CIM_RES_TYPE_CONTROLLER 32771 + +-#define CIM_RES_TYPE_COUNT 7 ++#define CIM_RES_TYPE_COUNT 8 + const static int cim_res_types[CIM_RES_TYPE_COUNT] = + {CIM_RES_TYPE_NET, + CIM_RES_TYPE_DISK, +@@ -51,6 +51,7 @@ const static int cim_res_types[CIM_RES_TYPE_COUNT] = + CIM_RES_TYPE_GRAPHICS, + CIM_RES_TYPE_INPUT, + CIM_RES_TYPE_CONSOLE, ++ CIM_RES_TYPE_CONTROLLER, + }; + + #define CIM_VSSD_RECOVERY_NONE 2 +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-ee74ebc1.patch b/SOURCES/libvirt-cim-0.6.3-ee74ebc1.patch new file mode 100644 index 0000000..1d9d471 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-ee74ebc1.patch @@ -0,0 +1,38 @@ +From ee74ebc122c60e86dd02442589b880c367a4eb9a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Wed, 21 Aug 2013 15:35:28 +0200 +Subject: [PATCH 04/48] libvirt-cim.spec.in: Uninstall open-pegasus-specific + providers from sfcb +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Older libvirt-cim might've installed these in the sblim-sfcb +repository, causing errors when calling sfcbrepos on libvirt-cim update. + +Signed-off-by: Ján Tomko +Signed-off-by: John Ferlan +--- + libvirt-cim.spec.in | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in +index a027246..cd399b1 100644 +--- a/libvirt-cim.spec.in ++++ b/libvirt-cim.spec.in +@@ -84,6 +84,13 @@ rm -fr $RPM_BUILD_ROOT + -n @CIM_VIRT_NS@ \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true + ++# Remove open-pegasus-specific providers installed in sfcb repository ++# by older libvirt-cim packages ++%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ ++ -n root/PG_InterOp \ ++ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true ++ ++ + %post + /sbin/ldconfig + +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-ee84e10f.patch b/SOURCES/libvirt-cim-0.6.3-ee84e10f.patch new file mode 100644 index 0000000..f662be5 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-ee84e10f.patch @@ -0,0 +1,39 @@ +From ee84e10f3daba3050b17904c34b05db0765736d4 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Wed, 11 Sep 2013 16:45:35 +0200 +Subject: [PATCH 15/60] VSMS: Set resource types for default devices + +The default graphics and input devices were built without their +resource types being set correctly. This has not hurted yet. +Future changes will however require that the device resource +type is matching the actual device type. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 79dec73..6629b35 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -581,6 +581,7 @@ static bool default_graphics_device(struct domain *domain) + return false; + } + ++ domain->dev_graphics->type = CIM_RES_TYPE_GRAPHICS; + domain->dev_graphics->dev.graphics.type = strdup("vnc"); + domain->dev_graphics->dev.graphics.dev.vnc.port = strdup("-1"); + domain->dev_graphics->dev.graphics.dev.vnc.host = strdup("127.0.0.1"); +@@ -609,6 +610,7 @@ static bool default_input_device(struct domain *domain) + return false; + } + ++ domain->dev_input->type = CIM_RES_TYPE_INPUT; + domain->dev_input->dev.input.type = strdup("mouse"); + + if (domain->type == DOMAIN_XENPV) { +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-f18ba715.patch b/SOURCES/libvirt-cim-0.6.3-f18ba715.patch new file mode 100644 index 0000000..ab52cbc --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-f18ba715.patch @@ -0,0 +1,71 @@ +From f18ba71595815c820742e2f12cc30481fc510642 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 30 Aug 2013 14:12:20 +0200 +Subject: [PATCH 13/48] build: Don't use /bin/sh unconditionally + +provider-register.sh implicitly assumes that the shell has bash-like +capabilities. On systems like Ubuntu this is not the case leading +to a make postinstall failure when used with Pegasus. +Changing the script shebang to /bin/bash to make this explicit. +Further replace occurrences of sh to $(SHELL) in the Makefile +invocations of provider-register.sh. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: John Ferlan +--- + Makefile.am | 18 +++++++++--------- + provider-register.sh | 2 +- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 63ed3c7..9e8e96b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -201,26 +201,26 @@ uninstall-local: + done + + preinstall: +- sh -x base_schema/install_base_schema.sh `pwd`/base_schema ++ $(SHELL) -x base_schema/install_base_schema.sh `pwd`/base_schema + + # Un/Register the providers and class definitions from/to the current CIMOM. + # @CIMSERVER@ is set by the configure script + postinstall: +- sh provider-register.sh -v -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(MOFS)) +- sh provider-register.sh -v -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS)) +- sh provider-register.sh -v -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS)) ++ $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(MOFS)) ++ $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS)) ++ $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS)) + if [[ @CIMSERVER@ = pegasus ]]; then \ +- sh provider-register.sh -v -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ ++ $(SHELL) provider-register.sh -v -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ + fi + virsh -v | grep -q '^0.3' && cp examples/diskpool.conf $(DISK_POOL_CONFIG) || true + mkdir -p $(INFO_STORE) + + preuninstall: +- sh provider-register.sh -v -d -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(MOFS)) +- sh provider-register.sh -v -d -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS)) +- sh provider-register.sh -v -d -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS)) ++ $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n @CIM_VIRT_NS@ -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(MOFS)) ++ $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/interop -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(INTEROP_MOFS)) ++ $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/cimv2 -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(CIMV2_MOFS)) + if [[ @CIMSERVER@ = pegasus ]]; then \ +- sh provider-register.sh -v -d -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ ++ $(SHELL) provider-register.sh -v -d -t @CIMSERVER@ -n root/PG_InterOp -r $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_REGS)) -m $(subst $(top_srcdir)/schema,$(pkgdatadir), $(PGINTEROP_MOFS)); \ + fi + + rpm: clean +diff --git a/provider-register.sh b/provider-register.sh +index b907df1..b730ef3 100755 +--- a/provider-register.sh ++++ b/provider-register.sh +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + # $Id$ + # ================================================================== + # Copyright IBM Corp. 2005 +-- +1.8.5.3 diff --git a/SOURCES/libvirt-cim-0.6.3-f6b7eeaf.patch b/SOURCES/libvirt-cim-0.6.3-f6b7eeaf.patch new file mode 100644 index 0000000..1354591 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-f6b7eeaf.patch @@ -0,0 +1,124 @@ +From f6b7eeaf097b6441ed7928c7130582a83bba5f7d Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 6 Sep 2013 14:09:55 +0200 +Subject: [PATCH 13/60] libxkutil: Plug memory leaks in device parsing + +Fixed a number of memory leaks detected while running xml_parse_test +under valgrind. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 31 +++++++++++++++++++++---------- + 1 file changed, 21 insertions(+), 10 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index fa9f998..f55061e 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -95,6 +95,8 @@ static void cleanup_net_device(struct net_device *dev) + free(dev->device); + free(dev->net_mode); + free(dev->filter_ref); ++ free(dev->poolid); ++ cleanup_vsi_device(&dev->vsi); + } + + static void cleanup_emu_device(struct emu_device *dev) +@@ -566,6 +568,8 @@ static int parse_mem_device(xmlNode *node, struct virt_device **vdevs) + struct virt_device *vdev = NULL; + struct mem_device *mdev = NULL; + char *content = NULL; ++ char *tmpval = NULL; ++ int ret = 0; + + vdev = calloc(1, sizeof(*vdev)); + if (vdev == NULL) +@@ -579,27 +583,26 @@ static int parse_mem_device(xmlNode *node, struct virt_device **vdevs) + sscanf(content, "%" PRIu64, &mdev->size); + else if (XSTREQ(node->name, "memory")) { + sscanf(content, "%" PRIu64, &mdev->maxsize); +- content = get_attr_value(node, "dumpCore"); +- if (content && XSTREQ(content, "on")) { ++ tmpval = get_attr_value(node, "dumpCore"); ++ if (tmpval && XSTREQ(tmpval, "on")) { + mdev->dumpCore = MEM_DUMP_CORE_ON; +- } else if (content && XSTREQ(content, "off")) { ++ } else if (tmpval && XSTREQ(content, "off")) { + mdev->dumpCore = MEM_DUMP_CORE_OFF; + } else { + mdev->dumpCore = MEM_DUMP_CORE_NOT_SET; + } + } + +- free(content); +- + *vdevs = vdev; +- +- return 1; ++ vdev = NULL; ++ ret = 1; + + err: + free(content); ++ free(tmpval); + free(vdev); + +- return 0; ++ return ret; + } + + static char *get_attr_value_default(xmlNode *node, char *attrname, +@@ -787,7 +790,10 @@ static int do_parse(xmlNodeSet *nsv, dev_parse_func_t do_real_parse, + } + + out: +- *l = list; ++ if (list) { ++ free(*l); ++ *l = list; ++ } + return lstidx; + } + +@@ -1203,7 +1209,7 @@ static int parse_features(struct domain *dominfo, xmlNode *features) + + static void set_action(int *val, xmlNode *child) + { +- const char *action = (char *)xmlNodeGetContent(child); ++ char *action = (char *)xmlNodeGetContent(child); + + if (action == NULL) + *val = CIM_VSSD_RECOVERY_NONE; +@@ -1215,6 +1221,8 @@ static void set_action(int *val, xmlNode *child) + *val = CIM_VSSD_RECOVERY_RESTART; + else + *val = CIM_VSSD_RECOVERY_NONE; ++ ++ xmlFree(action); + } + + static int parse_domain(xmlNodeSet *nsv, struct domain *dominfo) +@@ -1366,9 +1374,11 @@ void cleanup_dominfo(struct domain **dominfo) + + dom = *dominfo; + free(dom->name); ++ free(dom->typestr); + free(dom->uuid); + free(dom->bootloader); + free(dom->bootloader_args); ++ free(dom->clock); + + if (dom->type == DOMAIN_XENPV) { + free(dom->os_info.pv.type); +@@ -1390,6 +1400,7 @@ void cleanup_dominfo(struct domain **dominfo) + CU_DEBUG("Unknown domain type %i", dom->type); + } + ++ cleanup_virt_devices(&dom->dev_emu, 1); + cleanup_virt_devices(&dom->dev_mem, dom->dev_mem_ct); + cleanup_virt_devices(&dom->dev_net, dom->dev_net_ct); + cleanup_virt_devices(&dom->dev_disk, dom->dev_disk_ct); +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-f70a8ea0.patch b/SOURCES/libvirt-cim-0.6.3-f70a8ea0.patch new file mode 100644 index 0000000..84f92f1 --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-f70a8ea0.patch @@ -0,0 +1,171 @@ +From f70a8ea0305c82d14e47d08f2e130f8e11b0e9b3 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Mon, 7 Oct 2013 16:02:35 +0200 +Subject: [PATCH 22/60] libxkutil: Simplify XML handling of consoles + +The attempt to avoid duplication of console definitions was a bit +too complicated and error prone. We move the generation of console +XML entirely to the new console code. +Further, it's incorrect to restrict PTY consoles being represented +as GraphicsRASDs to virtio only. At least serial must be allowed, +but it doesn't really hurt to map all PTYs to GraphicsRASD consoles. + +Further, the parsing code returned two instances for serial consoles, +one from the /domain/devices/console and /domain/devices/serial +both representing the same device. This confuses cimtest and, +more problematic, will prevent DefineSystem to work, if a reference +VSSD with a serial console is passed in. + +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Daniel Hansel +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 12 +------- + libxkutil/xmlgen.c | 76 ---------------------------------------------- + 2 files changed, 1 insertion(+), 87 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 55c8d57..aecca4c 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -47,7 +47,7 @@ + * still part of the graphics. + */ + #define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics | "\ +- "/domain/devices/console | /domain/devices/serial" ++ "/domain/devices/console" + #define INPUT_XPATH (xmlChar *)"/domain/devices/input" + + #define DEFAULT_BRIDGE "xenbr0" +@@ -948,16 +948,6 @@ static int parse_graphics_device(xmlNode *node, struct virt_device **vdevs) + else if (XSTREQ(child->name, "target")) { + gdev->dev.vnc.port = + get_attr_value(child, "port"); +- /* The graphics pty console can only be a +- virtio console. If 'type' is not set in the +- xml, the default of libvirt is virtio.*/ +- char *t_type = get_attr_value(child, "type"); +- if (t_type != NULL && !STREQC(t_type, "virtio")) { +- CU_DEBUG("Not a pty-virtio graphics console"); +- free(t_type); +- goto err; +- } +- free(t_type); + } + } + } +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 45bfb04..7e8801d 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -42,36 +42,11 @@ typedef const char *(*devfn_t)(xmlNodePtr node, struct domain *dominfo); + typedef const char *(*poolfn_t)(xmlNodePtr node, struct virt_pool *pool); + typedef const char *(*resfn_t)(xmlNodePtr node, struct virt_pool_res *res); + +-static int _count_graphics_console_definitions(struct domain *dominfo) +-{ +- int i; +- int num = 0; +- +- for (i = 0; i < dominfo->dev_graphics_ct; i++) { +- struct virt_device *_dev = &dominfo->dev_graphics[i]; +- if (_dev->type == CIM_RES_TYPE_UNKNOWN) +- continue; +- +- struct graphics_device *dev = &_dev->dev.graphics; +- +- if (STREQC(dev->type, "console")) { +- num++; +- } +- } +- CU_DEBUG("Found %d console defintions in graphics devices.",num); +- return num; +- +-} +- + static const char *console_xml(xmlNodePtr root, struct domain *dominfo) + { + int i; + xmlNodePtr console; + xmlNodePtr tmp; +- int num_graphics_consol_def = 0; +- int num_suppressed_console_def = 0; +- +- num_graphics_consol_def = _count_graphics_console_definitions(dominfo); + + for (i = 0; i < dominfo->dev_console_ct; i++) { + struct virt_device *_dev = &dominfo->dev_console[i]; +@@ -80,25 +55,6 @@ static const char *console_xml(xmlNodePtr root, struct domain *dominfo) + + struct console_device *cdev = &_dev->dev.console; + +- /* Due to backward compatibility, the graphics device handling +- is still parsing consoles: +- source = pty, target = virtio (which is the default target) +- But the console device handling processes these kind of +- consoles too. This would lead to a duplication of these +- default consoles in the domain xml definition. +- This code prevents the console handling of writing xml for +- duplicate pty/virtio consoles which are written by the +- graphics device handling. */ +- if (cdev->source_type == CIM_CHARDEV_SOURCE_TYPE_PTY && +- (cdev->target_type == NULL || +- STREQC(cdev->target_type, "virtio"))) { +- if (num_suppressed_console_def < +- num_graphics_consol_def) { +- num_suppressed_console_def++; +- continue; +- } +- } +- + console = xmlNewChild(root, NULL, BAD_CAST "console", NULL); + if (console == NULL) + return XML_ERROR; +@@ -760,35 +716,6 @@ static const char *graphics_vnc_xml(xmlNodePtr root, + return NULL; + } + +-static const char *graphics_pty_xml(xmlNodePtr root, +- struct graphics_device *dev) +-{ +- xmlNodePtr pty = NULL; +- xmlNodePtr tmp = NULL; +- +- pty = xmlNewChild(root, NULL, BAD_CAST dev->type, NULL); +- if (pty == NULL) +- return XML_ERROR; +- +- xmlNewProp(pty, BAD_CAST "type", BAD_CAST "pty"); +- +- tmp = xmlNewChild(pty, NULL, BAD_CAST "source", NULL); +- if (tmp == NULL) +- return XML_ERROR; +- +- if(dev->dev.vnc.host) +- xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); +- +- tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); +- if (tmp == NULL) +- return XML_ERROR; +- +- if(dev->dev.vnc.port) +- xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); +- +- return NULL; +-} +- + static const char *graphics_xml(xmlNodePtr root, struct domain *dominfo) + { + const char *msg = NULL; +@@ -803,9 +730,6 @@ static const char *graphics_xml(xmlNodePtr root, struct domain *dominfo) + + if (STREQC(dev->type, "vnc") || STREQC(dev->type, "sdl")) + msg = graphics_vnc_xml(root, dev); +- else if (STREQC(dev->type, "console") || +- STREQC(dev->type, "serial")) +- msg = graphics_pty_xml(root, dev); + else + continue; + +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-f9fc5821.patch b/SOURCES/libvirt-cim-0.6.3-f9fc5821.patch new file mode 100644 index 0000000..a59828a --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-f9fc5821.patch @@ -0,0 +1,104 @@ +From f9fc5821db08f04ecc92aabb3c87ce2869e78fb2 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Tue, 21 Jan 2014 14:42:24 -0500 +Subject: [PATCH 40/60] VSMS: Coverity cleanups + +A new version of Coverity found a number of issues: + +parse_ip_address(): FORWARD_NULL + - Benign issue regarding how 'tmp_ip' was compared against NULL for + the IPv6 processing and then used blindly later when strdup()'ing + into *ip. Rather than use NULL check, compare against return of 1 + or more which indicates that something is there + +update_system_settings(): RESOURCE_LEAK + - The 'uuid' value was being leaked if strdup()'d. Also rather than + strdup()'g and strdup()'d value and risking failure, just assign the + initially strdup()'d value and reinitialize uuid to NULL + +fv_vssd_to_domain(): USE_AFTER_FREE + - The domain->os_info.fv.arch is free()'d only to be potentially + strdup()'d after processing the 'cu_get_str_prop()' for "Arch". + The complaint was that it was possible to not strdup() a new value + and thus possible to pass a free()'d value to get_default_machine(). + Passing a NULL is not an issue as that is checked. + + Additionally found by inspection, 'val' was not initialized to NULL, + so the setting of os_info.fv.arch may not be what was expected. Also, + after processing "Arch" it was not reinitialized to NULL so its + contents could potentially have been saved in os_info.fv.machine. + +Signed-off-by: John Ferlan +--- + src/Virt_VirtualSystemManagementService.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 5c7238f..83e5c53 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -464,7 +464,7 @@ static int fv_vssd_to_domain(CMPIInstance *inst, + { + int ret = 1; + int retr; +- const char *val; ++ const char *val = NULL; + const char *domtype = NULL; + const char *ostype = "hvm"; + struct capabilities *capsinfo = NULL; +@@ -494,6 +494,7 @@ static int fv_vssd_to_domain(CMPIInstance *inst, + } + + free(domain->os_info.fv.arch); ++ domain->os_info.fv.arch = NULL; + retr = cu_get_str_prop(inst, "Arch", &val); + if (retr != CMPI_RC_OK) { + if (capsinfo != NULL) { /* set default */ +@@ -506,6 +507,8 @@ static int fv_vssd_to_domain(CMPIInstance *inst, + domain->os_info.fv.arch = strdup(val); + + free(domain->os_info.fv.machine); ++ domain->os_info.fv.machine = NULL; ++ val = NULL; + retr = cu_get_str_prop(inst, "Machine", &val); + if (retr != CMPI_RC_OK) { + if (capsinfo != NULL && domtype != NULL) { /* set default */ +@@ -1415,7 +1418,7 @@ static int parse_ip_address(const char *id, + if (strstr(id, "[") != NULL) { + /* its an ipv6 address */ + ret = sscanf(id, "%a[^]]]:%as", &tmp_ip, &tmp_port); +- if (tmp_ip != NULL) { ++ if (ret >= 1) { + tmp_ip = realloc(tmp_ip, strlen(tmp_ip) + 2); + if (tmp_ip == NULL) { + ret = 0; +@@ -2755,7 +2758,7 @@ static CMPIStatus update_system_settings(const CMPIContext *context, + virDomainPtr dom = NULL; + struct domain *dominfo = NULL; + char *xml = NULL; +- const char *uuid = NULL; ++ char *uuid = NULL; + + CU_DEBUG("Enter update_system_settings"); + ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier", &name); +@@ -2798,7 +2801,9 @@ static CMPIStatus update_system_settings(const CMPIContext *context, + } + + if ((dominfo->uuid == NULL) || (STREQ(dominfo->uuid, ""))) { +- dominfo->uuid = strdup(uuid); ++ free(dominfo->uuid); ++ dominfo->uuid = uuid; ++ uuid = NULL; + } else if (!STREQ(uuid, dominfo->uuid)) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, +@@ -2829,6 +2834,7 @@ static CMPIStatus update_system_settings(const CMPIContext *context, + } + + out: ++ free(uuid); + free(xml); + virDomainFree(dom); + virConnectClose(conn); +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-fb5d2fcf.patch b/SOURCES/libvirt-cim-0.6.3-fb5d2fcf.patch new file mode 100644 index 0000000..0ee97df --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-fb5d2fcf.patch @@ -0,0 +1,208 @@ +From fb5d2fcfe770d5446a6d8fcdcd405c6645c4dfb0 Mon Sep 17 00:00:00 2001 +From: John Ferlan +Date: Wed, 22 Jan 2014 16:09:04 -0500 +Subject: [PATCH 46/60] Adjust sscanf format string + +Currently the sscanf() calls use "%as" or "%a[" in order to allocate and +return strings for read fields. It was pointed out to me that this is an +older and non-portable method. Instead the "%ms" or "%m[" should be used. + +Signed-off-by: John Ferlan +--- + libxkutil/acl_parsing.c | 2 +- + libxkutil/device_parsing.c | 2 +- + libxkutil/misc_util.c | 2 +- + src/Virt_ComputerSystemIndication.c | 2 +- + src/Virt_Device.c | 6 +++--- + src/Virt_DevicePool.c | 8 ++++---- + src/Virt_SettingsDefineState.c | 2 +- + src/Virt_VirtualSystemManagementService.c | 12 ++++++------ + 8 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/libxkutil/acl_parsing.c b/libxkutil/acl_parsing.c +index 3de6a65..c368b99 100644 +--- a/libxkutil/acl_parsing.c ++++ b/libxkutil/acl_parsing.c +@@ -666,7 +666,7 @@ int parse_rule_id(const char *rule_id, char **filter, int *index) + + if ((filter == NULL) || (index == NULL)) + return 0; +- ret = sscanf(rule_id, "%as[^:]:%u", filter, index); ++ ret = sscanf(rule_id, "%ms[^:]:%u", filter, index); + if (ret != 2) { + free(*filter); + *filter = NULL; +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index 4dd9e58..c9ae886 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -1463,7 +1463,7 @@ int parse_fq_devid(const char *devid, char **host, char **device) + { + int ret; + +- ret = sscanf(devid, "%a[^/]/%a[^\n]", host, device); ++ ret = sscanf(devid, "%m[^/]/%m[^\n]", host, device); + if (ret != 2) { + free(*host); + free(*device); +diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c +index 2164dd0..6a54815 100644 +--- a/libxkutil/misc_util.c ++++ b/libxkutil/misc_util.c +@@ -671,7 +671,7 @@ int parse_id(const char *id, + char *tmp_pfx = NULL; + char *tmp_name = NULL; + +- ret = sscanf(id, "%a[^:]:%a[^\n]", &tmp_pfx, &tmp_name); ++ ret = sscanf(id, "%m[^:]:%m[^\n]", &tmp_pfx, &tmp_name); + if (ret != 2) { + ret = 0; + goto out; +diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c +index 20c60bc..32bee97 100644 +--- a/src/Virt_ComputerSystemIndication.c ++++ b/src/Virt_ComputerSystemIndication.c +@@ -382,7 +382,7 @@ static char *sys_name_from_xml(char *xml) + goto out; + } + +- rc = sscanf(tmp, "%a[^<]s", &name); ++ rc = sscanf(tmp, "%m[^<]s", &name); + if (rc != 1) { + name = NULL; + } +diff --git a/src/Virt_Device.c b/src/Virt_Device.c +index b93e592..12ae6bd 100644 +--- a/src/Virt_Device.c ++++ b/src/Virt_Device.c +@@ -675,7 +675,7 @@ static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, + + s = enum_devices(_BROKER, + reference, +- NULL, ++ NULL, + res_type_from_device_classname(CLASSNAME(reference)), + &list); + if (s.rc != CMPI_RC_OK) +@@ -696,7 +696,7 @@ static int parse_devid(const char *devid, char **dom, char **dev) + { + int ret; + +- ret = sscanf(devid, "%a[^/]/%as", dom, dev); ++ ret = sscanf(devid, "%m[^/]/%ms", dom, dev); + if (ret != 2) { + free(*dom); + free(*dev); +@@ -711,7 +711,7 @@ static int proc_dev_list(uint64_t quantity, + { + int i; + +- *list = (struct virt_device *)calloc(quantity, ++ *list = (struct virt_device *)calloc(quantity, + sizeof(struct virt_device)); + + for (i = 0; i < quantity; i++) { +diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c +index d6e51ba..aae7ed4 100644 +--- a/src/Virt_DevicePool.c ++++ b/src/Virt_DevicePool.c +@@ -383,11 +383,11 @@ static bool _diskpool_is_member(virConnectPtr conn, + + pool_vol = virStoragePoolLookupByVolume(vol); + if (vol != NULL) { +- pool_name = virStoragePoolGetName(pool_vol); ++ pool_name = virStoragePoolGetName(pool_vol); + if ((pool_name != NULL) && (STREQC(pool_name, pool->tag))) + result = true; + } +- ++ + out: + CU_DEBUG("Image %s in pool %s: %s", + file, +@@ -405,7 +405,7 @@ static bool parse_diskpool_line(struct tmp_disk_pool *pool, + { + int ret; + +- ret = sscanf(line, "%as %as", &pool->tag, &pool->path); ++ ret = sscanf(line, "%ms %ms", &pool->tag, &pool->path); + if (ret != 2) { + free(pool->tag); + free(pool->path); +@@ -1610,7 +1610,7 @@ CMPIStatus get_pool_by_name(const CMPIBroker *broker, + goto out; + } + +- ret = sscanf(id, "%*[^/]/%a[^\n]", &poolid); ++ ret = sscanf(id, "%*[^/]/%m[^\n]", &poolid); + if (ret != 1) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, +diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c +index be2ded5..c8cda97 100644 +--- a/src/Virt_SettingsDefineState.c ++++ b/src/Virt_SettingsDefineState.c +@@ -298,7 +298,7 @@ static CMPIStatus vssd_to_vs(const CMPIObjectPath *ref, + goto out; + } + +- ret = sscanf(id, "%a[^:]:%as", &pfx, &name); ++ ret = sscanf(id, "%m[^:]:%ms", &pfx, &name); + if (ret != 2) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, +diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c +index 83e5c53..3e7785e 100644 +--- a/src/Virt_VirtualSystemManagementService.c ++++ b/src/Virt_VirtualSystemManagementService.c +@@ -1330,7 +1330,7 @@ static int parse_console_address(const char *id, + + CU_DEBUG("Entering parse_console_address, address is %s", id); + +- ret = sscanf(id, "%a[^:]:%as", &tmp_path, &tmp_port); ++ ret = sscanf(id, "%m[^:]:%ms", &tmp_path, &tmp_port); + + if (ret != 2) { + ret = 0; +@@ -1366,10 +1366,10 @@ static int parse_sdl_address(const char *id, + + CU_DEBUG("Entering parse_sdl_address, address is %s", id); + +- ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); ++ ret = sscanf(id, "%m[^:]:%ms", &tmp_xauth, &tmp_display); + + if (ret <= 0) { +- ret = sscanf(id, ":%as", &tmp_display); ++ ret = sscanf(id, ":%ms", &tmp_display); + if (ret <= 0) { + if (STREQC(id, ":")) { + /* do nothing, it is empty */ +@@ -1417,7 +1417,7 @@ static int parse_ip_address(const char *id, + CU_DEBUG("Entering parse_ip_address, address is %s", id); + if (strstr(id, "[") != NULL) { + /* its an ipv6 address */ +- ret = sscanf(id, "%a[^]]]:%as", &tmp_ip, &tmp_port); ++ ret = sscanf(id, "%m[^]]]:%ms", &tmp_ip, &tmp_port); + if (ret >= 1) { + tmp_ip = realloc(tmp_ip, strlen(tmp_ip) + 2); + if (tmp_ip == NULL) { +@@ -1427,7 +1427,7 @@ static int parse_ip_address(const char *id, + strcat(tmp_ip, "]"); + } + } else { +- ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port); ++ ret = sscanf(id, "%m[^:]:%ms", &tmp_ip, &tmp_port); + } + + /* ret == 2: address and port, ret == 1: address only */ +@@ -1464,7 +1464,7 @@ static bool parse_console_url(const char *url, + + CU_DEBUG("Entering parse_console_url:'%s'", url); + +- if (sscanf(url,"%a[^:]://%as", &tmp_protocol, &tmp_address) != 2) ++ if (sscanf(url,"%m[^:]://%ms", &tmp_protocol, &tmp_address) != 2) + goto out; + + if (parse_ip_address(tmp_address, host, port) < 1) +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-0.6.3-fffbde4e.patch b/SOURCES/libvirt-cim-0.6.3-fffbde4e.patch new file mode 100644 index 0000000..741b21e --- /dev/null +++ b/SOURCES/libvirt-cim-0.6.3-fffbde4e.patch @@ -0,0 +1,749 @@ +From fffbde4e7b49d4c49f9f2d739572e51833c39d90 Mon Sep 17 00:00:00 2001 +From: Thilo Boehm +Date: Wed, 11 Sep 2013 16:45:37 +0200 +Subject: [PATCH 17/60] libxkutil: Console Support + +Added data types for the representation of console devices and their +source type specific properties. +Further, implemented libvirt XML parsing and generation of console +device XML. + +Signed-off-by: Thilo Boehm +Signed-off-by: Viktor Mihajlovski +Reviewed-by: Boris Fiuczynski +Signed-off-by: John Ferlan +--- + libxkutil/device_parsing.c | 314 +++++++++++++++++++++++++++++++++++++++++++-- + libxkutil/device_parsing.h | 43 ++++++- + libxkutil/xmlgen.c | 191 ++++++++++++++++++++++++++- + src/svpc_types.h | 5 +- + 4 files changed, 541 insertions(+), 12 deletions(-) + +diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c +index f55061e..55c8d57 100644 +--- a/libxkutil/device_parsing.c ++++ b/libxkutil/device_parsing.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007, 2013 + * + * Authors: + * Dan Smith +@@ -41,6 +41,11 @@ + #define NET_XPATH (xmlChar *)"/domain/devices/interface" + #define EMU_XPATH (xmlChar *)"/domain/devices/emulator" + #define MEM_XPATH (xmlChar *)"/domain/memory | /domain/currentMemory" ++#define CONSOLE_XPATH (xmlChar *)"/domain/devices/console" ++/* ++ * To be backward compatible, serial and console is ++ * still part of the graphics. ++ */ + #define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics | "\ + "/domain/devices/console | /domain/devices/serial" + #define INPUT_XPATH (xmlChar *)"/domain/devices/input" +@@ -50,6 +55,11 @@ + + #define MAX(a,b) (((a)>(b))?(a):(b)) + ++#define DUP_FIELD(d, s, f) do { \ ++ if ((s)->f != NULL) \ ++ (d)->f = strdup((s)->f); \ ++ } while (0); ++ + /* Device parse function */ + typedef int (*dev_parse_func_t)(xmlNode *, struct virt_device **); + +@@ -135,6 +145,140 @@ static void cleanup_graphics_device(struct graphics_device *dev) + free(dev->type); + } + ++static void cleanup_path_device(struct path_device *dev) ++{ ++ if (dev == NULL) ++ return; ++ ++ free(dev->path); ++ ++} ++ ++static void cleanup_unixsock_device(struct unixsock_device *dev) ++{ ++ if (dev == NULL) ++ return; ++ ++ free(dev->path); ++ free(dev->mode); ++ ++} ++ ++static void cleanup_tcp_device(struct tcp_device *dev) ++{ ++ if (dev == NULL) ++ return; ++ ++ free(dev->mode); ++ free(dev->protocol); ++ free(dev->host); ++ free(dev->service); ++ ++} ++ ++static void cleanup_udp_device(struct udp_device *dev) ++{ ++ if (dev == NULL) ++ return; ++ ++ free(dev->bind_host); ++ free(dev->bind_service); ++ free(dev->connect_host); ++ free(dev->connect_service); ++}; ++ ++static void cleanup_console_device(struct console_device *dev) ++{ ++ if (dev == NULL) ++ return; ++ ++ switch (dev->source_type) ++ { ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ cleanup_path_device(&dev->source_dev.pty); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ cleanup_path_device(&dev->source_dev.dev); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ cleanup_path_device(&dev->source_dev.file); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ cleanup_path_device(&dev->source_dev.pipe); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ cleanup_unixsock_device(&dev->source_dev.unixsock); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ cleanup_udp_device(&dev->source_dev.udp); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ cleanup_tcp_device(&dev->source_dev.tcp); ++ break; ++ default: ++ /* Nothing to do for : ++ CIM_CHARDEV_SOURCE_TYPE_STDIO ++ CIM_CHARDEV_SOURCE_TYPE_NULL ++ CIM_CHARDEV_SOURCE_TYPE_VC ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC ++ */ ++ break; ++ } ++ ++ dev->source_type = 0; ++ free(dev->target_type); ++ memset(&dev->source_dev, 0, sizeof(dev->source_dev)); ++}; ++ ++static void console_device_dup(struct console_device *t, ++ struct console_device *s) ++{ ++ cleanup_console_device(t); ++ ++ t->source_type = s->source_type; ++ DUP_FIELD(t, s, target_type); ++ ++ switch (s->source_type) ++ { ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ DUP_FIELD(t, s, source_dev.pty.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ DUP_FIELD(t, s, source_dev.dev.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ DUP_FIELD(t, s, source_dev.file.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ DUP_FIELD(t, s, source_dev.pipe.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ DUP_FIELD(t, s, source_dev.unixsock.path); ++ DUP_FIELD(t, s, source_dev.unixsock.mode); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ DUP_FIELD(t, s, source_dev.udp.bind_host); ++ DUP_FIELD(t, s, source_dev.udp.bind_service); ++ DUP_FIELD(t, s, source_dev.udp.connect_host); ++ DUP_FIELD(t, s, source_dev.udp.connect_service); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ DUP_FIELD(t, s, source_dev.tcp.mode); ++ DUP_FIELD(t, s, source_dev.tcp.protocol); ++ DUP_FIELD(t, s, source_dev.tcp.host); ++ DUP_FIELD(t, s, source_dev.tcp.service); ++ break; ++ default: ++ /* Nothing to do for : ++ CIM_CHARDEV_SOURCE_TYPE_STDIO ++ CIM_CHARDEV_SOURCE_TYPE_NULL ++ CIM_CHARDEV_SOURCE_TYPE_VC ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC ++ */ ++ break; ++ } ++} ++ + static void cleanup_input_device(struct input_device *dev) + { + if (dev == NULL) +@@ -159,6 +303,8 @@ void cleanup_virt_device(struct virt_device *dev) + cleanup_graphics_device(&dev->dev.graphics); + else if (dev->type == CIM_RES_TYPE_INPUT) + cleanup_input_device(&dev->dev.input); ++ else if (dev->type == CIM_RES_TYPE_CONSOLE) ++ cleanup_console_device(&dev->dev.console); + + free(dev->id); + +@@ -616,6 +762,138 @@ static char *get_attr_value_default(xmlNode *node, char *attrname, + return ret; + } + ++static int parse_console_device(xmlNode *node, struct virt_device **vdevs) ++{ ++ struct virt_device *vdev = NULL; ++ struct console_device *cdev = NULL; ++ char *source_type_str = NULL; ++ char *target_port_ID = NULL; ++ char *udp_source_mode = NULL; ++ ++ xmlNode *child = NULL; ++ ++ vdev = calloc(1, sizeof(*vdev)); ++ if (vdev == NULL) ++ goto err; ++ ++ cdev = &(vdev->dev.console); ++ ++ source_type_str = get_attr_value(node, "type"); ++ if (source_type_str == NULL) ++ goto err; ++ CU_DEBUG("console device type = %s", source_type_str ? : "NULL"); ++ ++ cdev->source_type = chardev_source_type_StrToID(source_type_str); ++ if (cdev->source_type == CIM_CHARDEV_SOURCE_TYPE_UNKNOWN) ++ goto err; ++ ++ CU_DEBUG("console device type ID = %d", cdev->source_type); ++ ++ for (child = node->children; child != NULL; child = child->next) { ++ if (XSTREQ(child->name, "target")) { ++ cdev->target_type = get_attr_value(child, "type"); ++ CU_DEBUG("Console device target type = '%s'", ++ cdev->target_type ? : "NULL"); ++ target_port_ID = get_attr_value(child, "port"); ++ if (target_port_ID == NULL) ++ goto err; ++ } ++ ++ if (XSTREQ(child->name, "source")) { ++ switch (cdev->source_type) ++ { ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ cdev->source_dev.pty.path = ++ get_attr_value(child, "path"); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ cdev->source_dev.dev.path = ++ get_attr_value(child, "path"); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ cdev->source_dev.file.path = ++ get_attr_value(child, "path"); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ cdev->source_dev.pipe.path = ++ get_attr_value(child, "path"); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ cdev->source_dev.unixsock.mode = ++ get_attr_value(child, "mode"); ++ cdev->source_dev.unixsock.path = ++ get_attr_value(child, "path"); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ udp_source_mode = get_attr_value(child, "mode"); ++ if (udp_source_mode == NULL) ++ goto err; ++ if (STREQC(udp_source_mode, "bind")) { ++ cdev->source_dev.udp.bind_host = ++ get_attr_value(child, "host"); ++ cdev->source_dev.udp.bind_service = ++ get_attr_value(child, "service"); ++ } else if (STREQC(udp_source_mode, "connect")) { ++ cdev->source_dev.udp.connect_host = ++ get_attr_value(child, "host"); ++ cdev->source_dev.udp.connect_service = ++ get_attr_value(child, "service"); ++ } else { ++ CU_DEBUG("unknown udp mode: %s", ++ udp_source_mode ? : "NULL"); ++ goto err; ++ } ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ cdev->source_dev.tcp.mode = ++ get_attr_value(child, "mode"); ++ cdev->source_dev.tcp.host = ++ get_attr_value(child, "host"); ++ cdev->source_dev.tcp.service = ++ get_attr_value(child, "service"); ++ break; ++ ++ default: ++ /* Nothing to do for : ++ CIM_CHARDEV_SOURCE_TYPE_STDIO ++ CIM_CHARDEV_SOURCE_TYPE_NULL ++ CIM_CHARDEV_SOURCE_TYPE_VC ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC ++ */ ++ break; ++ } ++ } ++ if ((cdev->source_type == CIM_CHARDEV_SOURCE_TYPE_TCP) ++ && XSTREQ(child->name, "protocol")) { ++ cdev->source_dev.tcp.protocol = ++ get_attr_value(child, "type"); ++ } ++ } ++ ++ vdev->type = CIM_RES_TYPE_CONSOLE; ++ ++ if (asprintf(&vdev->id, "charconsole:%s", target_port_ID) == -1) { ++ CU_DEBUG("Failed to create charconsole id string"); ++ goto err; ++ } ++ ++ *vdevs = vdev; ++ free(source_type_str); ++ free(target_port_ID); ++ free(udp_source_mode); ++ ++ return 1; ++ ++ err: ++ free(source_type_str); ++ free(target_port_ID); ++ free(udp_source_mode); ++ cleanup_console_device(cdev); ++ free(vdev); ++ ++ return 0; ++} ++ + static int parse_graphics_device(xmlNode *node, struct virt_device **vdevs) + { + struct virt_device *vdev = NULL; +@@ -667,8 +945,20 @@ static int parse_graphics_device(xmlNode *node, struct virt_device **vdevs) + child = child->next) { + if (XSTREQ(child->name, "source")) + gdev->dev.vnc.host = get_attr_value(child, "path"); +- else if (XSTREQ(child->name, "target")) +- gdev->dev.vnc.port = get_attr_value(child, "port"); ++ else if (XSTREQ(child->name, "target")) { ++ gdev->dev.vnc.port = ++ get_attr_value(child, "port"); ++ /* The graphics pty console can only be a ++ virtio console. If 'type' is not set in the ++ xml, the default of libvirt is virtio.*/ ++ char *t_type = get_attr_value(child, "type"); ++ if (t_type != NULL && !STREQC(t_type, "virtio")) { ++ CU_DEBUG("Not a pty-virtio graphics console"); ++ free(t_type); ++ goto err; ++ } ++ free(t_type); ++ } + } + } + else { +@@ -847,6 +1137,11 @@ static int parse_devices(const char *xml, struct virt_device **_list, int type) + func = &parse_graphics_device; + break; + ++ case CIM_RES_TYPE_CONSOLE: ++ xpathstr = CONSOLE_XPATH; ++ func = &parse_console_device; ++ break; ++ + case CIM_RES_TYPE_INPUT: + xpathstr = INPUT_XPATH; + func = &parse_input_device; +@@ -882,11 +1177,6 @@ static int parse_devices(const char *xml, struct virt_device **_list, int type) + return count; + } + +-#define DUP_FIELD(d, s, f) do { \ +- if ((s)->f != NULL) \ +- (d)->f = strdup((s)->f); \ +- } while (0); +- + struct virt_device *virt_device_dup(struct virt_device *_dev) + { + struct virt_device *dev; +@@ -945,8 +1235,10 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) + } else if (dev->type == CIM_RES_TYPE_INPUT) { + DUP_FIELD(dev, _dev, dev.input.type); + DUP_FIELD(dev, _dev, dev.input.bus); ++ } else if (dev->type == CIM_RES_TYPE_CONSOLE) { ++ console_device_dup(&dev->dev.console, ++ &_dev->dev.console); + } +- + return dev; + } + +@@ -1307,6 +1599,9 @@ int get_dominfo_from_xml(const char *xml, struct domain **dominfo) + (*dominfo)->dev_graphics_ct = parse_devices(xml, + &(*dominfo)->dev_graphics, + CIM_RES_TYPE_GRAPHICS); ++ (*dominfo)->dev_console_ct = parse_devices(xml, ++ &(*dominfo)->dev_console, ++ CIM_RES_TYPE_CONSOLE); + (*dominfo)->dev_input_ct = parse_devices(xml, + &(*dominfo)->dev_input, + CIM_RES_TYPE_INPUT); +@@ -1407,6 +1702,7 @@ void cleanup_dominfo(struct domain **dominfo) + cleanup_virt_devices(&dom->dev_vcpu, dom->dev_vcpu_ct); + cleanup_virt_devices(&dom->dev_graphics, dom->dev_graphics_ct); + cleanup_virt_devices(&dom->dev_input, dom->dev_input_ct); ++ cleanup_virt_devices(&dom->dev_console, dom->dev_console_ct); + + free(dom); + +diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h +index 14e49b8..2803d6a 100644 +--- a/libxkutil/device_parsing.h ++++ b/libxkutil/device_parsing.h +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007, 2013 + * + * Authors: + * Dan Smith +@@ -111,6 +111,43 @@ struct graphics_device { + } dev; + }; + ++struct path_device { ++ char *path; ++}; ++ ++struct unixsock_device { ++ char *path; ++ char *mode; ++}; ++ ++struct tcp_device { ++ char *mode; ++ char *protocol; ++ char *host; ++ char *service; ++}; ++ ++struct udp_device { ++ char *bind_host; ++ char *bind_service; ++ char *connect_host; ++ char *connect_service; ++}; ++ ++struct console_device { ++ uint16_t source_type; ++ union { ++ struct path_device file; ++ struct path_device pty; ++ struct path_device dev; ++ struct path_device pipe; ++ struct unixsock_device unixsock; ++ struct tcp_device tcp; ++ struct udp_device udp; ++ } source_dev; ++ char *target_type; ++}; ++ + struct input_device { + char *type; + char *bus; +@@ -125,6 +162,7 @@ struct virt_device { + struct vcpu_device vcpu; + struct emu_device emu; + struct graphics_device graphics; ++ struct console_device console; + struct input_device input; + } dev; + char *id; +@@ -182,6 +220,9 @@ struct domain { + struct virt_device *dev_graphics; + int dev_graphics_ct; + ++ struct virt_device *dev_console; ++ int dev_console_ct; ++ + struct virt_device *dev_emu; + + struct virt_device *dev_input; +diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c +index 2ca2341..45bfb04 100644 +--- a/libxkutil/xmlgen.c ++++ b/libxkutil/xmlgen.c +@@ -1,5 +1,5 @@ + /* +- * Copyright IBM Corp. 2007 ++ * Copyright IBM Corp. 2007, 2013 + * + * Authors: + * Dan Smith +@@ -42,6 +42,189 @@ typedef const char *(*devfn_t)(xmlNodePtr node, struct domain *dominfo); + typedef const char *(*poolfn_t)(xmlNodePtr node, struct virt_pool *pool); + typedef const char *(*resfn_t)(xmlNodePtr node, struct virt_pool_res *res); + ++static int _count_graphics_console_definitions(struct domain *dominfo) ++{ ++ int i; ++ int num = 0; ++ ++ for (i = 0; i < dominfo->dev_graphics_ct; i++) { ++ struct virt_device *_dev = &dominfo->dev_graphics[i]; ++ if (_dev->type == CIM_RES_TYPE_UNKNOWN) ++ continue; ++ ++ struct graphics_device *dev = &_dev->dev.graphics; ++ ++ if (STREQC(dev->type, "console")) { ++ num++; ++ } ++ } ++ CU_DEBUG("Found %d console defintions in graphics devices.",num); ++ return num; ++ ++} ++ ++static const char *console_xml(xmlNodePtr root, struct domain *dominfo) ++{ ++ int i; ++ xmlNodePtr console; ++ xmlNodePtr tmp; ++ int num_graphics_consol_def = 0; ++ int num_suppressed_console_def = 0; ++ ++ num_graphics_consol_def = _count_graphics_console_definitions(dominfo); ++ ++ for (i = 0; i < dominfo->dev_console_ct; i++) { ++ struct virt_device *_dev = &dominfo->dev_console[i]; ++ if (_dev->type == CIM_RES_TYPE_UNKNOWN) ++ continue; ++ ++ struct console_device *cdev = &_dev->dev.console; ++ ++ /* Due to backward compatibility, the graphics device handling ++ is still parsing consoles: ++ source = pty, target = virtio (which is the default target) ++ But the console device handling processes these kind of ++ consoles too. This would lead to a duplication of these ++ default consoles in the domain xml definition. ++ This code prevents the console handling of writing xml for ++ duplicate pty/virtio consoles which are written by the ++ graphics device handling. */ ++ if (cdev->source_type == CIM_CHARDEV_SOURCE_TYPE_PTY && ++ (cdev->target_type == NULL || ++ STREQC(cdev->target_type, "virtio"))) { ++ if (num_suppressed_console_def < ++ num_graphics_consol_def) { ++ num_suppressed_console_def++; ++ continue; ++ } ++ } ++ ++ console = xmlNewChild(root, NULL, BAD_CAST "console", NULL); ++ if (console == NULL) ++ return XML_ERROR; ++ ++ xmlNewProp(console, BAD_CAST "type", ++ BAD_CAST ++ chardev_source_type_IDToStr(cdev->source_type)); ++ ++ switch (cdev->source_type) { ++ case CIM_CHARDEV_SOURCE_TYPE_PTY: ++ /* The path property is not mandatory */ ++ if (cdev->source_dev.pty.path) { ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "path", ++ BAD_CAST cdev->source_dev.pty.path); ++ } ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_DEV: ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "path", ++ BAD_CAST cdev->source_dev.dev.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_FILE: ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "path", ++ BAD_CAST cdev->source_dev.file.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_PIPE: ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "path", ++ BAD_CAST cdev->source_dev.pipe.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UNIXSOCK: ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "mode", ++ BAD_CAST cdev->source_dev.unixsock.mode); ++ xmlNewProp(tmp, BAD_CAST "path", ++ BAD_CAST cdev->source_dev.unixsock.path); ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_UDP: ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "mode", BAD_CAST "bind"); ++ xmlNewProp(tmp, BAD_CAST "host", ++ BAD_CAST cdev->source_dev.udp.bind_host); ++ /* The service property is not mandatory */ ++ if (cdev->source_dev.udp.bind_service) ++ xmlNewProp(tmp, BAD_CAST "service", ++ BAD_CAST ++ cdev->source_dev.udp.bind_service); ++ ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "mode", BAD_CAST "connect"); ++ xmlNewProp(tmp, BAD_CAST "host", ++ BAD_CAST cdev->source_dev.udp.connect_host); ++ /* The service property is not mandatory */ ++ if (cdev->source_dev.udp.connect_service) ++ xmlNewProp(tmp, BAD_CAST "service", ++ BAD_CAST ++ cdev->source_dev.udp.connect_service); ++ ++ break; ++ case CIM_CHARDEV_SOURCE_TYPE_TCP: ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "source", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "mode", ++ BAD_CAST cdev->source_dev.tcp.mode); ++ xmlNewProp(tmp, BAD_CAST "host", ++ BAD_CAST cdev->source_dev.tcp.host); ++ if (cdev->source_dev.tcp.service) ++ xmlNewProp(tmp, BAD_CAST "service", ++ BAD_CAST ++ cdev->source_dev.tcp.service); ++ if (cdev->source_dev.tcp.protocol) { ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "protocol", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "type", ++ BAD_CAST cdev->source_dev.tcp.protocol); ++ } ++ break; ++ default: ++ /* Nothing to do for : ++ CIM_CHARDEV_SOURCE_TYPE_STDIO ++ CIM_CHARDEV_SOURCE_TYPE_NULL ++ CIM_CHARDEV_SOURCE_TYPE_VC ++ CIM_CHARDEV_SOURCE_TYPE_SPICEVMC ++ */ ++ break; ++ } ++ ++ if (cdev->target_type) { ++ tmp = xmlNewChild(console, NULL, ++ BAD_CAST "target", NULL); ++ if (tmp == NULL) ++ return XML_ERROR; ++ xmlNewProp(tmp, BAD_CAST "type", ++ BAD_CAST cdev->target_type); ++ } ++ } ++ return NULL; ++} ++ + static char *disk_block_xml(xmlNodePtr root, struct disk_device *dev) + { + xmlNodePtr disk; +@@ -977,6 +1160,11 @@ char *device_to_xml(struct virt_device *_dev) + dominfo->dev_graphics_ct = 1; + dominfo->dev_graphics = dev; + break; ++ case CIM_RES_TYPE_CONSOLE: ++ func = console_xml; ++ dominfo->dev_console_ct = 1; ++ dominfo->dev_console = dev; ++ break; + case CIM_RES_TYPE_INPUT: + func = input_xml; + dominfo->dev_input_ct = 1; +@@ -1017,6 +1205,7 @@ char *system_to_xml(struct domain *dominfo) + &disk_xml, + &net_xml, + &input_xml, ++ &console_xml, + &graphics_xml, + &emu_xml, + NULL +diff --git a/src/svpc_types.h b/src/svpc_types.h +index 2e4d73f..0f46a86 100644 +--- a/src/svpc_types.h ++++ b/src/svpc_types.h +@@ -25,6 +25,7 @@ + #define CIM_OPERATIONAL_STATUS 2 + + #define CIM_RES_TYPE_ALL 0 ++#define CIM_RES_TYPE_OTHER 1 + #define CIM_RES_TYPE_PROC 3 + #define CIM_RES_TYPE_MEM 4 + #define CIM_RES_TYPE_NET 10 +@@ -34,8 +35,9 @@ + #define CIM_RES_TYPE_INPUT 13 + #define CIM_RES_TYPE_UNKNOWN 1000 + #define CIM_RES_TYPE_IMAGE 32768 ++#define CIM_RES_TYPE_CONSOLE 32769 + +-#define CIM_RES_TYPE_COUNT 6 ++#define CIM_RES_TYPE_COUNT 7 + const static int cim_res_types[CIM_RES_TYPE_COUNT] = + {CIM_RES_TYPE_NET, + CIM_RES_TYPE_DISK, +@@ -43,6 +45,7 @@ const static int cim_res_types[CIM_RES_TYPE_COUNT] = + CIM_RES_TYPE_PROC, + CIM_RES_TYPE_GRAPHICS, + CIM_RES_TYPE_INPUT, ++ CIM_RES_TYPE_CONSOLE, + }; + + #define CIM_VSSD_RECOVERY_NONE 2 +-- +2.1.0 diff --git a/SOURCES/libvirt-cim-aarch64.patch b/SOURCES/libvirt-cim-aarch64.patch new file mode 100644 index 0000000..edc0cf9 --- /dev/null +++ b/SOURCES/libvirt-cim-aarch64.patch @@ -0,0 +1,1144 @@ +diff -urN libvirt-cim-0.6.1/config.guess libvirt-cim-0.6.1-aarch64/config.guess +--- libvirt-cim-0.6.1/config.guess 2012-02-08 07:34:11.000000000 -0600 ++++ libvirt-cim-0.6.1-aarch64/config.guess 2013-03-03 06:13:33.134390652 -0600 +@@ -1,10 +1,10 @@ + #! /bin/sh + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +-# Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ++# 2011, 2012 Free Software Foundation, Inc. + +-timestamp='2009-11-20' ++timestamp='2012-09-25' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -17,9 +17,7 @@ + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +-# 02110-1301, USA. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a +@@ -56,8 +54,9 @@ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 ++Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -144,7 +143,7 @@ + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or +- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, ++ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward +@@ -180,7 +179,7 @@ + fi + ;; + *) +- os=netbsd ++ os=netbsd + ;; + esac + # The OS release +@@ -201,6 +200,10 @@ + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; ++ *:Bitrig:*:*) ++ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} ++ exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} +@@ -223,7 +226,7 @@ + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) +- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on +@@ -269,7 +272,10 @@ + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- exit ;; ++ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. ++ exitcode=$? ++ trap '' 0 ++ exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead +@@ -295,12 +301,12 @@ + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) +- echo powerpc-ibm-os400 ++ echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; +- arm:riscos:*:*|arm:RISCOS:*:*) ++ arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) +@@ -394,23 +400,23 @@ + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit ;; ++ exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) +- echo m68k-milan-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-milan-mint${UNAME_RELEASE} ++ exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) +- echo m68k-hades-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-hades-mint${UNAME_RELEASE} ++ exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) +- echo m68k-unknown-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-unknown-mint${UNAME_RELEASE} ++ exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; +@@ -480,8 +486,8 @@ + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) +- # DG/UX returns AViiON for all architectures +- UNAME_PROCESSOR=`/usr/bin/uname -p` ++ # DG/UX returns AViiON for all architectures ++ UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ +@@ -494,7 +500,7 @@ + else + echo i586-dg-dgux${UNAME_RELEASE} + fi +- exit ;; ++ exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; +@@ -551,7 +557,7 @@ + echo rs6000-ibm-aix3.2 + fi + exit ;; +- *:AIX:*:[456]) ++ *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 +@@ -594,52 +600,52 @@ + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` +- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` +- case "${sc_cpu_version}" in +- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 +- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 +- 532) # CPU_PA_RISC2_0 +- case "${sc_kernel_bits}" in +- 32) HP_ARCH="hppa2.0n" ;; +- 64) HP_ARCH="hppa2.0w" ;; ++ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` ++ case "${sc_cpu_version}" in ++ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 ++ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 ++ 532) # CPU_PA_RISC2_0 ++ case "${sc_kernel_bits}" in ++ 32) HP_ARCH="hppa2.0n" ;; ++ 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 +- esac ;; +- esac ++ esac ;; ++ esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ sed 's/^ //' << EOF >$dummy.c ++ ++ #define _HPUX_SOURCE ++ #include ++ #include + +- #define _HPUX_SOURCE +- #include +- #include +- +- int main () +- { +- #if defined(_SC_KERNEL_BITS) +- long bits = sysconf(_SC_KERNEL_BITS); +- #endif +- long cpu = sysconf (_SC_CPU_VERSION); +- +- switch (cpu) +- { +- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; +- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; +- case CPU_PA_RISC2_0: +- #if defined(_SC_KERNEL_BITS) +- switch (bits) +- { +- case 64: puts ("hppa2.0w"); break; +- case 32: puts ("hppa2.0n"); break; +- default: puts ("hppa2.0"); break; +- } break; +- #else /* !defined(_SC_KERNEL_BITS) */ +- puts ("hppa2.0"); break; +- #endif +- default: puts ("hppa1.0"); break; +- } +- exit (0); +- } ++ int main () ++ { ++ #if defined(_SC_KERNEL_BITS) ++ long bits = sysconf(_SC_KERNEL_BITS); ++ #endif ++ long cpu = sysconf (_SC_CPU_VERSION); ++ ++ switch (cpu) ++ { ++ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; ++ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; ++ case CPU_PA_RISC2_0: ++ #if defined(_SC_KERNEL_BITS) ++ switch (bits) ++ { ++ case 64: puts ("hppa2.0w"); break; ++ case 32: puts ("hppa2.0n"); break; ++ default: puts ("hppa2.0"); break; ++ } break; ++ #else /* !defined(_SC_KERNEL_BITS) */ ++ puts ("hppa2.0"); break; ++ #endif ++ default: puts ("hppa1.0"); break; ++ } ++ exit (0); ++ } + EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa +@@ -730,22 +736,22 @@ + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd +- exit ;; ++ exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit ;; ++ exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd +- exit ;; ++ exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd +- exit ;; ++ exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd +- exit ;; ++ exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; +@@ -769,14 +775,14 @@ + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` +- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit ;; ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` ++ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + 5000:UNIX_System_V:4.*:*) +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` +- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` ++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +@@ -788,30 +794,35 @@ + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) +- case ${UNAME_MACHINE} in +- pc98) +- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ UNAME_PROCESSOR=`/usr/bin/uname -p` ++ case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) +- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; ++ *:MINGW64*:*) ++ echo ${UNAME_MACHINE}-pc-mingw64 ++ exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; ++ i*:MSYS*:*) ++ echo ${UNAME_MACHINE}-pc-msys ++ exit ;; + i*:windows32*:*) +- # uname -m includes "-pc" on this system. +- echo ${UNAME_MACHINE}-mingw32 ++ # uname -m includes "-pc" on this system. ++ echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) +- case ${UNAME_MACHINE} in ++ case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; +@@ -857,6 +868,13 @@ + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; ++ aarch64:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ aarch64_be:Linux:*:*) ++ UNAME_MACHINE=aarch64_be ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; +@@ -866,7 +884,7 @@ + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; +- esac ++ esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} +@@ -878,20 +896,29 @@ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else +- echo ${UNAME_MACHINE}-unknown-linux-gnueabi ++ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_PCS_VFP ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi ++ else ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf ++ fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) +- echo cris-axis-linux-gnu ++ echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) +- echo crisv32-axis-linux-gnu ++ echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) +- echo frv-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ hexagon:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu +@@ -933,7 +960,7 @@ + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) +- echo or32-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu +@@ -959,7 +986,7 @@ + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu +@@ -967,14 +994,17 @@ + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; ++ tile*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) +- echo x86_64-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. +@@ -983,11 +1013,11 @@ + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) +- # Unixware is an offshoot of SVR4, but it has its own version +- # number series starting with 2... +- # I am not positive that other SVR4 systems won't match this, ++ # Unixware is an offshoot of SVR4, but it has its own version ++ # number series starting with 2... ++ # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. +- # Use sysv4.2uw... so that sysv4* matches it. ++ # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) +@@ -1019,7 +1049,7 @@ + fi + exit ;; + i*86:*:5:[678]*) +- # UnixWare 7.x, OpenUNIX and OpenServer 6. ++ # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; +@@ -1047,13 +1077,13 @@ + exit ;; + pc:*:*:*) + # Left here for compatibility: +- # uname -m prints for DJGPP always 'pc', but it prints nothing about +- # the processor, so we play safe by assuming i586. ++ # uname -m prints for DJGPP always 'pc', but it prints nothing about ++ # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp +- exit ;; ++ exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; +@@ -1088,8 +1118,8 @@ + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) +- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && { echo i486-ncr-sysv4; exit; } ;; ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ +@@ -1132,10 +1162,10 @@ + echo ns32k-sni-sysv + fi + exit ;; +- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort +- # says +- echo i586-unisys-sysv4 +- exit ;; ++ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ++ # says ++ echo i586-unisys-sysv4 ++ exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm +@@ -1161,11 +1191,11 @@ + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then +- echo mips-nec-sysv${UNAME_RELEASE} ++ echo mips-nec-sysv${UNAME_RELEASE} + else +- echo mips-unknown-sysv${UNAME_RELEASE} ++ echo mips-unknown-sysv${UNAME_RELEASE} + fi +- exit ;; ++ exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; +@@ -1178,6 +1208,9 @@ + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; ++ x86_64:Haiku:*:*) ++ echo x86_64-unknown-haiku ++ exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; +@@ -1230,7 +1263,10 @@ + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; +- NSE-?:NONSTOP_KERNEL:*:*) ++ NEO-?:NONSTOP_KERNEL:*:*) ++ echo neo-tandem-nsk${UNAME_RELEASE} ++ exit ;; ++ NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) +@@ -1275,13 +1311,13 @@ + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) +- echo mips-sei-seiux${UNAME_RELEASE} ++ echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) +- UNAME_MACHINE=`(uname -p) 2>/dev/null` ++ UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; +@@ -1299,11 +1335,11 @@ + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; ++ x86_64:VMkernel:*:*) ++ echo ${UNAME_MACHINE}-unknown-esx ++ exit ;; + esac + +-#echo '(No uname command or uname output not recognized.)' 1>&2 +-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +- + eval $set_cc_for_build + cat >$dummy.c < + printf ("m68k-sony-newsos%s\n", + #ifdef NEWSOS4 +- "4" ++ "4" + #else +- "" ++ "" + #endif +- ); exit (0); ++ ); exit (0); + #endif + #endif + +diff -urN libvirt-cim-0.6.1/config.sub libvirt-cim-0.6.1-aarch64/config.sub +--- libvirt-cim-0.6.1/config.sub 2012-02-08 07:34:11.000000000 -0600 ++++ libvirt-cim-0.6.1-aarch64/config.sub 2013-03-03 06:13:33.162387423 -0600 +@@ -1,10 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +-# Free Software Foundation, Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ++# 2011, 2012 Free Software Foundation, Inc. + +-timestamp='2009-11-20' ++timestamp='2012-10-10' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -21,9 +21,7 @@ + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +-# 02110-1301, USA. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a +@@ -75,8 +73,9 @@ + version="\ + GNU config.sub ($timestamp) + +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 ++Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -123,13 +122,18 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ +- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ ++ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ ++ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ ++ knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; ++ android-linux) ++ os=-linux-android ++ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ++ ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] +@@ -152,12 +156,12 @@ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis | -knuth | -cray | -microblaze) ++ -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; +- -bluegene*) +- os=-cnk ++ -bluegene*) ++ os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= +@@ -173,10 +177,10 @@ + os=-chorusos + basic_machine=$1 + ;; +- -chorusrdb) +- os=-chorusrdb ++ -chorusrdb) ++ os=-chorusrdb + basic_machine=$1 +- ;; ++ ;; + -hiux*) + os=-hiuxwe2 + ;; +@@ -221,6 +225,12 @@ + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -lynx*178) ++ os=-lynxos178 ++ ;; ++ -lynx*5) ++ os=-lynxos5 ++ ;; + -lynx*) + os=-lynxos + ;; +@@ -245,20 +255,25 @@ + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ ++ | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ ++ | be32 | be64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ ++ | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ++ | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ ++ | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ +- | maxq | mb | microblaze | mcore | mep | metag \ ++ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ +@@ -281,29 +296,39 @@ + | moxie \ + | mt \ + | msp430 \ ++ | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ ++ | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ +- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ++ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ +- | rx \ ++ | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ +- | spu | strongarm \ +- | tahoe | thumb | tic4x | tic80 | tron \ ++ | spu \ ++ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ +- | v850 | v850e \ ++ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ +- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ ++ | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12 | picochip) +- # Motorola 68HC11/12. ++ c54x) ++ basic_machine=tic54x-unknown ++ ;; ++ c55x) ++ basic_machine=tic55x-unknown ++ ;; ++ c6x) ++ basic_machine=tic6x-unknown ++ ;; ++ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; +@@ -313,6 +338,21 @@ + basic_machine=mt-unknown + ;; + ++ strongarm | thumb | xscale) ++ basic_machine=arm-unknown ++ ;; ++ xgate) ++ basic_machine=$basic_machine-unknown ++ os=-none ++ ;; ++ xscaleeb) ++ basic_machine=armeb-unknown ++ ;; ++ ++ xscaleel) ++ basic_machine=armel-unknown ++ ;; ++ + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. +@@ -327,25 +367,30 @@ + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ ++ | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ ++ | be32-* | be64-* \ + | bfin-* | bs2000-* \ +- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ++ | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ ++ | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ ++ | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +@@ -367,25 +412,29 @@ + | mmix-* \ + | mt-* \ + | msp430-* \ ++ | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ ++ | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ +- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ +- | romp-* | rs6000-* | rx-* \ ++ | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ +- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ +- | tahoe-* | thumb-* \ +- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ ++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ ++ | tahoe-* \ ++ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tile*-* \ + | tron-* \ + | ubicom32-* \ +- | v850-* | v850e-* | vax-* \ ++ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ ++ | vax-* \ + | we32k-* \ +- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ ++ | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) +@@ -410,7 +459,7 @@ + basic_machine=a29k-amd + os=-udi + ;; +- abacus) ++ abacus) + basic_machine=abacus-unknown + ;; + adobe68k) +@@ -480,11 +529,20 @@ + basic_machine=powerpc-ibm + os=-cnk + ;; ++ c54x-*) ++ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c55x-*) ++ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c6x-*) ++ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; +- cegcc) ++ cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; +@@ -516,7 +574,7 @@ + basic_machine=craynv-cray + os=-unicosmp + ;; +- cr16) ++ cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; +@@ -674,7 +732,6 @@ + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +-# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 +@@ -732,9 +789,13 @@ + basic_machine=ns32k-utek + os=-sysv + ;; +- microblaze) ++ microblaze*) + basic_machine=microblaze-xilinx + ;; ++ mingw64) ++ basic_machine=x86_64-pc ++ os=-mingw64 ++ ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 +@@ -771,10 +832,18 @@ + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; ++ msys) ++ basic_machine=i386-pc ++ os=-msys ++ ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ++ nacl) ++ basic_machine=le32-unknown ++ os=-nacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -839,6 +908,12 @@ + np1) + basic_machine=np1-gould + ;; ++ neo-tandem) ++ basic_machine=neo-tandem ++ ;; ++ nse-tandem) ++ basic_machine=nse-tandem ++ ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; +@@ -921,9 +996,10 @@ + ;; + power) basic_machine=power-ibm + ;; +- ppc) basic_machine=powerpc-unknown ++ ppc | ppcbe) basic_machine=powerpc-unknown + ;; +- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ppc-* | ppcbe-*) ++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown +@@ -1017,6 +1093,9 @@ + basic_machine=i860-stratus + os=-sysv4 + ;; ++ strongarm-* | thumb-*) ++ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + sun2) + basic_machine=m68000-sun + ;; +@@ -1073,20 +1152,8 @@ + basic_machine=t90-cray + os=-unicos + ;; +- tic54x | c54x*) +- basic_machine=tic54x-unknown +- os=-coff +- ;; +- tic55x | c55x*) +- basic_machine=tic55x-unknown +- os=-coff +- ;; +- tic6x | c6x*) +- basic_machine=tic6x-unknown +- os=-coff +- ;; + tile*) +- basic_machine=tile-unknown ++ basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) +@@ -1156,6 +1223,9 @@ + xps | xps100) + basic_machine=xps100-honeywell + ;; ++ xscale-* | xscalee[bl]-*) ++ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ++ ;; + ymp) + basic_machine=ymp-cray + os=-unicos +@@ -1253,11 +1323,11 @@ + if [ x"$os" != x"" ] + then + case $os in +- # First match some system type aliases +- # that might get confused with valid system types. ++ # First match some system type aliases ++ # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. +- -auroraux) +- os=-auroraux ++ -auroraux) ++ os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` +@@ -1287,14 +1357,15 @@ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ +- | -openbsd* | -solidbsd* \ ++ | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ +- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ ++ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ ++ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ ++ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ +@@ -1341,7 +1412,7 @@ + -opened*) + os=-openedition + ;; +- -os400*) ++ -os400*) + os=-os400 + ;; + -wince*) +@@ -1390,7 +1461,7 @@ + -sinix*) + os=-sysv4 + ;; +- -tpf*) ++ -tpf*) + os=-tpf + ;; + -triton*) +@@ -1435,6 +1506,8 @@ + -dicos*) + os=-dicos + ;; ++ -nacl*) ++ ;; + -none) + ;; + *) +@@ -1457,10 +1530,10 @@ + # system, and we'll never get to this point. + + case $basic_machine in +- score-*) ++ score-*) + os=-elf + ;; +- spu-*) ++ spu-*) + os=-elf + ;; + *-acorn) +@@ -1472,8 +1545,20 @@ + arm*-semi) + os=-aout + ;; +- c4x-* | tic4x-*) +- os=-coff ++ c4x-* | tic4x-*) ++ os=-coff ++ ;; ++ hexagon-*) ++ os=-elf ++ ;; ++ tic54x-*) ++ os=-coff ++ ;; ++ tic55x-*) ++ os=-coff ++ ;; ++ tic6x-*) ++ os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) +@@ -1493,14 +1578,11 @@ + ;; + m68000-sun) + os=-sunos3 +- # This also exists in the configure program, but was not the +- # default. +- # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; +- mep-*) ++ mep-*) + os=-elf + ;; + mips*-cisco) +@@ -1527,7 +1609,7 @@ + *-ibm) + os=-aix + ;; +- *-knuth) ++ *-knuth) + os=-mmixware + ;; + *-wec) diff --git a/SPECS/libvirt-cim.spec b/SPECS/libvirt-cim.spec new file mode 100644 index 0000000..b4e4bb9 --- /dev/null +++ b/SPECS/libvirt-cim.spec @@ -0,0 +1,800 @@ +# -*- rpm-spec -*- + +Summary: A CIM provider for libvirt +Name: libvirt-cim +Version: 0.6.3 +Release: 19%{?dist}%{?extra_release} +License: LGPLv2+ +Group: Development/Libraries +Source: ftp://libvirt.org/libvirt-cim/libvirt-cim-%{version}.tar.gz + +# Update configure for aarch64 (bz #925923) +Patch1: libvirt-cim-aarch64.patch + +# Patches 2 -> 10 were added as one submit for libvirt-cim.0.6.3-5. +# They are listed in the order they were added to the upstream +# libvirt-cim.git repository. Although Patch10 is the ultimate fix +# for BZ#1070346, the other patches were cumulative issues seen in +# since 0.6.3 was generated upstream and pulled into RHEL7. The only +# change not pulled in was commit id 'f18ba715' as it failed for the +# s390/s390x brew builds, perhaps due to $(SHELL) not being defined +# in whatever build environment is installed. + +# libvirt-cim.spec.in: Don't install open-pegasus' specific providers +# Author: Michal Privoznik +Patch2: libvirt-cim-0.6.3-19ffef8e.patch + +# libvirt-cim.spec.in: Uninstall open-pegasus-specific providers from sfcb +# Author: Ján Tomko +Patch3: libvirt-cim-0.6.3-ee74ebc1.patch + +# spec: Replace the path to the tar.gz file +# Author: John Ferlan +Patch4: libvirt-cim-0.6.3-3c3a541d.patch + +# spec: Fix capitalization for version check +# Author: John Ferlan +Patch5: libvirt-cim-0.6.3-5d2626f6.patch + +# build: Don't use /bin/sh unconditionally +# Author: Viktor Mihajlovski +Patch6: libvirt-cim-0.6.3-f18ba715.patch + +# build: Fix incorrect provider registration in upgrade path +# Author: Viktor Mihajlovski +Patch7: libvirt-cim-0.6.3-1c7dfda2.patch + +# build: Fix provider registration issues +# Author: Viktor Mihajlovski +Patch8: libvirt-cim-0.6.3-9c1d321b.patch + +# schema: Fix class removal with Pegasus +# Author: Viktor Mihajlovski +Patch9: libvirt-cim-0.6.3-95f0d418.patch + +# spec: Fix docs/*.html packaging issue +# Author: John Ferlan +Patch10: libvirt-cim-0.6.3-54778c78.patch + +# Use of root/interop instead of root/PG_InterOp +# Author: John Ferlan +Patch11: libvirt-cim-0.6.3-a8cfd7dc.patch + +# Patches 12 -> 15 were added as one submit for libvirt-cim.0.6.3-6. +# They are listed in order as there were added upstream. Since applying +# the changes without merge conflicts relies on previous changes being +# included, it was easier to make one submit for all 4 changes. Of the +# changes only Patch12 doesn't have an existing RHEL6* based bug, but +# it's an important enough change to be included. + +# get_dominfo: Use VIR_DOMAIN_XML_SECURE more wisely +# Author: Michal Privoznik +Patch12: libvirt-cim-0.6.3-7e164fbd.patch + +# Add dumpCore tag support to memory +# Author: Xu Wang +# Added to libvirt-cim.0.6.1-9 in RHEL 6.5 as part of BZ#1000937 +Patch13: libvirt-cim-0.6.3-de03c66f.patch + +# libxkutil: Improve domain.os_info cleanup +# Author: Viktor Mihajlovski +# Added to libvirt-cim.0.6.1-10 in RHEL 6.6 as BZ#1046280 +# Added to libvirt-cim.0.6.1-9.el6_5.1 in RHEL 6.5.z as BZ#1055626 +Patch14: libvirt-cim-0.6.3-0a742856.patch + +# VSSD: Add properties for arch and machine +# Author: Viktor Mihajlovski +# Added to libvirt-cim.0.6.1-10 in RHEL 6.6 as BZ#1046280 +# Added to libvirt-cim.0.6.1-9.el6_5.1 in RHEL 6.5.z as BZ#1055626 +Patch15: libvirt-cim-0.6.3-6024403e.patch + +# Patch 16 -> 18 follow-on patches 14 & 15 from upstream, while perhaps +# not specifically RHEL releated, they'll make it far easier to apply future +# patches that will be necessary. + +# S390: Avoid the generation of default input and graphics +# Author: Viktor Mihajlovski +Patch16: libvirt-cim-0.6.3-1fae439d.patch + +# libxkutil: Provide easy access to the libvirt capabilities +# uthor: Boris Fiuczynski +Patch17: libvirt-cim-0.6.3-3e6f1489.patch + +# VSSM: Set default values based on libvirt capabilities on DefineSystem calls +# Author: Boris Fiuczynski +Patch18: libvirt-cim-0.6.3-117dabb9.patch + +# Patches 19 & 20 fix a couple of memory leaks + +# libxkutil: Plug memory leaks in device parsing +# Author: Viktor Mihajlovski +Patch19: libvirt-cim-0.6.3-f6b7eeaf.patch + +# xml_parse_test: Call cleanup_dominfo before exiting +# Author: Viktor Mihajlovski +Patch20: libvirt-cim-0.6.3-605090b6.patch + +# Patch 21 -> 27 add support for full function console. Again, although +# more s390 work, applying these make future patches easier to add + +# VSMS: Set resource types for default devices +# Author: Viktor Mihajlovski +Patch21: libvirt-cim-0.6.3-ee84e10f.patch + +# schema: New SVPC types for chardev/consoles +# Author: Thilo Boehm +Patch22: libvirt-cim-0.6.3-93ea8130.patch + +# libxkutil: Console Support +# Author: Thilo Boehm +Patch23: libvirt-cim-0.6.3-fffbde4e.patch + +# RASD: Schema and Provider Support for Console RASDs +# Author: Thilo Boehm +Patch24: libvirt-cim-0.6.3-8a060e0d.patch + +# Device: CIM_LogicalDevice for consoles +# Author: Viktor Mihajlovski +Patch25: libvirt-cim-0.6.3-a3649c21.patch + +# VSMS: Support for domains with console devices +# Author: Thilo Boehm +Patch26: libvirt-cim-0.6.3-21dea212.patch + +# VSMS: add default console +# Author: Thilo Boehm +Patch27: libvirt-cim-0.6.3-583ea685.patch + +# Patch 28 -> 30 - add the patches for console fixes and enhancements + +# libxkutil: Simplify XML handling of consoles +# Author: Viktor Mihajlovski +Patch28: libvirt-cim-0.6.3-f70a8ea0.patch + +# Virt_Device: Add a device class for consoles +# Author: Viktor Mihajlovski +Patch29: libvirt-cim-0.6.3-ace5e8fd.patch + +# KVMRedirectionSAP: Only return redirection SAPs for VNC graphics +# Author: Viktor Mihajlovski +Patch30: libvirt-cim-0.6.3-242ddaa6.patch + +# Patch 31 -> 35 - Persistent Device Address Support + +# RASD/schema: Add properties for device address representation +# Author: Viktor Mihajlovski +Patch32: libvirt-cim-0.6.3-4f74864c.patch + +# RASD: Support for device address properties +# Author: Viktor Mihajlovski +Patch33: libvirt-cim-0.6.3-a72ab39b.patch + +# VSMS: Support for device addresses +# Author: Viktor Mihajlovski +Patch34: libvirt-cim-0.6.3-6bc7bfdf.patch + +# VSMS: Improve device cleanup +# Author: Viktor Mihajlovski +Patch35: libvirt-cim-0.6.3-d75cae45.patch + +# Patch 36 - Bugfix: Changed resource type value EMU + +# libvirt-cim: Changed resource type value EMU +# Author: Daniel Hansel +Patch36: libvirt-cim-0.6.3-6f050582.patch + +# Patch 37 -> 40 Resolve endianness issues + +# VSDC: Fix endianess issues +# Author: Viktor Mihajlovski +Patch37: libvirt-cim-0.6.3-7e5f561c.patch + +# VSSM: Fix endianness issue in domain properties +# Author: Thilo Boehm +Patch38: libvirt-cim-0.6.3-9a4f2a32.patch + +# libxkutil: clean entire device structure to avoid memory corruption +# Author: Viktor Mihajlovski +Patch39: libvirt-cim-0.6.3-14883f33.patch + +# FilterEntry: Fix endianness issues +# Author: Thilo Boehm +Patch40: libvirt-cim-0.6.3-2e9c18d6.patch + +# Patch 41 - Bugfix: Added missing address element for filesystem 'disk' + +# libxkutil: Added missing address element for filesystem 'disk' +# Author: Viktor Mihajlovski +Patch41: libvirt-cim-0.6.3-6a13c463.patch + +# Patch 42 - 48 Coverity cleanups + +# VSMS: Coverity cleanups +# Author: John Ferlan +Patch42: libvirt-cim-0.6.3-f9fc5821.patch + +# libxkutil:pool_parsing: Coverity cleanups +# Author: John Ferlan +Patch43: libvirt-cim-0.6.3-7f3288be.patch + +# libxkutil:device_parsing: Coverity cleanups +# Author: John Ferlan +Patch44: libvirt-cim-0.6.3-4013f9a0.patch + +# libxkutil/xml_parse_test: Coverity cleanup +# Author: John Ferlan +Patch45: libvirt-cim-0.6.3-a6cbafc6.patch + +# RAFP: Coverity cleanup +# Author: John Ferlan +Patch46: libvirt-cim-0.6.3-55d3f9fc.patch + +# EAFP: Coverity cleanup +# Author: John Ferlan +Patch47: libvirt-cim-0.6.3-8eb5c1e7.patch + +# Adjust sscanf format string +# Author: John Ferlan +Patch48: libvirt-cim-0.6.3-fb5d2fcf.patch + +# Patch 49 - 50 rawio and sgio support + +# Add rawio property support +# Author: Xu Wang +Patch49: libvirt-cim-0.6.3-d9414e36.patch + +# Add sgio property support +# Author: Xu Wang +Patch50: libvirt-cim-0.6.3-1a91ecd3.patch + +# Patch 51 - 59 Controller and Controller Pools support + +# Add virtual controller device types +# Author: Xu Wang +Patch51: libvirt-cim-0.6.3-4954aa8c.patch + +# Parse/Store controller XML tags +# Author: Xu Wang +Patch52: libvirt-cim-0.6.3-48b28b6a.patch + +# Add virtual controller object definitions to mofs +# Author: Xu Wang +Patch53: libvirt-cim-0.6.3-a16ca9d0.patch + +# Set fields in mofs for Controller Device/RASD +# Author: Xu Wang +Patch54: libvirt-cim-0.6.3-de34dda2.patch + +# VSMS: Support for domains with controller devices +# Author: Xu Wang +Patch55: libvirt-cim-0.6.3-ca8e81b3.patch + +# Controller: Add associations for KVM_Controller +# Author: Xu Wang +Patch56: libvirt-cim-0.6.3-53a4dff9.patch + +# Add MOFS and change install for ControllerPools +# Author: John Ferlan +Patch57: libvirt-cim-0.6.3-222a3219.patch + +# Add code and associations for ControllerPool +# Author: John Ferlan +Patch58: libvirt-cim-0.6.3-58d6e308.patch + +# xmlgen: fix build issue +# Author: Pavel Hrdina +Patch59: libvirt-cim-0.6.3-2cbbac52.patch + +# Patch 59 - 61 - Bug fixes for missing portions of previous patches +# and fix for build breaker with newer gcc + +# Add disk device='lun' support +# Author: Xu Wang +# Note: Avoids merge conflicts for Patch61 +Patch60: libvirt-cim-0.6.3-5787acc15.patch + +# Complete the support for dumpCore +# Author: Xu Wang +# Fixes build issue with gcc 5.0 +Patch62: libvirt-cim-0.6.3-63acad05.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +URL: http://libvirt.org/CIM/ +Requires: libxml2 >= 2.6.0 +Requires: libvirt >= 0.9.0 +Requires: unzip +# either tog-pegasus or sblim-sfcb should provide cim-server +Requires: cim-server +BuildRequires: libtool +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libcmpiutil >= 0.5.4 +BuildRequires: tog-pegasus-devel +BuildRequires: libvirt-devel >= 0.9.0 + +# In RHEL5 uuid-devel is provided by e2fsprogs +%if 0%{?el5} +BuildRequires: e2fsprogs-devel +%else +BuildRequires: libuuid-devel +BuildRequires: libconfig-devel +%endif + +BuildRequires: libxml2-devel +BuildRequires: libcmpiutil-devel +%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 +BuildRequires: systemd-units +%endif +BuildConflicts: sblim-cmpi-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 + +# Update configure for aarch64 (bz #925923) +%patch1 -p1 +# Patches for installation issues (bz #1070346) +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +# Patches for adding properties for arch and machine +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +# Patches for 3390 Enablement +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +# Patches for fixing memory leaks +%patch19 -p1 +%patch20 -p1 +# Patches for full function consoles +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +# Patches for Console Fixes and Enhancements +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +# Patches for Persistent Device Address Support +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +# Bugfix: Changed resource type value EMU +%patch36 -p1 +# Patches for Endianness issues +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +# Bugfix: Added missing address element for filesystem 'disk' +%patch41 -p1 +# Patches for Coverity cleanups +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +# Patches for sgio and rawio suport +%patch49 -p1 +%patch50 -p1 +# Patches for Controller and ControllerPool +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +# Patches for bug fixes, potential build breakers +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 + +%build +# Run the upstream commands from autoconfiscate.sh +libtoolize --copy --force --automake +aclocal --force +autoheader --force +automake -i --add-missing --copy --foreign +autoconf --force + +# Need to update .revision in order to allow cimtest to recognize the +# controller and controller pools which were added as of upstream revision +# number 1312 + +echo "1316" > .revision +echo "63acad0" > .changeset + +%configure --disable-werror +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +make %{?_smp_mflags} + +%install +rm -fr $RPM_BUILD_ROOT + +make DESTDIR=$RPM_BUILD_ROOT install +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 +rm -f $RPM_BUILD_ROOT%{_libdir}/libxkutil.so +rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-cim-%{version} +mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d +echo %{_libdir}/cmpi > $RPM_BUILD_ROOT/etc/ld.so.conf.d/libvirt-cim.%{_arch}.conf +mkdir -p $RPM_BUILD_ROOT/etc/libvirt/cim + +%clean +rm -fr $RPM_BUILD_ROOT + +%pre +%define REGISTRATION %{_datadir}/%{name}/*.registration +%define SCHEMA %{_datadir}/%{name}/*.mof + +%define INTEROP_REG %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.registration +%define INTEROP_MOF %{_datadir}/%{name}/{ComputerSystem,HostSystem,RegisteredProfile,DiskPool,MemoryPool,NetPool,ProcessorPool,VSMigrationService,ElementConformsToProfile,ReferencedProfile,AllocationCapabilities}.mof + +%define PGINTEROP_REG %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.registration +%define PGINTEROP_MOF %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.mof + +%define CIMV2_REG %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,ElementConformsToProfile,HostedAccessPoint}.registration +%define CIMV2_MOF %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,RegisteredProfile,ComputerSystem,ElementConformsToProfile,HostedAccessPoint}.mof + +# _If_ there is already a version of this installed, we must deregister +# the classes we plan to install in post, otherwise we may corrupt +# the pegasus repository. This is convention in other provider packages +%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true + +%post +/sbin/ldconfig + +%{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} + +%if 0%{?Fedora} >= 17 || 0%{?rhel} >= 7 + if [ "`systemctl is-active tog-pegasus.service`" = "active" ] + then + systemctl restart tog-pegasus.service + fi + + if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] + then + systemctl restart sblim-sfcb.service + fi +%else + /etc/init.d/tog-pegasus condrestart +%endif + +if [ -x /usr/sbin/cimserver ] +then +%{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/PG_InterOp \ + -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t pegasus \ + -n root/cimv2\ + -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true +fi +if [ -x /usr/sbin/sfcbd ] +then +%{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/PG_InterOp \ + -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -t sfcb \ + -n root/cimv2\ + -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true +fi + +%preun +if [ -x /usr/sbin/cimserver ] +then +%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ + -n root/PG_InterOp \ + -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -d -t pegasus \ + -n root/cimv2 \ + -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true +fi +if [ -x /usr/sbin/sfcbd ] +then +%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ + -n root/virt \ + -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ + -n root/interop \ + -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ + -n root/PG_InterOp \ + -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true +%{_datadir}/%{name}/provider-register.sh -d -t sfcb \ + -n root/cimv2 \ + -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true +fi + +%postun -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%{_sysconfdir}/libvirt/cim + +%doc README COPYING doc/CodingStyle doc/SubmittingPatches +%doc base_schema/README.DMTF +%doc doc/*.html +%{_libdir}/lib*.so* +%{_libdir}/cmpi/lib*.so* +%{_datadir}/libvirt-cim +%{_datadir}/libvirt-cim/*.sh +%{_datadir}/libvirt-cim/*.mof +%{_datadir}/libvirt-cim/cimv*-interop_mof +%{_datadir}/libvirt-cim/cimv*-cimv2_mof +%{_datadir}/libvirt-cim/*.registration +%{_datadir}/libvirt-cim/cim_schema_*-MOFs.zip +%{_sysconfdir}/ld.so.conf.d/libvirt-cim.%{_arch}.conf +%config(noreplace) %{_sysconfdir}/libvirt-cim.conf + +%changelog +* Mon May 4 2015 John Ferlan 0.6.3-19 +- Add in upstream changes post bz#1075874 to fix a couple of issues + with supporting patch and to avoid future potential build issue + +* Mon May 4 2015 John Ferlan 0.6.3-18 +- Changes to resolve bz#1075874 +- Add code to support controller and controller pools + +* Fri May 1 2015 John Ferlan 0.6.3-17 +- Add in upstream submit to support bz#1075874 +- rawio and sgio support + +* Fri May 1 2015 John Ferlan 0.6.3-16 +- Add in upstream submit to support bz#1075874 +- Coverity cleanups + +* Fri May 1 2015 John Ferlan 0.6.3-15 +- Add in upstream submit to support bz#1075874 +- Added missing address element for filesystem 'disk' + +* Fri May 1 2015 John Ferlan 0.6.3-14 +- Add in upstream submit to support bz#1075874 +- Resolve endianness issues + +* Fri May 1 2015 John Ferlan 0.6.3-13 +- Add in upstream submit to support bz#1075874 +- Changed resource type value EMU + +* Fri May 1 2015 John Ferlan 0.6.3-12 +- Add in upstream submit to support bz#1075874 +- Persistent Device Address Support + +* Fri May 1 2015 John Ferlan 0.6.3-11 +- Add in upstream submit to support bz#1075874 +- Console Fixes and Enhancements + +* Fri May 1 2015 John Ferlan 0.6.3-10 +- Add in upstream submit to support bz#1075874 +- Support for full function consoles + +* Fri May 1 2015 John Ferlan 0.6.3-9 +- Add in upstream submit to support bz#1075874 +- Remove memory leaks in XML device parsing + +* Fri May 1 2015 John Ferlan 0.6.3-8 +- Add in upstream submit to support bz#1075874 +- Support for s390 + +* Tue Apr 28 2015 John Ferlan 0.6.3-7 +- Build in RHEL 7.2 branch was failing, add upstream autoconfiscate.sh + contents to the %build section, plus the prerequisite BuildRequires for + libtool. Also generates the .revision and .changeset for each build. + +* Thu Feb 27 2014 John Ferlan 0.6.3-6 +- Add properties for arch and machine bz#1070337 + +* Thu Feb 27 2014 John Ferlan 0.6.3-5 +- Use root/interop instead of root/PG_InterOp for tog-pegasus bz#1070346 + +* Fri Jan 24 2014 Daniel Mach - 0.6.3-4 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 0.6.3-3 +- Mass rebuild 2013-12-27 + +* Tue Aug 6 2013 John Ferlan 0.6.3-2 +- Replace the path to the source tar.gz file + +* Thu Jul 25 2013 Daniel Veillard 0.6.3-1 +- update to 0.6.3 release + +* Fri Jun 28 2013 Cole Robinson - 0.6.2-2 +- Update configure for aarch64 (bz #925923) + +* Mon Apr 15 2013 Daniel Veillard 0.6.2-1 +- update to 0.6.2 release + +* Thu Feb 14 2013 Fedora Release Engineering - 0.6.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 0.6.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Mar 12 2012 Daniel Veillard - 0.6.1-2 +- fix build in the presence of sblim-sfcb +- add schemas (de)registration with sfcb if found + +* Mon Mar 5 2012 Daniel Veillard - 0.6.1-1 +- update to upstream release 0.6.1 +- allow to use tog-pegasus or sblimfscb +- switch for systemctl for conditional restart of the server + +* Fri Jan 13 2012 Fedora Release Engineering - 0.5.14-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Jul 25 2011 Daniel Veillard - 0.5.14-1 +- update to upstream release 0.5.14 + +* Wed Jul 6 2011 Daniel Veillard - 0.5.13-1 +- update to upstream release 0.5.13 + +* Tue Feb 08 2011 Fedora Release Engineering - 0.5.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Dec 07 2009 Kaitlin Rupert - 0.5.8-2 +- Add missing namespace unreg bits for root/interop, root/cimv2 +- Remove additional reg call of root/virt from postinstall +- Do not use /etc directly. Use sysconfigdir instead +- Remove additional DESTDIR definition +- Fix Xen migration URI to not include 'system' +- Change net->name to net->source + +* Wed Dec 02 2009 Kaitlin Rupert - 0.5.8-1 +- Updated to latest upstream source + +* Mon Oct 05 2009 Kaitlin Rupert - 0.5.7-1 +- Updated to latest upstream source + +* Sat Jul 25 2009 Fedora Release Engineering - 0.5.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Jul 14 2009 Kaitlin Rupert - 0.5.6-1 +- Updated to latest upstream source + +* Tue Apr 21 2009 Kaitlin Rupert - 0.5.5-1 +- Updated to latest upstream source + +* Wed Feb 25 2009 Fedora Release Engineering - 0.5.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 17 2009 Kaitlin Rupert - 0.5.4-1 +- Updated to latest upstream source + +* Thu Jan 15 2009 Kaitlin Rupert - 0.5.3-1 +- Updated to latest upstream source + +* Mon Oct 06 2008 Kaitlin Rupert - 0.5.2-1 +- Updated to latest upstream source + +* Tue Sep 23 2008 Kaitlin Rupert - 0.5.1-5 +- Added vsmigser_schema patch to remove dup method name from VSMigrationService +- Added mem_parse patch to set proper mem max_size and mem values +- Added mig_prof_ver patch to report the proper Migration Profile version +- Added hyp_conn_fail patch to fix when not connecting to hyp returns a failure +- Added rm_def_virtdev patch to remove default DiskRADSD virtual device +- Added rm_eafp_err patch to remove error status when EAFP no pool link exists +- Added sdc_unsup patch to make SDC not return unsup for RASD to AC case + +* Wed Aug 27 2008 Kaitlin Rupert - 0.5.1-4 +- Added nostate patch to consider XenFV no state guests as running guests +- Added createsnap_override patch to add vendor defined values to CreateSnapshot +- Added add_shutdown_rsc patch to add support for shutdown operation +- Added vsmc_add_remove patch to expose Add/Remove resources via VSMC +- Added override_refconf patch to fix dup devs where ID matches refconf dev ID + +* Thu Aug 07 2008 Dan Smith - 0.5.1-3 +- Added infostore_trunc patch to fix infostore corruption +- Added vsss_paramname patch to fix VSSS parameter name +- Added vsss_logic patch to fix terminal memory snapshot logic +- Added /etc/libvirt/cim directory for infostore + +* Thu Jul 31 2008 Dan Smith - 0.5.1-1 +- Updated to latest upstream source + +* Tue Jun 03 2008 Dan Smith - 0.5-1 +- Updated to latest upstream source + +* Fri May 30 2008 Dan Smith - 0.4-2 +- Fixed schema registration to pick up ECTP in root/virt properly +- Fixed schema registration to include ReferencedProfile in interop +- Added RASD namespace fix + +* Wed May 21 2008 Dan Smith - 0.4-1 +- Updated to latest upstream source +- Added default disk pool configuration patch + +* Fri Mar 14 2008 Dan Smith - 0.3-4 +- Fixed loader config for 64-bit systems +- Added missing root/interop schema install +- Added RegisteredProfile.registration to install + +* Fri Mar 07 2008 Dan Smith - 0.3-2 +- Added KVM method enablement patch + +* Mon Mar 03 2008 Dan Smith - 0.3-1 +- Updated to latest upstream source + +* Wed Feb 13 2008 Dan Smith - 0.2-1 +- Updated to latest upstream source + +* Thu Jan 17 2008 Dan Smith - 0.1-8 +- Add ld.so.conf.d configuration + +* Mon Jan 14 2008 Dan Smith - 0.1-7 +- Update to offical upstream release +- Patch source to fix parallel make issue until fixed upstream + +* Mon Jan 07 2008 Dan Smith - 0.1-3 +- Remove RPATH on provider modules + +* Mon Jan 07 2008 Dan Smith - 0.1-2 +- Cleaned up Release +- Removed unnecessary Requires +- After install, condrestart pegasus +- Updated to latest source snapshot + +* Fri Oct 26 2007 Daniel Veillard - 0.1-1 +- created