From 328c392914ebe94170ff554d8bbbb85a43b567bd641d43e69eaebbc0482a0f9d Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 6 May 2020 20:52:55 +0000 Subject: [PATCH] - Xen: Fix connection when host uses modular daemons d677de9d-libxl-fix-driver-name-check.patch, d218a9c2-libxl-xen-driver-tables.patch, 836ea91d-libxl-xenlight-internal.patch, 57687260-xen-doc-improvements.patch boo#1171113 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=826 --- 57687260-xen-doc-improvements.patch | 55 +++++++++ 836ea91d-libxl-xenlight-internal.patch | 130 +++++++++++++++++++++ d218a9c2-libxl-xen-driver-tables.patch | 58 +++++++++ d677de9d-libxl-fix-driver-name-check.patch | 27 +++++ libvirt.changes | 10 ++ libvirt.spec | 8 ++ libxl-set-migration-constraints.patch | 6 +- 7 files changed, 291 insertions(+), 3 deletions(-) create mode 100644 57687260-xen-doc-improvements.patch create mode 100644 836ea91d-libxl-xenlight-internal.patch create mode 100644 d218a9c2-libxl-xen-driver-tables.patch create mode 100644 d677de9d-libxl-fix-driver-name-check.patch diff --git a/57687260-xen-doc-improvements.patch b/57687260-xen-doc-improvements.patch new file mode 100644 index 0000000..2686d79 --- /dev/null +++ b/57687260-xen-doc-improvements.patch @@ -0,0 +1,55 @@ +commit 5768726093a86028b517975afc6762bf57edbf4a +Author: Jim Fehlig +Date: Mon May 4 15:52:34 2020 -0600 + + docs: Xen improvements + + In formatdomain, using 'libxl' and 'xen' is redundant since they now + both refer to the same driver. 'xen' predates 'libxl' and unambiguously + identifies the Xen hypervisor, so drop the use of 'libxl'. + + In aclpolkit, the connection URI was erroneously identified as 'libxl' + and the name 'xenlight'. Change the URI to 'xen' and driver name to 'Xen'. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-6.3.0/docs/aclpolkit.html.in +=================================================================== +--- libvirt-6.3.0.orig/docs/aclpolkit.html.in ++++ libvirt-6.3.0/docs/aclpolkit.html.in +@@ -342,8 +342,8 @@ + interface + + +- libxl +- xenlight ++ xen ++ Xen + + + lxc +Index: libvirt-6.3.0/docs/formatdomain.html.in +=================================================================== +--- libvirt-6.3.0.orig/docs/formatdomain.html.in ++++ libvirt-6.3.0/docs/formatdomain.html.in +@@ -2533,8 +2533,8 @@ + The name attribute selects which timer is + being modified, and can be one of + "platform" (currently unsupported), +- "hpet" (libxl, xen, qemu, lxc), "kvmclock" (qemu), +- "pit" (qemu), "rtc" (qemu, lxc), "tsc" (libxl, qemu - ++ "hpet" (xen, qemu, lxc), "kvmclock" (qemu), ++ "pit" (qemu), "rtc" (qemu, lxc), "tsc" (xen, qemu - + since 3.2.0), "hypervclock" + (qemu - since 1.2.2) or + "armvtimer" (qemu - since 6.1.0). +@@ -7518,7 +7518,7 @@ qemu-kvm -net nic,model=? /dev/null +

+ You can provide the amount of video memory in kibibytes (blocks of + 1024 bytes) using vram. This is supported only for guest +- type of "libxl", "vz", "qemu", "vbox", "vmx" and "xen". If no ++ type of "vz", "qemu", "vbox", "vmx" and "xen". If no + value is provided the default is used. If the size is not a power of + two it will be rounded to closest one. +

