c1c534
From 506c50ee610cae51d09bf7e26af850a395da0e1f Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <506c50ee610cae51d09bf7e26af850a395da0e1f@dist-git>
c1c534
From: Andrea Bolognani <abologna@redhat.com>
c1c534
Date: Wed, 29 Nov 2017 16:23:10 +0100
c1c534
Subject: [PATCH] qemu: Format targetModel for serial devices
c1c534
c1c534
Now that we've created a distinction between target type and target
c1c534
model, with the latter being the concrete device name, it's time to
c1c534
switch to formatting the model instead of the type.
c1c534
c1c534
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c1c534
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
c1c534
(cherry picked from commit 7c76c30465ff6038df3b7aa27b40a3348ec599c9)
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_command.c | 16 ++++++++--------
c1c534
 1 file changed, 8 insertions(+), 8 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
c1c534
index 8142834afd..7fd2afb1e0 100644
c1c534
--- a/src/qemu/qemu_command.c
c1c534
+++ b/src/qemu/qemu_command.c
c1c534
@@ -10346,8 +10346,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
c1c534
                               serial->info.alias);
c1c534
         }
c1c534
     } else {
c1c534
-        switch ((virDomainChrSerialTargetType) serial->targetType) {
c1c534
-        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
c1c534
+        switch ((virDomainChrSerialTargetModel) serial->targetModel) {
c1c534
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
c1c534
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) {
c1c534
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
c1c534
                                _("usb-serial is not supported in this QEMU binary"));
c1c534
@@ -10355,10 +10355,10 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
c1c534
             }
c1c534
             break;
c1c534
 
c1c534
-        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
c1c534
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
c1c534
             break;
c1c534
 
c1c534
-        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
c1c534
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
c1c534
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) {
c1c534
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
c1c534
                                _("pci-serial is not supported with this QEMU binary"));
c1c534
@@ -10366,19 +10366,19 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
c1c534
             }
c1c534
             break;
c1c534
 
c1c534
-        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
c1c534
-        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
c1c534
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
c1c534
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
c1c534
             /* Except from _LAST, which is just a guard value and will never
c1c534
              * be used, all of the above are platform devices, which means
c1c534
              * qemuBuildSerialCommandLine() will have taken the appropriate
c1c534
              * branch and we will not have ended up here. */
c1c534
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
c1c534
-                           _("Invalid target type for serial device"));
c1c534
+                           _("Invalid target model for serial device"));
c1c534
             goto error;
c1c534
         }
c1c534
 
c1c534
         virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s",
c1c534
-                          virDomainChrSerialTargetTypeToString(serial->targetType),
c1c534
+                          virDomainChrSerialTargetModelTypeToString(serial->targetModel),
c1c534
                           serial->info.alias, serial->info.alias);
c1c534
     }
c1c534
 
c1c534
-- 
c1c534
2.15.1
c1c534