|
|
c1c534 |
From 06cb6ae1254842377d0b17f9fdd52e0d2b6b23eb Mon Sep 17 00:00:00 2001
|
|
|
c1c534 |
Message-Id: <06cb6ae1254842377d0b17f9fdd52e0d2b6b23eb@dist-git>
|
|
|
c1c534 |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
c1c534 |
Date: Wed, 29 Nov 2017 16:22:56 +0100
|
|
|
c1c534 |
Subject: [PATCH] qemu: Introduce qemuDomainChrDefPostParse()
|
|
|
c1c534 |
|
|
|
c1c534 |
Having a separate function for char device handling is better than
|
|
|
c1c534 |
adding even more code to qemuDomainDeviceDefPostParse().
|
|
|
c1c534 |
|
|
|
c1c534 |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
c1c534 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c1c534 |
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
|
|
|
c1c534 |
(cherry picked from commit f4b50cc1b994e44c793f4dea59489ba51e2d1fe0)
|
|
|
c1c534 |
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1449265
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1511421
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1512929
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1512934
|
|
|
c1c534 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c1c534 |
---
|
|
|
c1c534 |
src/qemu/qemu_domain.c | 57 ++++++++++++++++++++++++++++++--------------------
|
|
|
c1c534 |
1 file changed, 34 insertions(+), 23 deletions(-)
|
|
|
c1c534 |
|
|
|
c1c534 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
c1c534 |
index 138f773c22..b15d994774 100644
|
|
|
c1c534 |
--- a/src/qemu/qemu_domain.c
|
|
|
c1c534 |
+++ b/src/qemu/qemu_domain.c
|
|
|
c1c534 |
@@ -4082,6 +4082,35 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
|
|
|
c1c534 |
return 0;
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
+static int
|
|
|
c1c534 |
+qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
|
|
|
c1c534 |
+ const virDomainDef *def,
|
|
|
c1c534 |
+ virQEMUDriverPtr driver,
|
|
|
c1c534 |
+ unsigned int parseFlags)
|
|
|
c1c534 |
+{
|
|
|
c1c534 |
+ /* set the default console type for S390 arches */
|
|
|
c1c534 |
+ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
|
|
c1c534 |
+ chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
|
|
|
c1c534 |
+ ARCH_IS_S390(def->os.arch)) {
|
|
|
c1c534 |
+ chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ /* clear auto generated unix socket path for inactive definitions */
|
|
|
c1c534 |
+ if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) {
|
|
|
c1c534 |
+ if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0)
|
|
|
c1c534 |
+ return -1;
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ /* For UNIX chardev if no path is provided we generate one.
|
|
|
c1c534 |
+ * This also implies that the mode is 'bind'. */
|
|
|
c1c534 |
+ if (chr->source &&
|
|
|
c1c534 |
+ chr->source->type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
|
|
c1c534 |
+ !chr->source->data.nix.path) {
|
|
|
c1c534 |
+ chr->source->data.nix.listen = true;
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ return 0;
|
|
|
c1c534 |
+}
|
|
|
c1c534 |
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
c1c534 |
@@ -4142,29 +4171,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
c1c534 |
}
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
- /* set the default console type for S390 arches */
|
|
|
c1c534 |
- if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
|
|
|
c1c534 |
- dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
|
|
c1c534 |
- dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
|
|
|
c1c534 |
- ARCH_IS_S390(def->os.arch))
|
|
|
c1c534 |
- dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
|
|
|
c1c534 |
-
|
|
|
c1c534 |
- /* clear auto generated unix socket path for inactive definitions */
|
|
|
c1c534 |
- if ((parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
|
|
c1c534 |
- dev->type == VIR_DOMAIN_DEVICE_CHR) {
|
|
|
c1c534 |
- virDomainChrDefPtr chr = dev->data.chr;
|
|
|
c1c534 |
- if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0)
|
|
|
c1c534 |
- goto cleanup;
|
|
|
c1c534 |
-
|
|
|
c1c534 |
- /* For UNIX chardev if no path is provided we generate one.
|
|
|
c1c534 |
- * This also implies that the mode is 'bind'. */
|
|
|
c1c534 |
- if (chr->source &&
|
|
|
c1c534 |
- chr->source->type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
|
|
c1c534 |
- !chr->source->data.nix.path) {
|
|
|
c1c534 |
- chr->source->data.nix.listen = true;
|
|
|
c1c534 |
- }
|
|
|
c1c534 |
- }
|
|
|
c1c534 |
-
|
|
|
c1c534 |
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
|
|
|
c1c534 |
if (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
|
|
|
c1c534 |
if ARCH_IS_PPC64(def->os.arch)
|
|
|
c1c534 |
@@ -4200,6 +4206,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
c1c534 |
qemuDomainShmemDefPostParse(dev->data.shmem) < 0)
|
|
|
c1c534 |
goto cleanup;
|
|
|
c1c534 |
|
|
|
c1c534 |
+ if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
|
|
|
c1c534 |
+ qemuDomainChrDefPostParse(dev->data.chr, def, driver, parseFlags) < 0) {
|
|
|
c1c534 |
+ goto cleanup;
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
+
|
|
|
c1c534 |
ret = 0;
|
|
|
c1c534 |
|
|
|
c1c534 |
cleanup:
|
|
|
c1c534 |
--
|
|
|
c1c534 |
2.15.1
|
|
|
c1c534 |
|