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 10 of 33] interface-reconfigure: Reformat some comments

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 10 of 33] interface-reconfigure: Reformat some comments slightly, move logging function to top of file
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Dec 2009 14:17:05 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 18 Dec 2009 06:19:09 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1261145815@xxxxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r ae57ef5b7b79 -r 85ffcded8ba0 scripts/interface-reconfigure
--- a/scripts/interface-reconfigure     Fri Dec 18 14:16:32 2009 +0000
+++ b/scripts/interface-reconfigure     Fri Dec 18 14:16:32 2009 +0000
@@ -55,6 +55,27 @@
 
 sysfs_bonding_masters = "/sys/class/net/bonding_masters"
 dbcache_file = "/var/xapi/network.dbcache"
+
+#
+# Logging.
+#
+
+def log(s):
+    syslog.syslog(s)
+
+def log_pif_action(action, pif):
+    pifrec = db.get_pif_record(pif)
+    rec = {}
+    rec['uuid'] = pifrec['uuid']
+    rec['ip_configuration_mode'] = pifrec['ip_configuration_mode']
+    rec['action'] = action
+    rec['pif_netdev_name'] = interface_name(pif)
+    rec['message'] = "Bring %(action)s PIF %(uuid)s" % rec
+    log("%(message)s: %(pif_netdev_name)s configured as 
%(ip_configuration_mode)s" % rec)
+
+#
+# Exceptions.
+#
 
 class Usage(Exception):
     def __init__(self, msg):
@@ -203,9 +224,6 @@
             os.unlink(self.__newpath)
 
         self.__state = self.__STATE['COMMITTED']
-
-def log(s):
-    syslog.syslog(s)
 
 def check_allowed(pif):
     pifrec = db.get_pif_record(pif)
@@ -789,16 +807,6 @@
     else:
         return "%(device)s.%(VLAN)s" % pifrec
 
-def log_pif_action(action, pif):
-    pifrec = db.get_pif_record(pif)
-    rec = {}
-    rec['uuid'] = pifrec['uuid']
-    rec['ip_configuration_mode'] = pifrec['ip_configuration_mode']
-    rec['action'] = action
-    rec['pif_netdev_name'] = interface_name(pif)
-    rec['message'] = "Bring %(action)s PIF %(uuid)s" % rec
-    log("%(message)s: %(pif_netdev_name)s configured as 
%(ip_configuration_mode)s" % rec)
-
 def load_bonding_driver():
     log("Loading bonding driver")
     os.spawnl(os.P_WAIT, "/sbin/modprobe", "/sbin/modprobe", "bonding")
@@ -941,15 +949,23 @@
     if oc and oc.has_key('domain'):
         f.write("DOMAIN='%s'\n" % oc['domain'].replace(',', ' '))
 
-    # We only allow one ifcfg-xenbr* to have PEERDNS=yes and there can be only 
one GATEWAYDEV in /etc/sysconfig/network.
-    # The peerdns pif will be the one with pif::other-config:peerdns=true, or 
the mgmt pif if none have this set.
-    # The gateway pif will be the one with 
pif::other-config:defaultroute=true, or the mgmt pif if none have this set.
+    # We only allow one ifcfg-* to have PEERDNS=yes and there can be
+    # only one GATEWAYDEV in /etc/sysconfig/network.
+    #
+    # The peerdns pif will be the one with
+    # pif::other-config:peerdns=true, or the mgmt pif if none have
+    # this set.
+    #
+    # The gateway pif will be the one with
+    # pif::other-config:defaultroute=true, or the mgmt pif if none
+    # have this set.
 
-    # Work out which pif on this host should be the one with PEERDNS=yes and 
which should be the GATEWAYDEV
+    # Work out which pif on this host should be the one with
+    # PEERDNS=yes and which should be the GATEWAYDEV
     #
-    # Note: we prune out the bond master pif (if it exists).
-    # This is because when we are called to bring up an interface with a bond 
master, it is implicit that
-    # we should bring down that master.
+    # Note: we prune out the bond master pif (if it exists). This is
+    # because when we are called to bring up an interface with a bond
+    # master, it is implicit that we should bring down that master.
     pifs_on_host = [ __pif for __pif in db.get_all_pifs() if
                      not  __pif in get_bond_masters_of_pif(pif) ]
     other_pifs_on_host = [ __pif for __pif in pifs_on_host if __pif != pif ]

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

<Prev in Thread] Current Thread [Next in Thread>