From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brendan Cully Subject: [PATCH 5 of 7] Remus: include device name in vif objects Date: Mon, 03 May 2010 11:53:52 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6563081266821137466==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============6563081266821137466== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Signed-off-by: Brendan Cully --===============6563081266821137466== Content-Type: text/x-patch; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen-4.0-5.patch # HG changeset patch # User Brendan Cully # Date 1272694699 25200 # Node ID c10edb7433f4546351dca7b47de0821fa0da795e # Parent d72ec2ffeb67195d55e942f50c04f98365eaec74 Remus: include device name in vif objects Signed-off-by: Brendan Cully diff --git a/tools/python/xen/remus/vif.py b/tools/python/xen/remus/vif.py --- a/tools/python/xen/remus/vif.py +++ b/tools/python/xen/remus/vif.py @@ -2,6 +2,7 @@ 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 @@ 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 --git a/tools/python/xen/remus/vm.py b/tools/python/xen/remus/vm.py --- a/tools/python/xen/remus/vm.py +++ b/tools/python/xen/remus/vm.py @@ -113,7 +113,13 @@ 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" --===============6563081266821137466== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============6563081266821137466==--