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

[Xen-changelog] Change the interface between XendRoot.get_network_script and Vifctl so that a



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 9f44b2aa98f3b4e48485900c857bae7cbc335895
# Parent  03612b7f69d50b18e24e58b61dce45ffa467fab3
Change the interface between XendRoot.get_network_script and Vifctl so that a
list is passed rather than a single string.  This expands the config-file
interface so that parameters may be passed to the network scripts from the
config file.

Fix XendRoot._logError (missing asterisk before args parameter).

In XendRoot, allow an empty configuration file.  This makes it easier to unit
test code reliant on XendRoot.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 03612b7f69d5 -r 9f44b2aa98f3 tools/python/xen/xend/Vifctl.py
--- a/tools/python/xen/xend/Vifctl.py   Sun Oct 30 12:45:06 2005
+++ b/tools/python/xen/xend/Vifctl.py   Sun Oct 30 12:48:34 2005
@@ -32,4 +32,5 @@
         raise ValueError('Invalid operation: ' + op)
     script = XendRoot.instance().get_network_script()
     if script:
-        os.spawnl(os.P_WAIT, script, script, op)
+        script.insert(1, op)
+        os.spawnv(os.P_WAIT, script[0], script)
diff -r 03612b7f69d5 -r 9f44b2aa98f3 tools/python/xen/xend/XendRoot.py
--- a/tools/python/xen/xend/XendRoot.py Sun Oct 30 12:45:06 2005
+++ b/tools/python/xen/xend/XendRoot.py Sun Oct 30 12:48:34 2005
@@ -114,7 +114,7 @@
         """
         return self.components.get(name)
 
-    def _logError(self, fmt, args):
+    def _logError(self, fmt, *args):
         """Logging function to log to stderr. We use this for XendRoot log
         messages because they may be logged before the logger has been
         configured.  Other components can safely use the logger.
@@ -144,7 +144,10 @@
                     config = sxp.parse(fin)
                 finally:
                     fin.close()
-                config.insert(0, 'xend-config')
+                if config is None:
+                    config = ['xend-config']
+                else:
+                    config.insert(0, 'xend-config')
                 self.config = config
             except Exception, ex:
                 self._logError('Reading config file %s: %s',
@@ -250,16 +253,15 @@
         s = self.get_config_value('network-script')
 
         if s:
-            return os.path.join(self.network_script_dir, s)
+            result = s.split(" ")
+            result[0] = os.path.join(self.network_script_dir, result[0])
+            return result
         else:
             return None
 
 
     def get_enable_dump(self):
         return self.get_config_bool('enable-dump', 'no')
-
-    def get_vif_bridge(self):
-        return self.get_config_value('vif-bridge', 'xenbr0')
 
     def get_vif_script(self):
         return self.get_config_value('vif-script', 'vif-bridge')

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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