args = ['--id', user]
if conf:
- args += ['--conf', conf]
+ args.extend(['--conf', conf])
if pool:
- args += '--pool', pool
+ args.extend(['--pool', pool])
return args
try:
cmd = ['rbd', 'export-diff'] + src_ceph_args
if from_snap is not None:
- cmd += ['--from-snap', from_snap]
+ cmd.extend(['--from-snap', from_snap])
if src_snap:
path = self._utf8("%s/%s@%s" % (src_pool, src_name, src_snap))
else:
path = self._utf8("%s/%s" % (src_pool, src_name))
- cmd += [path, '-']
+ cmd.extend([path, '-'])
out, err = self._execute(*cmd)
except (exception.ProcessExecutionError, exception.Error) as exc:
LOG.info(_("rbd export-diff failed - %s") % (str(exc)))
try:
cmd = ['rbd', 'import-diff'] + dest_ceph_args
- cmd += ['-', self._utf8("%s/%s" % (dest_pool, dest_name))]
+ cmd.extend(['-', self._utf8("%s/%s" % (dest_pool, dest_name))])
out, err = self._execute(*cmd, process_input=out)
except (exception.ProcessExecutionError, exception.Error) as exc:
LOG.info(_("rbd import-diff failed - %s") % (str(exc)))
name,
chap_auth_userid,
chap_auth_password]
- if extra_args != []:
- command_args += extra_args
+ if extra_args:
+ command_args.extend(extra_args)
self._execute(*command_args, run_as_root=True)
except exception.ProcessExecutionError as e:
LOG.error(_("Failed to create iscsi target for volume "
cmd = ['lvs', '--noheadings', '--unit=g', '-o', 'vg_name,name,size']
if no_suffix:
- cmd += ['--nosuffix']
+ cmd.append('--nosuffix')
if vg_name is not None:
- cmd += [vg_name]
+ cmd.append(vg_name)
(out, err) = putils.execute(*cmd, root_helper='sudo', run_as_root=True)
'-o', 'vg_name,name,size,free',
'--separator', ':']
if no_suffix:
- cmd += ['--nosuffix']
+ cmd.append('--nosuffix')
if vg_name is not None:
- cmd += [vg_name]
+ cmd.append(vg_name)
(out, err) = putils.execute(*cmd, root_helper='sudo', run_as_root=True)
'--separator', ':']
if no_suffix:
- cmd += ['--nosuffix']
+ cmd.append('--nosuffix')
if vg_name is not None:
- cmd += [vg_name]
+ cmd.append(vg_name)
(out, err) = putils.execute(*cmd, root_helper='sudo', run_as_root=True)
cmd = ['lvcreate', '-n', name, self.vg_name, '-L', size_str]
if mirror_count > 0:
- cmd += ['-m', mirror_count, '--nosync']
+ cmd.extend(['-m', mirror_count, '--nosync'])
terras = int(size_str[:-1]) / 1024.0
if terras >= 1.5:
rsize = int(2 ** math.ceil(math.log(terras) / math.log(2)))
# NOTE(vish): Next power of two for region size. See:
# http://red.ht/U2BPOD
- cmd += ['-R', str(rsize)]
+ cmd.extend(['-R', str(rsize)])
try:
self._execute(*cmd,
'--snapshot', '%s/%s' % (self.vg_name, source_lv_name)]
if lv_type != 'thin':
size = source_lvref['size']
- cmd += ['-L', '%sg' % (size)]
+ cmd.extend(['-L', '%sg' % (size)])
try:
self._execute(*cmd,
cmd = ['lvcreate', '-L', sizestr, '-n', volume_name, vg]
if self.configuration.lvm_mirrors:
- cmd += ['-m', self.configuration.lvm_mirrors, '--nosync']
+ cmd.extend(['-m', self.configuration.lvm_mirrors, '--nosync'])
terras = int(sizestr[:-1]) / 1024.0
if terras >= 1.5:
rsize = int(2 ** math.ceil(math.log(terras) / math.log(2)))
# NOTE(vish): Next power of two for region size. See:
# http://red.ht/U2BPOD
- cmd += ['-R', str(rsize)]
+ cmd.extend(['-R', str(rsize)])
self._try_execute(*cmd, run_as_root=True, no_retry_list=no_retry_list)
return ceph_backup.CephBackupDriver.get_backup_snaps(rbd_image)
def _get_mon_addrs(self):
- args = ['ceph', 'mon', 'dump', '--format=json'] + self._ceph_args()
+ args = ['ceph', 'mon', 'dump', '--format=json']
+ args.extend(self._ceph_args())
out, _ = self._execute(*args)
lines = out.split('\n')
if lines[0].startswith('dumped monmap epoch'):
'--pool', self.configuration.rbd_pool,
tmp.name, volume['name']]
if self._supports_layering():
- args += ['--new-format']
- args += self._ceph_args()
+ args.append('--new-format')
+ args.extend(self._ceph_args())
self._try_execute(*args)
self._resize(volume)
args = ['rbd', 'export',
'--pool', self.configuration.rbd_pool,
volume['name'], tmp_file]
- args += self._ceph_args()
+ args.extend(self._ceph_args())
self._try_execute(*args)
image_utils.upload_volume(context, image_service,
image_meta, tmp_file)