DaanHoogland commented on code in PR #7410:
URL: https://github.com/apache/cloudstack/pull/7410#discussion_r1206465238
##########
services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:
##########
@@ -1183,29 +1183,34 @@ public boolean
finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
s_logger.debug(String.format("Setting UseHttpsToUpload config on
cmdline with [%s] value.", useHttpsToUpload));
buf.append(" useHttpsToUpload=").append(useHttpsToUpload);
- for (DataStore secStore : secStores) {
- addSecondaryStorageServerAddressToBuffer(buf, secStore, vmName);
- }
+ addSecondaryStorageServerAddressToBuffer(buf, secStores, vmName);
return true;
}
/**
- * Adds the secondary storage address to the buffer if it is in the
following pattern: <protocol>//<address>/...
+ * Adds the secondary storages address to the buffer if it is in the
following pattern: <protocol>//<address>/...
*/
- protected void addSecondaryStorageServerAddressToBuffer(StringBuilder
buffer, DataStore dataStore, String vmName) {
- String url = dataStore.getTO().getUrl();
- String[] urlArray = url.split("/");
+ protected void addSecondaryStorageServerAddressToBuffer(StringBuilder
buffer, List<DataStore> dataStores, String vmName) {
+ List<String> addresses = new ArrayList<>();
+ for (DataStore dataStore: dataStores) {
+ String url = dataStore.getTO().getUrl();
+ String[] urlArray = url.split("/");
+
+ s_logger.debug(String.format("Found [%s] as secondary storage [%s]
URL for SSVM [%s].", dataStore.getName(), url, vmName));
+ if (ArrayUtils.getLength(urlArray) < 3) {
+ s_logger.debug(String.format("Could not retrieve secondary
storage [%s] address from URL [%s] of SSVM [%s].", dataStore.getName(), url,
vmName));
+ return;
Review Comment:
should it `return` or `continue` here? it seems an error condition is to be
handled rather than ignored.
--
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]