We read the nova code, find that the input device info was refreshed into nova db using the following line: nova.virt.libvirt.driver.LibvirtDriver.spawn#self._register_undefined_instance_details(context, instance),
but when the instance is booting, nova.virt.libvirt.driver.LibvirtDriver.spawn#xml = self._get_guest_xml(context, instance, network_info, disk_info, image_meta, block_device_info=block_device_info, mdevs=mdevs, accel_info=accel_info) record the xml without the usb keyboard, this may be the trick.
We created an instance and then rebooted it, but the instance xml is changed after we reboot it, the following lines were added to the xml:
<input type='keyboard' bus='usb'>
<alias name='input1'/>
<address type='usb' bus='0' port='2'/>
</input>
We read the nova code, find that the input device info was refreshed into nova db using the following line: nova.virt. libvirt. driver. LibvirtDriver. spawn#self. _register_ undefined_ instance_ details( context, instance),
but when the instance is booting, nova.virt. libvirt. driver. LibvirtDriver. spawn#xml = self._get_ guest_xml( context, instance, network_info, disk_info, image_meta, block_device_ info=block_ device_ info, mdevs=mdevs, accel_info= accel_info) record the xml without the usb keyboard, this may be the trick.
Thank you for looking into it.