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