[libvirt] [PATCH v2 3/4] device: cleanup input device code
Michal Privoznik
mprivozn at redhat.com
Tue Jan 26 16:09:56 UTC 2016
On 12.01.2016 12:59, Pavel Hrdina wrote:
> The current code was a little bit odd. At first we've removed all
> possible implicit input devices from domain definition to add them later
> back if there was any graphics device defined while parsing XML
> description. That's not all, while formating domain definition to XML
> description we at first ignore any input devices with bus different to
> USB and VIRTIO and few lines later we add implicit input devices to XML.
>
> This seems to me as a lot of code for nothing. This patch may look
> to be more complicated than original approach, but this is a preferred
> way to modify/add driver specific stuff only in those drivers and not
> deal with them in common parsing/formating functions.
>
> The update is to add those implicit input devices into config XML to
> follow the real HW configuration visible by guest OS.
>
> There was also inconsistence between our behavior and QEMU's in the way,
> that in QEMU there is no way how to disable those implicit input devices
> for x86 architecture and they are available always, even without graphics
> device. This applies also to XEN hypervisor. VZ driver already does its
> part by putting correct implicit devices into live XML.
>
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
> src/Makefile.am | 4 +--
> src/conf/domain_conf.c | 82 +++++-----------------------------------------
> src/libxl/libxl_domain.c | 5 +++
> src/qemu/qemu_domain.c | 23 +++++++++++++
> src/xen/xen_driver.c | 5 +++
> src/xenapi/xenapi_driver.c | 5 +++
> src/xenconfig/xen_common.c | 22 +++++++++++++
> src/xenconfig/xen_common.h | 2 ++
> 8 files changed, 72 insertions(+), 76 deletions(-)
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index aa5ab69..522c56d 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1211,7 +1211,7 @@ libvirt_driver_xen_impl_la_CFLAGS = \
> -I$(srcdir)/xenconfig \
> $(AM_CFLAGS)
> libvirt_driver_xen_impl_la_LDFLAGS = $(AM_LDFLAGS)
> -libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS)
> +libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS) libvirt_xenconfig.la
> libvirt_driver_xen_impl_la_SOURCES = $(XEN_DRIVER_SOURCES)
> endif WITH_XEN
>
> @@ -1272,7 +1272,7 @@ if WITH_XENAPI
> noinst_LTLIBRARIES += libvirt_driver_xenapi.la
> libvirt_la_BUILT_LIBADD += libvirt_driver_xenapi.la
> libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(CURL_CFLAGS) \
> - -I$(srcdir)/conf $(AM_CFLAGS)
> + -I$(srcdir)/conf -I$(srcdir)/xenconfig $(AM_CFLAGS)
> libvirt_driver_xenapi_la_LDFLAGS = $(AM_LDFLAGS)
> libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(CURL_LIBS)
> libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index cf5c9f6..ee49ba7 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -35,6 +35,7 @@
> #include "virstring.h"
> #include "virtime.h"
> #include "locking/domain_lock.h"
> +#include "xenconfig/xen_common.h"
You don't need to do this crossdir include. -Ixenconfig is already on
the compiler's command line.
>
> #define VIR_FROM_THIS VIR_FROM_LIBXL
>
> @@ -396,6 +397,10 @@ libxlDomainDefPostParse(virDomainDefPtr def,
> def->consoles[0] = chrdef;
> }
>
> + /* add implicit input devices */
> + if (xenDomainDefAddImplicitInputDevice(def) < 0)
> + return -1;
> +
> /* memory hotplug tunables are not supported by this driver */
> if (virDomainDefCheckUnsupportedMemoryHotplug(def) < 0)
> return -1;
Michal
More information about the libvir-list
mailing list