<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><span style="white-space: pre-wrap; line-height: 1.7;">At 2014-01-21 22:17:49,"Cole Robinson" <<a href="mailto:crobinso@redhat.com">crobinso@redhat.com</a>> wrote:</span><br><pre>>On 01/21/2014 04:19 AM, Chen Hanxiao wrote:
>> From: Chen Hanxiao <<a href="mailto:chenhanxiao@cn.fujitsu.com">chenhanxiao@cn.fujitsu.com</a>>
>>
>> We could specify 'model' for scsi controllers,
>> that means we could see more than one controllers
>> with same icon and blank details.
>> That will confuse users.
>>
>> This patch will show details of scsi controller device.
>> And also we could modify scsi controller model
>> between 'default' and 'virtio-scsi'.
>>
>> Signed-off-by: Chen Hanxiao <<a href="mailto:chenhanxiao@cn.fujitsu.com">chenhanxiao@cn.fujitsu.com</a>>
>> ---
>> v2: fix an issue if no scsi controller existed
>> v3: code refactor according to cole's comments
>>
>> virtManager/details.py | 6 ++++--
>> virtManager/domain.py | 21 +++++++++++++++------
>> 2 files changed, 19 insertions(+), 8 deletions(-)
>>
>> diff --git a/virtManager/details.py b/virtManager/details.py
>> index 32d51d7..aa48868 100644
>> --- a/virtManager/details.py
>> +++ b/virtManager/details.py
>> @@ -3299,13 +3299,12 @@ class vmmDetails(vmmGObjectUI):
>>
>> type_label = virtinst.VirtualController.pretty_type(dev.type)
>> model_label = dev.model
>> - is_usb = dev.type == virtinst.VirtualController.TYPE_USB
>> if not model_label:
>> model_label = _("Default")
>>
>> self.widget("controller-type").set_text(type_label)
>> combo = self.widget("controller-model")
>> - uihelpers.set_grid_row_visible(combo, is_usb)
>> + uihelpers.set_grid_row_visible(combo, True)
>>
>> model = combo.get_model()
>> model.clear()
>> @@ -3314,6 +3313,9 @@ class vmmDetails(vmmGObjectUI):
>> model.append(["ich9-ehci1", "USB 2"])
>> model.append(["nec-xhci", "USB 3"])
>> self.widget("config-remove").set_sensitive(False)
>> + elif dev.type == virtinst.VirtualController.TYPE_SCSI:
>> + model.append(["default", "Default"])
>> + model.append(["virtio-scsi", "Virtio SCSI"])
>> else:
>
>If you just do [None, "Default"] here, you don't need to specially handle
>"default" in domain.py</pre><pre>I did a simple test like:</pre><pre> + model.append([None, "Default"])
+ model.append(["virtio-scsi", "Virtio SCSI"])</pre><pre>And keep the rest of codes unchanged.</pre><pre>We could change scsi-controller from "default" to "virtio-scsi",</pre><pre>but failed to change it from "virtio-scsi" to "defalut"</pre><pre>(press 'Apply' button, but nothing happed)</pre><pre>>
>> self.widget("config-remove").set_sensitive(True)
>>
>> diff --git a/virtManager/domain.py b/virtManager/domain.py
>> index ada404b..6cfec3a 100644
>> --- a/virtManager/domain.py
>> +++ b/virtManager/domain.py
>> @@ -822,16 +822,15 @@ class vmmDomain(vmmLibvirtObject):
>>
>> # Controller define methods
>> def define_controller_model(self, devobj, newmodel):
>> - def change(editdev):
>> + def _change_usb(editdev):
>> ignore = editdev
>>
>> guest = self._get_xmlobj_to_define()
>> ctrls = guest.get_devices("controller")
>> - ctrls = [x for x in ctrls if (x.type ==
>> - VirtualController.TYPE_USB)]
>> - for dev in ctrls:
>> + ctrls_usb = [x for x in ctrls if
>> + (x.type == VirtualController.TYPE_USB)]
>> + for dev in ctrls_usb:
>> guest.remove_device(dev)
>> -
>
>Most of these changes are redundant now, please drop them.</pre><pre><span style="line-height: 1.7;">></span></pre><pre>Thanks,
>Cole
>
>_______________________________________________
>virt-tools-list mailing list
><a href="mailto:virt-tools-list@redhat.com">virt-tools-list@redhat.com</a>
>https://www.redhat.com/mailman/listinfo/virt-tools-list
</pre></div></div>