rhtyd closed pull request #2232: CLOUDSTACK-10040 Upload volume fails when
management server can not r?
URL: https://github.com/apache/cloudstack/pull/2232
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 3330cc74a26..a46beb40ea7 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -135,6 +135,7 @@
import
org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
import org.apache.cloudstack.framework.async.AsyncCallFuture;
import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.jobs.AsyncJob;
import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext;
@@ -173,7 +174,7 @@
import java.util.UUID;
import java.util.concurrent.ExecutionException;
-public class VolumeApiServiceImpl extends ManagerBase implements
VolumeApiService, VmWorkJobHandler {
+public class VolumeApiServiceImpl extends ManagerBase implements
VolumeApiService, VmWorkJobHandler, Configurable {
private final static Logger s_logger =
Logger.getLogger(VolumeApiServiceImpl.class);
public static final String VM_WORK_JOB_HANDLER =
VolumeApiServiceImpl.class.getSimpleName();
@@ -260,6 +261,17 @@
static final ConfigKey<Long> VmJobCheckInterval = new
ConfigKey<Long>("Advanced", Long.class, "vm.job.check.interval", "3000",
"Interval in milliseconds to check if the job is complete", false);
+ static final ConfigKey<Boolean> ValidateURLExistence =
+ new ConfigKey<Boolean>(
+ "Advanced",
+ Boolean.class,
+ "validate.url.existence",
+ "true",
+ "Whether url of the given volume during upload needs to be
validated for existence",
+ false,
+ ConfigKey.Scope.Zone);
+
+
private long _maxVolumeSizeInGb;
private final StateMachine2<Volume.State, Volume.Event, Volume>
_volStateMachine;
@@ -403,8 +415,11 @@ private boolean validateVolume(Account caller, long
ownerId, Long zoneId, String
throw new InvalidParameterValueException("File:// type urls
are currently unsupported");
}
UriUtils.validateUrl(format, url);
- // check URL existence
- UriUtils.checkUrlExistence(url);
+
+ // check URL existence
+ if(ValidateURLExistence.value()) {
+ UriUtils.checkUrlExistence(url);
+ }
// Check that the resource limit for secondary storage won't be
exceeded
_resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId),
ResourceType.secondary_storage, UriUtils.getRemoteSize(url));
} else {
@@ -3066,4 +3081,15 @@ private VmWorkJobVO createPlaceHolderWork(long
instanceId) {
return workJob;
}
+
+ @Override
+ public String getConfigComponentName() {
+ return VolumeApiService.class.getSimpleName();
+ }
+
+ @Override
+ public ConfigKey<?>[] getConfigKeys() {
+ return new ConfigKey<?>[] { ValidateURLExistence};
+ }
+
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services