mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: fix virDomainDefParseXML for parallels
Handle input devices in virDomainDefParseXML properly in case of parallels containers and VMs. Parallels containers support only VIR_DOMAIN_INPUT_BUS_PARALLELS. And if VNC is enabled we should add implicit mouse and keyboard. For VMs we should add implicit PS/2 mouse and keyboard. BTW, is it worth to refactor code and move all this code to drivers, to *DomainDefPostParse functions? Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c0c3d4c8c9
commit
79847f73c3
@ -9458,7 +9458,7 @@ virDomainInputDefParseXML(const virDomainDef *dom,
|
|||||||
bus);
|
bus);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (STREQ(dom->os.type, "xen")) {
|
||||||
if (def->bus != VIR_DOMAIN_INPUT_BUS_XEN) {
|
if (def->bus != VIR_DOMAIN_INPUT_BUS_XEN) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unsupported input bus %s"),
|
_("unsupported input bus %s"),
|
||||||
@ -9472,6 +9472,30 @@ virDomainInputDefParseXML(const virDomainDef *dom,
|
|||||||
type);
|
type);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (dom->virtType == VIR_DOMAIN_VIRT_PARALLELS) {
|
||||||
|
if (def->bus != VIR_DOMAIN_INPUT_BUS_PARALLELS) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("parallels containers don't support "
|
||||||
|
"input bus %s"),
|
||||||
|
bus);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
|
||||||
|
def->type != VIR_DOMAIN_INPUT_TYPE_KBD) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("parallels bus does not support "
|
||||||
|
"%s input device"),
|
||||||
|
type);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Input devices are not supported by this "
|
||||||
|
"virtualization driver."));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (STREQ(dom->os.type, "hvm")) {
|
if (STREQ(dom->os.type, "hvm")) {
|
||||||
@ -9482,8 +9506,11 @@ virDomainInputDefParseXML(const virDomainDef *dom,
|
|||||||
} else {
|
} else {
|
||||||
def->bus = VIR_DOMAIN_INPUT_BUS_USB;
|
def->bus = VIR_DOMAIN_INPUT_BUS_USB;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (STREQ(dom->os.type, "xen")) {
|
||||||
def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
|
def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
|
||||||
|
} else {
|
||||||
|
if ((dom->virtType == VIR_DOMAIN_VIRT_PARALLELS))
|
||||||
|
def->bus = VIR_DOMAIN_INPUT_BUS_PARALLELS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14979,8 +15006,13 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
input->bus == VIR_DOMAIN_INPUT_BUS_PS2 &&
|
input->bus == VIR_DOMAIN_INPUT_BUS_PS2 &&
|
||||||
(input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
|
(input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
|
||||||
input->type == VIR_DOMAIN_INPUT_TYPE_KBD)) ||
|
input->type == VIR_DOMAIN_INPUT_TYPE_KBD)) ||
|
||||||
(STRNEQ(def->os.type, "hvm") &&
|
(STREQ(def->os.type, "xen") &&
|
||||||
input->bus == VIR_DOMAIN_INPUT_BUS_XEN &&
|
input->bus == VIR_DOMAIN_INPUT_BUS_XEN &&
|
||||||
|
(input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
|
||||||
|
input->type == VIR_DOMAIN_INPUT_TYPE_KBD)) ||
|
||||||
|
(STREQ(def->os.type, "exe") &&
|
||||||
|
def->virtType == VIR_DOMAIN_VIRT_PARALLELS &&
|
||||||
|
input->bus == VIR_DOMAIN_INPUT_BUS_PARALLELS &&
|
||||||
(input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
|
(input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
|
||||||
input->type == VIR_DOMAIN_INPUT_TYPE_KBD))) {
|
input->type == VIR_DOMAIN_INPUT_TYPE_KBD))) {
|
||||||
virDomainInputDefFree(input);
|
virDomainInputDefFree(input);
|
||||||
@ -15014,6 +15046,9 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
|
|
||||||
if (STREQ(def->os.type, "hvm"))
|
if (STREQ(def->os.type, "hvm"))
|
||||||
input_bus = VIR_DOMAIN_INPUT_BUS_PS2;
|
input_bus = VIR_DOMAIN_INPUT_BUS_PS2;
|
||||||
|
if (STREQ(def->os.type, "exe") &&
|
||||||
|
def->virtType == VIR_DOMAIN_VIRT_PARALLELS)
|
||||||
|
input_bus = VIR_DOMAIN_INPUT_BUS_PARALLELS;
|
||||||
|
|
||||||
if (virDomainDefMaybeAddInput(def,
|
if (virDomainDefMaybeAddInput(def,
|
||||||
VIR_DOMAIN_INPUT_TYPE_MOUSE,
|
VIR_DOMAIN_INPUT_TYPE_MOUSE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user