[RFC PATCH] libxl: support configuring paravirtualized keyboard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Xen since 4.13 allows to configure whether PV vkb device is created or
not - instead of always creating it. Plug it into <input/> device
configuration and give the user a choice - setting PS2 keyboard disables
PV one, and setting XEN keyboard enables PV.

There is one issue with this approach: there are implicit keyboard and
mouse device added with bus 'ps2'. This is at least done by the xen-xl
-> libvirt xml config converter (why?). When one use a config generated
this way, this commit will make behavior change - PV keyboard will get
disabled. I'm not sure if that's a big issue - both keyboards works.
Can it be this way? Or maybe some better idea how to represent
vkb_device option in libvirt xml?

Once the above is sorted out (or chosen to ignore), I'll send updated
patch with tests and config converter support.

Because the implicit keyboard is added, I also avoided to reject keybord
device on too old Xen versions. This means <input type='keyboard'
bus='xen'/> will be _silently_ ignored on older Xen.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 src/libxl/libxl_conf.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 27de67d266..0999fb5678 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -637,6 +637,24 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
         for (i = 0; i < def->ninputs; i++) {
             char **usbdevice;
 
+#ifdef LIBXL_HAVE_BUILDINFO_VKB_DEVICE
+            if (def->inputs[i]->type == VIR_DOMAIN_INPUT_TYPE_KBD) {
+                switch (def->inputs[i]->bus) {
+                    case VIR_DOMAIN_INPUT_BUS_PS2:
+                        libxl_defbool_set(&b_info->u.hvm.vkb_device, false);
+                        break;
+                    case VIR_DOMAIN_INPUT_BUS_XEN:
+                        libxl_defbool_set(&b_info->u.hvm.vkb_device, true);
+                        break;
+                    case VIR_DOMAIN_INPUT_BUS_VIRTIO:
+                    default:
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                _("libxenlight supports only ps2/xen keyboard device"));
+                        return -1;
+                }
+            }
+#endif
+
             if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB)
                 continue;
 
-- 
2.21.0






[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux