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

Just made a tiny tweak to the last patch to correctly signal error when the clock offset value is invalid.

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1228767026 28800 # Node ID 18cd726e564ae8bffc518dbb5b27671548b97de1 # Parent ee41039956a0224ca7700e99153d79abe8060d5a 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). Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r ee41039956a0 -r 18cd726e564a Makefile.am --- a/Makefile.am Tue Dec 02 18:07:02 2008 -0200 +++ b/Makefile.am Mon Dec 08 12:10:26 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 18cd726e564a schema/VSSD.mof --- a/schema/VSSD.mof Tue Dec 02 18:07:02 2008 -0200 +++ b/schema/VSSD.mof Mon Dec 08 12:10:26 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")] @@ -36,11 +36,11 @@ }; [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.")] @@ -53,11 +53,11 @@ }; [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")] diff -r ee41039956a0 -r 18cd726e564a schema/Virt_VSSD.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/Virt_VSSD.mof Mon Dec 08 12:10:26 2008 -0800 @@ -0,0 +1,11 @@ +// Copyright IBM Corp. 2007 + +class Virt_VirtualSystemSettingData : CIM_VirtualSystemSettingData +{ + + [Description ("Clock offset control"), + ValueMap { "0", "1" }, + Values { "UTC", "Local" }] + uint16 ClockOffset; + +};

+class Virt_VirtualSystemSettingData : CIM_VirtualSystemSettingData +{ + + [Description ("Clock offset control"), + ValueMap { "0", "1" }, + Values { "UTC", "Local" }] + uint16 ClockOffset;
Spacing is off here. Also, shouldn't AutomaticShutdownAction be moved to Virt_VSSD as well since Xen, KVM, and LXC all need it? Everything else tested out just fine. =) -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

KR> Spacing is off here. It matches all the rest. KR> Also, shouldn't AutomaticShutdownAction be moved to Virt_VSSD as KR> well since Xen, KVM, and LXC all need it? Yeah, I'll move that over and re-send. KR> Everything else tested out just fine. =) Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1228767394 28800 # Node ID 780ad920644642f2fa54006b67942d1cfb2992c3 # Parent 18cd726e564ae8bffc518dbb5b27671548b97de1 Add <clock> support to device_parsing and xmlgen Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 18cd726e564a -r 780ad9206446 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Dec 08 12:10:26 2008 -0800 +++ b/libxkutil/device_parsing.c Mon Dec 08 12:16:34 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 18cd726e564a -r 780ad9206446 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Dec 08 12:10:26 2008 -0800 +++ b/libxkutil/device_parsing.h Mon Dec 08 12:16:34 2008 -0800 @@ -113,6 +113,7 @@ char *uuid; char *bootloader; char *bootloader_args; + char *clock; union { struct pv_os_info pv; diff -r 18cd726e564a -r 780ad9206446 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Dec 08 12:10:26 2008 -0800 +++ b/libxkutil/xmlgen.c Mon Dec 08 12:16:34 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 1228767402 28800 # Node ID 205d33ceaa23a3a116e790590b0109c77c5683aa # Parent 780ad920644642f2fa54006b67942d1cfb2992c3 Make VSSD provider expose ClockOffset property Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 780ad9206446 -r 205d33ceaa23 src/Virt_VSSD.c --- a/src/Virt_VSSD.c Mon Dec 08 12:16:34 2008 -0800 +++ b/src/Virt_VSSD.c Mon Dec 08 12:16:42 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 780ad9206446 -r 205d33ceaa23 src/Virt_VSSD.h --- a/src/Virt_VSSD.h Mon Dec 08 12:16:34 2008 -0800 +++ b/src/Virt_VSSD.h Mon Dec 08 12:16:42 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 1228771586 28800 # Node ID 1eed258563ade2a9f2193d018a7f410eec6d043c # Parent 205d33ceaa23a3a116e790590b0109c77c5683aa (#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 205d33ceaa23 -r 1eed258563ad src/Makefile.am --- a/src/Makefile.am Mon Dec 08 12:16:42 2008 -0800 +++ b/src/Makefile.am Mon Dec 08 13:26:26 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 205d33ceaa23 -r 1eed258563ad src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Dec 08 12:16:42 2008 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Mon Dec 08 13:26:26 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 (2)
-
Dan Smith
-
Kaitlin Rupert