[Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-07 Thread arei.gonglei
From: Gonglei 

Changes since v10:
 1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
 2. add especial bootidnex setter/getter functions for usb-storage
device in PATCH 29.
 3. add bootindex qom property for nvma and ne2k_isa devices,
avoid regrassion in PATCH 30.
 4. change fprintf to error_report in bootdevice.c in PATCH 34.
 5. rebase on the latest qemu master tree.
 6. add 'Reviewed-by' in other patches. (Thanks, Gerd)

Changes since v9:
 - rework del_boot_device_path() for code sharing more better.(Gerd)
   Now, it has only one delete funciton, which work for update fw_cfg list
   both setting bootindex and hot-unplugging devices.

Changes since v8:
 - fix wrong rebase on PATCH 14/30 and 15/30.

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.

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. 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.

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/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

Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-08 Thread Gonglei
On 2014/10/7 16:00, Gonglei (Arei) wrote:

> From: Gonglei 
> 
> Changes since v10:
>  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
>  2. add especial bootidnex setter/getter functions for usb-storage
> device in PATCH 29.
>  3. add bootindex qom property for nvma and ne2k_isa devices,
> avoid regrassion in PATCH 30.
>  4. change fprintf to error_report in bootdevice.c in PATCH 34.
>  5. rebase on the latest qemu master tree.
>  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)
> 


Hi, Gerd

Could you please review the v11 and consider to merge this series in your tree?
I have no idea which maintainer can apply this series. It seems that only you
and Eduardo  interested in and reviewed this patch series at present. :(

Any help will be appreciated! This patch series has crossed two versions of 
QEMU,
now is the soft freeze period of qemu-2.2 again.

Best regards,
-Gonglei

> Changes since v9:
>  - rework del_boot_device_path() for code sharing more better.(Gerd)
>Now, it has only one delete funciton, which work for update fw_cfg list
>both setting bootindex and hot-unplugging devices.
> 
> Changes since v8:
>  - fix wrong rebase on PATCH 14/30 and 15/30.
> 
> 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.
> 
> 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. 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.
> 
> For Convenience of testing, my test case based on Andreas's patch series:
>  [PATCH qom-next 0/4] qom: HMP commands to re

Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-09 Thread Gerd Hoffmann
On Mi, 2014-10-08 at 19:00 +0800, Gonglei wrote:
> On 2014/10/7 16:00, Gonglei (Arei) wrote:
> 
> > From: Gonglei 
> > 
> > Changes since v10:
> >  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
> >  2. add especial bootidnex setter/getter functions for usb-storage
> > device in PATCH 29.
> >  3. add bootindex qom property for nvma and ne2k_isa devices,
> > avoid regrassion in PATCH 30.
> >  4. change fprintf to error_report in bootdevice.c in PATCH 34.
> >  5. rebase on the latest qemu master tree.
> >  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)
> > 
> 
> 
> Hi, Gerd
> 
> Could you please review the v11 and consider to merge this series in your 
> tree?
> I have no idea which maintainer can apply this series. It seems that only you
> and Eduardo  interested in and reviewed this patch series at present. :(

Yea, for these cross-tree changes it isn't always clear which way they
should be merged.  qom or pc would make sense I think.

I can prepare a pull request too, but I'd like to have a second opinion
on the stuff which is outside of my primary focus:

  * fw_cfg changes (mst?  paolo?)
  * qom bits (andreas?  paolo?, eduardo?)

I'll go take "no answer" as "no objections", but I'd prefer to apply one
or another "reviewed-by" to the series.

thanks,
  Gerd





Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-09 Thread Gonglei
On 2014/10/9 17:47, Gerd Hoffmann wrote:

> On Mi, 2014-10-08 at 19:00 +0800, Gonglei wrote:
>> On 2014/10/7 16:00, Gonglei (Arei) wrote:
>>
>>> From: Gonglei 
>>>
>>> Changes since v10:
>>>  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
>>>  2. add especial bootidnex setter/getter functions for usb-storage
>>> device in PATCH 29.
>>>  3. add bootindex qom property for nvma and ne2k_isa devices,
>>> avoid regrassion in PATCH 30.
>>>  4. change fprintf to error_report in bootdevice.c in PATCH 34.
>>>  5. rebase on the latest qemu master tree.
>>>  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)
>>>
>>
>>
>> Hi, Gerd
>>
>> Could you please review the v11 and consider to merge this series in your 
>> tree?
>> I have no idea which maintainer can apply this series. It seems that only you
>> and Eduardo  interested in and reviewed this patch series at present. :(
> 
> Yea, for these cross-tree changes it isn't always clear which way they
> should be merged.  qom or pc would make sense I think.
> 
> I can prepare a pull request too, but I'd like to have a second opinion
> on the stuff which is outside of my primary focus:
> 

Thanks a lot!

>   * fw_cfg changes (mst?  paolo?)
>   * qom bits (andreas?  paolo?, eduardo?)
> 

I will appreciate for your review, guys :)