diff --git a/836ea91d-libxl-xenlight-internal.patch b/836ea91d-libxl-xenlight-internal.patch new file mode 100644 index 0000000..621926a --- /dev/null +++ b/836ea91d-libxl-xenlight-internal.patch @@ -0,0 +1,130 @@ +commit 836ea91d4ed174f2bb65ef894a8d6daf0675e743 +Author: Jim Fehlig +Date: Mon May 4 15:20:37 2020 -0600 + + libxl: Clarify that 'xenlight' should only be used internally + + The libxl driver has suffered an identity crisis since its introduction. + It took on the name 'libxl' since at the time libvirt already contained + a 'xen' driver for the old Xen toolstack implementation. 'libxl' is short + for libxenlight, which is often called xenlight. Unfortunately all forms + of the name are used in the libxl driver. + + The only remaining use of the 'xenlight' form is when interacting with + the host device manager, which is difficult to change since it would + cause problems when upgrading the driver. + + Rename the #define to make it clear the 'xenlight' form is internal and + add a comment describing why the name exists and that its use should be + discouraged. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-6.3.0/src/libxl/libxl_conf.h +=================================================================== +--- libvirt-6.3.0.orig/src/libxl/libxl_conf.h ++++ libvirt-6.3.0/src/libxl/libxl_conf.h +@@ -39,7 +39,12 @@ + #include "libxl_logger.h" + + #define LIBXL_DRIVER_EXTERNAL_NAME "Xen" +-#define LIBXL_DRIVER_NAME "xenlight" ++/* ++ * We are stuck with the 'xenlight' name since it is used by the hostdev ++ * manager. Changing it would break management of any host devices previously ++ * managed under the name 'xenlight'. ++ */ ++#define LIBXL_DRIVER_INTERNAL_NAME "xenlight" + #define LIBXL_VNC_PORT_MIN 5900 + #define LIBXL_VNC_PORT_MAX 65535 + +Index: libvirt-6.3.0/src/libxl/libxl_domain.c +=================================================================== +--- libvirt-6.3.0.orig/src/libxl/libxl_domain.c ++++ libvirt-6.3.0/src/libxl/libxl_domain.c +@@ -873,7 +873,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr + VIR_FREE(xml); + } + +- virHostdevReAttachDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ virHostdevReAttachDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def, hostdev_flags, NULL); + + VIR_FREE(priv->lockState); +@@ -1370,7 +1370,7 @@ libxlDomainStart(libxlDriverPrivatePtr d + if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0) + goto cleanup_dom; + +- if (virHostdevPrepareDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ if (virHostdevPrepareDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def, hostdev_flags) < 0) + goto cleanup_dom; + +Index: libvirt-6.3.0/src/libxl/libxl_driver.c +=================================================================== +--- libvirt-6.3.0.orig/src/libxl/libxl_driver.c ++++ libvirt-6.3.0/src/libxl/libxl_driver.c +@@ -431,7 +431,7 @@ libxlReconnectDomain(virDomainObjPtr vm, + libxlLoggerOpenFile(cfg->logger, vm->def->id, vm->def->name, NULL); + + /* Update hostdev state */ +- if (virHostdevUpdateActiveDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ if (virHostdevUpdateActiveDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def, hostdev_flags) < 0) + goto error; + +@@ -3127,7 +3127,7 @@ libxlDomainAttachHostPCIDevice(libxlDriv + if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) + goto cleanup; + +- if (virHostdevPreparePCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ if (virHostdevPreparePCIDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def->name, vm->def->uuid, + &hostdev, 1, 0) < 0) + goto cleanup; +@@ -3149,7 +3149,7 @@ libxlDomainAttachHostPCIDevice(libxlDriv + goto cleanup; + + error: +- virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def->name, &hostdev, 1, NULL); + + cleanup: +@@ -3264,7 +3264,7 @@ libxlDomainAttachHostUSBDevice(libxlDriv + if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) + goto cleanup; + +- if (virHostdevPrepareUSBDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ if (virHostdevPrepareUSBDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def->name, &hostdev, 1, 0) < 0) + goto cleanup; + +@@ -3284,7 +3284,7 @@ libxlDomainAttachHostUSBDevice(libxlDriv + goto cleanup; + + reattach: +- virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def->name, &hostdev, 1); + + cleanup: +@@ -3689,7 +3689,7 @@ libxlDomainDetachHostPCIDevice(libxlDriv + + virDomainHostdevRemove(vm->def, idx); + +- virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def->name, &hostdev, 1, NULL); + + ret = 0; +@@ -3811,7 +3811,7 @@ libxlDomainDetachHostUSBDevice(libxlDriv + + virDomainHostdevRemove(vm->def, idx); + +- virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_NAME, ++ virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME, + vm->def->name, &hostdev, 1); + + ret = 0; diff --git a/d218a9c2-libxl-xen-driver-tables.patch b/d218a9c2-libxl-xen-driver-tables.patch new file mode 100644 index 0000000..2393f80 --- /dev/null +++ b/d218a9c2-libxl-xen-driver-tables.patch @@ -0,0 +1,58 @@ +commit d218a9c263190681aa8ee7f0ec5f3c298339d635 +Author: Jim Fehlig +Date: Mon May 4 14:51:32 2020 -0600 + + libxl: Use the name 'Xen' in driver tables + + The libxl driver declares its name as 'Xen' through the public + virConnectGetType() API. In the virHypervisorDriver table the name is + set to 'xenlight'. To add more confusion, the name is set to 'LIBXL' + in the virStateDriver. For consistency, use the same name in the driver + tables as reported in the public virConnectGetType() API. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-6.3.0/src/libxl/libxl_conf.h +=================================================================== +--- libvirt-6.3.0.orig/src/libxl/libxl_conf.h ++++ libvirt-6.3.0/src/libxl/libxl_conf.h +@@ -38,6 +38,7 @@ + #include "libxl_capabilities.h" + #include "libxl_logger.h" + ++#define LIBXL_DRIVER_EXTERNAL_NAME "Xen" + #define LIBXL_DRIVER_NAME "xenlight" + #define LIBXL_VNC_PORT_MIN 5900 + #define LIBXL_VNC_PORT_MAX 65535 +Index: libvirt-6.3.0/src/libxl/libxl_driver.c +=================================================================== +--- libvirt-6.3.0.orig/src/libxl/libxl_driver.c ++++ libvirt-6.3.0/src/libxl/libxl_driver.c +@@ -911,7 +911,7 @@ libxlConnectGetType(virConnectPtr conn) + if (virConnectGetTypeEnsureACL(conn) < 0) + return NULL; + +- return "Xen"; ++ return LIBXL_DRIVER_EXTERNAL_NAME; + } + + static int +@@ -6608,7 +6608,7 @@ libxlDomainGetMetadata(virDomainPtr dom, + } + + static virHypervisorDriver libxlHypervisorDriver = { +- .name = LIBXL_DRIVER_NAME, ++ .name = LIBXL_DRIVER_EXTERNAL_NAME, + .connectURIProbe = libxlConnectURIProbe, + .connectOpen = libxlConnectOpen, /* 0.9.0 */ + .connectClose = libxlConnectClose, /* 0.9.0 */ +@@ -6732,7 +6732,7 @@ static virConnectDriver libxlConnectDriv + }; + + static virStateDriver libxlStateDriver = { +- .name = "LIBXL", ++ .name = LIBXL_DRIVER_EXTERNAL_NAME, + .stateInitialize = libxlStateInitialize, + .stateCleanup = libxlStateCleanup, + .stateReload = libxlStateReload, diff --git a/d677de9d-libxl-fix-driver-name-check.patch b/d677de9d-libxl-fix-driver-name-check.patch new file mode 100644 index 0000000..e6a7544 --- /dev/null +++ b/d677de9d-libxl-fix-driver-name-check.patch @@ -0,0 +1,27 @@ +commit d677de9d567e3e87be295b91723457b461345caa +Author: Daniel P. Berrangé +Date: Mon May 4 17:41:46 2020 +0100 + + remote: fix driver name check for libxl driver + + The virConnectGetType() returns "Xen" for libxl, not "LIBXL". + + This prevents users opening a connection to the libxl driver when using + the modular daemons. + + Reviewed-by: Jim Fehlig + Signed-off-by: Daniel P. Berrangé + +Index: libvirt-6.3.0/src/remote/remote_daemon_dispatch.c +=================================================================== +--- libvirt-6.3.0.orig/src/remote/remote_daemon_dispatch.c ++++ libvirt-6.3.0/src/remote/remote_daemon_dispatch.c +@@ -2111,7 +2111,7 @@ remoteDispatchConnectOpen(virNetServerPt + + VIR_DEBUG("Primary driver type is '%s'", type); + if (STREQ(type, "QEMU") || +- STREQ(type, "LIBXL") || ++ STREQ(type, "Xen") || + STREQ(type, "LXC") || + STREQ(type, "VBOX") || + STREQ(type, "bhyve") || diff --git a/libvirt.changes b/libvirt.changes index 0eb980b..3156331 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed May 6 20:43:16 UTC 2020 - James Fehlig + +- Xen: Fix connection when host uses modular daemons + d677de9d-libxl-fix-driver-name-check.patch, + d218a9c2-libxl-xen-driver-tables.patch, + 836ea91d-libxl-xenlight-internal.patch, + 57687260-xen-doc-improvements.patch + boo#1171113 + ------------------------------------------------------------------- Wed May 6 01:40:32 UTC 2020 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index b55f10f..7876676 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -338,6 +338,10 @@ Source6: libvirtd-relocation-server.xml Source99: baselibs.conf Source100: %{name}-rpmlintrc # Upstream patches +Patch0: d677de9d-libxl-fix-driver-name-check.patch +Patch1: d218a9c2-libxl-xen-driver-tables.patch +Patch2: 836ea91d-libxl-xenlight-internal.patch +Patch3: 57687260-xen-doc-improvements.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch @@ -873,6 +877,10 @@ libvirt plugin for NSS for translating domain names into IP addresses. %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %patch100 -p1 %patch101 -p1 %patch150 -p1 diff --git a/libxl-set-migration-constraints.patch b/libxl-set-migration-constraints.patch index d4c9da6..6cf8fa1 100644 --- a/libxl-set-migration-constraints.patch +++ b/libxl-set-migration-constraints.patch @@ -316,7 +316,7 @@ Index: libvirt-6.3.0/tools/virsh-domain.c =================================================================== --- libvirt-6.3.0.orig/tools/virsh-domain.c +++ libvirt-6.3.0/tools/virsh-domain.c -@@ -10722,6 +10722,22 @@ static const vshCmdOptDef opts_migrate[] +@@ -10721,6 +10721,22 @@ static const vshCmdOptDef opts_migrate[] .type = VSH_OT_STRING, .help = N_("override the destination host name used for TLS verification") }, @@ -339,7 +339,7 @@ Index: libvirt-6.3.0/tools/virsh-domain.c {.name = NULL} }; -@@ -10743,6 +10759,7 @@ doMigrate(void *opaque) +@@ -10742,6 +10758,7 @@ doMigrate(void *opaque) unsigned long long ullOpt = 0; int rv; virConnectPtr dconn = data->dconn; @@ -347,7 +347,7 @@ Index: libvirt-6.3.0/tools/virsh-domain.c #ifndef WIN32 sigset_t sigmask, oldsigmask; -@@ -10865,6 +10882,27 @@ doMigrate(void *opaque) +@@ -10864,6 +10881,27 @@ doMigrate(void *opaque) goto save_error; }