Convert xenapi's xvp console to processutils.

Convert xenapi's xvp console implementation to use processutils
directly.

Change-Id: I27d5365a2d231387e4acc0b665b161edab9e3a17
blueprint: execs-ive-had-a-few
This commit is contained in:
Michael Still
2018-04-25 14:46:21 +10:00
parent ea2d459d09
commit d08314d80f

View File

@@ -27,7 +27,6 @@ import nova.conf
from nova import context from nova import context
from nova import db from nova import db
from nova.i18n import _ from nova.i18n import _
from nova import utils
CONF = nova.conf.CONF CONF = nova.conf.CONF
@@ -119,10 +118,10 @@ class XVPConsoleProxy(object):
return return
LOG.debug('Starting xvp') LOG.debug('Starting xvp')
try: try:
utils.execute('xvp', processutils.execute('xvp',
'-p', CONF.xvp.console_xvp_pid, '-p', CONF.xvp.console_xvp_pid,
'-c', CONF.xvp.console_xvp_conf, '-c', CONF.xvp.console_xvp_conf,
'-l', CONF.xvp.console_xvp_log) '-l', CONF.xvp.console_xvp_log)
except processutils.ProcessExecutionError as err: except processutils.ProcessExecutionError as err:
LOG.error('Error starting xvp: %s', err) LOG.error('Error starting xvp: %s', err)
@@ -178,7 +177,7 @@ class XVPConsoleProxy(object):
flag = '-x' flag = '-x'
# xvp will blow up on passwords that are too long (mdragon) # xvp will blow up on passwords that are too long (mdragon)
password = password[:maxlen] password = password[:maxlen]
out, err = utils.execute('xvp', flag, process_input=password) out, err = processutils.execute('xvp', flag, process_input=password)
if err: if err:
raise processutils.ProcessExecutionError(_("Failed to run xvp.")) raise processutils.ProcessExecutionError(_("Failed to run xvp."))
return out.strip() return out.strip()