qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8 00/30] modify boot order of guest, and take e


From: Gonglei (Arei)
Subject: Re: [Qemu-devel] [PATCH v8 00/30] modify boot order of guest, and take effect after rebooting
Date: Thu, 11 Sep 2014 05:58:27 +0000

> > 主题: [Qemu-devel] [PATCH v8 00/30] modify boot order of guest, and take
> > effect after rebooting
> >
> > 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.
> 
> What about interactive boot menu?
> 
If you are using libvirt API, you can using libvirt interface to do this(I'm 
not sure
whether have ready-to-wear qom-set interface or not).
If you are using qemu command line boot vm, you can by qom-set directly.
See my test case please.

> >
> > 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.
> 
> you're aiming hotplug cases?

Including, but not limited to hotplugging situation. All devices
which support boot, regardless hotplug or coldplug in command line.

> So, do you have to QOMize bootindex of other devices?
> 
By the previous conversation, using QOM is the best way for bootindex property.
In this way, we needn't to introduce a new qmp interface.
Of course, we should realize all devices.

> >
> > 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. 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 v7:
> >  - IDE unit's value is set too later, so change IDE to not use
> >    device_add_bootindex_property(). IDE has its own getter/setter and a
> call
> >    to add_boot_device_path() on realize(). PATCH 25/30, 28/30 (Eduardo)
> >  - rewrite PATCH 5/30 using g_strcmp0. (Eduardo)
> >  - set 'ide_device_type_info.instance_init = ide_dev_instance_init'
> >    for all ide devices. PATCH 25/30 (Eduardo)
> >  - set 'scsi_device_type_info.instance_init = scsi_dev_instance_init'
> >    for all scsi devices. PATCH 24/30
> >  - initialize bootindex property to -1 in device_add_bootindex_property,
> >    so there is no need to duplicate the call to init bootindex with -1
> >    in all devices. (Gerd)
> >
> >  Thanks for review!
> >
> > changes since v6:
> >  - move all bootindex/boot-device code to a new file, named bootdevice.c.
> >  - introduce a getter/setter wrapper for all device.
> >  - call add_boot_device_path in setter bootindx callback function.
> >  - call del_boot_device_path in finalize bootindex qom callback function.
> >  - other bugfixes.
> >
> >  Thanks for Eduardo's good suggestion! And other guys, thanks too!
> >
> > 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.
> >
> > This series based on my patch posted yestoday:
> >  [PATCH v2 0/9] virtio: fix virtio child recount in transports
> > http://lists.gnu.org/archive/html/qemu-devel/2014-09/msg01601.html
> >
> > ./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/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=/mnt/sdb/gonglei/image/virtio-win-1.5.3.vfd,if=none,id=drive-fdc0-0-0,for
> > mat=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 -device
> > virtio-scsi-pci,id=scsi0 -drive file=/home/suse11_sp3_32,if=none,\
> > id=drive-scsi0-0-0-0,format=raw,cache=none,aio=native \ -device
> >
> scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-
> > 0-0-0,bootindex=8
> > QEMU 2.1.50 monitor - type 'help' for more information
> > (qemu) qom-get nic1 bootindex
> > 3 (0x3)
> > (qemu) qom-set nic1 bootindex 3
> > The bootindex 3 has already been used
> > (qemu) qom-set nic1 bootindex 0
> > (qemu) qom-set floppy1 bootindexA 3
> > (qemu) system_reset
> > (qemu) qom-get nic1 bootindex
> > 0 (0x0)
> > (qemu) qom-get scsi0-0-0-0 bootindex
> > 8 (0x8)
> > (qemu) qom-set scsi0-0-0-0 bootindex 0
> > The bootindex 0 has already been used
> > (qemu) qom-set nic1 bootindex -1
> > (qemu) qom-set scsi0-0-0-0 bootindex 0
> > (qemu) qom-get scsi0-0-0-0 bootindex
> > 0 (0x0)
> > (qemu)
> >
> 
> Hmm..., seems we also need something like this:
> (qemu) qom-get bootindex
> dev0 bootindex 0
> dev1 bootindex 1
> dev2 bootindex 2
> ...
I don't think so. Qom-get interface is ready-to-wear, we must
provide both QOM path and QOM property name. This interface
is not added by me. Thanks. :)

BTW, you can look at with Andreas's patch series:
http://thread.gmane.org/gmane.comp.emulators.qemu/271513

which haven't applied in mater tree.

Best regards,
-Gonglei

reply via email to

[Prev in Thread] Current Thread [Next in Thread]