Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,22 +306,40 @@ public void resizeCloudStackVolume(CloudStackVolume cloudstackVolume, long sizeI
if (sizeInBytes <= 0) {
throw new CloudRuntimeException("Failed to resize Lun, invalid size " + sizeInBytes);
}
String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
LunSpace lunSpace = new LunSpace();
lunSpace.setSize(sizeInBytes);
Lun patch = new Lun();
patch.setSpace(lunSpace);

int maxRetries = OntapStorageConstants.ONTAP_LUN_RESIZE_MAX_RETRIES;
int pollIntervalMs = OntapStorageConstants.ONTAP_LUN_RESIZE_RETRY_INTERVAL_MS;
String lunUuid = cloudstackVolume.getLun().getUuid();
logger.trace("resizeCloudStackVolume: Resizing Lun {} to {} bytes", lunUuid, sizeInBytes);
try {
String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
LunSpace lunSpace = new LunSpace();
lunSpace.setSize(sizeInBytes);
Lun patch = new Lun();
patch.setSpace(lunSpace);
JobResponse response = sanFeignClient.updateLun(authHeader, lunUuid, patch);
pollJobIfPresent(response, "resize Lun [" + lunUuid + "]");
logger.debug("resizeCloudStackVolume: Lun {} resized to {} bytes", lunUuid, sizeInBytes);
} catch (FeignException e) {
throw new CloudRuntimeException("Failed to resize Lun: " + e.getMessage(), e);
} catch (Exception e) {
logger.error("Exception occurred while resizing LUN: {}, Exception: {}", lunUuid, e.getMessage());
throw new CloudRuntimeException("Failed to resize Lun: " + e.getMessage());
for (int attempt = 1; ; attempt++) {
logger.trace("resizeCloudStackVolume: Resizing Lun {} to {} bytes", lunUuid, sizeInBytes);
try {
JobResponse response = sanFeignClient.updateLun(authHeader, lunUuid, patch);
pollJobIfPresent(response, "resize Lun [" + lunUuid + "]");
logger.debug("resizeCloudStackVolume: Lun {} resized to {} bytes", lunUuid, sizeInBytes);
return;
} catch (FeignException e) {
if (e.status() != 404 || attempt >= maxRetries) {
logger.error("FeignException occurred while resizing LUN: {}, Status: {}, Exception: {}",
lunUuid, e.status(), e.getMessage());
throw new CloudRuntimeException("Failed to resize Lun: " + e.getMessage(), e);
}
logger.debug("resizeCloudStackVolume: PATCH for Lun {} returned 404, retry {}/{}",
lunUuid, attempt, maxRetries);
} catch (Exception e) {
logger.error("Exception occurred while resizing LUN: {}, Exception: {}", lunUuid, e.getMessage());
throw new CloudRuntimeException("Failed to resize Lun: " + e.getMessage(), e);
}
try {
Thread.sleep(pollIntervalMs);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw new CloudRuntimeException("Interrupted while waiting for Lun to accept resize", ie);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public class OntapStorageConstants {
public static final int ONTAP_CG_JOB_POLL_INTERVAL_MS = 2000;
public static final int ONTAP_CG_SNAPSHOT_RESOLVE_MAX_RETRIES = 30;
public static final int ONTAP_CG_SNAPSHOT_RESOLVE_POLL_INTERVAL_MS = 1000;
/** Retry settings for a newly cloned LUN that is not yet visible to the resize API. */
public static final int ONTAP_LUN_RESIZE_MAX_RETRIES = 30;
public static final int ONTAP_LUN_RESIZE_RETRY_INTERVAL_MS = 1000;
public static final int ONTAP_SFSR_JOB_MAX_RETRIES = 60;
public static final int ONTAP_SFSR_JOB_POLL_INTERVAL_MS = 2000;
public static final int ONTAP_SNAPSHOT_DELETE_JOB_MAX_RETRIES = 30;
Expand Down
Loading