QEMU supported to set device's boot index online recently(since QEMU 2.2.0).
http://lists.gnu.org/archive/html/qemu-devel/2014-10/msg00879.html
The QMP "qom-set" is available for setting boot index. qom-set's example is
as follows:
{
.name = "qom-set",
.args_type = "path:s,property:s,value:q",
.mhandler.cmd_new = qmp_qom_set,
}
(qemu) qom-set nic1 bootindex 3
(qemu) qom-set nic1 bootindex -1
(qemu) qom-set scsi0-0-0-0 bootindex 2
Setting boot index to -1 means cancel it.
We can attach/update a device and set it's boot order when VM is running. The boot
order will take effect immediately(after guest rebooting). For example, we can use
'virsh update-device' to change an interface's boot order. The xml is
specified as
below.
<interface type='bridge'>
<mac address='fa:16:3e:2e:d4:3d'/>
<source bridge='br0'/>
<target dev='tap4f2bce78-5b'/>
<model type='virtio'/>
<driver queues='4'/>
<boot order='2'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
</interface>
If the 'boot order' is not specified in the xml, that means canceling its boot
order.
Wang Rui (8):
qemu: add a new qemuMonitorSetBootIndex() method to set device's
bootorder
qemu: support attachment of net device with boot index
conf: check boot order which is used by itself
qemu: a code movement
qemu: support attachment of disk device with boot index
conf: add compatiblity check for boot index when updating device
qemu: support updating interface with boot index
qemu: support updating disk with boot index
src/conf/device_conf.c | 13 ++
src/conf/device_conf.h | 12 ++
src/conf/domain_conf.c | 74 ++++++----
src/conf/domain_conf.h | 9 --
src/qemu/qemu_driver.c | 64 +++++++--
src/qemu/qemu_hotplug.c | 329 +++++++++++++++++++++++++++++++------------
src/qemu/qemu_hotplug.h | 4 +
src/qemu/qemu_monitor.c | 25 ++++
src/qemu/qemu_monitor.h | 4 +
src/qemu/qemu_monitor_json.c | 19 +++
src/qemu/qemu_monitor_json.h | 5 +
11 files changed, 424 insertions(+), 134 deletions(-)
--
1.7.12.4