Best regards,
-Gonglei

> I'll go take "no answer" as "no objections", but I'd prefer to apply one
> or another "reviewed-by" to the series.
> 
> thanks,
>   Gerd
> 
> 







Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-09 Thread Michael Mueller
On Thu, 09 Oct 2014 11:47:12 +0200
Gerd Hoffmann  wrote:

> On Mi, 2014-10-08 at 19:00 +0800, Gonglei wrote:
> > On 2014/10/7 16:00, Gonglei (Arei) wrote:
> > 
> > > From: Gonglei 
> > > 
> > > Changes since v10:
> > >  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
> > >  2. add especial bootidnex setter/getter functions for usb-storage
> > > device in PATCH 29.
> > >  3. add bootindex qom property for nvma and ne2k_isa devices,
> > > avoid regrassion in PATCH 30.
> > >  4. change fprintf to error_report in bootdevice.c in PATCH 34.
> > >  5. rebase on the latest qemu master tree.
> > >  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)
> > > 
> > 
> > 
> > Hi, Gerd
> > 
> > Could you please review the v11 and consider to merge this series in your 
> > tree?
> > I have no idea which maintainer can apply this series. It seems that only 
> > you
> > and Eduardo  interested in and reviewed this patch series at present. :(
> 
> Yea, for these cross-tree changes it isn't always clear which way they
> should be merged.  qom or pc would make sense I think.
> 
> I can prepare a pull request too, but I'd like to have a second opinion
> on the stuff which is outside of my primary focus:
> 
>   * fw_cfg changes (mst?  paolo?)
>   * qom bits (andreas?  paolo?, eduardo?)
> 
> I'll go take "no answer" as "no objections", but I'd prefer to apply one
> or another "reviewed-by" to the series.
> 
> thanks,
>   Gerd
> 

The s390x team is planning to use some functionality of this patch set as base 
for diag308
implementation. I'll give v11 a try on our platform.

Michael

> 
> 




Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-09 Thread Andreas Färber
Am 09.10.2014 um 12:09 schrieb Gonglei:
> On 2014/10/9 17:47, Gerd Hoffmann wrote:
> 
>> On Mi, 2014-10-08 at 19:00 +0800, Gonglei wrote:
>>> On 2014/10/7 16:00, Gonglei (Arei) wrote:
>>>
 From: Gonglei 

 Changes since v10:
  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
  2. add especial bootidnex setter/getter functions for usb-storage
 device in PATCH 29.
  3. add bootindex qom property for nvma and ne2k_isa devices,
 avoid regrassion in PATCH 30.
  4. change fprintf to error_report in bootdevice.c in PATCH 34.
  5. rebase on the latest qemu master tree.
  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)

>>>
>>>
>>> Hi, Gerd
>>>
>>> Could you please review the v11 and consider to merge this series in your 
>>> tree?
>>> I have no idea which maintainer can apply this series. It seems that only 
>>> you
>>> and Eduardo  interested in and reviewed this patch series at present. :(
>>
>> Yea, for these cross-tree changes it isn't always clear which way they
>> should be merged.  qom or pc would make sense I think.
>>
>> I can prepare a pull request too, but I'd like to have a second opinion
>> on the stuff which is outside of my primary focus:
>>
> 
> Thanks a lot!
> 
>>   * fw_cfg changes (mst?  paolo?)
>>   * qom bits (andreas?  paolo?, eduardo?)

I'll try to look at whatever QOM bits, but I don't have the time to take
another large series myself right now. Not everything using QOM (as
opposed to changing QOM) needs to go through qom-next. :)

