From c5b02b6773c09fe4380002f5a23a46f9032ba0e8 Mon Sep 17 00:00:00 2001 From: Hu Tao Date: Mon, 28 Jul 2014 16:45:23 +0800 Subject: [PATCH] qemu: error out if PCI passthrough type is not supported If PCI passthrough type is not supported, we should error out rather than continue building the command line. When starting a domain, the type has been already checked by qemuPrepareHostdevPCICheckSupport() before building qemu command line, so the problem doesn't emerge. But when coverting a domain xml without specifying passthrough type explictly to qemu arg, we will get a malformed command line. the xml:
the converted command line: -device ,host=0001:03:00.0,id=hostdev0,bus=pci.0,addr=0x5 After this patch, virsh gives an error message: virsh domxml-to-native qemu-argv /tmp/tmp.xml error: internal error: invalid PCI passthrough type 'default' Signed-off-by: Hu Tao --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e115004210..4e074e5c34 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4883,7 +4883,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def, virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid PCI passthrough type '%s'"), virDomainHostdevSubsysPCIBackendTypeToString(backend)); - break; + goto error; } virBufferAddLit(&buf, ",host="); -- 2.47.2