mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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@xensource.com>
This commit is contained in:
1 parent
d2e3b493ab
commit
77e1fe3493
2 files changed
+10
-7
No files matched your search
@@ -32,4 +32,5 @@ def network(op):
|
||||
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)
|
||||
@@ -114,7 +114,7 @@ class XendRoot:
|
||||
"""
|
||||
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 @@ class XendRoot:
|
||||
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,7 +253,9 @@ class XendRoot:
|
||||
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
|
||||
|
||||
@@ -258,9 +263,6 @@ class XendRoot:
|
||||
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')
|
||||
|
||||
|
||||