volume_info['uid'] = ('ABCDEF' * 3) + ('0' * 14) + volume_info['id']
if 'name' in kwargs:
- volume_info['name'] = kwargs['name'].strip('\'\'')
+ volume_info['name'] = kwargs['name'].strip('\'\"')
else:
volume_info['name'] = 'vdisk' + volume_info['id']
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol_name = kwargs['obj'].strip('\'\'')
+ vol_name = kwargs['obj'].strip('\'\"')
if vol_name not in self._volumes_list:
return self._errors['CMMVC5753E']
def _cmd_expandvdisksize(self, **kwargs):
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol_name = kwargs['obj'].strip('\'\'')
+ vol_name = kwargs['obj'].strip('\'\"')
# Assume unit is gb
if 'size' not in kwargs:
def _cmd_addhostport(self, **kwargs):
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- host_name = kwargs['obj'].strip('\'\'')
+ host_name = kwargs['obj'].strip('\'\"')
if host_name not in self._hosts_list:
return self._errors['CMMVC5753E']
def _cmd_chhost(self, **kwargs):
if 'chapsecret' not in kwargs:
return self._errors['CMMVC5707E']
- secret = kwargs['obj'].strip('\'\'')
+ secret = kwargs['obj'].strip('\'\"')
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- host_name = kwargs['obj'].strip('\'\'')
+ host_name = kwargs['obj'].strip('\'\"')
if host_name not in self._hosts_list:
return self._errors['CMMVC5753E']
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- host_name = kwargs['obj'].strip('\'\'')
+ host_name = kwargs['obj'].strip('\'\"')
if host_name not in self._hosts_list:
return self._errors['CMMVC5753E']
else:
return ('', '')
else:
- if kwargs['obj'] not in self._hosts_list:
+ host_name = kwargs['obj'].strip('\'\"')
+ if host_name not in self._hosts_list:
return self._errors['CMMVC5754E']
- host = self._hosts_list[kwargs['obj']]
+ host = self._hosts_list[host_name]
rows = []
rows.append(['id', host['id']])
rows.append(['name', host['host_name']])
if 'host' not in kwargs:
return self._errors['CMMVC5707E']
- mapping_info['host'] = kwargs['host'].strip('\'\'')
+ mapping_info['host'] = kwargs['host'].strip('\'\"')
if 'scsi' not in kwargs:
return self._errors['CMMVC5707E']
- mapping_info['lun'] = kwargs['scsi'].strip('\'\'')
+ mapping_info['lun'] = kwargs['scsi'].strip('\'\"')
if 'obj' not in kwargs:
return self._errors['CMMVC5707E']
- mapping_info['vol'] = kwargs['obj'].strip('\'\'')
+ mapping_info['vol'] = kwargs['obj'].strip('\'\"')
if mapping_info['vol'] not in self._volumes_list:
return self._errors['CMMVC5753E']
def _cmd_rmvdiskhostmap(self, **kwargs):
if 'host' not in kwargs:
return self._errors['CMMVC5707E']
- host = kwargs['host'].strip('\'\'')
+ host = kwargs['host'].strip('\'\"')
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol = kwargs['obj'].strip('\'\'')
+ vol = kwargs['obj'].strip('\'\"')
mapping_ids = []
for v in self._mappings_list.itervalues():
# List information about host->vdisk mappings
def _cmd_lshostvdiskmap(self, **kwargs):
- host_name = kwargs['obj']
+ host_name = kwargs['obj'].strip('\'\"')
if host_name not in self._hosts_list:
return self._errors['CMMVC5754E']
if 'source' not in kwargs:
return self._errors['CMMVC5707E']
- source = kwargs['source'].strip('\'\'')
+ source = kwargs['source'].strip('\'\"')
if source not in self._volumes_list:
return self._errors['CMMVC5754E']
if 'target' not in kwargs:
return self._errors['CMMVC5707E']
- target = kwargs['target'].strip('\'\'')
+ target = kwargs['target'].strip('\'\"')
if target not in self._volumes_list:
return self._errors['CMMVC5754E']
def _cmd_migratevdisk(self, **kwargs):
if 'mdiskgrp' not in kwargs or 'vdisk' not in kwargs:
return self._errors['CMMVC5707E']
- mdiskgrp = kwargs['mdiskgrp'].strip('\'\'')
- vdisk = kwargs['vdisk'].strip('\'\'')
+ mdiskgrp = kwargs['mdiskgrp'].strip('\'\"')
+ vdisk = kwargs['vdisk'].strip('\'\"')
if vdisk in self._volumes_list:
curr_mdiskgrp = self._volumes_list
def _cmd_addvdiskcopy(self, **kwargs):
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol_name = kwargs['obj'].strip('\'\'')
+ vol_name = kwargs['obj'].strip('\'\"')
if vol_name not in self._volumes_list:
return self._errors['CMMVC5753E']
vol = self._volumes_list[vol_name]
if 'mdiskgrp' not in kwargs:
return self._errors['CMMVC5707E']
- mdiskgrp = kwargs['mdiskgrp'].strip('\'\'')
+ mdiskgrp = kwargs['mdiskgrp'].strip('\'\"')
copy_info = {}
copy_info['id'] = self._find_unused_id(vol['copies'])
if 'copy' not in kwargs:
return self._print_info_cmd(rows=rows, **kwargs)
else:
- copy_id = kwargs['copy'].strip('\'\'')
+ copy_id = kwargs['copy'].strip('\'\"')
if copy_id not in vol['copies']:
return self._errors['CMMVC6353E']
copy = vol['copies'][copy_id]
def _cmd_rmvdiskcopy(self, **kwargs):
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol_name = kwargs['obj'].strip('\'\'')
+ vol_name = kwargs['obj'].strip('\'\"')
if 'copy' not in kwargs:
return self._errors['CMMVC5707E']
- copy_id = kwargs['copy'].strip('\'\'')
+ copy_id = kwargs['copy'].strip('\'\"')
if vol_name not in self._volumes_list:
return self._errors['CMMVC5753E']
vol = self._volumes_list[vol_name]
def _cmd_chvdisk(self, **kwargs):
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol_name = kwargs['obj'].strip('\'\'')
+ vol_name = kwargs['obj'].strip('\'\"')
vol = self._volumes_list[vol_name]
kwargs.pop('obj')
def _cmd_movevdisk(self, **kwargs):
if 'obj' not in kwargs:
return self._errors['CMMVC5701E']
- vol_name = kwargs['obj'].strip('\'\'')
+ vol_name = kwargs['obj'].strip('\'\"')
vol = self._volumes_list[vol_name]
if 'iogrp' not in kwargs:
def _run_ssh(self, cmd, check_exit_code=True, attempts=1):
try:
LOG.debug(_('Run CLI command: %s') % cmd)
+ utils.check_ssh_injection(cmd)
ret = self.fake_storage.execute_command(cmd, check_exit_code)
(stdout, stderr) = ret
LOG.debug(_('CLI output:\n stdout: %(stdout)s\n stderr: '
self.driver._state['extent_size'])
self.driver.migrate_volume(ctxt, volume, host)
attrs = self.driver._helpers.get_vdisk_attributes(volume['name'])
- print('AVISHAY ' + str(attrs))
self.assertIn('openstack3', attrs['mdisk_grp_name'])
self.driver.delete_volume(volume)
def mkhost(self, host_name, port_type, port_name):
port = self._create_port_arg(port_type, port_name)
- ssh_cmd = ['svctask', 'mkhost', '-force'] + port + ['-name', host_name]
+ ssh_cmd = ['svctask', 'mkhost', '-force'] + port
+ ssh_cmd += ['-name', '"%s"' % host_name]
return self.run_ssh_check_created(ssh_cmd)
def addhostport(self, host, port_type, port_name):
port = self._create_port_arg(port_type, port_name)
- ssh_cmd = ['svctask', 'addhostport', '-force'] + port + [host]
+ ssh_cmd = ['svctask', 'addhostport', '-force'] + port + ['"%s"' % host]
self.run_ssh_assert_no_output(ssh_cmd)
def lshost(self, host=None):
ssh_cmd = ['svcinfo', 'lshost', '-delim', '!']
if host:
with_header = False
- ssh_cmd.append(host)
+ ssh_cmd.append('"%s"' % host)
return self.run_ssh_info(ssh_cmd, with_header=with_header)
def add_chap_secret(self, secret, host):
- ssh_cmd = ['svctask', 'chhost', '-chapsecret', secret, host]
+ ssh_cmd = ['svctask', 'chhost', '-chapsecret', secret, '"%s"' % host]
self.run_ssh_assert_no_output(ssh_cmd)
def lsiscsiauth(self):
if wwpn:
ssh_cmd = ['svcinfo', 'lsfabric', '-wwpn', wwpn, '-delim', '!']
elif host:
- ssh_cmd = ['svcinfo', 'lsfabric', '-host', host]
+ ssh_cmd = ['svcinfo', 'lsfabric', '-host', '"%s"' % host]
else:
msg = (_('Must pass wwpn or host to lsfabric.'))
LOG.error(msg)
If vdisk already mapped and multihostmap is True, use the force flag.
"""
- ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', host,
+ ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', '"%s"' % host,
'-scsi', lun, vdisk]
out, err = self._ssh(ssh_cmd, check_exit_code=False)
if 'successfully created' in out:
return self.run_ssh_check_created(ssh_cmd)
def rmvdiskhostmap(self, host, vdisk):
- ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', host, vdisk]
+ ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', '"%s"' % host, vdisk]
self.run_ssh_assert_no_output(ssh_cmd)
def lsvdiskhostmap(self, vdisk):
return self.run_ssh_info(ssh_cmd, with_header=True)
def lshostvdiskmap(self, host):
- ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', host]
+ ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', '"%s"' % host]
return self.run_ssh_info(ssh_cmd, with_header=True)
def rmhost(self, host):
- ssh_cmd = ['svctask', 'rmhost', host]
+ ssh_cmd = ['svctask', 'rmhost', '"%s"' % host]
self.run_ssh_assert_no_output(ssh_cmd)
def mkvdisk(self, name, size, units, pool, opts, params):