diff --git a/xtremio.py b/xtremio.py index 9c2efef..26dedc1 100644 --- a/xtremio.py +++ b/xtremio.py @@ -746,12 +746,12 @@ def create_cgsnapshot(self, context, cgsnapshot, snapshots): snapshots = objects.SnapshotList().get_all_for_cgsnapshot( context, cgsnapshot['id']) + snap_model_update = [] for snapshot in snapshots: - snapshot.status = 'available' - + snap_model_update.append({'id': snapshot.id, 'status': 'available'}) model_update = {'status': 'available'} - return model_update, snapshots + return model_update, snap_model_update def delete_cgsnapshot(self, context, cgsnapshot, snapshots): """Deletes a cgsnapshot.""" @@ -925,6 +925,19 @@ def _get_iscsi_properties(self, lunmap): 'target_luns': [lunmap['lun']] * len(portals)} return properties + def terminate_connection(self, volume, connector, **kwargs): + (super(XtremIOISCSIDriver, self) + .terminate_connection(volume, connector, **kwargs)) + num_vols = (self.client + .num_of_mapped_volumes(self._get_ig_name(connector))) + if num_vols > 0: + return + else: + igName = self._get_ig_name(connector) + # delete the initiator group + self.client.req('initiator-groups', 'DELETE', name=igName, ver='v2') + LOG.debug('Deleted initiator group: %s', igName) + def _get_initiator_names(self, connector): return [connector['initiator']]