[libvirt] [PATCH v3 2/2] qemu: add a target type check when hot/cold-plug a Chr device

Peter Krempa pkrempa at redhat.com
Thu Jan 22 07:37:56 UTC 2015

On Thu, Jan 22, 2015 at 10:28:19 +0800, Luyao Huang wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1164627
> Add a func just check the base target type which
> qemu support. And this check will help to avoid add a qemu
> unsupport target type chr device to a running guest(hotplug)
> or to the guest inactive XML (coldplug, will effect next boot)

You can get exactly the same behavior adding the device by specifying a
new XML containing the device (via virsh edit for example).
Unfortunately the unsupported devices can't be checked in the post parse
callback as it would make existing VMs with broken config disappear.

Additionally even if you forbid known-bad targets you still even with
this code can get a failure by adding a SCLP console on a x86 machine:

    <console type='pty'>
      <target type='sclp' port='0'/>

Starting such VM gets you:
error: unsupported configuration: sclp console requires QEMU to support

This kind of failure depends on the actual qemu process running the VM
and can be checked only when the VM is starting.
> And this check only check the target type, and other things
> have been checked in virDomainChrDefParseXML.
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>  src/libvirt_private.syms |  2 ++
>  src/qemu/qemu_hotplug.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+)

Said this. I don't think it's worth adding the check to the coldplug

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150122/c71dd202/attachment-0001.sig>

More information about the libvir-list mailing list