qemu: Add QEMU_CAPS_DEVICE_SPAPR_VTY

Up until now we assumed the spapr-vty device would always be
present, which is not very nice. Check for its availability before
using it instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Andrea Bolognani 2017-11-08 19:13:28 +01:00
parent 3343ab0cd9
commit 87eabeb17d
7 changed files with 24 additions and 0 deletions

View File

@ -445,6 +445,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"virtio-blk.num-queues",
"machine.pseries.resize-hpt",
"vmcoreinfo",
"spapr-vty",
);
@ -1673,6 +1674,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI },
{ "spapr-pci-host-bridge", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE },
{ "vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO },
{ "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {

View File

@ -431,6 +431,7 @@ typedef enum {
QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT, /* -machine pseries,resize-hpt */
QEMU_CAPS_DEVICE_VMCOREINFO, /* -device vmcoreinfo */
QEMU_CAPS_DEVICE_SPAPR_VTY, /* -device spapr-vty */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;

View File

@ -10221,6 +10221,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
if (qemuDomainIsPSeries(def)) {
if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("spapr-vty not supported in this QEMU binary"));
goto error;
}
virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
serial->info.alias);
}

View File

@ -178,6 +178,7 @@
<flag name='vxhs'/>
<flag name='virtio-blk.num-queues'/>
<flag name='machine.pseries.resize-hpt'/>
<flag name='spapr-vty'/>
<version>2010000</version>
<kvmVersion>0</kvmVersion>
<package> (v2.10.0)</package>

View File

@ -167,6 +167,7 @@
<flag name='vnc-multi-servers'/>
<flag name='chardev-reconnect'/>
<flag name='virtio-gpu.max_outputs'/>
<flag name='spapr-vty'/>
<version>2006000</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -173,6 +173,7 @@
<flag name='chardev-reconnect'/>
<flag name='virtio-gpu.max_outputs'/>
<flag name='virtio-blk.num-queues'/>
<flag name='spapr-vty'/>
<version>2009000</version>
<kvmVersion>0</kvmVersion>
<package> (v2.9.0)</package>

View File

@ -1753,50 +1753,62 @@ mymain(void)
DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE);
DO_TEST("pseries-basic",
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-vio",
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-usb-default",
QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_PIIX3_USB_UHCI,
QEMU_CAPS_PCI_OHCI,
QEMU_CAPS_PCI_MULTIFUNCTION);
DO_TEST("pseries-usb-multi",
QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_PIIX3_USB_UHCI,
QEMU_CAPS_PCI_OHCI,
QEMU_CAPS_PCI_MULTIFUNCTION);
DO_TEST("pseries-vio-user-assigned",
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST_PARSE_ERROR("pseries-vio-address-clash",
QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM);
DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
QEMU_CAPS_DEVICE_USB_KBD,
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-cpu-exact",
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST_PARSE_ERROR("pseries-no-parallel",
QEMU_CAPS_NODEFCONFIG);
qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM,
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST_FAILURE("pseries-cpu-compat-power9", QEMU_CAPS_KVM);
qemuTestSetHostCPU(driver.caps, cpuPower9);
DO_TEST("pseries-cpu-compat-power9",
QEMU_CAPS_KVM,
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
qemuTestSetHostCPU(driver.caps, NULL);
qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
DO_TEST("pseries-panic-missing",
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-panic-no-address",
QEMU_CAPS_DEVICE_SPAPR_VTY,
QEMU_CAPS_NODEFCONFIG);
DO_TEST_FAILURE("pseries-panic-address",
QEMU_CAPS_NODEFCONFIG);