old_persist_file = os.path.join(volumes_dir, old_name)
try:
+ # with the persistent tgts we create them
+ # by creating the entry in the persist file
+ # and then doing an update to get the target
+ # created.
self.update_iscsi_target(name)
# Grab targets list for debug
'target',
run_as_root=True)
LOG.debug("Targets after update: %s" % out)
- except putils.ProcessExecutionError as e:
+ except (putils.ProcessExecutionError,
+ exception.ISCSITargetUpdateFailed) as e:
LOG.warning(_("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': str(e)})
except putils.ProcessExecutionError as e:
LOG.error(_("Failed to update iscsi target %(name)s: %(e)s") %
{'name': name, 'e': str(e)})
- LOG.debug("StdOut from tgt-admin --update: %s", e.stdout)
- LOG.debug("StdErr from tgt-admin --update: %s", e.stderr)
+ LOG.error("StdOut from tgt-admin --update: %s", e.stdout)
+ LOG.error("StdErr from tgt-admin --update: %s", e.stderr)
raise exception.ISCSITargetUpdateFailed(name=name)
def remove_iscsi_target(self, tid, lun, vol_id, vol_name, **kwargs):
data["driver_version"] = self.VERSION
data["storage_protocol"] = self.protocol
- data['total_capacity_gb'] = float(self.vg.vg_size)
- data['free_capacity_gb'] = float(self.vg.vg_free_space)
- if self.configuration.lvm_type == 'thin':
+ if self.configuration.lvm_mirrors > 0:
+ data['total_capacity_gb'] =\
+ self.vg.vg_mirror_size(self.configuration.lvm_mirrors)
+ data['free_capacity_gb'] =\
+ self.vg.vg_mirror_free_space(self.configuration.lvm_mirrors)
+ elif self.configuration.lvm_type == 'thin':
data['total_capacity_gb'] = float(self.vg.vg_thin_pool_size)
data['free_capacity_gb'] = float(self.vg.vg_thin_pool_free_space)
+ else:
+ data['total_capacity_gb'] = float(self.vg.vg_size)
+ data['free_capacity_gb'] = float(self.vg.vg_free_space)
data['reserved_percentage'] = self.configuration.reserved_percentage
data['QoS_support'] = False
data['location_info'] =\
# update the iSCSI target
iscsi_name = "%s%s" % (self.configuration.iscsi_target_prefix,
volume['name'])
- self.tgtadm.update_iscsi_target(iscsi_name)
+ try:
+ self.tgtadm.update_iscsi_target(iscsi_name)
+ except brick_exception.ISCSITargetUpdateFailed as e:
+ msg = (_('Failed to initialize iscsi '
+ 'connection for target: %s.') % iscsi_name)
+ LOG.error(msg)
+ raise exception.VolumeBackendAPIException(data=msg)
# continue with the base class behaviour
return driver.ISCSIDriver.initialize_connection(self,