genegr commented on code in PR #13061:
URL: https://github.com/apache/cloudstack/pull/13061#discussion_r3528310090


##########
plugins/storage/volume/flasharray/src/main/java/org/apache/cloudstack/storage/datastore/adapter/flasharray/FlashArrayAdapter.java:
##########
@@ -260,14 +283,19 @@ public ProviderVolume 
getVolumeByAddress(ProviderAdapterContext context, Address
             throw new RuntimeException("Invalid search criteria provided for 
getVolumeByAddress");
         }
 
-        // only support WWN type addresses at this time.
-        if (!ProviderVolume.AddressType.FIBERWWN.equals(addressType)) {
+        String serial;
+        if (ProviderVolume.AddressType.FIBERWWN.equals(addressType)) {
+            // Strip the NAA prefix (1 char) + Pure OUI to recover the volume 
serial.
+            serial = address.substring(FlashArrayVolume.PURE_OUI.length() + 
1).toUpperCase();
+        } else if (ProviderVolume.AddressType.NVMETCP.equals(addressType)) {
+            // Reverse the EUI-128 layout: serial = eui[2:16] + eui[22:32], 
after
+            // stripping the optional "eui." prefix that appears in udev paths.
+            String eui = address.startsWith("eui.") ? address.substring(4) : 
address;
+            serial = (eui.substring(2, 16) + eui.substring(22)).toUpperCase();
+        } else {

Review Comment:
   Fixed in `71b494c897` — an address that is not a 32-hex EUI-128 is now 
rejected explicitly instead of surfacing as a `StringIndexOutOfBoundsException`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to