[libvirt] [PATCH] qemu: error out if PCI passthrough type is not supported
Ján Tomko
jtomko at redhat.com
Tue Jul 29 13:38:30 UTC 2014
On 07/28/2014 10:45 AM, Hu Tao wrote:
> 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:
>
> <hostdev mode='subsystem' type='pci' managed='yes'>
> <source>
> <address domain='0x0001' bus='0x03' slot='0x00' function='0x0'/>
> </source>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
> </hostdev>
>
> 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 <hutao at cn.fujitsu.com>
> ---
> src/qemu/qemu_command.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
ACK and pushed.
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 7f9357c..12d6354 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4880,7 +4880,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
> virReportError(VIR_ERR_INTERNAL_ERROR,
> _("invalid PCI passthrough type '%s'"),
> virDomainHostdevSubsysPCIBackendTypeToString(backend));
> - break;
> + goto error;
> }
>
> virBufferAddLit(&buf, ",host=");
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140729/7ed26cbb/attachment-0001.sig>
More information about the libvir-list
mailing list