Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Update
libvirt.10106
c391e07e-libxl-clock-settings.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File c391e07e-libxl-clock-settings.patch of Package libvirt.10106
commit c391e07eb08d713474ae8998cfd859e1827a4b2d Author: Jim Fehlig <jfehlig@suse.com> Date: Tue Feb 20 16:51:27 2018 -0700 libxl: add support for specifying clock offset and adjustment libxl supports setting the domain real time clock to local time or UTC via the localtime field of libxl_domain_build_info. Adjustment of the clock is also supported via the rtc_timeoffset field. The libvirt libxl driver has never supported these settings, instead relying on libxl's default of a UTC real time clock with adjustment set to 0. There is at least one user that would like the ability to change the defaults https://www.redhat.com/archives/libvirt-users/2018-February/msg00059.html Add support for specifying a local time clock and for specifying an adjustment for both local time and UTC clocks. Add a test case to verify the XML to libxl_domain_config conversion. Local time clock and clock adjustment is already supported by the XML <-> xl.cfg converter. What is missing is an explicit test for the conversion. There are plenty of existing tests that all use UTC with 0 adjustment. Hijack test-fullvirt-tsc-timer to test a local time clock with 1 hour adjustment. Signed-off-by: Jim Fehlig <jfehlig@suse.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Index: libvirt-3.3.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-3.3.0.orig/src/libxl/libxl_conf.c +++ libvirt-3.3.0/src/libxl/libxl_conf.c @@ -297,6 +297,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr de virCapsPtr caps, libxl_domain_config *d_config) { + virDomainClockDef clock = def->clock; libxl_domain_build_info *b_info = &d_config->b_info; int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM; size_t i; @@ -316,10 +317,38 @@ libxlMakeDomBuildInfo(virDomainDefPtr de for (i = 0; i < virDomainDefGetVcpus(def); i++) libxl_bitmap_set((&b_info->avail_vcpus), i); - for (i = 0; i < def->clock.ntimers; i++) { - switch ((virDomainTimerNameType) def->clock.timers[i]->name) { + switch ((virDomainClockOffsetType) clock.offset) { + case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE: + if (clock.data.variable.basis == VIR_DOMAIN_CLOCK_BASIS_LOCALTIME) + libxl_defbool_set(&b_info->localtime, true); + b_info->rtc_timeoffset = clock.data.variable.adjustment; + break; + + case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: + libxl_defbool_set(&b_info->localtime, true); + break; + + /* Nothing to do since UTC is the default in libxl */ + case VIR_DOMAIN_CLOCK_OFFSET_UTC: + break; + + case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset '%s'"), + virDomainClockOffsetTypeToString(clock.offset)); + return -1; + + case VIR_DOMAIN_CLOCK_OFFSET_LAST: + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unexpected clock offset '%d'"), clock.offset); + return -1; + } + + for (i = 0; i < clock.ntimers; i++) { + switch ((virDomainTimerNameType) clock.timers[i]->name) { case VIR_DOMAIN_TIMER_NAME_TSC: - switch (def->clock.timers[i]->mode) { + switch (clock.timers[i]->mode) { case VIR_DOMAIN_TIMER_MODE_NATIVE: b_info->tsc_mode = LIBXL_TSC_MODE_NATIVE; break; @@ -338,10 +367,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr de if (!hvm) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported timer type (name) '%s'"), - virDomainTimerNameTypeToString(def->clock.timers[i]->name)); + virDomainTimerNameTypeToString(clock.timers[i]->name)); return -1; } - if (def->clock.timers[i]->present == 1) + if (clock.timers[i]->present == 1) libxl_defbool_set(&b_info->u.hvm.hpet, 1); break; @@ -352,7 +381,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr de case VIR_DOMAIN_TIMER_NAME_PIT: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported timer type (name) '%s'"), - virDomainTimerNameTypeToString(def->clock.timers[i]->name)); + virDomainTimerNameTypeToString(clock.timers[i]->name)); return -1; case VIR_DOMAIN_TIMER_NAME_LAST: Index: libvirt-3.3.0/tests/xlconfigdata/test-fullvirt-tsc-timer.cfg =================================================================== --- libvirt-3.3.0.orig/tests/xlconfigdata/test-fullvirt-tsc-timer.cfg +++ libvirt-3.3.0/tests/xlconfigdata/test-fullvirt-tsc-timer.cfg @@ -9,8 +9,8 @@ apic = 1 hap = 0 viridian = 0 tsc_mode = "native" -rtc_timeoffset = 0 -localtime = 0 +rtc_timeoffset = 3600 +localtime = 1 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" Index: libvirt-3.3.0/tests/xlconfigdata/test-fullvirt-tsc-timer.xml =================================================================== --- libvirt-3.3.0.orig/tests/xlconfigdata/test-fullvirt-tsc-timer.xml +++ libvirt-3.3.0/tests/xlconfigdata/test-fullvirt-tsc-timer.xml @@ -15,7 +15,7 @@ <pae/> <hap state='off'/> </features> - <clock offset='variable' adjustment='0' basis='utc'> + <clock offset='variable' adjustment='3600' basis='localtime'> <timer name='tsc' present='yes' mode='native'/> </clock> <on_poweroff>destroy</on_poweroff>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor