From 64ce927cf66c2da462ac5787008e9166592fda70 Mon Sep 17 00:00:00 2001 From: Kaitlin Rupert Date: Aug 27 2008 23:00:03 +0000 Subject: Add new patches and corresponding spec changes for release 0.5.1-4. --- diff --git a/add_shutdown_rsc.patch b/add_shutdown_rsc.patch new file mode 100644 index 0000000..4728a60 --- /dev/null +++ b/add_shutdown_rsc.patch @@ -0,0 +1,40 @@ +# HG changeset patch +# User Kaitlin Rupert +# Date 1218234088 25200 +# Node ID 9c6a7cfd8c0bd78bef65b60fad37b0873582d09d +# Parent 380a563d6f54bf073ddd94eeafb626f29c586d18 +Map SHUTDOWN state change to current DISABLED functionality + +Signed-off-by: Kaitlin Rupert + +diff -r 380a563d6f54 -r 9c6a7cfd8c0b src/Virt_ComputerSystem.c +--- a/src/Virt_ComputerSystem.c Fri Aug 08 12:13:41 2008 -0600 ++++ b/src/Virt_ComputerSystem.c Fri Aug 08 15:21:28 2008 -0700 +@@ -804,6 +804,8 @@ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret = 0; + ++ info->state = adjust_state_xen(dom, info->state); ++ + switch (info->state) { + case VIR_DOMAIN_RUNNING: + case VIR_DOMAIN_BLOCKED: +@@ -811,7 +813,8 @@ + ret = virDomainShutdown(dom); + break; + default: +- CU_DEBUG("Cannot go to disabled state from %i", info->state); ++ CU_DEBUG("Cannot go to disabled/shutdown state from %i", ++ info->state); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Invalid state transition"); +@@ -939,7 +942,7 @@ + + if (state == CIM_STATE_ENABLED) + s = state_change_enable(dom, &info); +- else if (state == CIM_STATE_DISABLED) ++ else if ((state == CIM_STATE_DISABLED) || (state == CIM_STATE_SHUTDOWN)) + s = state_change_disable(dom, &info); + else if (state == CIM_STATE_PAUSED) + s = state_change_pause(dom, &info); diff --git a/createsnap_override.patch b/createsnap_override.patch new file mode 100644 index 0000000..358e27f --- /dev/null +++ b/createsnap_override.patch @@ -0,0 +1,87 @@ +# HG changeset patch +# User Jim Fehlig +# Date 1218219221 21600 +# Node ID 380a563d6f54bf073ddd94eeafb626f29c586d18 +# Parent b5bbd672c2bf32810192260075d100689b99d86a +Override CreateSnapshot extrinsic to include vendor-defined values + +Some tools will parse the class info and format gui based on qualifiers +it finds. In the case of CreateSnapshot, such tools will not display +the vendor additions unless the method is overridden to describe the +additions. + +This patch introduces a new class Virt_VirtualSystemSnapshotService +where CreateSnapshot is overridden. The various virtualizer flavors +then inherit from that. + + Signed-off-by: Jim Fehlig + +diff -r b5bbd672c2bf -r 380a563d6f54 schema/VirtualSystemSnapshotService.mof +--- a/schema/VirtualSystemSnapshotService.mof Thu Aug 07 11:40:57 2008 -0700 ++++ b/schema/VirtualSystemSnapshotService.mof Fri Aug 08 12:13:41 2008 -0600 +@@ -1,8 +1,59 @@ + // Copyright IBM Corp. 2008 + +-[Description ( "Snapshot types are as follows: " +- "32768: Memory-only snapshot (suspend, resume, keep image)" +- "32769: Memory-only, terminal (domain is offline after op)")] +-class Xen_VirtualSystemSnapshotService : CIM_VirtualSystemSnapshotService { }; +-class KVM_VirtualSystemSnapshotService : CIM_VirtualSystemSnapshotService { }; +-class LXC_VirtualSystemSnapshotService : CIM_VirtualSystemSnapshotService { }; ++[Description ( ++ "Service to create, apply and destroy snapshots of virtual systems." ++ )] ++class Virt_VirtualSystemSnapshotService: CIM_VirtualSystemSnapshotService { ++ [Override, Description ( "Creates a snapshot of a virtual system." ), ++ ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "4096", ++ "4097..32767", "32768..65535" }, ++ Values { "Completed with No Error", "Not Supported", ++ "Failed", "Timeout", "Invalid Parameter", "Invalid State", ++ "Invalid Type", "DMTF Reserved", ++ "Method Parameters Checked - Job Started", ++ "Method Reserved", "Vendor Specific" }] ++ uint32 CreateSnapshot( ++ [In, Description ( ++ "Reference to the affected virtual system." )] ++ CIM_ComputerSystem REF AffectedSystem, ++ [In, Description ( "Parameter settings." ), ++ EmbeddedInstance ( "CIM_SettingData" )] ++ string SnapshotSettings, ++ [In, Description ( ++ "Requested snapshot type:\n" ++ "Full Snapshot: Complete snapshot of the virtual system.\n" ++ "Disk Snapshot: Snapshot of virtual system disks.\n" ++ "Memory Snapshot: Snapshot of virtual system memory only. " ++ "The virtual system remains active after memory snapshot " ++ "is complete.\n" ++ "Memory Snapshot Terminal: Snapshot of virtual system " ++ "memory only. The virtual system is transitioned to " ++ "disabled state after the memory snapshot is complete.\n" ), ++ ValueMap { "2", "3", "..", "32768", "32769", "32770..65535" }, ++ Values { "Full Snapshot", "Disk Snapshot", ++ "DMTF Reserved", "Memory Snapshot", "Memory Snapshot Terminal", ++ "Vendor Specific" }, ++ ModelCorrespondence { ++ "CIM_VirtualSystemSnapshotCapabilities.SnapshotTypesEnabled", ++ "CIM_VirtualSystemSnapshotServiceCapabilities.SnapshotTypesSupported" }] ++ uint16 SnapshotType, ++ [In, Out, Description ( ++ "Resulting virtual system snapshot" )] ++ CIM_VirtualSystemSettingData REF ResultingSnapshot, ++ [In, Out, Description ( ++ "If the operation is long running, then optionally " ++ "a job may be returned. In this case, the instance " ++ "of the CIM_VirtualSystemSettingData class " ++ "representing the new virtual system snapshot is " ++ "presented via the CIM_AffectedJobElement " ++ "association with the value of the AffectedElement " ++ "property referring to the new instance of the " ++ "CIM_VirtualSystemSettingData class representing " ++ "the virtual system snapshot and and the value of " ++ "the ElementEffects set to 5 (Create)." )] ++ CIM_ConcreteJob REF Job); ++}; ++ ++class Xen_VirtualSystemSnapshotService : Virt_VirtualSystemSnapshotService { }; ++class KVM_VirtualSystemSnapshotService : Virt_VirtualSystemSnapshotService { }; ++class LXC_VirtualSystemSnapshotService : Virt_VirtualSystemSnapshotService { }; diff --git a/libvirt-cim.spec b/libvirt-cim.spec index cc5af24..eba5da1 100644 --- a/libvirt-cim.spec +++ b/libvirt-cim.spec @@ -3,7 +3,7 @@ Summary: A CIM provider for libvirt Name: libvirt-cim Version: 0.5.1 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ Group: Development/Libraries Source: libvirt-cim-%{version}.tar.gz @@ -23,6 +23,11 @@ Patch2: uuidcompare.patch Patch3: infostore_trunc.patch Patch4: vsss_paramname.patch Patch5: vsss_logic.patch +Patch6: nostate.patch +Patch7: createsnap_override.patch +Patch8: add_shutdown_rsc.patch +Patch9: vsmc_add_remove.patch +Patch10: override_refconf.patch %description Libvirt-cim is a CMPI CIM provider that implements the DMTF SVPC @@ -40,6 +45,11 @@ chmod +X src/* libxkutil/* schema/* %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 %build %configure --disable-werror @@ -121,6 +131,13 @@ rm -fr $RPM_BUILD_ROOT /etc/ld.so.conf.d/libvirt-cim.conf %changelog +* 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 diff --git a/nostate.patch b/nostate.patch new file mode 100644 index 0000000..7b5bee1 --- /dev/null +++ b/nostate.patch @@ -0,0 +1,93 @@ +# HG changeset patch +# User Kaitlin Rupert +# Date 1218134457 25200 +# Node ID b5bbd672c2bf32810192260075d100689b99d86a +# Parent f1a672f33772c5a6314f1d5a5fd0f701b1564673 +(#4) For pause, reboot, and enable add support for guests in the NOSTATE state. + +It's possible that a XenFV guest might return no state instead of blocked or running. This can occur when the guest is active, but isn't running of the CPU or blocked waiting for it. + +This should be a safe approach - we return an error if the guest is in some other state or if libvirt is unable to successfully change the state of the guest. + +Updates from 3 to 4: + -Use single function to convert Xen NOSTATE to RUNNING. + +Updates from 2 to 3: + -Add logic to check connection type so NOSTATE only applied to Xen guests. + +Updates from 1 to 2: + -For the reboot and reset operations, add support for paused guests (per the VSP). + -If the guest returns VIR_DOMAIN_NOSTATE, the provider should return the value CIM_STATE_ENABLED, not CIM_STATE_UNKNOWN. + +Signed-off-by: Kaitlin Rupert + +diff -r f1a672f33772 -r b5bbd672c2bf src/Virt_ComputerSystem.c +--- a/src/Virt_ComputerSystem.c Wed Aug 06 21:35:12 2008 -0600 ++++ b/src/Virt_ComputerSystem.c Thu Aug 07 11:40:57 2008 -0700 +@@ -230,6 +230,22 @@ + } + } + ++static unsigned char adjust_state_xen(virDomainPtr dom, ++ unsigned char state) ++{ ++ virConnectPtr conn; ++ ++ if (state != VIR_DOMAIN_NOSTATE) ++ return state; ++ ++ conn = virDomainGetConnect(dom); ++ ++ if (STREQC(virConnectGetType(conn), "Xen")) ++ return VIR_DOMAIN_RUNNING; ++ ++ return state; ++} ++ + static uint16_t adjust_state_if_saved(const char *name, + uint16_t state) + { +@@ -259,6 +275,8 @@ + ret = virDomainGetInfo(dom, &info); + if (ret != 0) + return 0; ++ ++ info.state = adjust_state_xen(dom, info.state); + + cim_state = state_lv_to_cim((const int)info.state); + cim_state = adjust_state_if_saved(virDomainGetName(dom), cim_state); +@@ -812,6 +830,8 @@ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret = 0; + ++ info->state = adjust_state_xen(dom, info->state); ++ + switch (info->state) { + case VIR_DOMAIN_RUNNING: + case VIR_DOMAIN_BLOCKED: +@@ -837,9 +857,12 @@ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret = 0; + ++ info->state = adjust_state_xen(dom, info->state); ++ + switch (info->state) { + case VIR_DOMAIN_RUNNING: + case VIR_DOMAIN_BLOCKED: ++ case VIR_DOMAIN_PAUSED: + CU_DEBUG("Reboot domain"); + ret = virDomainReboot(dom, 0); + break; +@@ -862,9 +885,12 @@ + CMPIStatus s = {CMPI_RC_OK, NULL}; + int ret = 0; + ++ info->state = adjust_state_xen(dom, info->state); ++ + switch (info->state) { + case VIR_DOMAIN_RUNNING: + case VIR_DOMAIN_BLOCKED: ++ case VIR_DOMAIN_PAUSED: + CU_DEBUG("Reset domain"); + ret = domain_reset(dom); + break; diff --git a/override_refconf.patch b/override_refconf.patch new file mode 100644 index 0000000..c859053 --- /dev/null +++ b/override_refconf.patch @@ -0,0 +1,133 @@ +# HG changeset patch +# User Dan Smith +# Date 1219084718 25200 +# Node ID 80e6ea1a1a296d424e15b3771d6753c3f8bbc5d1 +# Parent f40ac4d174324f9ee4c76a4a8832704d3439e7dd +(#2) Override devices in reference configuration, where the ID is the same + +Currently, we depend on libvirt to return an error if the client's +combination of ReferenceConfig and ResourceSettings results in a duplicate +device. That error is non-obvious in origin. Since two devices that would +result in the same InstanceID cannot be properly represented by the providers +anyway, this patch adds some logic to properly override such a conflicting +device. + +To do this, I had to make sure we set the ID in rasd_to_vdev, which wasn't +previously required. The actual insertion of the device into the appropriate +type list is done by a helper function which checks for (and overrides if +appropriate) a duplicate before tacking the new instance on the end of the +list. + +Changes: +We were already making the required space for the additional devices, +but I didn't correctly specify the new size then calling add_device_nodup() +function, resulting in a false failure. + +Side note: the classify_resources() function is really getting out of hand +and could use some refactoring. + +Signed-off-by: Dan Smith + +diff -r f40ac4d17432 -r 80e6ea1a1a29 src/Virt_VirtualSystemManagementService.c +--- a/src/Virt_VirtualSystemManagementService.c Fri Aug 15 09:30:30 2008 -0700 ++++ b/src/Virt_VirtualSystemManagementService.c Mon Aug 18 11:38:38 2008 -0700 +@@ -411,6 +411,9 @@ + free(dev->dev.net.mac); + dev->dev.net.mac = strdup(val); + ++ free(dev->id); ++ dev->id = strdup(dev->dev.net.mac); ++ + op = CMGetObjectPath(inst, NULL); + if (op == NULL) { + CU_DEBUG("Unable to get instance path"); +@@ -449,6 +452,9 @@ + dev->dev.disk.source = strdup(val); + dev->dev.disk.disk_type = disk_type_from_file(val); + ++ free(dev->id); ++ dev->id = strdup(dev->dev.disk.virtual_dev); ++ + return NULL; + } + +@@ -469,6 +475,9 @@ + free(dev->dev.disk.source); + dev->dev.disk.source = strdup(val); + dev->dev.disk.disk_type = DISK_FS; ++ ++ free(dev->id); ++ dev->id = strdup(dev->dev.disk.virtual_dev); + + return NULL; + } +@@ -621,6 +630,33 @@ + return true; + } + ++static char *add_device_nodup(struct virt_device *dev, ++ struct virt_device *list, ++ int max, ++ int *index) ++{ ++ int i; ++ ++ for (i = 0; i < *index; i++) { ++ struct virt_device *ptr = &list[i]; ++ ++ if (STREQC(ptr->id, dev->id)) { ++ CU_DEBUG("Overriding device %s from refconf", ptr->id); ++ cleanup_virt_device(ptr); ++ memcpy(ptr, dev, sizeof(*ptr)); ++ return NULL; ++ } ++ } ++ ++ if (*index == max) ++ return "Internal error: no more device slots"; ++ ++ memcpy(&list[*index], dev, sizeof(list[*index])); ++ *index += 1; ++ ++ return NULL; ++} ++ + static const char *classify_resources(CMPIArray *resources, + const char *ns, + struct domain *domain) +@@ -678,15 +714,33 @@ + &domain->dev_mem[0], + ns); + } else if (type == CIM_RES_TYPE_DISK) { ++ struct virt_device dev; ++ int dcount = count + domain->dev_disk_ct; ++ ++ memset(&dev, 0, sizeof(dev)); + msg = rasd_to_vdev(inst, + domain, +- &domain->dev_disk[domain->dev_disk_ct++], ++ &dev, + ns); ++ if (msg == NULL) ++ msg = add_device_nodup(&dev, ++ domain->dev_disk, ++ dcount, ++ &domain->dev_disk_ct); + } else if (type == CIM_RES_TYPE_NET) { ++ struct virt_device dev; ++ int ncount = count + domain->dev_net_ct; ++ ++ memset(&dev, 0, sizeof(dev)); + msg = rasd_to_vdev(inst, + domain, +- &domain->dev_net[domain->dev_net_ct++], ++ &dev, + ns); ++ if (msg == NULL) ++ msg = add_device_nodup(&dev, ++ domain->dev_net, ++ ncount, ++ &domain->dev_net_ct); + } + if (msg != NULL) + return msg; diff --git a/vsmc_add_remove.patch b/vsmc_add_remove.patch new file mode 100644 index 0000000..f7887f7 --- /dev/null +++ b/vsmc_add_remove.patch @@ -0,0 +1,47 @@ +# HG changeset patch +# User Dan Smith +# Date 1218724102 25200 +# Node ID 86d7161daef682ba869fbae74133cfd811f1d306 +# Parent 9c6a7cfd8c0bd78bef65b60fad37b0873582d09d +Update VirtualSystemManagementCapabilities to show Add/Remove resources +as supported for synchronous calls. + +Signed-off-by: Dan Smith + +diff -r 9c6a7cfd8c0b -r 86d7161daef6 src/Virt_VirtualSystemManagementCapabilities.c +--- a/src/Virt_VirtualSystemManagementCapabilities.c Fri Aug 08 15:21:28 2008 -0700 ++++ b/src/Virt_VirtualSystemManagementCapabilities.c Thu Aug 14 07:28:22 2008 -0700 +@@ -58,21 +58,27 @@ + CMSetProperty(inst, "InstanceID", + (CMPIValue *)"ManagementCapabilities", CMPI_chars); + +- array = CMNewArray(broker, 4, CMPI_uint16, &s); ++ array = CMNewArray(broker, 6, CMPI_uint16, &s); + if ((s.rc != CMPI_RC_OK) || CMIsNullObject(array)) + goto out; +- +- element = (uint16_t)DEFINE_SYSTEM; ++ ++ element = (uint16_t)ADD_RESOURCES; + CMSetArrayElementAt(array, 0, &element, CMPI_uint16); + +- element = (uint16_t)DESTROY_SYSTEM; ++ element = (uint16_t)DEFINE_SYSTEM; + CMSetArrayElementAt(array, 1, &element, CMPI_uint16); + +- element = (uint16_t)MOD_RESOURCE_SETTINGS; ++ element = (uint16_t)DESTROY_SYSTEM; + CMSetArrayElementAt(array, 2, &element, CMPI_uint16); + ++ element = (uint16_t)MOD_RESOURCE_SETTINGS; ++ CMSetArrayElementAt(array, 3, &element, CMPI_uint16); ++ + element = (uint16_t)MOD_SYS_SETTINGS; +- CMSetArrayElementAt(array, 3, &element, CMPI_uint16); ++ CMSetArrayElementAt(array, 4, &element, CMPI_uint16); ++ ++ element = (uint16_t)RM_RESOURCES; ++ CMSetArrayElementAt(array, 5, &element, CMPI_uint16); + + CMSetProperty(inst, "SynchronousMethodsSupported", + (CMPIValue *)&array, CMPI_uint16A);