Merge "Sheepdog: fix command execution failure"
This commit is contained in:
commit
7b88334e02
|
@ -124,17 +124,14 @@ class SheepdogImage(object):
|
|||
self.chunk_size = chunk_size
|
||||
|
||||
def _run_command(self, command, data, *params):
|
||||
cmd = ("collie vdi %(command)s -a %(addr)s -p %(port)d %(name)s "
|
||||
"%(params)s" %
|
||||
{"command": command,
|
||||
"addr": self.addr,
|
||||
"port": self.port,
|
||||
"name": self.name,
|
||||
"params": " ".join(map(str, params))})
|
||||
cmd = ['collie', 'vdi']
|
||||
cmd.extend(command.split(' '))
|
||||
cmd.extend(['-a', self.addr, '-p', self.port, self.name])
|
||||
cmd.extend(params)
|
||||
|
||||
try:
|
||||
return processutils.execute(
|
||||
cmd, process_input=data)[0]
|
||||
*cmd, process_input=data)[0]
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
LOG.error(exc)
|
||||
raise glance_store.BackendException(exc)
|
||||
|
|
|
@ -58,14 +58,11 @@ class TestSheepdogImage(oslotest.base.BaseTestCase):
|
|||
sheepdog.DEFAULT_CHUNKSIZE,
|
||||
)
|
||||
image._run_command('create', None)
|
||||
expected_cmd = ('collie vdi %(command)s'
|
||||
' -a %(addr)s -p %(port)d %(name)s ') % {
|
||||
'command': 'create',
|
||||
'addr': '127.0.0.1',
|
||||
'port': 7000,
|
||||
'name': '6bd59e6e-c410-11e5-ab67-0a73f1fda51b',
|
||||
}
|
||||
actual_cmd = mock_execute.call_args[0][0]
|
||||
expected_cmd = (
|
||||
'collie', 'vdi', 'create', '-a', '127.0.0.1', '-p', 7000,
|
||||
'6bd59e6e-c410-11e5-ab67-0a73f1fda51b',
|
||||
)
|
||||
actual_cmd = mock_execute.call_args[0]
|
||||
self.assertEqual(expected_cmd, actual_cmd)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue