All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v6 00/27] modify boot order of guest, and take effect after rebooting
@ 2014-08-30 10:00 arei.gonglei
  2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 01/27] bootindex: add check bootindex function arei.gonglei
                   ` (26 more replies)
  0 siblings, 27 replies; 58+ messages in thread
From: arei.gonglei @ 2014-08-30 10:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, ehabkost, luonengjun,
	peter.huangpeng, hani, stefanha, pbonzini, lcapitulino, kwolf,
	peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

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

^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2014-09-05 14:57 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-30 10:00 [Qemu-devel] [PATCH v6 00/27] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 01/27] bootindex: add check bootindex function arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 02/27] bootindex: add del_boot_device_path function arei.gonglei
2014-09-01  6:43   ` Gerd Hoffmann
2014-09-01  6:47     ` Gonglei (Arei)
2014-09-02 18:00       ` Eduardo Habkost
2014-09-03  2:35         ` Gonglei (Arei)
2014-09-03  6:24           ` Gerd Hoffmann
2014-09-03  6:45             ` Gonglei (Arei)
2014-09-03 18:13               ` Eduardo Habkost
2014-09-04  3:01                 ` Gonglei (Arei)
2014-09-04 13:22                   ` Eduardo Habkost
2014-09-05  0:44                     ` Gonglei (Arei)
2014-09-05  2:20                       ` Eduardo Habkost
2014-09-05  2:42                         ` Gonglei (Arei)
2014-09-05 14:56                           ` Eduardo Habkost
2014-09-04  6:15                 ` Gonglei (Arei)
2014-09-04 11:48                   ` Gonglei (Arei)
2014-09-04 12:06                     ` Gonglei (Arei)
2014-09-03  2:40         ` Gonglei (Arei)
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 03/27] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 04/27] bootindex: rework add_boot_device_path function arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 05/27] bootindex: support to set a existent device's bootindex to -1 arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 06/27] bootindex: move setting bootindex on reset() instead of realize/init() arei.gonglei
2014-09-04 14:50   ` Eduardo Habkost
2014-09-05  0:09     ` Gonglei (Arei)
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 07/27] vl.c: add setter/getter functions for bootindex property arei.gonglei
2014-08-31  9:58   ` Michael S. Tsirkin
2014-09-01  1:02     ` Gonglei (Arei)
2014-09-03  7:47   ` Gonglei (Arei)
2014-09-03  8:20     ` Gerd Hoffmann
2014-09-03  8:37       ` Gonglei (Arei)
2014-09-04 15:01   ` Eduardo Habkost
2014-09-05  0:37     ` Gonglei (Arei)
2014-09-05  1:55       ` Eduardo Habkost
2014-09-05  2:07         ` Gonglei (Arei)
2014-09-05  2:21           ` Eduardo Habkost
2014-09-05  2:44             ` Gonglei (Arei)
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 08/27] virtio-net: add bootindex to qom property arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 09/27] e1000: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 10/27] eepro100: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 11/27] ne2000: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 12/27] pcnet: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 13/27] rtl8139: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 14/27] spapr_lian: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 15/27] vmxnet3: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 16/27] usb-net: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 17/27] net: remove bootindex property from qdev to qom arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 18/27] host-libusb: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 19/27] pci-assign: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 20/27] vfio: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 21/27] redirect: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 22/27] isa-fdc: remove bootindexA/B " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 23/27] ide: add bootindex to qom property arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 24/27] scsi: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 25/27] virtio-blk: " arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 26/27] block: remove bootindex property from qdev to qom arei.gonglei
2014-08-30 10:00 ` [Qemu-devel] [PATCH v6 27/27] bootindex: delete bootindex when device is removed arei.gonglei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.