[virt-tools-list] [virt-manager PATCH 4/4]RFC: addhardware:enable setting controller model

Chen Hanxiao chen_han_xiao at 126.com
Wed Apr 16 16:09:32 UTC 2014


On 04/16/2014 08:32 PM, Giuseppe Scrivano wrote:
> Chen Hanxiao <chenhanxiao at cn.fujitsu.com> writes:
>
>> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
>> ---
>>   virtManager/addhardware.py | 18 +++++++++++-------
>>   1 file changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
>> index 60e8033..531282c 100644
>> --- a/virtManager/addhardware.py
>> +++ b/virtManager/addhardware.py
>> @@ -325,9 +325,6 @@ class vmmAddHardware(vmmGObjectUI):
>>           target_model = Gtk.ListStore(str, str)
>>           combo.set_model(target_model)
>>           uiutil.set_combo_text_column(combo, 1)
>> -        # FIXME: we should deal with controller model
>> -        combo.set_visible(False)
>> -        self.widget("controller-model-label").set_visible(False)
>>   
>>           # Available HW options
>>           is_local = not self.conn.is_remote()
>> @@ -1813,12 +1810,19 @@ class vmmAddHardware(vmmGObjectUI):
>>           controller_type = self.get_config_controller_type()
>>           model = self.get_config_controller_model()
>>           self._dev = VirtualController(conn)
>> -        # FIXME
>> -        model = "none"
>> +
>> +        for ctrl in self.vm.get_controller_devices():
>> +            # FIXME: some sync issue
>> +            if ctrl.type == "usb":
>> +                self.vm.remove_device(ctrl)
> why do we remove the device here?
We could not get rid of USB controller.
UI forbid us from removing it either. (Although we still could delete it 
by right-click)

So I think we should remove the existed USB controller before adding a 
new one.

USB 2 maps to multi device and we need to deal with some complex scenario.
We also support modifying controller model, remove the existed USB 
controller
may simplify codes.

But I met some sync issue: when I remove USB controllers, it will be 
added back automatically.
We would see more than one USB controllers, sometimes error would be thrown.

So maybe we need a better method to deal with.

Thanks

- Chen
>
>> +            for dev in VirtualController.get_usb2_controllers(conn):
>> +                setattr(self._dev, "type", dev.type)
>> +                setattr(self._dev, "model", dev.model)
>> +                setattr(self._dev, "master_startport", dev.master_startport)
> these could also be rewritten as object.name = value.
>
> Thanks,
> Giuseppe
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
>





More information about the virt-tools-list mailing list