mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
Remus: include device name in vif objects
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca> xen-unstable changeset: 21242:e1482f91b235 xen-unstable date: Tue May 04 09:35:18 2010 +0100
This commit is contained in:
1 parent
db1139fb6e
commit
d72b079a28
2 files changed
+13
-3
No files matched your search
@@ -2,6 +2,7 @@ from xen.remus.util import canonifymac
|
||||
|
||||
class VIF(object):
|
||||
def __init__(self, **props):
|
||||
self.dev = 'unknown'
|
||||
self.__dict__.update(props)
|
||||
if 'mac' in props:
|
||||
self.mac = canonifymac(props['mac'])
|
||||
@@ -9,6 +10,9 @@ class VIF(object):
|
||||
def __str__(self):
|
||||
return self.mac
|
||||
|
||||
def parse(props):
|
||||
def parse(props, domid, index):
|
||||
"turn a vm device dictionary into a vif object"
|
||||
return VIF(**props)
|
||||
vif = VIF(**props)
|
||||
vif.dev = 'vif%d.%d' % (domid, index)
|
||||
|
||||
return vif
|
||||
@@ -113,7 +113,13 @@ def getvifs(dom):
|
||||
if type(vifs) != list:
|
||||
vifs = [vifs]
|
||||
|
||||
return [vif.parse(v) for v in vifs]
|
||||
vifno = 0
|
||||
parsed = []
|
||||
for v in vifs:
|
||||
parsed.append(vif.parse(v, dom['domid'], vifno))
|
||||
vifno += 1
|
||||
|
||||
return parsed
|
||||
|
||||
def getdisks(dom):
|
||||
"return block device objects for devices in dom"
|
||||
|
||||