Input devices are not stored in SDK but we report them
on dumpxml if vnc is on. Thus we need to handle input devices
on define xml as well. The latter part have some problems.
Let's fix them.
Nikolay Shirokovskiy (2):
vz: add default input devices on post parse
vz: fix config input device check
src/vz/vz_driver.c | 26 +++++++++++++++++++++++++-
src/vz/vz_sdk.c | 27 ++++++++++++++++++---------
2 files changed, 43 insertions(+), 10 deletions(-)
--
1.8.3.1
Show replies by date
It is on par with prlsdkLoadDomain actions.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)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
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(a)virtuozzo.com>
---
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 8691887..5996caf 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1857,6 +1857,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",
@@ -2052,17 +2054,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