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

[Xen-API] [PATCH 24 of 33] interface-reconfigure: do not require a PIF for rewrite action



Rewrite only needs to write a new /var/xapi/network.dbcache and this
contains all PIFs so passing a specific PIF is unnecessary.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r d680275b3054 -r bd764843637e scripts/init.d-management-interface
--- a/scripts/init.d-management-interface       Fri Dec 18 14:16:32 2009 +0000
+++ b/scripts/init.d-management-interface       Fri Dec 18 14:16:32 2009 +0000
@@ -35,13 +35,9 @@
 }
 
 stop() {
-    [ -n "${INSTALLATION_UUID}" ] || return 0
-    echo -n 
     rm -f /var/lock/subsys/management-interface
-    PIF=$(xe pif-list host-uuid="${INSTALLATION_UUID}" management=true 
--minimal)
-    [ -n "${PIF}" ] || return 0
-    action $"Storing management interface configuration: " \
-       ${INTERFACE_RECONFIGURE} --pif-uuid "${PIF}" --management 
rewrite-configuration
+    action $"Storing network configuration: " \
+       ${INTERFACE_RECONFIGURE} rewrite
 }
 
 restart() {
diff -r d680275b3054 -r bd764843637e 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
@@ -16,7 +16,7 @@
 
     %(command-name)s <PIF> up
     %(command-name)s <PIF> down
-    %(command-name)s [<PIF>] rewrite
+    %(command-name)s rewrite
     %(command-name)s --force <BRIDGE> up
     %(command-name)s --force <BRIDGE> down
     %(command-name)s --force <BRIDGE> rewrite --device=<INTERFACE> 
--mac=<MAC-ADDRESS> <CONFIG>
@@ -1561,21 +1561,6 @@
     if dp:
         bring_down_interface(dp, destroy=True)
 
-def action_rewrite(pif):
-    dp = pif_datapath(pif)
-    f = ipdev_configure_network(pif)
-    if dp:
-        pf = configure_pif(dp)
-        f.attach_child(pf)
-    f.close()
-    try:
-        f.apply()
-        f.commit()
-    except Error, e:
-        log("failed to apply changes: %s" % e.msg)
-        f.revert()
-        raise
-
 # This is useful for reconfiguring the mgmt interface after having lost 
connectivity to the pool master
 def action_force_rewrite(bridge, config):
     def getUUID():
@@ -1745,7 +1730,9 @@
             raise Usage("--force is mutually exclusive with --session, --pif 
and --pif-uuid")
         if len(force_rewrite_config) and not (force_interface and action == 
"rewrite"):
             raise Usage("\"--force rewrite\" needed for --device, --mode, 
--ip, --netmask, and --gateway")
-
+        if (action == "rewrite") and (pif or pif_uuid ):
+            raise Usage("rewrite action does not take --pif or --pif-uuid")
+        
         global db
         if force_interface:
             log("Force interface %s %s" % (force_interface, action))
@@ -1769,7 +1756,7 @@
             if pif_uuid:
                 pif = db.get_pif_by_uuid(pif_uuid)
 
-            if action == "rewrite" and not pif:
+            if action == "rewrite":
                 pass
             else:
                 if not pif:
@@ -1793,8 +1780,6 @@
                     action_up(pif, False)
                 elif action == "down":
                     action_down(pif)
-                elif action == "rewrite":
-                    action_rewrite(pif)
                 else:
                     raise Error("Unknown action %s"  % action)
 

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


 


Rackspace

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