1
0

qemu: Format targetModel for serial devices

Now that we've created a distinction between target type and target
model, with the latter being the concrete device name, it's time to
switch to formatting the model instead of the type.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Andrea Bolognani 2017-11-21 14:14:16 +01:00
parent a9254a2d6e
commit 7c76c30465

View File

@ -10375,8 +10375,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
serial->info.alias); serial->info.alias);
} }
} else { } else {
switch ((virDomainChrSerialTargetType) serial->targetType) { switch ((virDomainChrSerialTargetModel) serial->targetModel) {
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("usb-serial is not supported in this QEMU binary")); _("usb-serial is not supported in this QEMU binary"));
@ -10384,10 +10384,10 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
} }
break; break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
break; break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("pci-serial is not supported with this QEMU binary")); _("pci-serial is not supported with this QEMU binary"));
@ -10395,19 +10395,19 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
} }
break; break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
/* Except from _LAST, which is just a guard value and will never /* Except from _LAST, which is just a guard value and will never
* be used, all of the above are platform devices, which means * be used, all of the above are platform devices, which means
* qemuBuildSerialCommandLine() will have taken the appropriate * qemuBuildSerialCommandLine() will have taken the appropriate
* branch and we will not have ended up here. */ * branch and we will not have ended up here. */
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Invalid target type for serial device")); _("Invalid target model for serial device"));
goto error; goto error;
} }
virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s", virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s",
virDomainChrSerialTargetTypeToString(serial->targetType), virDomainChrSerialTargetModelTypeToString(serial->targetModel),
serial->info.alias, serial->info.alias); serial->info.alias, serial->info.alias);
} }