[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remus: include device name in vif objects



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1272962118 -3600
# Node ID e1482f91b235428a6f7dab8da4b651520b3e6c94
# Parent  d6bd61a5a0fc845d9905605c676e58521d5e1621
Remus: include device name in vif objects

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
---
 tools/python/xen/remus/vif.py |    8 ++++++--
 tools/python/xen/remus/vm.py  |    8 +++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff -r d6bd61a5a0fc -r e1482f91b235 tools/python/xen/remus/vif.py
--- a/tools/python/xen/remus/vif.py     Tue May 04 09:34:50 2010 +0100
+++ b/tools/python/xen/remus/vif.py     Tue May 04 09:35:18 2010 +0100
@@ -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
diff -r d6bd61a5a0fc -r e1482f91b235 tools/python/xen/remus/vm.py
--- a/tools/python/xen/remus/vm.py      Tue May 04 09:34:50 2010 +0100
+++ b/tools/python/xen/remus/vm.py      Tue May 04 09:35:18 2010 +0100
@@ -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"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.