From c5e448dfb33cd20dc6e34ace8fbd34f6b3e3a09cf856a0dedf8e8efa339945b9 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Mon, 5 Mar 2018 17:46:32 +0000 Subject: [PATCH] Accepting request 583090 from home:jfehlig:branches:Virtualization - Update to libvirt 4.1.0 - Many incremental improvements and bug fixes, see http://libvirt.org/news.html - Dropped patches: 72adaf2f-revert-qemu-monitor-error-report.patch, 71d56a39-nodedev-fix-parse-PCI-address.patch, 68eed56b-conf-smbios-oem-strings.patch, 76977061-qemu-smbios-oem-strings.patch, 0c710a37-libxl-resume-lock-on-mig-failure.patch, 759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch, c2dc6698-fix-deadlock-obtaining-hostname.patch, c391e07e-libxl-clock-settings.patch, ef71caea-libxl-memalign.patch, suse-apparmor-signal.patch OBS-URL: https://build.opensuse.org/request/show/583090 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674 --- ...stats-functions-from-the-qemu-driver.patch | 83 +++-- ...c-implement-connectGetAllDomainStats.patch | 17 +- ...a37-libxl-resume-lock-on-mig-failure.patch | 52 ---- 68eed56b-conf-smbios-oem-strings.patch | 245 --------------- 71d56a39-nodedev-fix-parse-PCI-address.patch | 96 ------ ...f2f-revert-qemu-monitor-error-report.patch | 60 ---- ...-the-hostname-on-startup-CVE-2018-67.patch | 65 ---- 76977061-qemu-smbios-oem-strings.patch | 110 ------- apibuild-py3.patch | 6 +- apparmor-no-mount.patch | 6 +- blockcopy-check-dst-identical-device.patch | 8 +- ...6698-fix-deadlock-obtaining-hostname.patch | 121 -------- c391e07e-libxl-clock-settings.patch | 284 ------------------ ef71caea-libxl-memalign.patch | 33 -- libvirt-4.0.0.tar.xz | 3 - libvirt-4.0.0.tar.xz.asc | 10 - libvirt-4.1.0.tar.xz | 3 + libvirt-4.1.0.tar.xz.asc | 10 + libvirt-power8-models.patch | 8 +- libvirt-suse-netcontrol.patch | 56 ++-- libvirt.changes | 18 ++ libvirt.spec | 81 ++--- libxl-dom-reset.patch | 10 +- libxl-qemu-emulator-caps.patch | 6 +- libxl-set-cach-mode.patch | 6 +- libxl-set-migration-constraints.patch | 42 +-- libxl-support-block-script.patch | 6 +- lxc-wait-after-eth-del.patch | 32 +- ...e-dhcp-authoritative-on-static-netwo.patch | 14 +- ppc64le-canonical-name.patch | 6 +- qemu-apparmor-screenshot.patch | 6 +- support-managed-pci-xen-driver.patch | 12 +- suse-apparmor-libnl-paths.patch | 12 +- suse-apparmor-signal.patch | 25 -- suse-libvirt-guests-service.patch | 28 +- suse-libvirtd-disable-tls.patch | 18 +- suse-libvirtd-service-xen.patch | 10 +- suse-libvirtd-sysconfig-settings.patch | 6 +- suse-ovmf-paths.patch | 12 +- suse-qemu-conf.patch | 6 +- suse-virtlockd-sysconfig-settings.patch | 6 +- suse-virtlogd-sysconfig-settings.patch | 6 +- xen-pv-cdrom.patch | 6 +- xen-sxpr-disk-type.patch | 6 +- 44 files changed, 290 insertions(+), 1366 deletions(-) delete mode 100644 0c710a37-libxl-resume-lock-on-mig-failure.patch delete mode 100644 68eed56b-conf-smbios-oem-strings.patch delete mode 100644 71d56a39-nodedev-fix-parse-PCI-address.patch delete mode 100644 72adaf2f-revert-qemu-monitor-error-report.patch delete mode 100644 759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch delete mode 100644 76977061-qemu-smbios-oem-strings.patch delete mode 100644 c2dc6698-fix-deadlock-obtaining-hostname.patch delete mode 100644 c391e07e-libxl-clock-settings.patch delete mode 100644 ef71caea-libxl-memalign.patch delete mode 100644 libvirt-4.0.0.tar.xz delete mode 100644 libvirt-4.0.0.tar.xz.asc create mode 100644 libvirt-4.1.0.tar.xz create mode 100644 libvirt-4.1.0.tar.xz.asc delete mode 100644 suse-apparmor-signal.patch diff --git a/0001-Extract-stats-functions-from-the-qemu-driver.patch b/0001-Extract-stats-functions-from-the-qemu-driver.patch index bcaac6e..6b54edc 100644 --- a/0001-Extract-stats-functions-from-the-qemu-driver.patch +++ b/0001-Extract-stats-functions-from-the-qemu-driver.patch @@ -18,11 +18,11 @@ them. create mode 100644 src/conf/domain_stats.c create mode 100644 src/conf/domain_stats.h -diff --git a/src/Makefile.am b/src/Makefile.am -index 166c9a8e9..25f913a5f 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -404,6 +404,7 @@ DOMAIN_CONF_SOURCES = \ +Index: libvirt-4.1.0/src/Makefile.am +=================================================================== +--- libvirt-4.1.0.orig/src/Makefile.am ++++ libvirt-4.1.0/src/Makefile.am +@@ -441,6 +441,7 @@ DOMAIN_CONF_SOURCES = \ conf/domain_conf.c conf/domain_conf.h \ conf/domain_audit.c conf/domain_audit.h \ conf/domain_nwfilter.c conf/domain_nwfilter.h \ @@ -30,11 +30,10 @@ index 166c9a8e9..25f913a5f 100644 conf/virsavecookie.c conf/virsavecookie.h \ conf/snapshot_conf.c conf/snapshot_conf.h \ conf/numa_conf.c conf/numa_conf.h \ -diff --git a/src/conf/domain_stats.c b/src/conf/domain_stats.c -new file mode 100644 -index 000000000..beb3c09d5 +Index: libvirt-4.1.0/src/conf/domain_stats.c +=================================================================== --- /dev/null -+++ b/src/conf/domain_stats.c ++++ libvirt-4.1.0/src/conf/domain_stats.c @@ -0,0 +1,139 @@ +/* + * domain_stats.c: domain stats extraction helpers @@ -175,11 +174,10 @@ index 000000000..beb3c09d5 +} + +#undef STATS_ADD_NET_PARAM -diff --git a/src/conf/domain_stats.h b/src/conf/domain_stats.h -new file mode 100644 -index 000000000..42f8cb6d3 +Index: libvirt-4.1.0/src/conf/domain_stats.h +=================================================================== --- /dev/null -+++ b/src/conf/domain_stats.h ++++ libvirt-4.1.0/src/conf/domain_stats.h @@ -0,0 +1,64 @@ +/* + * domain_stats.h: domain stats extraction helpers @@ -245,11 +243,11 @@ index 000000000..42f8cb6d3 + int *maxparams); + +#endif /* __DOMAIN_STATS_H */ -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index bc8cc1fba..2e22abcec 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -630,6 +630,9 @@ virDomainConfNWFilterRegister; +Index: libvirt-4.1.0/src/libvirt_private.syms +=================================================================== +--- libvirt-4.1.0.orig/src/libvirt_private.syms ++++ libvirt-4.1.0/src/libvirt_private.syms +@@ -644,6 +644,9 @@ virDomainConfNWFilterRegister; virDomainConfNWFilterTeardown; virDomainConfVMNWFilterTeardown; @@ -259,7 +257,7 @@ index bc8cc1fba..2e22abcec 100644 # conf/interface_conf.h virInterfaceDefFormat; -@@ -1468,6 +1471,7 @@ virCgroupGetMemoryUsage; +@@ -1500,6 +1503,7 @@ virCgroupGetMemoryUsage; virCgroupGetMemSwapHardLimit; virCgroupGetMemSwapUsage; virCgroupGetPercpuStats; @@ -267,10 +265,10 @@ index bc8cc1fba..2e22abcec 100644 virCgroupHasController; virCgroupHasEmptyTasks; virCgroupKill; -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index a203c9297..f60436e4c 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c +Index: libvirt-4.1.0/src/qemu/qemu_driver.c +=================================================================== +--- libvirt-4.1.0.orig/src/qemu/qemu_driver.c ++++ libvirt-4.1.0/src/qemu/qemu_driver.c @@ -72,6 +72,7 @@ #include "viralloc.h" #include "viruuid.h" @@ -279,7 +277,7 @@ index a203c9297..f60436e4c 100644 #include "domain_audit.h" #include "node_device_conf.h" #include "virpci.h" -@@ -19380,21 +19381,7 @@ qemuDomainGetStatsState(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, +@@ -19518,21 +19519,7 @@ qemuDomainGetStatsState(virQEMUDriverPtr int *maxparams, unsigned int privflags ATTRIBUTE_UNUSED) { @@ -302,7 +300,7 @@ index a203c9297..f60436e4c 100644 } -@@ -19417,37 +19404,7 @@ qemuDomainGetStatsCpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, +@@ -19555,37 +19542,7 @@ qemuDomainGetStatsCpu(virQEMUDriverPtr d unsigned int privflags ATTRIBUTE_UNUSED) { qemuDomainObjPrivatePtr priv = dom->privateData; @@ -341,7 +339,7 @@ index a203c9297..f60436e4c 100644 } static int -@@ -19624,44 +19581,6 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver, +@@ -19764,44 +19721,6 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr return ret; } @@ -386,7 +384,7 @@ index a203c9297..f60436e4c 100644 static int qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, virDomainObjPtr dom, -@@ -19669,68 +19588,9 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, +@@ -19809,68 +19728,9 @@ qemuDomainGetStatsInterface(virQEMUDrive int *maxparams, unsigned int privflags ATTRIBUTE_UNUSED) { @@ -456,7 +454,7 @@ index a203c9297..f60436e4c 100644 #define QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, num, name, value) \ do { \ char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \ -@@ -19852,10 +19712,10 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver, +@@ -19992,10 +19852,10 @@ qemuDomainGetStatsOneBlock(virQEMUDriver if (disk->info.alias) alias = qemuDomainStorageAlias(disk->info.alias, backing_idx); @@ -469,7 +467,7 @@ index a203c9297..f60436e4c 100644 block_idx, src->path); if (backing_idx) QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, block_idx, "backingIndex", -@@ -19971,7 +19831,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, +@@ -20111,7 +19971,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr * after the iteration than it is to iterate twice; but we still * want count listed first. */ count_index = record->nparams; @@ -478,7 +476,7 @@ index a203c9297..f60436e4c 100644 for (i = 0; i < dom->def->ndisks; i++) { virDomainDiskDefPtr disk = dom->def->disks[i]; -@@ -20005,10 +19865,6 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, +@@ -20145,10 +20005,6 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr #undef QEMU_ADD_BLOCK_PARAM_ULL @@ -489,11 +487,11 @@ index a203c9297..f60436e4c 100644 static int qemuDomainGetStatsPerfOneEvent(virPerfPtr perf, virPerfEventType type, -diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c -index 0a31947b0..04ef4c1a7 100644 ---- a/src/util/vircgroup.c -+++ b/src/util/vircgroup.c -@@ -4122,6 +4122,44 @@ virCgroupControllerAvailable(int controller) +Index: libvirt-4.1.0/src/util/vircgroup.c +=================================================================== +--- libvirt-4.1.0.orig/src/util/vircgroup.c ++++ libvirt-4.1.0/src/util/vircgroup.c +@@ -4122,6 +4122,44 @@ virCgroupControllerAvailable(int control return ret; } @@ -538,7 +536,7 @@ index 0a31947b0..04ef4c1a7 100644 #else /* !VIR_CGROUP_SUPPORTED */ bool -@@ -4899,6 +4937,14 @@ virCgroupControllerAvailable(int controller ATTRIBUTE_UNUSED) +@@ -4899,6 +4937,14 @@ virCgroupControllerAvailable(int control { return false; } @@ -553,11 +551,11 @@ index 0a31947b0..04ef4c1a7 100644 #endif /* !VIR_CGROUP_SUPPORTED */ -diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h -index d83392767..2ebdf9505 100644 ---- a/src/util/vircgroup.h -+++ b/src/util/vircgroup.h -@@ -297,4 +297,8 @@ int virCgroupSetOwner(virCgroupPtr cgroup, +Index: libvirt-4.1.0/src/util/vircgroup.h +=================================================================== +--- libvirt-4.1.0.orig/src/util/vircgroup.h ++++ libvirt-4.1.0/src/util/vircgroup.h +@@ -297,4 +297,8 @@ int virCgroupSetOwner(virCgroupPtr cgrou int virCgroupHasEmptyTasks(virCgroupPtr cgroup, int controller); bool virCgroupControllerAvailable(int controller); @@ -566,6 +564,3 @@ index d83392767..2ebdf9505 100644 + virDomainStatsRecordPtr record, + int *maxparams); #endif /* __VIR_CGROUP_H__ */ --- -2.15.1 - diff --git a/0002-lxc-implement-connectGetAllDomainStats.patch b/0002-lxc-implement-connectGetAllDomainStats.patch index 6c62c7a..3ce0a8e 100644 --- a/0002-lxc-implement-connectGetAllDomainStats.patch +++ b/0002-lxc-implement-connectGetAllDomainStats.patch @@ -9,11 +9,11 @@ them using the existing API. src/lxc/lxc_driver.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) -diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c -index b3447100f..10667c134 100644 ---- a/src/lxc/lxc_driver.c -+++ b/src/lxc/lxc_driver.c -@@ -81,6 +81,7 @@ +Index: libvirt-4.1.0/src/lxc/lxc_driver.c +=================================================================== +--- libvirt-4.1.0.orig/src/lxc/lxc_driver.c ++++ libvirt-4.1.0/src/lxc/lxc_driver.c +@@ -80,6 +80,7 @@ #include "viraccessapichecklxc.h" #include "virhostdev.h" #include "netdev_bandwidth_conf.h" @@ -21,7 +21,7 @@ index b3447100f..10667c134 100644 #define VIR_FROM_THIS VIR_FROM_LXC -@@ -5485,6 +5486,142 @@ lxcDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) +@@ -5514,6 +5515,142 @@ lxcDomainHasManagedSaveImage(virDomainPt return ret; } @@ -164,7 +164,7 @@ index b3447100f..10667c134 100644 /* Function Tables */ static virHypervisorDriver lxcHypervisorDriver = { -@@ -5579,6 +5716,7 @@ static virHypervisorDriver lxcHypervisorDriver = { +@@ -5608,6 +5745,7 @@ static virHypervisorDriver lxcHypervisor .nodeGetFreePages = lxcNodeGetFreePages, /* 1.2.6 */ .nodeAllocPages = lxcNodeAllocPages, /* 1.2.9 */ .domainHasManagedSaveImage = lxcDomainHasManagedSaveImage, /* 1.2.13 */ @@ -172,6 +172,3 @@ index b3447100f..10667c134 100644 }; static virConnectDriver lxcConnectDriver = { --- -2.15.1 - diff --git a/0c710a37-libxl-resume-lock-on-mig-failure.patch b/0c710a37-libxl-resume-lock-on-mig-failure.patch deleted file mode 100644 index 0f62cfc..0000000 --- a/0c710a37-libxl-resume-lock-on-mig-failure.patch +++ /dev/null @@ -1,52 +0,0 @@ -commit 0c710a37ea265dc7dfa0ebcebf1e21e4c6b2ea21 -Author: Jim Fehlig -Date: Wed Jan 24 14:23:04 2018 -0700 - - libxl: resume lock process after failed migration - - During migration, the lock process is paused in the perform phase - but not resumed if there is a subsequent failure, leaving the locked - resource unprotected. - - The perform phase itself can fail, in which case the lock process - should be resumed before returning from perform. The finish phase - could also fail on the destination host, in which case the migration - is canceled in the confirm phase and the VM is resumed. The lock - process needs to be resumed there as well. - - Signed-off-by: Jim Fehlig - -Index: libvirt-4.0.0/src/libxl/libxl_migration.c -=================================================================== ---- libvirt-4.0.0.orig/src/libxl/libxl_migration.c -+++ libvirt-4.0.0/src/libxl/libxl_migration.c -@@ -1238,6 +1238,12 @@ libxlDomainMigrationPerform(libxlDriverP - ret = libxlDoMigrateSend(driver, vm, flags, sockfd); - virObjectLock(vm); - -+ if (ret < 0) -+ virDomainLockProcessResume(driver->lockManager, -+ "xen:///system", -+ vm, -+ priv->lockState); -+ - cleanup: - VIR_FORCE_CLOSE(sockfd); - virURIFree(uri); -@@ -1349,10 +1355,16 @@ libxlDomainMigrationConfirm(libxlDriverP - int cancelled) - { - libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); -+ libxlDomainObjPrivatePtr priv = vm->privateData; - virObjectEventPtr event = NULL; - int ret = -1; - - if (cancelled) { -+ /* Resume lock process that was paused in MigrationPerform */ -+ virDomainLockProcessResume(driver->lockManager, -+ "xen:///system", -+ vm, -+ priv->lockState); - if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, 0) == 0) { - ret = 0; - } else { diff --git a/68eed56b-conf-smbios-oem-strings.patch b/68eed56b-conf-smbios-oem-strings.patch deleted file mode 100644 index 781a36c..0000000 --- a/68eed56b-conf-smbios-oem-strings.patch +++ /dev/null @@ -1,245 +0,0 @@ -commit 68eed56b2d51e66bb540062fe09f5ffd44e99f6e -Author: Daniel P. Berrange -Date: Sat Oct 28 14:56:51 2017 +0100 - - conf: add support for setting OEM strings SMBIOS data fields - - The OEM strings table in SMBIOS allows the vendor to pass arbitrary - strings into the guest OS. This can be used as a way to pass data to an - application like cloud-init, or potentially as an alternative to the - kernel command line for OS installers where you can't modify the install - ISO image to change the kernel args. - - As an example, consider if cloud-init and anaconda supported OEM strings - you could use something like - - - cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/ - anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os - - - use of a application specific prefix as illustrated above is - recommended, but not mandated, so that an app can reliably identify - which of the many OEM strings are targetted at it. - - Reviewed-by: John Ferlan - Signed-off-by: Daniel P. Berrange - -Index: libvirt-4.0.0/docs/formatdomain.html.in -=================================================================== ---- libvirt-4.0.0.orig/docs/formatdomain.html.in -+++ libvirt-4.0.0/docs/formatdomain.html.in -@@ -411,6 +411,10 @@ - <entry name='version'>0B98401 Pro</entry> - <entry name='serial'>W1KS427111E</entry> - </baseBoard> -+ <oemStrings> -+ <entry>myappname:some arbitrary data</entry> -+ <entry>otherappname:more arbitrary data</entry> -+ </oemStrings> - </sysinfo> - ... - -@@ -498,6 +502,15 @@ - validation and date format checking, all values are - passed as strings to the hypervisor driver. - -+
oemStrings
-+
-+ This is block 11 of SMBIOS. This element should appear once and -+ can have multiple entry child elements, each providing -+ arbitrary string data. There are no restrictions on what data can -+ be provided in the entries, however, if the data is intended to be -+ consumed by an application in the guest, it is recommended to use -+ the application name as a prefix in the string. (Since 4.1.0) -+
- - - -Index: libvirt-4.0.0/docs/schemas/domaincommon.rng -=================================================================== ---- libvirt-4.0.0.orig/docs/schemas/domaincommon.rng -+++ libvirt-4.0.0/docs/schemas/domaincommon.rng -@@ -4857,6 +4857,15 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -Index: libvirt-4.0.0/src/conf/domain_conf.c -=================================================================== ---- libvirt-4.0.0.orig/src/conf/domain_conf.c -+++ libvirt-4.0.0/src/conf/domain_conf.c -@@ -14461,6 +14461,42 @@ virSysinfoBaseBoardParseXML(xmlXPathCont - return ret; - } - -+ -+static int -+virSysinfoOEMStringsParseXML(xmlXPathContextPtr ctxt, -+ virSysinfoOEMStringsDefPtr *oem) -+{ -+ int ret = -1; -+ virSysinfoOEMStringsDefPtr def; -+ xmlNodePtr *strings = NULL; -+ int nstrings; -+ size_t i; -+ -+ nstrings = virXPathNodeSet("./entry", ctxt, &strings); -+ if (nstrings < 0) -+ return -1; -+ if (nstrings == 0) -+ return 0; -+ -+ if (VIR_ALLOC(def) < 0) -+ goto cleanup; -+ -+ if (VIR_ALLOC_N(def->values, nstrings) < 0) -+ goto cleanup; -+ -+ def->nvalues = nstrings; -+ for (i = 0; i < nstrings; i++) -+ def->values[i] = virXMLNodeContentString(strings[i]); -+ -+ *oem = def; -+ def = NULL; -+ ret = 0; -+ cleanup: -+ VIR_FREE(strings); -+ virSysinfoOEMStringsDefFree(def); -+ return ret; -+} -+ - static virSysinfoDefPtr - virSysinfoParseXML(xmlNodePtr node, - xmlXPathContextPtr ctxt, -@@ -14519,6 +14555,17 @@ virSysinfoParseXML(xmlNodePtr node, - if (virSysinfoBaseBoardParseXML(ctxt, &def->baseBoard, &def->nbaseBoard) < 0) - goto error; - -+ /* Extract system related metadata */ -+ if ((tmpnode = virXPathNode("./oemStrings[1]", ctxt)) != NULL) { -+ oldnode = ctxt->node; -+ ctxt->node = tmpnode; -+ if (virSysinfoOEMStringsParseXML(ctxt, &def->oemStrings) < 0) { -+ ctxt->node = oldnode; -+ goto error; -+ } -+ ctxt->node = oldnode; -+ } -+ - cleanup: - VIR_FREE(type); - return def; -Index: libvirt-4.0.0/src/util/virsysinfo.c -=================================================================== ---- libvirt-4.0.0.orig/src/util/virsysinfo.c -+++ libvirt-4.0.0/src/util/virsysinfo.c -@@ -108,6 +108,20 @@ void virSysinfoBaseBoardDefClear(virSysi - VIR_FREE(def->location); - } - -+void virSysinfoOEMStringsDefFree(virSysinfoOEMStringsDefPtr def) -+{ -+ size_t i; -+ -+ if (def == NULL) -+ return; -+ -+ for (i = 0; i < def->nvalues; i++) -+ VIR_FREE(def->values[i]); -+ VIR_FREE(def->values); -+ -+ VIR_FREE(def); -+} -+ - /** - * virSysinfoDefFree: - * @def: a sysinfo structure -@@ -157,6 +171,8 @@ void virSysinfoDefFree(virSysinfoDefPtr - } - VIR_FREE(def->memory); - -+ virSysinfoOEMStringsDefFree(def->oemStrings); -+ - VIR_FREE(def); - } - -@@ -1294,6 +1310,24 @@ virSysinfoMemoryFormat(virBufferPtr buf, - } - } - -+static void -+virSysinfoOEMStringsFormat(virBufferPtr buf, virSysinfoOEMStringsDefPtr def) -+{ -+ size_t i; -+ -+ if (!def) -+ return; -+ -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ for (i = 0; i < def->nvalues; i++) { -+ virBufferEscapeString(buf, "%s\n", -+ def->values[i]); -+ } -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+} -+ - /** - * virSysinfoFormat: - * @buf: buffer to append output to (may use auto-indentation) -@@ -1324,6 +1358,7 @@ virSysinfoFormat(virBufferPtr buf, virSy - virSysinfoBaseBoardFormat(&childrenBuf, def->baseBoard, def->nbaseBoard); - virSysinfoProcessorFormat(&childrenBuf, def); - virSysinfoMemoryFormat(&childrenBuf, def); -+ virSysinfoOEMStringsFormat(&childrenBuf, def->oemStrings); - - virBufferAsprintf(buf, " -Date: Fri Jan 5 17:10:47 2018 -0700 - - nodedev: Fix failing to parse PCI address for non-PCI network devices - - Commit 8708ca01c added virNetDevSwitchdevFeature() to check if a network - device has Switchdev capabilities. virNetDevSwitchdevFeature() attempts - to retrieve the PCI device associated with the network device, ignoring - non-PCI devices. It does so via the following call chain - - virNetDevSwitchdevFeature()->virNetDevGetPCIDevice()-> - virPCIGetDeviceAddressFromSysfsLink() - - For non-PCI network devices (qeth, Xen vif, etc), - virPCIGetDeviceAddressFromSysfsLink() will report an error when - virPCIDeviceAddressParse() fails. virPCIDeviceAddressParse() also - logs an error. After commit 8708ca01c there are now two errors reported - for each non-PCI network device even though the errors are harmless. - - To avoid the errors, introduce virNetDevIsPCIDevice() and use it in - virNetDevGetPCIDevice() before attempting to retrieve the associated - PCI device. virNetDevIsPCIDevice() uses the 'subsystem' property of the - device to determine if it is PCI. See the sysfs rules in kernel - documentation for more details - - https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html - -Index: libvirt-4.0.0/src/util/virnetdev.c -=================================================================== ---- libvirt-4.0.0.orig/src/util/virnetdev.c -+++ libvirt-4.0.0/src/util/virnetdev.c -@@ -22,6 +22,7 @@ - - #include - -+#include "dirname.h" - #include "virnetdev.h" - #include "virnetlink.h" - #include "virmacaddr.h" -@@ -1147,6 +1148,45 @@ virNetDevSysfsDeviceFile(char **pf_sysfs - return 0; - } - -+/** -+ * Determine if the device path specified in devpath is a PCI Device -+ * by resolving the 'subsystem'-link in devpath and looking for -+ * 'pci' in the last component. For more information see the rules -+ * for accessing sysfs in the kernel docs -+ * -+ * https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html -+ * -+ * Returns true if devpath's susbsystem is pci, false otherwise. -+ */ -+static bool -+virNetDevIsPCIDevice(const char *devpath) -+{ -+ char *subsys_link = NULL; -+ char *abs_path = NULL; -+ char *subsys = NULL; -+ bool ret = false; -+ -+ if (virAsprintf(&subsys_link, "%s/subsystem", devpath) < 0) -+ return false; -+ -+ if (!virFileExists(subsys_link)) -+ goto cleanup; -+ -+ if (virFileResolveLink(subsys_link, &abs_path) < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unable to resolve device subsystem symlink %s"), -+ subsys_link); -+ goto cleanup; -+ } -+ -+ subsys = last_component(abs_path); -+ ret = STRPREFIX(subsys, "pci"); -+ -+ cleanup: -+ VIR_FREE(subsys_link); -+ VIR_FREE(abs_path); -+ return ret; -+} - - static virPCIDevicePtr - virNetDevGetPCIDevice(const char *devName) -@@ -1158,6 +1198,9 @@ virNetDevGetPCIDevice(const char *devNam - if (virNetDevSysfsFile(&vfSysfsDevicePath, devName, "device") < 0) - goto cleanup; - -+ if (!virNetDevIsPCIDevice(vfSysfsDevicePath)) -+ goto cleanup; -+ - vfPCIAddr = virPCIGetDeviceAddressFromSysfsLink(vfSysfsDevicePath); - if (!vfPCIAddr) - goto cleanup; diff --git a/72adaf2f-revert-qemu-monitor-error-report.patch b/72adaf2f-revert-qemu-monitor-error-report.patch deleted file mode 100644 index b85707c..0000000 --- a/72adaf2f-revert-qemu-monitor-error-report.patch +++ /dev/null @@ -1,60 +0,0 @@ -commit 72adaf2f10509c3682f2c65ffad4176e00e5a2fb -Author: Michal Privoznik -Date: Fri Jan 19 13:53:57 2018 +0100 - - Revert "qemu: monitor: do not report error on shutdown" - - https://bugzilla.redhat.com/show_bug.cgi?id=1536461 - - This reverts commit aeda1b8c56dc58b0a413acc61bbea938b40499e1. - - Problem is that we need mon->lastError to be set because it's - used all over the place. Also, there's nothing wrong with - reporting error if one occurred. I mean, if there's a thread - executing an API and which currently is talking on monitor it - definitely wants the error reported. - - Signed-off-by: Michal Privoznik - -Index: libvirt-4.0.0/src/qemu/qemu_monitor.c -=================================================================== ---- libvirt-4.0.0.orig/src/qemu/qemu_monitor.c -+++ libvirt-4.0.0/src/qemu/qemu_monitor.c -@@ -78,7 +78,6 @@ struct _qemuMonitor { - * < 0: an error occurred during the registration of @fd */ - int watch; - int hasSendFD; -- int willhangup; - - virDomainObjPtr vm; - -@@ -716,10 +715,8 @@ qemuMonitorIO(int watch, int fd, int eve - if (events & VIR_EVENT_HANDLE_HANGUP) { - hangup = true; - if (!error) { -- if (!mon->willhangup) { -- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -- _("End of file from qemu monitor")); -- } -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("End of file from qemu monitor")); - eof = true; - events &= ~VIR_EVENT_HANDLE_HANGUP; - } -@@ -758,7 +755,7 @@ qemuMonitorIO(int watch, int fd, int eve - if (mon->lastError.code != VIR_ERR_OK) { - /* Already have an error, so clear any new error */ - virResetLastError(); -- } else if (!mon->willhangup) { -+ } else { - virErrorPtr err = virGetLastError(); - if (!err) - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -@@ -1352,7 +1349,6 @@ qemuMonitorEmitShutdown(qemuMonitorPtr m - { - int ret = -1; - VIR_DEBUG("mon=%p guest=%u", mon, guest); -- mon->willhangup = 1; - - QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm, guest); - return ret; diff --git a/759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch b/759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch deleted file mode 100644 index d14d104..0000000 --- a/759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 759b4d1b0fe5f4d84d98b99153dfa7ac289dd167 Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Sat, 27 Jan 2018 23:43:58 +0100 -Subject: [PATCH] virlog: determine the hostname on startup CVE-2018-6764 - -At later point it might not be possible or even safe to use getaddrinfo(). It -can in turn result in a load of NSS module. - -Notably, on a LXC container startup we may find ourselves with the guest -filesystem already having replaced the host one. Loading a NSS module -from the guest tree would allow a malicous guest to escape the -confinement of its container environment because libvirt will not yet -have locked it down. ---- - src/util/virlog.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) - -diff --git a/src/util/virlog.c b/src/util/virlog.c -index 68439b919..9105337ce 100644 ---- a/src/util/virlog.c -+++ b/src/util/virlog.c -@@ -64,6 +64,7 @@ - VIR_LOG_INIT("util.log"); - - static regex_t *virLogRegex; -+static char *virLogHostname; - - - #define VIR_LOG_DATE_REGEX "[0-9]{4}-[0-9]{2}-[0-9]{2}" -@@ -271,6 +272,12 @@ virLogOnceInit(void) - VIR_FREE(virLogRegex); - } - -+ /* We get and remember the hostname early, because at later time -+ * it might not be possible to load NSS modules via getaddrinfo() -+ * (e.g. at container startup the host filesystem will not be -+ * accessible anymore. */ -+ virLogHostname = virGetHostnameQuiet(); -+ - virLogUnlock(); - return 0; - } -@@ -466,17 +473,14 @@ static int - virLogHostnameString(char **rawmsg, - char **msg) - { -- char *hostname = virGetHostnameQuiet(); - char *hoststr; - -- if (!hostname) -+ if (!virLogHostname) - return -1; - -- if (virAsprintfQuiet(&hoststr, "hostname: %s", hostname) < 0) { -- VIR_FREE(hostname); -+ if (virAsprintfQuiet(&hoststr, "hostname: %s", virLogHostname) < 0) { - return -1; - } -- VIR_FREE(hostname); - - if (virLogFormatString(msg, 0, NULL, VIR_LOG_INFO, hoststr) < 0) { - VIR_FREE(hoststr); --- -2.15.1 - diff --git a/76977061-qemu-smbios-oem-strings.patch b/76977061-qemu-smbios-oem-strings.patch deleted file mode 100644 index 791e37b..0000000 --- a/76977061-qemu-smbios-oem-strings.patch +++ /dev/null @@ -1,110 +0,0 @@ -commit 7697706135562121732a5ddb5574a4afb269645f -Author: Daniel P. Berrange -Date: Wed Jan 17 17:35:13 2018 +0000 - - qemu: add support for generating SMBIOS OEM strings command line - - This wires up the previously added OEM strings XML schema to be able to - generate comamnd line args for QEMU. This requires QEMU >= 2.12 release - containing this patch: - - commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd - Author: Daniel P. Berrange - Date: Sat Oct 28 21:51:36 2017 +0100 - - smbios: support setting OEM strings table - - Reviewed-by: John Ferlan - Signed-off-by: Daniel P. Berrange - -Index: libvirt-4.0.0/src/qemu/qemu_command.c -=================================================================== ---- libvirt-4.0.0.orig/src/qemu/qemu_command.c -+++ libvirt-4.0.0/src/qemu/qemu_command.c -@@ -6142,6 +6142,26 @@ qemuBuildSmbiosBaseBoardStr(virSysinfoBa - } - - -+static char * -+qemuBuildSmbiosOEMStringsStr(virSysinfoOEMStringsDefPtr def) -+{ -+ virBuffer buf = VIR_BUFFER_INITIALIZER; -+ size_t i; -+ -+ if (!def) -+ return NULL; -+ -+ virBufferAddLit(&buf, "type=11"); -+ -+ for (i = 0; i < def->nvalues; i++) { -+ virBufferAddLit(&buf, ",value="); -+ virQEMUBuildBufferEscapeComma(&buf, def->values[i]); -+ } -+ -+ return virBufferContentAndReset(&buf); -+} -+ -+ - static int - qemuBuildSmbiosCommandLine(virCommandPtr cmd, - virQEMUDriverPtr driver, -@@ -6210,6 +6230,14 @@ qemuBuildSmbiosCommandLine(virCommandPtr - return -1; - - virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL); -+ VIR_FREE(smbioscmd); -+ } -+ -+ if (source->oemStrings) { -+ if (!(smbioscmd = qemuBuildSmbiosOEMStringsStr(source->oemStrings))) -+ return -1; -+ -+ virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL); - VIR_FREE(smbioscmd); - } - } -Index: libvirt-4.0.0/tests/qemuxml2argvdata/smbios.args -=================================================================== ---- libvirt-4.0.0.orig/tests/qemuxml2argvdata/smbios.args -+++ libvirt-4.0.0/tests/qemuxml2argvdata/smbios.args -@@ -17,6 +17,8 @@ serial=32dfcb37-5af1-552b-357c-be8c3aa38 - uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809,sku=1234567890,family=Red Hat' \ - -smbios 'type=2,manufacturer=Hewlett-Packard,product=0B4Ch,version=D,\ - serial=CZC1065993,asset=CZC1065993,location=Upside down' \ -+-smbios 'type=11,value=Hello,value=World,value=This is,,\ -+ more tricky value=escaped' \ - -nographic \ - -nodefaults \ - -chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -Index: libvirt-4.0.0/tests/qemuxml2argvdata/smbios.xml -=================================================================== ---- libvirt-4.0.0.orig/tests/qemuxml2argvdata/smbios.xml -+++ libvirt-4.0.0/tests/qemuxml2argvdata/smbios.xml -@@ -26,6 +26,11 @@ - CZC1065993 - Upside down - -+ -+ Hello -+ World -+ This is, more tricky value=escaped -+ - - - hvm -Index: libvirt-4.0.0/tests/qemuxml2xmloutdata/smbios.xml -=================================================================== ---- libvirt-4.0.0.orig/tests/qemuxml2xmloutdata/smbios.xml -+++ libvirt-4.0.0/tests/qemuxml2xmloutdata/smbios.xml -@@ -26,6 +26,11 @@ - CZC1065993 - Upside down - -+ -+ Hello -+ World -+ This is, more tricky value=escaped -+ - - - hvm diff --git a/apibuild-py3.patch b/apibuild-py3.patch index 7779809..c5cd224 100644 --- a/apibuild-py3.patch +++ b/apibuild-py3.patch @@ -1,7 +1,7 @@ -Index: libvirt-4.0.0/docs/apibuild.py +Index: libvirt-4.1.0/docs/apibuild.py =================================================================== ---- libvirt-4.0.0.orig/docs/apibuild.py -+++ libvirt-4.0.0/docs/apibuild.py +--- libvirt-4.1.0.orig/docs/apibuild.py ++++ libvirt-4.1.0/docs/apibuild.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 diff --git a/apparmor-no-mount.patch b/apparmor-no-mount.patch index 4941e8d..4aedc2e 100644 --- a/apparmor-no-mount.patch +++ b/apparmor-no-mount.patch @@ -1,7 +1,7 @@ -Index: libvirt-4.0.0/examples/apparmor/libvirt-lxc +Index: libvirt-4.1.0/examples/apparmor/libvirt-lxc =================================================================== ---- libvirt-4.0.0.orig/examples/apparmor/libvirt-lxc -+++ libvirt-4.0.0/examples/apparmor/libvirt-lxc +--- libvirt-4.1.0.orig/examples/apparmor/libvirt-lxc ++++ libvirt-4.1.0/examples/apparmor/libvirt-lxc @@ -2,39 +2,15 @@ #include diff --git a/blockcopy-check-dst-identical-device.patch b/blockcopy-check-dst-identical-device.patch index 25900d3..ab810ff 100644 --- a/blockcopy-check-dst-identical-device.patch +++ b/blockcopy-check-dst-identical-device.patch @@ -11,11 +11,11 @@ Signed-off-by: Chunyan Liu src/qemu/qemu_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) -Index: libvirt-4.0.0/src/qemu/qemu_driver.c +Index: libvirt-4.1.0/src/qemu/qemu_driver.c =================================================================== ---- libvirt-4.0.0.orig/src/qemu/qemu_driver.c -+++ libvirt-4.0.0/src/qemu/qemu_driver.c -@@ -17159,6 +17159,14 @@ qemuDomainBlockCopyCommon(virDomainObjPt +--- libvirt-4.1.0.orig/src/qemu/qemu_driver.c ++++ libvirt-4.1.0/src/qemu/qemu_driver.c +@@ -17275,6 +17275,14 @@ qemuDomainBlockCopyCommon(virDomainObjPt goto endjob; } diff --git a/c2dc6698-fix-deadlock-obtaining-hostname.patch b/c2dc6698-fix-deadlock-obtaining-hostname.patch deleted file mode 100644 index b6bf51d..0000000 --- a/c2dc6698-fix-deadlock-obtaining-hostname.patch +++ /dev/null @@ -1,121 +0,0 @@ -From c2dc6698c88fb591639e542c8ecb0076c54f3dfb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Mon, 12 Feb 2018 10:03:08 +0000 -Subject: [PATCH] log: fix deadlock obtaining hostname (related CVE-2018-6764) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The fix for CVE-2018-6764 introduced a potential deadlock scenario -that gets triggered by the NSS module when virGetHostname() calls -getaddrinfo to resolve the hostname: - - #0 0x00007f6e714b57e7 in futex_wait - #1 futex_wait_simple - #2 __pthread_once_slow - #3 0x00007f6e71d16e7d in virOnce - #4 0x00007f6e71d0997c in virLogInitialize - #5 0x00007f6e71d0a09a in virLogVMessage - #6 0x00007f6e71d09ffd in virLogMessage - #7 0x00007f6e71d0db22 in virObjectNew - #8 0x00007f6e71d0dbf1 in virObjectLockableNew - #9 0x00007f6e71d0d3e5 in virMacMapNew - #10 0x00007f6e71cdc50a in findLease - #11 0x00007f6e71cdcc56 in _nss_libvirt_gethostbyname4_r - #12 0x00007f6e724631fc in gaih_inet - #13 0x00007f6e72464697 in __GI_getaddrinfo - #14 0x00007f6e71d19e81 in virGetHostnameImpl - #15 0x00007f6e71d1a057 in virGetHostnameQuiet - #16 0x00007f6e71d09936 in virLogOnceInit - #17 0x00007f6e71d09952 in virLogOnce - #18 0x00007f6e714b5829 in __pthread_once_slow - #19 0x00007f6e71d16e7d in virOnce - #20 0x00007f6e71d0997c in virLogInitialize - #21 0x00007f6e71d0a09a in virLogVMessage - #22 0x00007f6e71d09ffd in virLogMessage - #23 0x00007f6e71d0db22 in virObjectNew - #24 0x00007f6e71d0dbf1 in virObjectLockableNew - #25 0x00007f6e71d0d3e5 in virMacMapNew - #26 0x00007f6e71cdc50a in findLease - #27 0x00007f6e71cdc839 in _nss_libvirt_gethostbyname3_r - #28 0x00007f6e71cdc724 in _nss_libvirt_gethostbyname2_r - #29 0x00007f6e7248f72f in __gethostbyname2_r - #30 0x00007f6e7248f494 in gethostbyname2 - #31 0x000056348c30c36d in hosts_keys - #32 0x000056348c30b7d2 in main - -Fortunately the extra stuff virGetHostname does is totally irrelevant to -the needs of the logging code, so we can just inline a call to the -native hostname() syscall directly. - -Signed-off-by: Daniel P. Berrangé ---- - cfg.mk | 2 +- - src/util/virlog.c | 20 ++++++++++++++------ - 2 files changed, 15 insertions(+), 7 deletions(-) - -Index: libvirt-4.0.0/cfg.mk -=================================================================== ---- libvirt-4.0.0.orig/cfg.mk -+++ libvirt-4.0.0/cfg.mk -@@ -1183,7 +1183,7 @@ _src2=src/(util/vircommand|libvirt|lxc/l - exclude_file_name_regexp--sc_prohibit_fork_wrappers = \ - (^($(_src2)|tests/testutils|daemon/libvirtd)\.c$$) - --exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/virutil\.c$$ -+exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/vir(util|log)\.c$$ - - exclude_file_name_regexp--sc_prohibit_internal_functions = \ - ^src/(util/(viralloc|virutil|virfile)\.[hc]|esx/esx_vi\.c)$$ -Index: libvirt-4.0.0/src/util/virlog.c -=================================================================== ---- libvirt-4.0.0.orig/src/util/virlog.c -+++ libvirt-4.0.0/src/util/virlog.c -@@ -64,7 +64,7 @@ - VIR_LOG_INIT("util.log"); - - static regex_t *virLogRegex; --static char *virLogHostname; -+static char virLogHostname[HOST_NAME_MAX+1]; - - - #define VIR_LOG_DATE_REGEX "[0-9]{4}-[0-9]{2}-[0-9]{2}" -@@ -261,6 +261,8 @@ virLogPriorityString(virLogPriority lvl) - static int - virLogOnceInit(void) - { -+ int r; -+ - if (virMutexInit(&virLogMutex) < 0) - return -1; - -@@ -275,8 +277,17 @@ virLogOnceInit(void) - /* We get and remember the hostname early, because at later time - * it might not be possible to load NSS modules via getaddrinfo() - * (e.g. at container startup the host filesystem will not be -- * accessible anymore. */ -- virLogHostname = virGetHostnameQuiet(); -+ * accessible anymore. -+ * Must not use virGetHostname though as that causes re-entrancy -+ * problems if it triggers logging codepaths -+ */ -+ r = gethostname(virLogHostname, sizeof(virLogHostname)); -+ if (r == -1) { -+ ignore_value(virStrcpy(virLogHostname, -+ "(unknown)", sizeof(virLogHostname))); -+ } else { -+ NUL_TERMINATE(virLogHostname); -+ } - - virLogUnlock(); - return 0; -@@ -475,9 +486,6 @@ virLogHostnameString(char **rawmsg, - { - char *hoststr; - -- if (!virLogHostname) -- return -1; -- - if (virAsprintfQuiet(&hoststr, "hostname: %s", virLogHostname) < 0) { - return -1; - } diff --git a/c391e07e-libxl-clock-settings.patch b/c391e07e-libxl-clock-settings.patch deleted file mode 100644 index 1b36a08..0000000 --- a/c391e07e-libxl-clock-settings.patch +++ /dev/null @@ -1,284 +0,0 @@ -commit c391e07eb08d713474ae8998cfd859e1827a4b2d -Author: Jim Fehlig -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 - Reviewed-by: Daniel P. Berrangé - -Index: libvirt-4.0.0/src/libxl/libxl_conf.c -=================================================================== ---- libvirt-4.0.0.orig/src/libxl/libxl_conf.c -+++ libvirt-4.0.0/src/libxl/libxl_conf.c -@@ -274,6 +274,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; -@@ -293,10 +294,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; -@@ -315,10 +344,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; - -@@ -329,7 +358,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-4.0.0/tests/libxlxml2domconfigdata/variable-clock-hvm.json -=================================================================== ---- /dev/null -+++ libvirt-4.0.0/tests/libxlxml2domconfigdata/variable-clock-hvm.json -@@ -0,0 +1,91 @@ -+{ -+ "c_info": { -+ "type": "hvm", -+ "name": "test-hvm", -+ "uuid": "2147d599-9cc6-c0dc-92ab-4064b5446e9b" -+ }, -+ "b_info": { -+ "max_vcpus": 4, -+ "avail_vcpus": [ -+ 0, -+ 1, -+ 2, -+ 3 -+ ], -+ "max_memkb": 1048576, -+ "target_memkb": 1048576, -+ "video_memkb": 8192, -+ "shadow_memkb": 12288, -+ "rtc_timeoffset": 3600, -+ "localtime": "True", -+ "device_model_version": "qemu_xen", -+ "device_model": "/bin/true", -+ "sched_params": { -+ "weight": 1000 -+ }, -+ "type.hvm": { -+ "pae": "True", -+ "apic": "True", -+ "acpi": "True", -+ "vga": { -+ "kind": "cirrus" -+ }, -+ "vnc": { -+ "enable": "True", -+ "listen": "0.0.0.0", -+ "findunused": "False" -+ }, -+ "sdl": { -+ "enable": "False" -+ }, -+ "spice": { -+ -+ }, -+ "boot": "c", -+ "rdm": { -+ -+ } -+ }, -+ "arch_arm": { -+ -+ } -+ }, -+ "disks": [ -+ { -+ "pdev_path": "/var/lib/xen/images/test-hvm.img", -+ "vdev": "hda", -+ "backend": "qdisk", -+ "format": "raw", -+ "removable": 1, -+ "readwrite": 1 -+ } -+ ], -+ "nics": [ -+ { -+ "devid": 0, -+ "mac": "00:16:3e:66:12:b4", -+ "bridge": "br0", -+ "script": "/etc/xen/scripts/vif-bridge", -+ "nictype": "vif_ioemu" -+ } -+ ], -+ "vfbs": [ -+ { -+ "devid": -1, -+ "vnc": { -+ "enable": "True", -+ "listen": "0.0.0.0", -+ "findunused": "False" -+ }, -+ "sdl": { -+ "enable": "False" -+ } -+ } -+ ], -+ "vkbs": [ -+ { -+ "devid": -1 -+ } -+ ], -+ "on_reboot": "restart" -+} -Index: libvirt-4.0.0/tests/libxlxml2domconfigdata/variable-clock-hvm.xml -=================================================================== ---- /dev/null -+++ libvirt-4.0.0/tests/libxlxml2domconfigdata/variable-clock-hvm.xml -@@ -0,0 +1,36 @@ -+ -+ test-hvm -+ None -+ 2147d599-9cc6-c0dc-92ab-4064b5446e9b -+ 1048576 -+ 1048576 -+ 4 -+ destroy -+ restart -+ destroy -+ -+ -+ hvm -+ /usr/lib/xen/boot/hvmloader -+ -+ -+ -+ -+ -+ -+ -+ -+ /bin/true -+ -+ -+ -+ -+ -+ -+ -+ -+