Fixes arguments parsing when executing command

A regression was caused by changing the eventlet.subprocess.Popen
with the builtin subprocess.Popen (by using the nova.utils execute
method) without changing the way the arguments were parsed.

In the v1 volume utilities module, the execution args were parsed
separated by whitespaces, which is not allowed by the builtin
subprocess.Popen, causing a "not found" error.

This error is returned for example when attaching a volume, at the
point where iscsicli tool is used to login the iSCSI target or portal.

This patch fixes the issue by simply splitting the args.

Closes-bug: #1317180

Change-Id: Iee7d5de0dde8b68d8f2bab4214e9b6779ad9f722
This commit is contained in:
Lucian Petrut 2014-05-07 19:43:27 +03:00
parent 6872a9467c
commit 40a790c32e
1 changed files with 11 additions and 6 deletions

View File

@ -17,6 +17,10 @@
"""
Helper methods for operations related to the management of volumes,
and storage repositories
Official Microsoft iSCSI Initiator and iSCSI command line interface
documentation can be retrieved at:
http://www.microsoft.com/en-us/download/details.aspx?id=34750
"""
import time
@ -49,13 +53,14 @@ class VolumeUtils(basevolumeutils.BaseVolumeUtils):
target_port) = utils.parse_server_string(target_portal)
#Adding target portal to iscsi initiator. Sending targets
self.execute('iscsicli.exe ' + 'AddTargetPortal ' +
target_address + ' ' + target_port +
' * * * * * * * * * * * * *')
self.execute('iscsicli.exe', 'AddTargetPortal',
target_address, target_port,
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*')
#Listing targets
self.execute('iscsicli.exe ' + 'ListTargets')
self.execute('iscsicli.exe', 'ListTargets')
#Sending login
self.execute('iscsicli.exe ' + 'qlogintarget ' + target_iqn)
self.execute('iscsicli.exe', 'qlogintarget', target_iqn)
#Waiting the disk to be mounted.
#TODO(pnavarro): Check for the operation to end instead of
#relying on a timeout
@ -72,4 +77,4 @@ class VolumeUtils(basevolumeutils.BaseVolumeUtils):
def execute_log_out(self, session_id):
"""Executes log out of the session described by its session ID."""
self.execute('iscsicli.exe ' + 'logouttarget ' + session_id)
self.execute('iscsicli.exe', 'logouttarget', session_id)