WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 07 of 12] [PATCH] xenserver: Set xs-network-uuids for b

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 07 of 12] [PATCH] xenserver: Set xs-network-uuids for both datapath and VLAN bridges
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 8 Jul 2010 14:29:11 +0100
Delivery-date: Thu, 08 Jul 2010 06:41:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1278595744@ely>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1278595744@ely>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# HG changeset patch
# User Ben Pfaff <blp@xxxxxxxxxx>
# Date 1278595551 -3600
# Node ID a3c387c9835cee7e280e5e99436d720ff8971738
# Parent  fed38a5f5a3ce46f59545f3d1ffdb0ad31c64744
[PATCH] xenserver: Set xs-network-uuids for both datapath and VLAN bridges.

>From c0a50086d9e60995b17bdd8a4e1f150caba337d5 Mon Sep 17 00:00:00 2001
Date: Mon, 22 Feb 2010 16:41:19 -0800
It makes sense to set xs-network-uuids for every bridge, so this commit
does so.  It also makes the code a bit more readable by factoring logic
out into a new function.

Signed-off-by: Ben Pfaff <blp@xxxxxxxxxx>
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 ...ensource_libexec_InterfaceReconfigureVswitch.py |   39 ++++++++++++--------
 1 files changed, 23 insertions(+), 16 deletions(-)

diff -r fed38a5f5a3c -r a3c387c9835c scripts/InterfaceReconfigureVswitch.py
--- a/scripts/InterfaceReconfigureVswitch.py    Thu Jul 08 14:25:51 2010 +0100
+++ b/scripts/InterfaceReconfigureVswitch.py    Thu Jul 08 14:25:51 2010 +0100
@@ -257,6 +257,7 @@
         vsctl_argv += ['# add physical device %s' % iface]
         vsctl_argv += ['--', '--may-exist', 'add-port', bridge, iface]
 
+    vsctl_argv += set_br_external_ids(pif)
     return vsctl_argv,extra_up_ports
 
 def deconfigure_datapath(pif):
@@ -284,6 +285,26 @@
 
     return vsctl_argv
 
+def set_br_external_ids(pif):
+    xs_network_uuids = []
+    for nwpif in db().get_pifs_by_device(db().get_pif_record(pif)['device']):
+        rec = db().get_pif_record(nwpif)
+
+        # When state is read from dbcache PIF.currently_attached
+        # is always assumed to be false... Err on the side of
+        # listing even detached networks for the time being.
+        #if nwpif != pif and not rec['currently_attached']:
+        #    log("Network PIF %s not currently attached (%s)" % 
(rec['uuid'],pifrec['uuid']))
+        #    continue
+        nwrec = db().get_network_record(rec['network'])
+        xs_network_uuids += [nwrec['uuid']]
+
+    vsctl_argv = []
+    vsctl_argv += ['# configure xs-network-uuids']
+    vsctl_argv += ['--', 'br-set-external-id', pif_bridge_name(pif),
+            'xs-network-uuids', ';'.join(xs_network_uuids)]
+    return vsctl_argv
+
 #
 #
 #
@@ -324,22 +345,8 @@
             # Stack a VLAN bridge on top of it.
             vsctl_argv += ['--', '--may-exist', 'add-br',
                            bridge, pif_bridge_name(self._dp), pifrec['VLAN']]
-        xs_network_uuids = []
-        for nwpif in 
db().get_pifs_by_device(db().get_pif_record(self._pif)['device']):
-            rec = db().get_pif_record(nwpif)
 
-            # When state is read from dbcache PIF.currently_attached
-            # is always assumed to be false... Err on the side of
-            # listing even detached networks for the time being.
-            #if nwpif != pif and not rec['currently_attached']:
-            #    log("Network PIF %s not currently attached (%s)" % 
(rec['uuid'],pifrec['uuid']))
-            #    continue
-            nwrec = db().get_network_record(rec['network'])
-            xs_network_uuids += [nwrec['uuid']]
-
-        vsctl_argv += ['# configure xs-network-uuids']
-        vsctl_argv += ['--', 'br-set-external-id', bridge,
-                'xs-network-uuids', ';'.join(xs_network_uuids)]
+            vsctl_argv += set_br_external_ids(self._pif)
 
         if ipdev != bridge:
             vsctl_argv += ["# deconfigure ipdev %s" % ipdev]
 scripts/InterfaceReconfigureVswitch.py |  37 ++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 15 deletions(-)


Attachment: txti2Fm8hYZ6b.txt
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api