Re: [libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
On 2014年02月14日 17:36, Ján Tomko wrote: On 02/14/2014 10:02 AM, Li Zhang wrote: On 2014年02月14日 00:39, Daniel P. Berrange wrote: On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote: @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml, * XXX will this be true for other virt types ? */ if ((STREQ(def-os.type, hvm) 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)) || (STRNEQ(def-os.type, hvm) input-bus == VIR_DOMAIN_INPUT_BUS_XEN - input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) { + (input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input-type == VIR_DOMAIN_INPUT_TYPE_KBD))) { virDomainInputDefFree(input); continue; Later on in this function there is /* If graphics are enabled, there's an implicit PS2 mouse */ if (def-ngraphics 0) { virDomainInputDefPtr input; if (VIR_ALLOC(input) 0) { goto error; } if (STREQ(def-os.type, hvm)) { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_PS2; } else { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_XEN; } if (VIR_REALLOC_N(def-inputs, def-ninputs + 1) 0) { virDomainInputDefFree(input); goto error; } def-inputs[def-ninputs] = input; def-ninputs++; } which needs to take care of keyboards too now. And some more similar logic in virDomainDefFormatInternal which needs updating I have add the keyboard device in this function in this version [3/6]. But Jan suggested to remove it from virDomainDefFormatInternal in v5. Because it would make the XML unreadable by older libvirtd that didn't know the keyboard input type. Sorry about that, it seems we only care about XML to be readable by older libvirt if virDomainDefFormat* is called with the VIR_DOMAIN_XML_MIGRATABLE flag, so we can safely format it when this flag is not set. I see. I will add this device when this flag is not set. :) Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
On 2014年02月14日 00:39, Daniel P. Berrange wrote: On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote: @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml, * XXX will this be true for other virt types ? */ if ((STREQ(def-os.type, hvm) 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)) || (STRNEQ(def-os.type, hvm) input-bus == VIR_DOMAIN_INPUT_BUS_XEN - input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) { + (input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input-type == VIR_DOMAIN_INPUT_TYPE_KBD))) { virDomainInputDefFree(input); continue; Later on in this function there is /* If graphics are enabled, there's an implicit PS2 mouse */ if (def-ngraphics 0) { virDomainInputDefPtr input; if (VIR_ALLOC(input) 0) { goto error; } if (STREQ(def-os.type, hvm)) { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_PS2; } else { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_XEN; } if (VIR_REALLOC_N(def-inputs, def-ninputs + 1) 0) { virDomainInputDefFree(input); goto error; } def-inputs[def-ninputs] = input; def-ninputs++; } which needs to take care of keyboards too now. And some more similar logic in virDomainDefFormatInternal which needs updating I have add the keyboard device in this function in this version [3/6]. But Jan suggested to remove it from virDomainDefFormatInternal in v5. Because it would make the XML unreadable by older libvirtd that didn't know the keyboard input type. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
On 02/14/2014 10:02 AM, Li Zhang wrote: On 2014年02月14日 00:39, Daniel P. Berrange wrote: On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote: @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml, * XXX will this be true for other virt types ? */ if ((STREQ(def-os.type, hvm) 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)) || (STRNEQ(def-os.type, hvm) input-bus == VIR_DOMAIN_INPUT_BUS_XEN - input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) { + (input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input-type == VIR_DOMAIN_INPUT_TYPE_KBD))) { virDomainInputDefFree(input); continue; Later on in this function there is /* If graphics are enabled, there's an implicit PS2 mouse */ if (def-ngraphics 0) { virDomainInputDefPtr input; if (VIR_ALLOC(input) 0) { goto error; } if (STREQ(def-os.type, hvm)) { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_PS2; } else { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_XEN; } if (VIR_REALLOC_N(def-inputs, def-ninputs + 1) 0) { virDomainInputDefFree(input); goto error; } def-inputs[def-ninputs] = input; def-ninputs++; } which needs to take care of keyboards too now. And some more similar logic in virDomainDefFormatInternal which needs updating I have add the keyboard device in this function in this version [3/6]. But Jan suggested to remove it from virDomainDefFormatInternal in v5. Because it would make the XML unreadable by older libvirtd that didn't know the keyboard input type. Sorry about that, it seems we only care about XML to be readable by older libvirt if virDomainDefFormat* is called with the VIR_DOMAIN_XML_MIGRATABLE flag, so we can safely format it when this flag is not set. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
From: Li Zhang zhlci...@linux.vnet.ibm.com There is no keyboard for non-x86 platforms when graphics are enabled. It's preferred to add one USB keyboard. This patch is to add keyboard input device type. Signed-off-by: Li Zhang zhlci...@linux.vnet.ibm.com --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c| 20 +--- src/conf/domain_conf.h| 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c1efcd2..601e7ac 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3269,6 +3269,7 @@ choice valuetablet/value valuemouse/value + valuekeyboard/value /choice /attribute optional diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f6065ed..9d344bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -506,7 +506,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST, mouse, - tablet) + tablet, + keyboard) VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST, ps2, @@ -7796,8 +7797,9 @@ virDomainInputDefParseXML(const char *ostype, } if (STREQ(ostype, hvm)) { -if (def-bus == VIR_DOMAIN_INPUT_BUS_PS2 /* Only allow mouse for ps2 */ -def-type != VIR_DOMAIN_INPUT_TYPE_MOUSE) { +if (def-bus == VIR_DOMAIN_INPUT_BUS_PS2 /* PS2 can be mouse or keyboard */ +!(def-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || +def-type == VIR_DOMAIN_INPUT_TYPE_KBD)) { virReportError(VIR_ERR_INTERNAL_ERROR, _(ps2 bus does not support %s input device), type); @@ -7815,7 +7817,8 @@ virDomainInputDefParseXML(const char *ostype, _(unsupported input bus %s), bus); } -if (def-type != VIR_DOMAIN_INPUT_TYPE_MOUSE) { +if (def-type != VIR_DOMAIN_INPUT_TYPE_MOUSE +def-type != VIR_DOMAIN_INPUT_TYPE_KBD) { virReportError(VIR_ERR_INTERNAL_ERROR, _(xen bus does not support %s input device), type); @@ -7824,7 +7827,8 @@ virDomainInputDefParseXML(const char *ostype, } } else { if (STREQ(ostype, hvm)) { -if (def-type == VIR_DOMAIN_INPUT_TYPE_MOUSE) +if (def-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || +def-type == VIR_DOMAIN_INPUT_TYPE_KBD) def-bus = VIR_DOMAIN_INPUT_BUS_PS2; else def-bus = VIR_DOMAIN_INPUT_BUS_USB; @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml, * XXX will this be true for other virt types ? */ if ((STREQ(def-os.type, hvm) 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)) || (STRNEQ(def-os.type, hvm) input-bus == VIR_DOMAIN_INPUT_BUS_XEN - input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) { + (input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input-type == VIR_DOMAIN_INPUT_TYPE_KBD))) { virDomainInputDefFree(input); continue; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4895e81..98706d5 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1239,6 +1239,7 @@ struct _virDomainTPMDef { enum virDomainInputType { VIR_DOMAIN_INPUT_TYPE_MOUSE, VIR_DOMAIN_INPUT_TYPE_TABLET, +VIR_DOMAIN_INPUT_TYPE_KBD, VIR_DOMAIN_INPUT_TYPE_LAST }; -- 1.8.2.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
On 02/13/2014 09:48 AM, Li Zhang wrote: From: Li Zhang zhlci...@linux.vnet.ibm.com There is no keyboard for non-x86 platforms when graphics are enabled. It's preferred to add one USB keyboard. This patch is to add keyboard input device type. Signed-off-by: Li Zhang zhlci...@linux.vnet.ibm.com --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c| 20 +--- src/conf/domain_conf.h| 1 + 3 files changed, 15 insertions(+), 7 deletions(-) ACK Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote: @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml, * XXX will this be true for other virt types ? */ if ((STREQ(def-os.type, hvm) 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)) || (STRNEQ(def-os.type, hvm) input-bus == VIR_DOMAIN_INPUT_BUS_XEN - input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) { + (input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input-type == VIR_DOMAIN_INPUT_TYPE_KBD))) { virDomainInputDefFree(input); continue; Later on in this function there is /* If graphics are enabled, there's an implicit PS2 mouse */ if (def-ngraphics 0) { virDomainInputDefPtr input; if (VIR_ALLOC(input) 0) { goto error; } if (STREQ(def-os.type, hvm)) { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_PS2; } else { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_XEN; } if (VIR_REALLOC_N(def-inputs, def-ninputs + 1) 0) { virDomainInputDefFree(input); goto error; } def-inputs[def-ninputs] = input; def-ninputs++; } which needs to take care of keyboards too now. And some more similar logic in virDomainDefFormatInternal which needs updating Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type
On 2014年02月14日 00:39, Daniel P. Berrange wrote: On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote: @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml, * XXX will this be true for other virt types ? */ if ((STREQ(def-os.type, hvm) 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)) || (STRNEQ(def-os.type, hvm) input-bus == VIR_DOMAIN_INPUT_BUS_XEN - input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) { + (input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input-type == VIR_DOMAIN_INPUT_TYPE_KBD))) { virDomainInputDefFree(input); continue; Later on in this function there is /* If graphics are enabled, there's an implicit PS2 mouse */ if (def-ngraphics 0) { virDomainInputDefPtr input; if (VIR_ALLOC(input) 0) { goto error; } if (STREQ(def-os.type, hvm)) { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_PS2; } else { input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE; input-bus = VIR_DOMAIN_INPUT_BUS_XEN; } if (VIR_REALLOC_N(def-inputs, def-ninputs + 1) 0) { virDomainInputDefFree(input); goto error; } def-inputs[def-ninputs] = input; def-ninputs++; } which needs to take care of keyboards too now. And some more similar logic in virDomainDefFormatInternal which needs updating ok, I will do it in next version soon. :) Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list