rpms/libvirt-cim/devel add_shutdown_rsc.patch, NONE, 1.1 applysnapshot.patch, NONE, 1.1 createsnap_override.patch, NONE, 1.1 mem_term_snapshot.patch, NONE, 1.1 nostate.patch, NONE, 1.1 override_refconf.patch, NONE, 1.1 vsmc_add_remove.patch, NONE, 1.1 libvirt-cim.spec, 1.16, 1.17

Kaitlin Rupert kaitlin at fedoraproject.org
Wed Aug 27 17:48:57 UTC 2008


Author: kaitlin

Update of /cvs/pkgs/rpms/libvirt-cim/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31483

Modified Files:
	libvirt-cim.spec 
Added Files:
	add_shutdown_rsc.patch applysnapshot.patch 
	createsnap_override.patch mem_term_snapshot.patch 
	nostate.patch override_refconf.patch vsmc_add_remove.patch 
Log Message:
Update libvirt-cim.spec to include patches for the 0.5.1-4 update.




add_shutdown_rsc.patch:

--- NEW FILE add_shutdown_rsc.patch ---
# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1218234088 25200
# Node ID 9c6a7cfd8c0bd78bef65b60fad37b0873582d09d
# Parent  380a563d6f54bf073ddd94eeafb626f29c586d18
Map SHUTDOWN state change to current DISABLED functionality

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

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);

applysnapshot.patch:

--- NEW FILE applysnapshot.patch ---
# HG changeset patch
# User Jim Fehlig <jfehlig at novell.com>
# Date 1218080667 21600
# Node ID 9118e2bc677263105b82148c8d69a820ef900107
# Parent  ca56c48f31038a8dc718e09ef8bf68a8917408fa
Fix name of Snaphot parameter to ApplySnapshot

The ApplySnapshot extrinsic takes 1 input parameter named Snapshot.
Change parameter name from AffectedSnapshot to Snapshot.

     Signed-off-by: Jim Fehlig <jfehlig at novell.com>

diff -r ca56c48f3103 -r 9118e2bc6772 src/Virt_VirtualSystemSnapshotService.c
--- a/src/Virt_VirtualSystemSnapshotService.c	Fri Aug 01 11:02:53 2008 -0700
+++ b/src/Virt_VirtualSystemSnapshotService.c	Wed Aug 06 21:44:27 2008 -0600
@@ -542,7 +542,7 @@
         char *name = NULL;
         uint32_t retcode = CIM_RETURN_FAILED;
 
-        if (cu_get_ref_arg(argsin, "AffectedSnapshot", &snap) != CMPI_RC_OK) {
+        if (cu_get_ref_arg(argsin, "Snapshot", &snap) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_INVALID_PARAMETER,
                            "Missing Snapshot");
@@ -587,7 +587,7 @@
 static struct method_handler ApplySnapshot = {
         .name = "ApplySnapshot",
         .handler = apply_snapshot,
-        .args = {{"AffectedSnapshot", CMPI_ref, false},
+        .args = {{"Snapshot", CMPI_ref, false},
                  ARG_END}
 };
 

createsnap_override.patch:

--- NEW FILE createsnap_override.patch ---
# HG changeset patch
# User Jim Fehlig <jfehlig at novell.com>
# 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 <jfehlig at novell.com>

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 { };

mem_term_snapshot.patch:

--- NEW FILE mem_term_snapshot.patch ---
# HG changeset patch
# User Jim Fehlig <jfehlig at novell.com>
# Date 1218080112 21600
# Node ID f1a672f33772c5a6314f1d5a5fd0f701b1564673
# Parent  9118e2bc677263105b82148c8d69a820ef900107
Fix logic that determines memory only or memory terminal snapshot

According to comments in Virt_VirtualSystemSnapshotService.h and
VirtualSystemSnapshotService.mof, it seems logic that determines
whether to do a restore uses wrong definition.

     Signed-off-by: Jim Fehlig <jfehlig at novell.com>

diff -r 9118e2bc6772 -r f1a672f33772 src/Virt_VirtualSystemSnapshotService.c
--- a/src/Virt_VirtualSystemSnapshotService.c	Wed Aug 06 21:44:27 2008 -0600
+++ b/src/Virt_VirtualSystemSnapshotService.c	Wed Aug 06 21:35:12 2008 -0600
@@ -397,7 +397,7 @@
         }
 
         ctx->save = (type != 0);
-        ctx->restore = (type != VIR_VSSS_SNAPSHOT_MEM);
+        ctx->restore = (type != VIR_VSSS_SNAPSHOT_MEMT);
 
         s = create_job(context, ref, ctx, &job);
 

nostate.patch:

--- NEW FILE nostate.patch ---
# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# 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 <karupert at us.ibm.com>

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;

override_refconf.patch:

--- NEW FILE override_refconf.patch ---
# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# 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 <danms at us.ibm.com>

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;

vsmc_add_remove.patch:

--- NEW FILE vsmc_add_remove.patch ---
# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# 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 <danms at us.ibm.com>

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);


Index: libvirt-cim.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libvirt-cim/devel/libvirt-cim.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- libvirt-cim.spec	7 Aug 2008 16:11:09 -0000	1.16
+++ libvirt-cim.spec	27 Aug 2008 17:48:56 -0000	1.17
@@ -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
@@ -20,9 +20,13 @@
 Patch0: parse.patch
 Patch1: uuidbuflen.patch
 Patch2: uuidcompare.patch
-Patch3: infostore_trunc.patch
-Patch4: vsss_paramname.patch
-Patch5: vsss_logic.patch
+Patch3: mem_term_snapshot.patch
+Patch4: applysnapshot.patch
+Patch5: nostate.patch
+Patch6: createsnap_override.patch
+Patch7: add_shutdown_rsc.patch
+Patch8: vsmc_add_remove.patch
+Patch9: override_refconf.patch
 
 %description
 Libvirt-cim is a CMPI CIM provider that implements the DMTF SVPC
@@ -40,6 +44,10 @@
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
 
 %build
 %configure --disable-werror
@@ -121,6 +129,15 @@
 /etc/ld.so.conf.d/libvirt-cim.conf
 
 %changelog
+* Wed Aug 26 2008 Kaitlin Rupert <kaitlin at us.ibm.com> - 0.5.1-3
+-Added mem_term_snapshot patch to fix memory terminal snapshot logic
+-Added applysnapshot patch to fix ApplySnapshot parameter name
+-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 devices where ID matches refconf dev ID
+
 * Thu Aug 07 2008 Dan Smith <danms at us.ibm.com> - 0.5.1-3
 - Added infostore_trunc patch to fix infostore corruption
 - Added vsss_paramname patch to fix VSSS parameter name




More information about the fedora-extras-commits mailing list