[PATCH 0 of 4] (#3) Add clock offset support

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1228836552 28800 # Node ID 212d2497ad6e17cdbf3cc19ee91e8e5bbb5e7fc4 # Parent ee41039956a0224ca7700e99153d79abe8060d5a (#2) Add ClockOffset to VSSD To do this, add an intermediate Virt_VSSD class to parent all of our platform implementations (per recent discussion on this as a strategy for the future). Changes: - Move the common AutomaticShutdownAction property to the parent class Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r ee41039956a0 -r 212d2497ad6e Makefile.am --- a/Makefile.am Tue Dec 02 18:07:02 2008 -0200 +++ b/Makefile.am Tue Dec 09 07:29:12 2008 -0800 @@ -10,6 +10,7 @@ schema/Memory.mof \ schema/Processor.mof \ schema/SystemDevice.mof \ + schema/Virt_VSSD.mof \ schema/VSSD.mof \ schema/HostSystem.mof \ schema/HostedDependency.mof \ diff -r ee41039956a0 -r 212d2497ad6e schema/VSSD.mof --- a/schema/VSSD.mof Tue Dec 02 18:07:02 2008 -0200 +++ b/schema/VSSD.mof Tue Dec 09 07:29:12 2008 -0800 @@ -1,11 +1,11 @@ // Copyright IBM Corp. 2007 [Description ( - "A class derived from CIM_VirtualSystemSettingData to represent " + "A class derived from Virt_VirtualSystemSettingData to represent " "the config of Xen virtual machines/domains running on the system."), Provider("cmpi::Virt_VSSD") ] -class Xen_VirtualSystemSettingData : CIM_VirtualSystemSettingData +class Xen_VirtualSystemSettingData : Virt_VirtualSystemSettingData { [Description ("Flag to determine whether this guest is fully-virtualized")] @@ -29,42 +29,30 @@ "One of hd,fd,cdrom.")] string BootDevice; - [Override, ValueMap { "2", "3", ".." }, - Values { "Turn Off", "Save state", "DMTF Reserved" }] - uint16 AutomaticShutdownAction; - }; [Description ( - "A class derived from CIM_VirtualSystemSettingData to represent " + "A class derived from Virt_VirtualSystemSettingData to represent " "the config of KVM virtual machines/domains running on the system."), Provider("cmpi::Virt_VSSD") ] -class KVM_VirtualSystemSettingData : CIM_VirtualSystemSettingData +class KVM_VirtualSystemSettingData : Virt_VirtualSystemSettingData { [Description ("The device to boot from. One of hd,fd,cdrom.")] string BootDevice; - [Override, ValueMap { "2", "3", ".." }, - Values { "Turn Off", "Save state", "DMTF Reserved" }] - uint16 AutomaticShutdownAction; - }; [Description ( - "A class derived from CIM_VirtualSystemSettingData to represent " + "A class derived from Virt_VirtualSystemSettingData to represent " "the config of LXC containers running on the system."), Provider("cmpi::Virt_VSSD") ] -class LXC_VirtualSystemSettingData : CIM_VirtualSystemSettingData +class LXC_VirtualSystemSettingData : Virt_VirtualSystemSettingData { [Description ("Path to the init process for the container")] string InitPath; - [Override, ValueMap { "2", "3", ".." }, - Values { "Turn Off", "Save state", "DMTF Reserved" }] - uint16 AutomaticShutdownAction; - }; diff -r ee41039956a0 -r 212d2497ad6e schema/Virt_VSSD.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/Virt_VSSD.mof Tue Dec 09 07:29:12 2008 -0800 @@ -0,0 +1,15 @@ +// Copyright IBM Corp. 2007 + +class Virt_VirtualSystemSettingData : CIM_VirtualSystemSettingData +{ + + [Description ("Clock offset control"), + ValueMap { "0", "1" }, + Values { "UTC", "Local" }] + uint16 ClockOffset; + + [Override, ValueMap { "2", "3", ".." }, + Values { "Turn Off", "Save state", "DMTF Reserved" }] + uint16 AutomaticShutdownAction; + +};

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1228836568 28800 # Node ID 97232024b240a8ebb69758e767910f65c571954e # Parent 212d2497ad6e17cdbf3cc19ee91e8e5bbb5e7fc4 Add <clock> support to device_parsing and xmlgen Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 212d2497ad6e -r 97232024b240 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Tue Dec 09 07:29:12 2008 -0800 +++ b/libxkutil/device_parsing.c Tue Dec 09 07:29:28 2008 -0800 @@ -882,6 +882,8 @@ set_action(&dominfo->on_reboot, child); else if (XSTREQ(child->name, "on_crash")) set_action(&dominfo->on_crash, child); + else if (XSTREQ(child->name, "clock")) + dominfo->clock = get_attr_value(child, "offset"); } return 1; diff -r 212d2497ad6e -r 97232024b240 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Tue Dec 09 07:29:12 2008 -0800 +++ b/libxkutil/device_parsing.h Tue Dec 09 07:29:28 2008 -0800 @@ -113,6 +113,7 @@ char *uuid; char *bootloader; char *bootloader_args; + char *clock; union { struct pv_os_info pv; diff -r 212d2497ad6e -r 97232024b240 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Dec 09 07:29:12 2008 -0800 +++ b/libxkutil/xmlgen.c Tue Dec 09 07:29:28 2008 -0800 @@ -404,6 +404,11 @@ NULL, BAD_CAST "uuid", BAD_CAST domain->uuid); + + if (domain->clock != NULL) { + tmp = xmlNewChild(root, NULL, BAD_CAST "clock", NULL); + xmlNewProp(tmp, BAD_CAST "offset", BAD_CAST domain->clock); + } return NULL; }

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1228836568 28800 # Node ID bbf5b752a9221d12748d9e2bb86dc8ae5b0b5ef1 # Parent 97232024b240a8ebb69758e767910f65c571954e Make VSSD provider expose ClockOffset property Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 97232024b240 -r bbf5b752a922 src/Virt_VSSD.c --- a/src/Virt_VSSD.c Tue Dec 09 07:29:28 2008 -0800 +++ b/src/Virt_VSSD.c Tue Dec 09 07:29:28 2008 -0800 @@ -124,6 +124,16 @@ CMSetProperty(inst, "AutomaticRecoveryAction", (CMPIValue *)&dominfo->on_crash, CMPI_uint16); + + if (dominfo->clock != NULL) { + uint16_t clock = VSSD_CLOCK_UTC; + + if (STREQC(dominfo->clock, "localtime")) + clock = VSSD_CLOCK_LOC; + + CMSetProperty(inst, "ClockOffset", + (CMPIValue *)&clock, CMPI_uint16); + } if ((dominfo->type == DOMAIN_XENFV) || (dominfo->type == DOMAIN_KVM)) diff -r 97232024b240 -r bbf5b752a922 src/Virt_VSSD.h --- a/src/Virt_VSSD.h Tue Dec 09 07:29:28 2008 -0800 +++ b/src/Virt_VSSD.h Tue Dec 09 07:29:28 2008 -0800 @@ -21,6 +21,9 @@ #ifndef __VIRT_VSSD_H #define __VIRT_VSSD_H +#define VSSD_CLOCK_UTC 0 +#define VSSD_CLOCK_LOC 1 + CMPIStatus get_vssd_by_ref(const CMPIBroker *broker, const CMPIObjectPath *reference, CMPIInstance **_inst);

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1228836568 28800 # Node ID 9e63b52769bf42a6c025b7baa32a84afff0f3828 # Parent bbf5b752a9221d12748d9e2bb86dc8ae5b0b5ef1 (#2) Add clock offset support to VSMS Changes: - Fixed inverted error return if clock offset value is incorrect Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r bbf5b752a922 -r 9e63b52769bf src/Makefile.am --- a/src/Makefile.am Tue Dec 09 07:29:28 2008 -0800 +++ b/src/Makefile.am Tue Dec 09 07:29:28 2008 -0800 @@ -89,9 +89,9 @@ libVirt_ComputerSystemMigrationIndication_la_SOURCES = Virt_ComputerSystemMigrationIndication.c libVirt_ComputerSystemMigrationIndication_la_LIBADD = -lVirt_ComputerSystem -libVirt_VirtualSystemManagementService_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ComputerSystemIndication.la libVirt_RASD.la libVirt_HostSystem.la libVirt_DevicePool.la libVirt_Device.la +libVirt_VirtualSystemManagementService_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ComputerSystemIndication.la libVirt_RASD.la libVirt_HostSystem.la libVirt_DevicePool.la libVirt_Device.la libVirt_VSSD.la libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c -libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem -lVirt_DevicePool -lVirt_Device +libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem -lVirt_DevicePool -lVirt_Device -lVirt_VSSD libVirt_VirtualSystemManagementCapabilities_la_DEPENDENCIES = libVirt_HostSystem.la libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c diff -r bbf5b752a922 -r 9e63b52769bf src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Tue Dec 09 07:29:28 2008 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Tue Dec 09 07:29:28 2008 -0800 @@ -47,6 +47,7 @@ #include "Virt_VirtualSystemManagementService.h" #include "Virt_ComputerSystem.h" #include "Virt_ComputerSystemIndication.h" +#include "Virt_VSSD.h" #include "Virt_RASD.h" #include "Virt_HostSystem.h" #include "Virt_DevicePool.h" @@ -308,6 +309,18 @@ if (cu_get_bool_prop(inst, "IsFullVirt", &fullvirt) != CMPI_RC_OK) fullvirt = false; + + if (cu_get_u16_prop(inst, "ClockOffset", &tmp) == CMPI_RC_OK) { + if (tmp == VSSD_CLOCK_UTC) + domain->clock = strdup("utc"); + else if (tmp == VSSD_CLOCK_LOC) + domain->clock = strdup("localtime"); + else { + CU_DEBUG("Unknown clock offset value %hi", tmp); + ret = 0; + goto out; + } + } if (fullvirt || STREQC(pfx, "KVM")) ret = fv_vssd_to_domain(inst, domain, pfx);
participants (3)
-
Dan Smith
-
Jim Fehlig
-
Kaitlin Rupert