On 03/26/2015 09:49 AM, Giuseppe Scrivano wrote: > When a new disk is added, by default choose a bus that is already used > by an existing disk, if any. > > Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1206097 > > Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx> > --- > virtManager/addhardware.py | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py > index b3ae68f..9153cad 100644 > --- a/virtManager/addhardware.py > +++ b/virtManager/addhardware.py > @@ -1,5 +1,5 @@ > # > -# Copyright (C) 2006-2007, 2012-2014 Red Hat, Inc. > +# Copyright (C) 2006-2007, 2012-2015 Red Hat, Inc. > # Copyright (C) 2006 Hugh O. Brock <hbrock@xxxxxxxxxx> > # > # This program is free software; you can redistribute it and/or modify > @@ -786,7 +786,15 @@ class vmmAddHardware(vmmGObjectUI): > if self.conn.is_xen() or self.conn.is_test_conn(): > model.append(["xen", "Xen"]) > > - if len(model) > 0: > + default_bus = None > + for i in self.vm.get_disk_devices(): > + if i.is_disk(): > + default_bus = i.bus > + break > + > + if default_bus: > + uiutil.set_row_selection(widget, default_bus) > + elif len(model) > 0: > widget.set_active(0) > > def populate_disk_device(self, src): > ACK, though I can't remember offhand what set_row_selection does if the requested selection isn't in the model. Might want to double check it doesn't throw an exception - Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list