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

Conflicts:
	api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
This commit is contained in:
Fang Wang 2013-08-13 17:15:33 -07:00 committed by Alena Prokharchyk
parent 782bd4d9bc
commit 15338e42a8
3 changed files with 12 additions and 0 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

@ -61,6 +61,10 @@ public class CapabilitiesResponse extends BaseResponse {
@Param(description = "time interval (in seconds) to reset api count")
private Integer apiLimitInterval;
@SerializedName("kvmsnapshotenabled")
@Param(description = "true if snapshot is supported for KVM host, false otherwise")
private boolean KVMSnapshotEnabled;
@SerializedName("apilimitmax")
@Param(description = "Max allowed number of api requests within the specified interval")
private Integer apiLimitMax;
@ -97,6 +101,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

@ -3251,6 +3251,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()) {
@ -3266,6 +3267,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());
@ -3289,6 +3291,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);