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

[libvirt] [PATCH 1/2] vz: add default input devices on post parse



It is on par with prlsdkLoadDomain actions.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy virtuozzo com>
---
 src/vz/vz_driver.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index e12a95a..5838c46 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -169,13 +169,37 @@ vzConnectGetCapabilities(virConnectPtr conn)
     vzDriverUnlock(privconn);
     return xml;
 }
+static int
+vzDomainDefAddDefaultInputDevices(virDomainDefPtr def)
+{
+    if (def->ngraphics == 0)
+        return 0;
+
+    int bus = IS_CT(def) ? VIR_DOMAIN_INPUT_BUS_PARALLELS :
+                           VIR_DOMAIN_INPUT_BUS_PS2;
+
+    if (virDomainDefMaybeAddInput(def,
+                                  VIR_DOMAIN_INPUT_TYPE_MOUSE,
+                                  bus) < 0)
+        return -1;
+
+    if (virDomainDefMaybeAddInput(def,
+                                  VIR_DOMAIN_INPUT_TYPE_KBD,
+                                  bus) < 0)
+        return -1;
+
+    return 0;
+}
 
 static int
-vzDomainDefPostParse(virDomainDefPtr def ATTRIBUTE_UNUSED,
+vzDomainDefPostParse(virDomainDefPtr def,
                      virCapsPtr caps ATTRIBUTE_UNUSED,
                      unsigned int parseFlags ATTRIBUTE_UNUSED,
                      void *opaque)
 {
+    if (vzDomainDefAddDefaultInputDevices(def) < 0)
+        return -1;
+
     if (vzCheckUnsupportedDisks(def, opaque) < 0)
         return -1;
 
-- 
1.8.3.1


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