debuggers.hg

changeset 21288:e1482f91b235

Remus: include device name in vif objects

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 04 09:35:18 2010 +0100 (2010-05-04)
parents d6bd61a5a0fc
children ca9519f09563
files tools/python/xen/remus/vif.py tools/python/xen/remus/vm.py
line diff
     1.1 --- a/tools/python/xen/remus/vif.py	Tue May 04 09:34:50 2010 +0100
     1.2 +++ b/tools/python/xen/remus/vif.py	Tue May 04 09:35:18 2010 +0100
     1.3 @@ -2,6 +2,7 @@ from xen.remus.util import canonifymac
     1.4  
     1.5  class VIF(object):
     1.6      def __init__(self, **props):
     1.7 +        self.dev = 'unknown'
     1.8          self.__dict__.update(props)
     1.9          if 'mac' in props:
    1.10              self.mac = canonifymac(props['mac'])
    1.11 @@ -9,6 +10,9 @@ class VIF(object):
    1.12      def __str__(self):
    1.13          return self.mac
    1.14  
    1.15 -def parse(props):
    1.16 +def parse(props, domid, index):
    1.17      "turn a vm device dictionary into a vif object"
    1.18 -    return VIF(**props)
    1.19 +    vif = VIF(**props)
    1.20 +    vif.dev = 'vif%d.%d' % (domid, index)
    1.21 +
    1.22 +    return vif
     2.1 --- a/tools/python/xen/remus/vm.py	Tue May 04 09:34:50 2010 +0100
     2.2 +++ b/tools/python/xen/remus/vm.py	Tue May 04 09:35:18 2010 +0100
     2.3 @@ -113,7 +113,13 @@ def getvifs(dom):
     2.4      if type(vifs) != list:
     2.5          vifs = [vifs]
     2.6  
     2.7 -    return [vif.parse(v) for v in vifs]
     2.8 +    vifno = 0
     2.9 +    parsed = []
    2.10 +    for v in vifs:
    2.11 +        parsed.append(vif.parse(v, dom['domid'], vifno))
    2.12 +        vifno += 1
    2.13 +
    2.14 +    return parsed
    2.15  
    2.16  def getdisks(dom):
    2.17      "return block device objects for devices in dom"