]> xenbits.xensource.com Git - xen.git/commitdiff
Remus: include device name in vif objects
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 4 May 2010 08:35:18 +0000 (09:35 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 4 May 2010 08:35:18 +0000 (09:35 +0100)
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
tools/python/xen/remus/vif.py
tools/python/xen/remus/vm.py

index 2022f16eae40083e435aad6f9d651a491f2c4f66..d14d54b14ffe3005d0bf57ddf4c0f2548fc7c66b 100644 (file)
@@ -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
index ae4d260a260bac168ae9ad88aa0b0e15b09f694f..90002e3f21911bd98cb5bbcc7320d9a73ac838df 100644 (file)
@@ -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"