Include driver name in ID colun for connection rows & fix physical ethernet device name

This commit is contained in:
Daniel P. Berrange 2007-09-06 20:11:47 -04:00
parent 2d77ee8aee
commit 9857442a59
2 changed files with 21 additions and 4 deletions

View File

@ -73,13 +73,25 @@ def get_transport(uri):
try:
(scheme, username, netloc, path, query, fragment) = uri_split(uri)
if scheme:
offset = scheme.index("+")
offset = scheme.find("+")
if offset > 0:
return [scheme[offset:], username]
except:
pass
return [None, None]
def get_driver(uri):
try:
(scheme, username, netloc, path, query, fragment) = uri_split(uri)
if scheme:
offset = scheme.find("+")
if offset > 0:
return scheme[:offset]
return scheme
except Exception, e:
pass
return None
# Standard python urlparse is utterly braindead - refusing to parse URIs
# in any useful fashion unless the 'scheme' is in some pre-defined white
# list. Theis functions is a hacked version of urlparse
@ -207,10 +219,12 @@ class vmmConnection(gobject.GObject):
# welcomed...
sysfspath = obj.GetPropertyString("linux.sysfs_path")
# Sick, disgusting hack for Xen netloop crack which renames
# ethN -> pethN, but which HAL never sees
# If running a device in bridged mode, there's a reasonable
# chance that the actual ethernet device has been renamed to
# something else. ethN -> pethN
psysfspath = sysfspath[0:len(sysfspath)-len(name)] + "p" + name
if os.path.exists(psysfspath):
name = "p" + name
sysfspath = psysfspath
brportpath = os.path.join(sysfspath, "brport")

View File

@ -414,7 +414,10 @@ class vmmManager(gobject.GObject):
row.insert(ROW_STATUS, _("Disconnected"))
row.insert(ROW_ACTION, gtk.STOCK_DELETE)
row.insert(ROW_NAME, static_conn.get_short_hostname(uri))
row.insert(ROW_ID, "")
drv = static_conn.get_driver(uri)
if drv is None:
drv = "xen"
row.insert(ROW_ID, drv)
row.insert(ROW_STATUS_ICON, None)
row.insert(ROW_CPU, "")
row.insert(ROW_VCPUS, 0)