All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
@ 2014-08-04 12:46 arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function arei.gonglei
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, 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.

The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
to achieve it.

Steps of testing:

./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive \
file=/home/redhat6.2.img,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/RH-DVD1.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 \
-netdev type=user,id=net1 -device e1000,netdev=net1,bootindex=2,id=nic2 \
-drive file=/home/virtio-disk.vfd,if=none,id=drive-fdc0-0-0,format=raw \
-device isa-fdc,driveA=drive-fdc0-0-0,id=floppy1,bootindexA=5 -monitor stdio
QEMU 2.0.93 monitor - type 'help' for more information
(qemu) info bootindex
id       bootindex       suffix
"floppy1"        5      "/floppy@0"
"ide0-0-1"       4      "/disk@1"
"nic1"   3      "/ethernet-phy@0"
"nic2"   2      "/ethernet-phy@0"
"ide0-0-0"       1      "/disk@0"
(qemu) set-bootindex ide0-0-1 1
The bootindex 1 has already been used
(qemu) set-bootindex ide0-0-1 6 "/disk@1"
(qemu) set-bootindex ide0-0-1 0
(qemu) system_reset
(qemu) set-bootindex ide0-0-1 1
The bootindex 1 has already been used
(qemu) set-bootindex nic1 0
The bootindex 0 has already been used
(qemu) set-bootindex ide0-0-1 -1
(qemu) set-bootindex nic1 0
(qemu) info bootindex
id       bootindex       suffix
"floppy1"        5      "/floppy@0"
"nic2"   2      "/ethernet-phy@0"
"ide0-0-0"       1      "/disk@0"
"nic1"   0      "/ethernet-phy@0"
(qemu) system_reset
(qemu)


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.

  Thanks Gerd.

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.

Gonglei (8):
  bootindex: add modify_boot_device_path function
  bootindex: add del_boot_device_path function
  fw_cfg: add fw_cfg_machine_reset function
  bootindex: delete bootindex when device is removed
  qmp: add set-bootindex command
  qemu-monitor: HMP set-bootindex wrapper
  qmp: add query-bootindex command
  qemu-monitor: add HMP "info-bootindex" command

 hmp-commands.hx           |  17 +++++++
 hmp.c                     |  33 +++++++++++++
 hmp.h                     |   2 +
 hw/core/qdev.c            |   4 ++
 hw/nvram/fw_cfg.c         |  54 ++++++++++++++++++---
 include/hw/nvram/fw_cfg.h |   2 +
 include/sysemu/sysemu.h   |   3 ++
 monitor.c                 |   7 +++
 qapi-schema.json          |  46 ++++++++++++++++++
 qmp-commands.hx           |  66 ++++++++++++++++++++++++++
 qmp.c                     |  17 +++++++
 vl.c                      | 117 ++++++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 361 insertions(+), 7 deletions(-)

-- 
1.7.12.4

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

end of thread, other threads:[~2014-08-28  4:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 3/8] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 4/8] bootindex: delete bootindex when device is removed arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 5/8] qmp: add set-bootindex command arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 6/8] qemu-monitor: HMP set-bootindex wrapper arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 7/8] qmp: add query-bootindex command arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 8/8] qemu-monitor: add HMP "info-bootindex" command arei.gonglei
2014-08-04 12:53 ` [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting Gonglei (Arei)
2014-08-07 11:50 ` Gonglei (Arei)
2014-08-07 12:57   ` Paolo Bonzini
2014-08-07 13:01     ` Gonglei (Arei)
2014-08-26  6:36 ` Gerd Hoffmann
2014-08-26  9:07   ` Gonglei (Arei)
2014-08-26 10:00     ` Gerd Hoffmann
2014-08-26 11:24       ` Markus Armbruster
2014-08-27  2:11         ` Gonglei (Arei)
2014-08-27 14:23           ` Gerd Hoffmann
2014-08-28  4:50             ` Gonglei (Arei)

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.