Repository navigation
Feature/cstackex 265: Netapp ONTAP iscsi provisioning using lun serial number instead of logical unit number #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7322d33
8399fcf
850f7b2
2b9b817
c2bb377
8d220ae
f4bf026
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -387,6 +387,46 @@ public CloudStackVolume getCloudStackVolume(Map<String, String> values) { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Fetches a LUN's serial number, the array-assigned identity its SCSI WWID is derived from. | ||
| * | ||
| * <p>Kept separate from {@link #getCloudStackVolume(Map)} rather than widening that method's | ||
| * query: ONTAP narrows a response to the requested {@code fields}, and existing callers of | ||
| * {@code getCloudStackVolume} rely on {@code name} and {@code uuid} being present.</p> | ||
| * | ||
| * @return the serial number, or null if the LUN no longer exists on the array | ||
| */ | ||
| public String getLunSerialNumber(String svmName, String lunName) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method might not be needed, as earlier LUN was fetched in |
||
| logger.trace("getLunSerialNumber: fetching serial number of LUN [{}] on SVM [{}]", lunName, svmName); | ||
| if (svmName == null || svmName.isEmpty() || lunName == null || lunName.isEmpty()) { | ||
| throw new CloudRuntimeException("Failed to get LUN serial number, invalid svm or LUN name"); | ||
| } | ||
| try { | ||
| String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword()); | ||
| Map<String, Object> queryParams = Map.of( | ||
| OntapStorageConstants.SVM_DOT_NAME, svmName, | ||
| OntapStorageConstants.NAME, lunName, | ||
| OntapStorageConstants.FIELDS, OntapStorageConstants.SERIAL_NUMBER); | ||
| OntapResponse<Lun> lunResponse = sanFeignClient.getLunResponse(authHeader, queryParams); | ||
| if (lunResponse == null || lunResponse.getRecords() == null || lunResponse.getRecords().isEmpty()) { | ||
| logger.warn("getLunSerialNumber: LUN [{}] on SVM [{}] not found", lunName, svmName); | ||
| return null; | ||
| } | ||
| return lunResponse.getRecords().get(0).getSerialNumber(); | ||
| } catch (FeignException e) { | ||
| if (e.status() == 404) { | ||
| logger.warn("getLunSerialNumber: LUN [{}] on SVM [{}] not found (status 404)", lunName, svmName); | ||
| return null; | ||
| } | ||
| logger.error("FeignException while fetching serial number of LUN [{}], Status: {}, Exception: {}", | ||
| lunName, e.status(), e.getMessage()); | ||
| throw new CloudRuntimeException("Failed to fetch LUN serial number: " + e.getMessage()); | ||
| } catch (Exception e) { | ||
| logger.error("Exception while fetching serial number of LUN [{}]: {}", lunName, e.getMessage()); | ||
| throw new CloudRuntimeException("Failed to fetch LUN serial number: " + e.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public AccessGroup createAccessGroup(AccessGroup accessGroup) { | ||
| logger.trace("createAccessGroup : Creating Igroup with access group request {} ", accessGroup); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,16 @@ public class OntapStorageConstants { | |
| // Query params | ||
| public static final String NAME = "name"; | ||
| public static final String FIELDS = "fields"; | ||
| /** ONTAP volume field: bytes consumed, {@code space.used}. */ | ||
| public static final String SERIAL_NUMBER = "serial_number"; | ||
|
|
||
| /** | ||
| * NetApp's IEEE OUI, which prefixes the NAA identifier of every ONTAP LUN. | ||
| * | ||
| * <p>A LUN's WWID is this followed by the hex of its 12-character serial number, giving the | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to restrict the explanation to 1-2 lines highlighting the structure of the path |
||
| * 32-hex-character value udev publishes as {@code /dev/disk/by-id/wwn-0x<wwid>} and (with the | ||
| * NAA designator type prepended by {@code scsi_id}) as {@code /dev/disk/by-id/scsi-3<wwid>}.</p> | ||
| */ | ||
| public static final String NETAPP_NAA_OUI = "600a0980"; | ||
| public static final String SPACE_USED = "space.used"; | ||
| public static final String CLUSTER_NODE_ASUP_FIELDS = "model,is_all_flash_optimized,is_capacity_optimized,is_perf_optimized"; | ||
| public static final String INITIATORS = "initiators"; | ||
|
|
@@ -110,6 +119,7 @@ public class OntapStorageConstants { | |
| public static final String LUN_DOT_NAME = "lun.name"; | ||
| public static final String IQN = "iqn"; | ||
| public static final String LUN_DOT_UUID = "lun.uuid"; | ||
| public static final String LUN_DOT_SERIAL_NUMBER = "lun.serial_number"; | ||
| public static final String QOS_POLICY_UUID = "qosPolicyUuid"; | ||
| public static final String IS_AFF = "isAFF"; | ||
| public static final String MIN_IOPS_NOT_SUPPORTED_ON_FAS = | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe its better to raise a separate PR for this, as we would be cherry-picking the commits for upstream