swift_objects = self.conn.get_container(backup['container'],
prefix=prefix,
full_listing=True)[1]
- swift_object_names = []
- for swift_object in swift_objects:
- swift_object_names.append(swift_object['name'])
+ swift_object_names = [swift_obj['name'] for swift_obj in swift_objects]
LOG.debug(_('generated object list: %s') % swift_object_names)
return swift_object_names
LOG.debug(_('v1 swift volume backup restore of %s started'), backup_id)
container = backup['container']
metadata_objects = metadata['objects']
- metadata_object_names = []
- for metadata_object in metadata_objects:
- metadata_object_names.extend(metadata_object.keys())
+ metadata_object_names = sum((obj.keys() for obj in metadata_objects),
+ [])
LOG.debug(_('metadata_object_names = %s') % metadata_object_names)
prune_list = [self._metadata_filename(backup)]
swift_object_names = [swift_object_name for swift_object_name in
mapped_flag = True
result_lun = mapping_data[volume_name]['SCSI_id']
else:
- lun_used = []
- for k, v in mapping_data.iteritems():
- lun_used.append(int(v['SCSI_id']))
+ lun_used = [int(v['SCSI_id']) for v in mapping_data.values()]
lun_used.sort()
# Assume all luns are taken to this point, and then try to find
# an unused one
mapping_ids = []
if (len(out.strip())):
lines = out.strip().split('\n')
- for line in lines:
- mapping_ids.append(line.split()[0])
+ mapping_ids = [line.split()[0] for line in lines]
return mapping_ids
def _get_vdisk_params(self, type_id):
'Headers: %(header)s\n Values: %(row)s')
% {'header': str(header),
'row': str(row)})
- dic = {}
- for attribute, value in map(None, attributes, values):
- dic[attribute] = value
+ dic = dict((a, v) for a, v in map(None, attributes, values))
return dic
def _log_cli_output_error(self, function, cmd, out, err):