cloudstack-4308 Add API listCapabilities for KVMSnapshotEnabled so that UI can use it for recurring snapshot.

Conflicts:
	api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
	api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
	server/src/com/cloud/server/ManagementServerImpl.java
This commit is contained in:
Fang Wang 2013-08-13 17:15:33 -07:00 committed by Alena Prokharchyk
parent d3520a5d18
commit 3f526fb052
3 changed files with 11 additions and 1 deletions

View File

@ -54,6 +54,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled"));
response.setKVMSnapshotEnabled((Boolean)capabilities.get("KVMSnapshotEnabled"));
if (capabilities.containsKey("apiLimitInterval")) {
response.setApiLimitInterval((Integer) capabilities.get("apiLimitInterval"));
}

View File

@ -46,10 +46,12 @@ public class CapabilitiesResponse extends BaseResponse {
@SerializedName(ApiConstants.CUSTOM_DISK_OFF_MAX_SIZE) @Param(description="maximum size that can be specified when " +
"create disk from disk offering with custom size")
private Long diskOffMaxSize;
@SerializedName("regionsecondaryenabled") @Param(description = "true if region wide secondary is enabled, false otherwise")
private boolean regionSecondaryEnabled;
@SerializedName("kvmsnapshotenabled") @Param(description = "true if snapshot is supported for KVM host, false otherwise")
private boolean KVMSnapshotEnabled;
@SerializedName("apilimitinterval") @Param(description="time interval (in seconds) to reset api count")
private Integer apiLimitInterval;
@ -89,6 +91,10 @@ public class CapabilitiesResponse extends BaseResponse {
this.regionSecondaryEnabled = regionSecondaryEnabled;
}
public void setKVMSnapshotEnabled(boolean KVMSnapshotEnabled) {
this.KVMSnapshotEnabled = KVMSnapshotEnabled;
}
public void setApiLimitInterval(Integer apiLimitInterval) {
this.apiLimitInterval = apiLimitInterval;
}

View File

@ -3285,6 +3285,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
Account caller = CallContext.current().getCallingAccount();
boolean securityGroupsEnabled = false;
boolean elasticLoadBalancerEnabled = false;
boolean KVMSnapshotEnabled = false;
String supportELB = "false";
List<NetworkVO> networks = _networkDao.listSecurityGroupEnabledNetworks();
if (networks != null && !networks.isEmpty()) {
@ -3300,6 +3301,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
long diskOffMaxSize = Long.valueOf(_configDao.getValue(Config.CustomDiskOfferingMaxSize.key()));
KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled"));
boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());
@ -3323,6 +3325,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
capabilities.put("allowusercreateprojects", _projectMgr.allowUserToCreateProject());
capabilities.put("customDiskOffMaxSize", diskOffMaxSize);
capabilities.put("regionSecondaryEnabled", regionSecondaryEnabled);
capabilities.put("KVMSnapshotEnabled", KVMSnapshotEnabled);
if (apiLimitEnabled) {
capabilities.put("apiLimitInterval", apiLimitInterval);
capabilities.put("apiLimitMax", apiLimitMax);