Thanks,
Andreas

>>
> 
> I will appreciate for your review, guys :)
> 
> Best regards,
> -Gonglei
> 
>> I'll go take "no answer" as "no objections", but I'd prefer to apply one
>> or another "reviewed-by" to the series.
>>
>> thanks,
>>   Gerd
>>
>>
> 
> 
> 
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-09 Thread Paolo Bonzini
Il 09/10/2014 11:47, Gerd Hoffmann ha scritto:
> On Mi, 2014-10-08 at 19:00 +0800, Gonglei wrote:
>> On 2014/10/7 16:00, Gonglei (Arei) wrote:
>>
>>> From: Gonglei 
>>>
>>> Changes since v10:
>>>  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
>>>  2. add especial bootidnex setter/getter functions for usb-storage
>>> device in PATCH 29.
>>>  3. add bootindex qom property for nvma and ne2k_isa devices,
>>> avoid regrassion in PATCH 30.
>>>  4. change fprintf to error_report in bootdevice.c in PATCH 34.
>>>  5. rebase on the latest qemu master tree.
>>>  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)
>>>
>>
>>
>> Hi, Gerd
>>
>> Could you please review the v11 and consider to merge this series in your 
>> tree?
>> I have no idea which maintainer can apply this series. It seems that only you
>> and Eduardo  interested in and reviewed this patch series at present. :(
> 
> Yea, for these cross-tree changes it isn't always clear which way they
> should be merged.  qom or pc would make sense I think.
> 
> I can prepare a pull request too, but I'd like to have a second opinion
> on the stuff which is outside of my primary focus:
> 
>   * fw_cfg changes (mst?  paolo?)
>   * qom bits (andreas?  paolo?, eduardo?)

I have not been looking at the series, you and Eduardo could do a better
job.  Anyway, I looked at the above pieces and they look good as far as
using/extending the API is concerned.

Paolo

> I'll go take "no answer" as "no objections", but I'd prefer to apply one
> or another "reviewed-by" to the series.
> 
> thanks,
>   Gerd
> 
> 
> 
> 




Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting

2014-10-09 Thread Gonglei
> Subject: Re: [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and
> take effect after rebooting
> 
> On Thu, 09 Oct 2014 11:47:12 +0200
> Gerd Hoffmann  wrote:
> 
> > On Mi, 2014-10-08 at 19:00 +0800, Gonglei wrote:
> > > On 2014/10/7 16:00, Gonglei (Arei) wrote:
> > >
> > > > From: Gonglei 
> > > >
> > > > Changes since v10:
> > > >  1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
> > > >  2. add especial bootidnex setter/getter functions for usb-storage
> > > > device in PATCH 29.
> > > >  3. add bootindex qom property for nvma and ne2k_isa devices,
> > > > avoid regrassion in PATCH 30.
> > > >  4. change fprintf to error_report in bootdevice.c in PATCH 34.
> > > >  5. rebase on the latest qemu master tree.
> > > >  6. add 'Reviewed-by' in other patches. (Thanks, Gerd)
> > > >
> > >
> > >
> > > Hi, Gerd
> > >
> > > Could you please review the v11 and consider to merge this series in your
> tree?
> > > I have no idea which maintainer can apply this series. It seems that only 
> > > you
> > > and Eduardo  interested in and reviewed this patch series at present. :(
> >
> > Yea, for these cross-tree changes it isn't always clear which way they
> > should be merged.  qom or pc would make sense I think.
> >
> > I can prepare a pull request too, but I'd like to have a second opinion
> > on the stuff which is outside of my primary focus:
> >
> >   * fw_cfg changes (mst?  paolo?)
> >   * qom bits (andreas?  paolo?, eduardo?)
> >
> > I'll go take "no answer" as "no objections", but I'd prefer to apply one
> > or another "reviewed-by" to the series.
> >
> > thanks,
> >   Gerd
> >
> 
> The s390x team is planning to use some functionality of this patch set as base
> for diag308
> implementation. I'll give v11 a try on our platform.
> 
> Michael
> 
Great! 

Please let us know your results. Thanks :)

Best regards,
-Gonglei