[PATCH REBASE 2/2] vz: fix config input device check

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

 



We don't have input devices in SDK thus for define/dumpxml
operations to be consistent we need to:

1. on dumpxml: infer input devices from other parts of config.
It is already done in prlsdkLoadDomain.

2. on define: check that input devices are the same that
will be infer back on dumpxml operation.

The second part should be fixed.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/vz/vz_sdk.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 9b783af..8cc8430 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2064,6 +2064,8 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
     PRL_VM_TYPE vmType;
     PRL_RESULT pret;
     virDomainNumatuneMemMode memMode;
+    int bus = IS_CT(def) ? VIR_DOMAIN_INPUT_BUS_PARALLELS :
+                           VIR_DOMAIN_INPUT_BUS_PS2;
 
     if (def->title) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -2254,17 +2256,24 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
         return -1;
     }
 
-    /* there may be one auto-input */
-    if (def->ninputs != 0 &&
-        (def->ninputs != 2 &&
-         def->inputs[0]->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
-         def->inputs[0]->bus != VIR_DOMAIN_INPUT_BUS_PS2 &&
-         def->inputs[1]->type != VIR_DOMAIN_INPUT_TYPE_KBD &&
-         def->inputs[1]->bus != VIR_DOMAIN_INPUT_BUS_PS2)) {
+    /* check we have only default input devices */
+    if (def->ngraphics > 0) {
+        if (def->ninputs != 2 ||
+            def->inputs[0]->bus != bus ||
+            def->inputs[1]->bus != bus ||
+            !((def->inputs[0]->type == VIR_DOMAIN_INPUT_TYPE_MOUSE &&
+               def->inputs[1]->type == VIR_DOMAIN_INPUT_TYPE_KBD) ||
+              (def->inputs[0]->type == VIR_DOMAIN_INPUT_TYPE_KBD &&
+               def->inputs[1]->type == VIR_DOMAIN_INPUT_TYPE_MOUSE))
+           ) {
 
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("unsupported input device configuration"));
+            return -1;
+        }
+    } else if (def->ninputs != 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("changing input devices parameters is not supported "
-                         "by vz driver"));
+                       _("input devices without vnc are not supported"));
         return -1;
     }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]