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