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
4 changes: 2 additions & 2 deletions api/src/main/java/com/cloud/storage/VolumeApiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public interface VolumeApiService {
Boolean.class,
"use.https.to.upload",
"true",
"Determines the protocol (HTTPS or HTTP) ACS will use to generate links to upload ISOs, volumes, and templates. When set as 'true', ACS will use protocol HTTPS, otherwise, it will use protocol HTTP. Default value is 'true'.",
"Controls whether upload links for ISOs, volumes, and templates use HTTPS (true, default) or HTTP (false). After changing this setting, the Secondary Storage VM (SSVM) must be recreated",
true,
ConfigKey.Scope.StoragePool);
ConfigKey.Scope.Zone);

/**
* Creates the database object for a volume based on the given criteria
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ public class TemplateOrVolumePostUploadCommand {

private String nfsVersion;

public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo,
String dataToRole) {
private long zoneId;

public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum,
String type, String name, String imageFormat, String dataTo, String dataToRole, long zoneId) {
this.entityId = entityId;
this.entityUUID = entityUUID;
this.absolutePath = absolutePath;
Expand All @@ -68,9 +70,7 @@ public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, Strin
this.imageFormat = imageFormat;
this.dataTo = dataTo;
this.dataToRole = dataToRole;
}

public TemplateOrVolumePostUploadCommand() {
this.zoneId = zoneId;
}

public String getRemoteEndPoint() {
Expand Down Expand Up @@ -216,4 +216,8 @@ public void setProcessTimeout(long processTimeout) {
public long getProcessTimeout() {
return processTimeout;
}

public long getZoneId() {
return zoneId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ CALL `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`('MaaS', 'orchestratorrequir

CALL `cloud`.`IDEMPOTENT_DROP_UNIQUE_KEY`('counter', 'uc_counter__provider__source__value');
CALL `cloud`.`IDEMPOTENT_ADD_UNIQUE_KEY`('cloud.counter', 'uc_counter__provider__source__value__removed', '(provider, source, value, removed)');

-- Change scope for configuration - 'use.https.to.upload from' from StoragePool to Zone
UPDATE `cloud`.`configuration` SET `scope` = 2 WHERE `name` = 'use.https.to.upload';
-- Delete the configuration for 'use.https.to.upload' from StoragePool
DELETE FROM `cloud`.`storage_pool_details` WHERE `name` = 'use.https.to.upload';
11 changes: 7 additions & 4 deletions server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,10 @@ public GetUploadParamsResponse doInTransaction(TransactionStatus status) throws
GetUploadParamsResponse response = new GetUploadParamsResponse();

String ssvmUrlDomain = _configDao.getValue(Config.SecStorageSecureCopyCert.key());
String protocol = UseHttpsToUpload.value() ? "https" : "http";
String protocol = UseHttpsToUpload.valueIn(zoneId) ? "https" : "http";

String url = ImageStoreUtil.generatePostUploadUrl(ssvmUrlDomain, ep.getPublicAddr(), vol.getUuid(), protocol);
String url = ImageStoreUtil.generatePostUploadUrl(ssvmUrlDomain, ep.getPublicAddr(), vol.getUuid(),
protocol);
response.setPostURL(new URL(url));

// set the post url, this is used in the monitoring thread to determine the SSVM
Expand All @@ -526,8 +527,10 @@ public GetUploadParamsResponse doInTransaction(TransactionStatus status) throws
/*
* encoded metadata using the post upload config key
*/
TemplateOrVolumePostUploadCommand command = new TemplateOrVolumePostUploadCommand(vol.getId(), vol.getUuid(), volumeStore.getInstallPath(), cmd.getChecksum(), vol.getType().toString(),
vol.getName(), vol.getFormat().toString(), dataObject.getDataStore().getUri(), dataObject.getDataStore().getRole().toString());
TemplateOrVolumePostUploadCommand command = new TemplateOrVolumePostUploadCommand(vol.getId(),
vol.getUuid(), volumeStore.getInstallPath(), cmd.getChecksum(), vol.getType().toString(),
vol.getName(), vol.getFormat().toString(), dataObject.getDataStore().getUri(),
dataObject.getDataStore().getRole().toString(), zoneId);
command.setLocalPath(volumeStore.getLocalDownloadPath());
//using the existing max upload size configuration
command.setProcessTimeout(NumbersUtil.parseLong(_configDao.getValue("vmware.package.ova.timeout"), 3600));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,10 @@ protected void postUploadAllocation(List<DataStore> imageStores, VMTemplateVO te
throw new CloudRuntimeException(errMsg);
}

TemplateOrVolumePostUploadCommand payload = new TemplateOrVolumePostUploadCommand(template.getId(), template.getUuid(), tmpl.getInstallPath(), tmpl
.getChecksum(), tmpl.getType().toString(), template.getUniqueName(), template.getFormat().toString(), templateOnStore.getDataStore().getUri(),
templateOnStore.getDataStore().getRole().toString());
TemplateOrVolumePostUploadCommand payload = new TemplateOrVolumePostUploadCommand(template.getId(),
template.getUuid(), tmpl.getInstallPath(), tmpl.getChecksum(), tmpl.getType().toString(),
template.getUniqueName(), template.getFormat().toString(), templateOnStore.getDataStore().getUri(),
templateOnStore.getDataStore().getRole().toString(), zoneId_is);
//using the existing max template size configuration
payload.setMaxUploadSize(_configDao.getValue(Config.MaxTemplateAndIsoSize.key()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private GetUploadParamsResponse registerPostUploadInternal(TemplateAdapter adapt
TemplateOrVolumePostUploadCommand firstCommand = payload.get(0);

String ssvmUrlDomain = _configDao.getValue(Config.SecStorageSecureCopyCert.key());
String protocol = VolumeApiService.UseHttpsToUpload.value() ? "https" : "http";
String protocol = VolumeApiService.UseHttpsToUpload.valueIn(firstCommand.getZoneId()) ? "https" : "http";

String url = ImageStoreUtil.generatePostUploadUrl(ssvmUrlDomain, firstCommand.getRemoteEndPoint(), firstCommand.getEntityUUID(), protocol);
response.setPostURL(new URL(url));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
logger.debug(String.format("Boot args for machine profile [%s]: [%s].", profile.toString(), bootArgs));
}

boolean useHttpsToUpload = BooleanUtils.toBooleanDefaultIfNull(VolumeApiService.UseHttpsToUpload.value(), true);
boolean useHttpsToUpload = VolumeApiService.UseHttpsToUpload.valueIn(dc.getId());
logger.debug(String.format("Setting UseHttpsToUpload config on cmdline with [%s] value.", useHttpsToUpload));
buf.append(" useHttpsToUpload=").append(useHttpsToUpload);

Expand Down
Loading