[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 00/27] modify boot order of guest, and take effec
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v6 00/27] modify boot order of guest, and take effect after rebooting |
Date: |
Sat, 30 Aug 2014 18:00:00 +0800 |
From: Gonglei <address@hidden>
Sometimes, we want to modify boot order of a guest, but no need to
shutdown it. We can call dynamic changing bootindex of a guest, which
can be assured taking effect just after the guest rebooting.
For example, in P2V scene, we boot a guest and then attach a
new system disk, for copying some thing. We want to assign the
new disk as the booting disk, which means its bootindex=1.
Different nics can be assigen different bootindex dynamically
also make sense.
This patch series do belows works:
1. add an fw_cfg_machine_reset() assure re-read global fw_boot_order list
during vm rebooting.
2. Set/update bootindex on reset instead of realize/init.
3. Switch the property from qdev to qom, then use the set
callback to also update the fw_cfg file.
Note:
- Do not support change pci option rom's bootindex.
- Do not handle those devices which don't have use the bootindex property.
changes since v5:
rework by Gerd and Markus's suggestion(Thanks a lot):
- Set/update bootindex on reset instead of realize/init.
- Switch the property from qdev to qom, then use the set
callback to also update the fw_cfg file.
- using qom-set instead of 'set-bootindex' qmp interface,
remove it.
This is a huge change relative to the previous version.
Changes since v4:
- using error_setg() instead of qerror_report() in patch 1/8.
- call del_boot_device_path() from device_finalize() instead
of placing it into each individual device in patch 4/8.
Changes since v3:
- rework del_* and modify_* function, because of virtio devices' specialation.
For example, virtio-net's id is NULL, and its parent virtio-net-pci's id was
assigned.
Though the global fw_boot_order stored the virtio-net device.
- call dell_boot_device_path in each individual device avoiding waste resouce.
- introduce qmp "query-bootindex" command
- introcude hmp "info bootindex" command
- Fixes by Eric's reviewing comments, thanks.
Changes since v2:
*address Gerd's reviewing suggestion:
- use the old entry's suffix, if the caller do not pass it in.
- call del_boot_device_path() from device_finalize() instead
of placing it into each individual device.
Changes since v1:
*rework by Gerd's suggestion:
- split modify and del fw_boot_order for single function.
- change modify bootindex's realization which simply lookup
the device and modify the bootindex. if the new bootindex
has already used by another device just throw an error.
- change to del_boot_device_path(DeviceState *dev) and simply delete all
entries belonging to the device.
For Convenience of testing, my test case based on Andreas's patch series:
[PATCH qom-next 0/4] qom: HMP commands to replace info qtree
http://thread.gmane.org/gmane.comp.emulators.qemu/271513
However, there is no direct relation with this bootindex patch series.
./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive
file=/home/win7_32_2U,if=none,id=drive-ide0-0-0 -device
ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive
file=/home/iso/rhel-server-7.0-x86_64-dvd.iso,if=none,id=drive-ide0-0-1 -device
ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=4 -vnc
0.0.0.0:10 -netdev type=user,id=net0 -device
virtio-net-pci,netdev=net0,bootindex=3,id=nic1 -drive
file=/home/virtio-win-1.5.3.vfd,if=none,id=drive-fdc0-0-0,format=raw -device
isa-fdc,driveA=drive-fdc0-0-0,bootindexA=5,id=floppy1 -qmp
unix:/tmp/qmp,server,nowait -monitor stdio -netdev type=user,id=net1 -device
e1000,netdev=net1,bootindex=2,id=nic -boot menu=on
QEMU 2.1.50 monitor - type 'help' for more information
(qemu) qom-get /machine/peripheral/nic1 bootindex
3 (0x3)
(qemu) qom-set /machine/peripheral/nic1 bootindex 3
The bootindex 3 has already been used
(qemu) qom-set /machine/peripheral/nic1 bootindex 0
(qemu) qom-get /machine/peripheral/nic1 bootindex
0 (0x0)
(qemu) qom-set /machine/peripheral/floppy1 bootindexA 3
The bootindex 3 has already been used
(qemu) system_reset
(qemu) qom-get /machine/peripheral/nic1 bootindex
0 (0x0)
(qemu) qom-get /machine/peripheral/floppy1 bootindexA
5 (0x5)
(qemu) qom-set /machine/peripheral/floppy1 bootindexA 3
(qemu) qom-get /machine/peripheral/floppy1 bootindexA
3 (0x3)
(qemu)
Gonglei (27):
bootindex: add check bootindex function
bootindex: add del_boot_device_path function
fw_cfg: add fw_cfg_machine_reset function
bootindex: rework add_boot_device_path function
bootindex: support to set a existent device's bootindex to -1
bootindex: move setting bootindex on reset() instead of
realize/init()
vl.c: add setter/getter functions for bootindex property
virtio-net: add bootindex to qom property
e1000: add bootindex to qom property
eepro100: add bootindex to qom property
ne2000: add bootindex to qom property
pcnet: add bootindex to qom property
rtl8139: add bootindex to qom property
spapr_lian: add bootindex to qom property
vmxnet3: add bootindex to qom property
usb-net: add bootindex to qom property
net: remove bootindex property from qdev to qom
host-libusb: remove bootindex property from qdev to qom
pci-assign: remove bootindex property from qdev to qom
vfio: remove bootindex property from qdev to qom
redirect: remove bootindex property from qdev to qom
isa-fdc: remove bootindexA/B property from qdev to qom
ide: add bootindex to qom property
scsi: add bootindex to qom property
virtio-blk: add bootindex to qom property
block: remove bootindex property from qdev to qom
bootindex: delete bootindex when device is removed
hw/block/fdc.c | 53 +++++++++++++++++++++---
hw/block/virtio-blk.c | 24 ++++++++++-
hw/core/qdev.c | 4 ++
hw/i386/kvm/pci-assign.c | 29 ++++++++++++--
hw/ide/qdev.c | 43 ++++++++++++++++++--
hw/misc/vfio.c | 29 +++++++++++++-
hw/net/e1000.c | 31 +++++++++++++-
hw/net/eepro100.c | 37 +++++++++++++++--
hw/net/lance.c | 29 ++++++++++++++
hw/net/ne2000.c | 38 +++++++++++++++++-
hw/net/pcnet-pci.c | 31 ++++++++++++++
hw/net/pcnet.c | 19 ++++++++-
hw/net/pcnet.h | 5 +++
hw/net/rtl8139.c | 29 +++++++++++++-
hw/net/spapr_llan.c | 29 +++++++++++++-
hw/net/virtio-net.c | 26 +++++++++++-
hw/net/vmxnet3.c | 29 +++++++++++++-
hw/nvram/fw_cfg.c | 55 +++++++++++++++++++++++--
hw/scsi/scsi-disk.c | 34 +++++++++++++++-
hw/scsi/scsi-generic.c | 9 +++--
hw/usb/dev-network.c | 29 +++++++++++++-
hw/usb/host-libusb.c | 29 +++++++++++++-
hw/usb/redirect.c | 31 +++++++++++++-
hw/virtio/virtio-pci.c | 23 +++++++++++
include/hw/block/block.h | 1 -
include/hw/nvram/fw_cfg.h | 2 +
include/hw/scsi/scsi.h | 1 +
include/net/net.h | 4 +-
include/sysemu/sysemu.h | 6 +++
vl.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++
30 files changed, 759 insertions(+), 50 deletions(-)
--
1.7.12.4
- [Qemu-devel] [PATCH v6 00/27] modify boot order of guest, and take effect after rebooting,
arei.gonglei <=
- [Qemu-devel] [PATCH v6 10/27] eepro100: add bootindex to qom property, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 01/27] bootindex: add check bootindex function, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 04/27] bootindex: rework add_boot_device_path function, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 09/27] e1000: add bootindex to qom property, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 05/27] bootindex: support to set a existent device's bootindex to -1, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 17/27] net: remove bootindex property from qdev to qom, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 25/27] virtio-blk: add bootindex to qom property, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 21/27] redirect: remove bootindex property from qdev to qom, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 20/27] vfio: remove bootindex property from qdev to qom, arei.gonglei, 2014/08/30
- [Qemu-devel] [PATCH v6 26/27] block: remove bootindex property from qdev to qom, arei.gonglei, 2014/08/30