From f8aee8c52071870113425024bec55fc1425d4f83 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 8 Sep 2014 17:05:13 -0700 Subject: [PATCH] Netapp: fix multiple copies of cinder-volume Various commands were failing when running multiple copies of cinder-volume. This is due to storing an in memory copy of the luns which may get updated in the backend by another cinder-volume. Fix it by attempting to refresh the list of luns if one is not found during a request. Change-Id: Iecd1dc5146525d7240a09f71669a3ab239c488bd Resolves-bug: #1367044 --- cinder/volume/drivers/netapp/iscsi.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cinder/volume/drivers/netapp/iscsi.py b/cinder/volume/drivers/netapp/iscsi.py index 761c79d46..7dbed3781 100644 --- a/cinder/volume/drivers/netapp/iscsi.py +++ b/cinder/volume/drivers/netapp/iscsi.py @@ -282,7 +282,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver): vol_name = snapshot['volume_name'] snapshot_name = snapshot['name'] - lun = self.lun_table[vol_name] + lun = self._get_lun_from_table(vol_name) self._clone_lun(lun.name, snapshot_name, 'false') def delete_snapshot(self, snapshot): @@ -545,7 +545,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver): def create_cloned_volume(self, volume, src_vref): """Creates a clone of the specified volume.""" vol_size = volume['size'] - src_vol = self.lun_table[src_vref['name']] + src_vol = self._get_lun_from_table(src_vref['name']) src_vol_size = src_vref['size'] new_name = volume['name'] self._clone_lun(src_vol.name, new_name, 'true') @@ -576,8 +576,9 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver): def extend_volume(self, volume, new_size): """Extend an existing volume to the new size.""" name = volume['name'] - path = self.lun_table[name].metadata['Path'] - curr_size_bytes = str(self.lun_table[name].size) + lun = self._get_lun_from_table(name) + path = lun.metadata['Path'] + curr_size_bytes = str(lun.size) new_size_bytes = str(int(new_size) * units.Gi) # Reused by clone scenarios. # Hence comparing the stored size. @@ -671,7 +672,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver): LOG.info(_("Resizing lun %s using sub clone to new size."), seg[-1]) name = seg[-1] vol_name = seg[2] - lun = self.lun_table[name] + lun = self._get_lun_from_table(name) metadata = lun.metadata compression = self._get_vol_option(vol_name, 'compression') if compression == "on": @@ -1130,7 +1131,10 @@ class NetAppDirectCmodeISCSIDriver(NetAppDirectISCSIDriver): def delete_volume(self, volume): """Driver entry point for destroying existing volumes.""" - lun = self.lun_table.get(volume['name']) + try: + lun = self._get_lun_from_table(volume['name']) + except exception.VolumeNotFound: + lun = None netapp_vol = None if lun: netapp_vol = lun.get_metadata_property('Volume') -- 2.45.2