xvp: change the default xvp conf path to CONF.xvp group

Since option console_xvp_XXX has been move to opt group 'xvp'.
so the CONF.XXX should change to CONF.xvp.XXX

Closes-Bug: 1597978
Change-Id: I33894ecc5586da9b760c43c765a8a1b2b2dcd667
This commit is contained in:
Chen Fan 2016-06-22 20:32:18 +08:00
parent baaeec1b63
commit 46b3a3ca1a

View File

@ -38,7 +38,7 @@ class XVPConsoleProxy(object):
"""Sets up XVP config, and manages XVP daemon.""" """Sets up XVP config, and manages XVP daemon."""
def __init__(self): def __init__(self):
self.xvpconf_template = open(CONF.console_xvp_conf_template).read() self.xvpconf_template = open(CONF.xvp.console_xvp_conf_template).read()
self.host = CONF.host # default, set by manager. self.host = CONF.host # default, set by manager.
super(XVPConsoleProxy, self).__init__() super(XVPConsoleProxy, self).__init__()
@ -51,7 +51,7 @@ class XVPConsoleProxy(object):
# TODO(mdragon): implement port selection for non multiplex ports, # TODO(mdragon): implement port selection for non multiplex ports,
# we are not using that, but someone else may want # we are not using that, but someone else may want
# it. # it.
return CONF.console_xvp_multiplex_port return CONF.xvp.console_xvp_multiplex_port
def setup_console(self, context, console): def setup_console(self, context, console):
"""Sets up actual proxies.""" """Sets up actual proxies."""
@ -84,7 +84,7 @@ class XVPConsoleProxy(object):
LOG.debug('No console pools!') LOG.debug('No console pools!')
self._xvp_stop() self._xvp_stop()
return return
conf_data = {'multiplex_port': CONF.console_xvp_multiplex_port, conf_data = {'multiplex_port': CONF.xvp.console_xvp_multiplex_port,
'pools': pools} 'pools': pools}
tmpl_path, tmpl_file = os.path.split(CONF.injected_network_template) tmpl_path, tmpl_file = os.path.split(CONF.injected_network_template)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(tmpl_path)) env = jinja2.Environment(loader=jinja2.FileSystemLoader(tmpl_path))
@ -95,8 +95,8 @@ class XVPConsoleProxy(object):
def _write_conf(self, config): def _write_conf(self, config):
try: try:
LOG.debug('Re-wrote %s', CONF.console_xvp_conf) LOG.debug('Re-wrote %s', CONF.xvp.console_xvp_conf)
with open(CONF.console_xvp_conf, 'w') as cfile: with open(CONF.xvp.console_xvp_conf, 'w') as cfile:
cfile.write(config) cfile.write(config)
except IOError: except IOError:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
@ -119,9 +119,9 @@ class XVPConsoleProxy(object):
LOG.debug('Starting xvp') LOG.debug('Starting xvp')
try: try:
utils.execute('xvp', utils.execute('xvp',
'-p', CONF.console_xvp_pid, '-p', CONF.xvp.console_xvp_pid,
'-c', CONF.console_xvp_conf, '-c', CONF.xvp.console_xvp_conf,
'-l', CONF.console_xvp_log) '-l', CONF.xvp.console_xvp_log)
except processutils.ProcessExecutionError as err: except processutils.ProcessExecutionError as err:
LOG.error(_LE('Error starting xvp: %s'), err) LOG.error(_LE('Error starting xvp: %s'), err)
@ -136,7 +136,7 @@ class XVPConsoleProxy(object):
def _xvp_pid(self): def _xvp_pid(self):
try: try:
with open(CONF.console_xvp_pid, 'r') as pidfile: with open(CONF.xvp.console_xvp_pid, 'r') as pidfile:
pid = int(pidfile.read()) pid = int(pidfile.read())
except IOError: except IOError:
return None return None