|
|
6ae9ed |
From 4fc22ae3f2a6894e26e996918d48e8cb8b4ca591 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <4fc22ae3f2a6894e26e996918d48e8cb8b4ca591@dist-git>
|
|
|
6ae9ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
Date: Fri, 8 Jul 2016 17:25:03 +0200
|
|
|
6ae9ed |
Subject: [PATCH] qemu: Drop default channel path during migration
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Migration to an older libvirt (pre v1.3.0-175-g7140807) is broken
|
|
|
6ae9ed |
because older versions of libvirt generated different channel paths and
|
|
|
6ae9ed |
they didn't drop the default paths when parsing domain XMLs. We'd get
|
|
|
6ae9ed |
such a nice error message:
|
|
|
6ae9ed |
|
|
|
6ae9ed |
internal error: process exited while connecting to monitor:
|
|
|
6ae9ed |
2016-07-08T15:28:02.665706Z qemu-kvm: -chardev socket,
|
|
|
6ae9ed |
id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/
|
|
|
6ae9ed |
domain-3-nest/org.qemu.guest_agent.0,server,nowait: Failed to bind
|
|
|
6ae9ed |
socket to /var/lib/libvirt/qemu/channel/target/domain-3-nest/
|
|
|
6ae9ed |
org.qemu.guest_agent.0: No such file or directory
|
|
|
6ae9ed |
|
|
|
6ae9ed |
That said, we should not even format the default paths when generating a
|
|
|
6ae9ed |
migratable XML.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1320470
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit 08d566a0cf7ed052b6ab3c9bd93f04156999d80b)
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_domain.c | 43 +++++++++++++++++++++++++++----------------
|
|
|
6ae9ed |
1 file changed, 27 insertions(+), 16 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
index e81e63f..5b4d7a3 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
@@ -2254,6 +2254,29 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
|
|
|
6ae9ed |
return "rtl8139";
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+/*
|
|
|
6ae9ed |
+ * Clear auto generated unix socket path, i.e., the one which starts with our
|
|
|
6ae9ed |
+ * channel directory.
|
|
|
6ae9ed |
+ */
|
|
|
6ae9ed |
+static void
|
|
|
6ae9ed |
+qemuDomainChrDefDropDefaultPath(virDomainChrDefPtr chr,
|
|
|
6ae9ed |
+ virQEMUDriverPtr driver)
|
|
|
6ae9ed |
+{
|
|
|
6ae9ed |
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
|
|
6ae9ed |
+ chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
|
|
|
6ae9ed |
+ chr->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
|
|
6ae9ed |
+ chr->source.data.nix.path &&
|
|
|
6ae9ed |
+ STRPREFIX(chr->source.data.nix.path, cfg->channelTargetDir)) {
|
|
|
6ae9ed |
+ VIR_FREE(chr->source.data.nix.path);
|
|
|
6ae9ed |
+ }
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ virObjectUnref(cfg);
|
|
|
6ae9ed |
+}
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
static int
|
|
|
6ae9ed |
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
6ae9ed |
const virDomainDef *def,
|
|
|
6ae9ed |
@@ -2335,21 +2358,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
6ae9ed |
|
|
|
6ae9ed |
/* clear auto generated unix socket path for inactive definitions */
|
|
|
6ae9ed |
if ((parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
|
|
6ae9ed |
- dev->type == VIR_DOMAIN_DEVICE_CHR &&
|
|
|
6ae9ed |
- dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
|
|
6ae9ed |
- dev->data.chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
|
|
|
6ae9ed |
- dev->data.chr->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
|
|
6ae9ed |
- dev->data.chr->source.data.nix.path &&
|
|
|
6ae9ed |
- STRPREFIX(dev->data.chr->source.data.nix.path, cfg->channelTargetDir)) {
|
|
|
6ae9ed |
- /*
|
|
|
6ae9ed |
- * If the address is generated by us (starts with our
|
|
|
6ae9ed |
- * channel dir), we should not keep it in the persistent
|
|
|
6ae9ed |
- * XML. If libvirt is the one who generated it, users
|
|
|
6ae9ed |
- * shouldn't care about that. If they do, they are
|
|
|
6ae9ed |
- * supposed to set it themselves.
|
|
|
6ae9ed |
- */
|
|
|
6ae9ed |
- VIR_FREE(dev->data.chr->source.data.nix.path);
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
+ dev->type == VIR_DOMAIN_DEVICE_CHR)
|
|
|
6ae9ed |
+ qemuDomainChrDefDropDefaultPath(dev->data.chr, driver);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
/* forbid capabilities mode hostdev in this kind of hypervisor */
|
|
|
6ae9ed |
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
|
|
6ae9ed |
@@ -3164,7 +3174,8 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainControllerDefFree(usb);
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
+ for (i = 0; i < def->nchannels; i++)
|
|
|
6ae9ed |
+ qemuDomainChrDefDropDefaultPath(def->channels[i], driver);
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
format:
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.2
|
|
|
6ae9ed |
|