result = self._getinstance_lunmask()
elif name == 'SE_ConcreteJob':
result = self._getinstance_job(objectpath)
+ elif name == 'SE_StorageSynchronized_SV_SV':
+ result = self._getinstance_syncsvsv(objectpath)
else:
result = self._default_getinstance(objectpath)
return result
break
return instance
+ def _getinstance_syncsvsv(self, objectpath):
+ foundsync = None
+ syncs = self._enum_syncsvsvs()
+ for sync in syncs:
+ if (sync['SyncedElement'] == objectpath['SyncedElement'] and
+ sync['SystemElement'] == objectpath['SystemElement']):
+ foundsync = sync
+ break
+ return foundsync
+
def _getinstance_lunmask(self):
lunmask = {}
lunmask['CreationClassName'] = lunmask_creationclass
vols = self._enum_storagevolumes()
- objpath1 = vols[0]
- objpath2 = vols[1]
- sync = {}
- sync['SyncedElement'] = objpath2
- sync['SystemElement'] = objpath1
- sync['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
+ sync = self._create_sync(vols[0], vols[1], 100)
syncs.append(sync)
- objpath1 = vols[1]
- objpath2 = vols[2]
- sync2 = {}
- sync2['SyncedElement'] = objpath2
- sync2['SystemElement'] = objpath1
- sync2['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
+ sync2 = self._create_sync(vols[1], vols[2], 100)
syncs.append(sync2)
- objpath1 = vols[0]
- objpath2 = vols[3]
- sync3 = {}
- sync3['SyncedElement'] = objpath2
- sync3['SystemElement'] = objpath1
- sync3['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
+ sync3 = self._create_sync(vols[0], vols[3], 100)
syncs.append(sync3)
objpath1 = vols[1]
if vol['ElementName'] == 'failed_snapshot_sync':
objpath2 = vol
break
- sync4 = {}
- sync4['SyncedElement'] = objpath2
- sync4['SystemElement'] = objpath1
- sync4['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
+ sync4 = self._create_sync(objpath1, objpath2, 100)
syncs.append(sync4)
objpath1 = vols[0]
if vol['ElementName'] == 'failed_clone_sync':
objpath2 = vol
break
- sync5 = {}
- sync5['SyncedElement'] = objpath2
- sync5['SystemElement'] = objpath1
- sync5['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
+ sync5 = self._create_sync(objpath1, objpath2, 100)
syncs.append(sync5)
return syncs
+ def _create_sync(self, objpath1, objpath2, percentsynced):
+ sync = {}
+ sync['SyncedElement'] = objpath2
+ sync['SystemElement'] = objpath1
+ sync['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
+ sync['PercentSynced'] = percentsynced
+ return sync
+
def _enum_unitnames(self):
return self._ref_unitnames()
self.driver.create_volume(test_volume)
export = self.driver.create_export(None, test_volume)
test_volume['provider_location'] = export['provider_location']
+ test_volume['EMCCurrentOwningStorageProcessor'] = \
+ 'iqn.1993-08.org.debian:01:a1b2c3d4e5f6'
connector = {'initiator': initiator1}
connection_info = self.driver.initialize_connection(test_volume,
connector)
'volume': volumename})
sync_name, storage_system = self._find_storage_sync_sv_sv(
- snapshotname, volumename)
+ snapshotname, volumename, False)
if sync_name is None:
LOG.error(_('Snapshot: %(snapshot)s: volume: %(volume)s '
'not found on the array. No snapshot to delete.')
return foundinstance
- def _find_storage_sync_sv_sv(self, snapshotname, volumename):
+ def _find_storage_sync_sv_sv(self, snapshotname, volumename,
+ waitforsync=True):
foundsyncname = None
storage_system = None
+ percent_synced = 0
LOG.debug(_("Source: %(volumename)s Target: %(snapshotname)s.")
% {'volumename': volumename, 'snapshotname': snapshotname})
if vol_instance['ElementName'] == volumename:
foundsyncname = n
storage_system = vol_instance['SystemName']
+ if waitforsync:
+ sync_instance = self.conn.GetInstance(n, LocalOnly=False)
+ percent_synced = sync_instance['PercentSynced']
break
if foundsyncname is None:
"Storage Synchronized instance: %(sync)s.")
% {'storage_system': storage_system,
'sync': str(foundsyncname)})
+ # Wait for SE_StorageSynchronized_SV_SV to be fully synced
+ while waitforsync and percent_synced < 100:
+ time.sleep(10)
+ sync_instance = self.conn.GetInstance(foundsyncname,
+ LocalOnly=False)
+ percent_synced = sync_instance['PercentSynced']
+
return foundsyncname, storage_system
def _find_initiator_names(self, connector):
volumename = volume['name']
vol_instance = self._find_lun(volume)
storage_system = vol_instance['SystemName']
+ sp = None
+ try:
+ sp = vol_instance['EMCCurrentOwningStorageProcessor']
+ except KeyError:
+ # VMAX LUN doesn't have this property
+ pass
unitnames = self.conn.ReferenceNames(
vol_instance.path,
'vol_instance': str(vol_instance.path)})
data = {'hostlunid': out_num_device_number,
- 'storagesystem': storage_system}
+ 'storagesystem': storage_system,
+ 'owningsp': sp}
LOG.debug(_("Device info: %(data)s.") % {'data': data})
'-t', 'sendtargets', '-p',
self.configuration.iscsi_ip_address,
run_as_root=True)
+ targets = []
for target in out.splitlines():
- index = target.find(self.configuration.iscsi_ip_address)
- if index != -1:
- return target
- return None
+ targets.append(target)
+
+ return targets
def _get_iscsi_properties(self, volume):
"""Gets iscsi configuration.
LOG.debug(_("ISCSI Discovery: Found %s") % (location))
properties['target_discovered'] = True
- results = location.split(" ")
- properties['target_portal'] = results[0].split(",")[0]
- properties['target_iqn'] = results[1]
-
device_info = self.common.find_device_number(volume)
if device_info is None or device_info['hostlunid'] is None:
exception_message = (_("Cannot find device number for volume %s")
device_number = device_info['hostlunid']
+ sp = device_info['owningsp']
+ for loc in location:
+ results = loc.split(" ")
+ properties['target_portal'] = results[0].split(",")[0]
+ properties['target_iqn'] = results[1]
+ # owning sp is None for VMAX
+ # for VNX, find the owning sp in target_iqn
+ if not sp or -1 != properties['target_iqn'].find(sp):
+ break
+
properties['target_lun'] = device_number
properties['volume_id'] = volume['id']