libvirt/6e4759d0-libxl-timer-fix.patch
James Fehlig f167ba3466 Accepting request 456194 from home:jfehlig:branches:Virtualization
- apparmor: don't fail on non-apparmor <seclabel>
  apparmor-errormsg-fix.patch, apparmor-alt-seclabel.patch
  bsc#1023436

- libxl: fix reporting of domain maximum memory
  ff225538-libxl-autoballoon-setting.patch,
  c89a6e78-libxl-physinfo-cleanup.patch,
  d2b77608-libxl-maxmem-fix.patch,
  79692c38-libxl-dom0-maxmem.patch
  bsc#1017762

- libxl: set disk format to raw if not specified and fix disk
  detach
  321a28c6-libxl-default-disk-format.patch,
  bd116810-libxl-fix-disk-detach.patch
  bsc#1003379

- libxl: fix timer configurations
  6e4759d0-libxl-timer-fix.patch,
  87df87e0-libxl-timer-tsc-emulate.patch,
  b4386fda-xenconfig-timer-fix.patch, d3970925-timer-tests.patch
  bsc#1019969

OBS-URL: https://build.opensuse.org/request/show/456194
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=583
2017-02-10 23:01:12 +00:00

82 lines
3.2 KiB
Diff

commit 6e4759d0695429e36765f3e1c516939a369799f2
Author: Jim Fehlig <jfehlig@suse.com>
Date: Mon Jan 16 15:37:40 2017 -0700
libxl: fix timer configuration
The current logic around configuring timers in libxl based on
virDomainDef object is a bit brain dead. Unsupported timers are
silently ignored and tsc is only recognized if it is the first
timer specified.
Change the logic to reject unsupported timers and honor the tsc
timer regardless of its order when multiple timers are specified.
Index: libvirt-3.0.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_conf.c
+++ libvirt-3.0.0/src/libxl/libxl_conf.c
@@ -313,9 +313,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr de
for (i = 0; i < virDomainDefGetVcpus(def); i++)
libxl_bitmap_set((&b_info->avail_vcpus), i);
- if (def->clock.ntimers > 0 &&
- def->clock.timers[0]->name == VIR_DOMAIN_TIMER_NAME_TSC) {
- switch (def->clock.timers[0]->mode) {
+ for (i = 0; i < def->clock.ntimers; i++) {
+ switch ((virDomainTimerNameType) def->clock.timers[i]->name) {
+ case VIR_DOMAIN_TIMER_NAME_TSC:
+ switch (def->clock.timers[i]->mode) {
case VIR_DOMAIN_TIMER_MODE_NATIVE:
b_info->tsc_mode = 2;
break;
@@ -324,8 +325,35 @@ libxlMakeDomBuildInfo(virDomainDefPtr de
break;
default:
b_info->tsc_mode = 1;
+ }
+ break;
+
+ case VIR_DOMAIN_TIMER_NAME_HPET:
+ if (!hvm) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported timer type (name) '%s'"),
+ virDomainTimerNameTypeToString(def->clock.timers[i]->name));
+ return -1;
+ }
+ if (def->clock.timers[i]->present == 1)
+ libxl_defbool_set(&b_info->u.hvm.hpet, 1);
+ break;
+
+ case VIR_DOMAIN_TIMER_NAME_PLATFORM:
+ case VIR_DOMAIN_TIMER_NAME_KVMCLOCK:
+ case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK:
+ case VIR_DOMAIN_TIMER_NAME_RTC:
+ case VIR_DOMAIN_TIMER_NAME_PIT:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported timer type (name) '%s'"),
+ virDomainTimerNameTypeToString(def->clock.timers[i]->name));
+ return -1;
+
+ case VIR_DOMAIN_TIMER_NAME_LAST:
+ break;
}
}
+
b_info->sched_params.weight = 1000;
b_info->max_memkb = virDomainDefGetMemoryInitial(def);
b_info->target_memkb = def->mem.cur_balloon;
@@ -341,12 +369,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr de
libxl_defbool_set(&b_info->u.hvm.acpi,
def->features[VIR_DOMAIN_FEATURE_ACPI] ==
VIR_TRISTATE_SWITCH_ON);
- for (i = 0; i < def->clock.ntimers; i++) {
- if (def->clock.timers[i]->name == VIR_DOMAIN_TIMER_NAME_HPET &&
- def->clock.timers[i]->present == 1) {
- libxl_defbool_set(&b_info->u.hvm.hpet, 1);
- }
- }
if (def->nsounds > 0) {
/*