uihelpers: Don't store network objs in combo model

Causes issues with trying to reap virConnect values
This commit is contained in:
Cole Robinson 2011-04-11 19:42:17 -04:00
parent a52ad2eb37
commit efee2bf7b2
2 changed files with 13 additions and 9 deletions

View File

@ -942,12 +942,15 @@ class vmmCreate(vmmGObjectUI):
if not idx < 0:
row = src.get_model()[idx]
ntype = row[0]
obj = row[6]
key = row[6]
show_pxe_warn = (
(ntype == virtinst.VirtualNetworkInterface.TYPE_USER or
(ntype == virtinst.VirtualNetworkInterface.TYPE_VIRTUAL and
not obj.can_pxe())))
if ntype == virtinst.VirtualNetworkInterface.TYPE_USER:
show_pxe_warn = True
elif ntype != virtinst.VirtualNetworkInterface.TYPE_VIRTUAL:
show_pxe_warn = False
else:
obj = self.conn.get_net(key)
show_pxe_warn = not obj.can_pxe()
self.set_net_warn(show_pxe_warn and pxe_install,
_("Network selection does not support PXE"), False)

View File

@ -360,10 +360,10 @@ def populate_network_list(net_list, conn, show_direct_interfaces=True):
iface_dict = {}
def build_row(nettype, name, label, is_sensitive, is_running,
manual_bridge=False, obj=None):
manual_bridge=False, key=None):
return [nettype, name, label,
is_sensitive, is_running, manual_bridge,
obj]
key]
def set_active(idx):
net_list.set_active(idx)
@ -401,7 +401,7 @@ def populate_network_list(net_list, conn, show_direct_interfaces=True):
netIdxLabel = label
vnet_dict[label] = build_row(nettype, net.get_name(), label, True,
net.is_active(), obj=net)
net.is_active(), key=net.get_uuid())
# Build a list of vnet bridges, so we know not to list them
# in the physical interface list
@ -448,7 +448,8 @@ def populate_network_list(net_list, conn, show_direct_interfaces=True):
if hasShared and not brIdxLabel:
brIdxLabel = label
row = build_row(nettype, bridge_name, label, sensitive, True, obj=br)
row = build_row(nettype, bridge_name, label, sensitive, True,
key=br.get_name())
if sensitive:
bridge_dict[label] = row