Skip to content

Commit 7acd5a3

Browse files
Merge branch '4.19' into 4.20
2 parents cda3640 + de5188e commit 7acd5a3

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ public List<StoragePoolMetricsResponse> listStoragePoolMetrics(List<StoragePoolR
641641
metricsResponse.setStorageUsedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageThreshold);
642642
metricsResponse.setStorageUsedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
643643
metricsResponse.setStorageAllocatedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageThreshold);
644-
metricsResponse.setStorageAllocatedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
644+
metricsResponse.setStorageAllocatedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
645645
metricsResponses.add(metricsResponse);
646646
}
647647
return metricsResponses;

plugins/storage/image/swift/src/main/java/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import com.cloud.configuration.Config;
2828
import com.cloud.utils.SwiftUtil;
29-
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
3029

3130
import org.apache.cloudstack.api.ApiConstants;
3231
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
@@ -37,18 +36,21 @@
3736
import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
3837
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
3938
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
39+
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
4040
import org.apache.cloudstack.storage.command.DownloadCommand;
4141
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
4242
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
4343
import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
4444
import org.apache.cloudstack.storage.to.TemplateObjectTO;
45+
import org.apache.log4j.Logger;
4546

4647
import com.cloud.agent.api.storage.DownloadAnswer;
4748
import com.cloud.agent.api.to.DataObjectType;
4849
import com.cloud.agent.api.to.DataStoreTO;
4950
import com.cloud.agent.api.to.SwiftTO;
51+
import com.cloud.configuration.Config;
5052
import com.cloud.storage.Storage.ImageFormat;
51-
import com.cloud.template.VirtualMachineTemplate;
53+
import com.cloud.utils.SwiftUtil;
5254
import com.cloud.utils.exception.CloudRuntimeException;
5355

5456
public class SwiftImageStoreDriverImpl extends BaseImageStoreDriverImpl {
@@ -99,8 +101,13 @@ public String createEntityExtractUrl(DataStore store, String installPath, ImageF
99101
@Override
100102
public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
101103
Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
102-
VirtualMachineTemplate tmpl = _templateDao.findById(data.getId());
103104
DataStore cacheStore = cacheManager.getCacheStorage(dataStore.getScope());
105+
if (cacheStore == null) {
106+
String errMsg = String.format("No cache store found for scope: %s",
107+
dataStore.getScope().getScopeType().name());
108+
logger.error(errMsg);
109+
throw new CloudRuntimeException(errMsg);
110+
}
104111
DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(data.getTO()), maxTemplateSizeInBytes);
105112
dcmd.setCacheStore(cacheStore.getTO());
106113
dcmd.setProxy(getHttpProxy());

ui/src/views/infra/AddSecondaryStorage.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,10 @@ export default {
295295
const swiftParams = {
296296
account: values.account,
297297
username: values.username,
298-
key: values.key,
299-
storagepolicy: values.storagepolicy
298+
key: values.key
299+
}
300+
if (values.storagepolicy) {
301+
swiftParams.storagepolicy = values.storagepolicy
300302
}
301303
Object.keys(swiftParams).forEach((key, index) => {
302304
data['details[' + index.toString() + '].key'] = key

0 commit comments

Comments
 (0)