Value of Global parameter "custom.diskoffering.size.min" is not reflected in UI during new instance creation.

Added fields to /api and /server classes for CustomDiskOfferingMinSize
to be available in CapabilitiesResponse. Fixed UI code in Instance
Wizard to have this config value as the minimum selectable option when
we are in custom disk size mode.
This commit is contained in:
Gabor Apati-Nagy 2014-03-28 14:39:02 +00:00 committed by Brian Federle
parent 24820d20d3
commit 883d7f17f7
7 changed files with 25 additions and 2 deletions

View File

@ -419,6 +419,7 @@ public class ApiConstants {
public static final String INSTANCE_NAME = "instancename";
public static final String START_VM = "startvm";
public static final String HA_HOST = "hahost";
public static final String CUSTOM_DISK_OFF_MIN_SIZE = "customdiskofferingminsize";
public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
public static final String DEFAULT_ZONE_ID = "defaultzoneid";
public static final String LIVE_MIGRATE = "livemigrate";

View File

@ -53,6 +53,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setSupportELB((String)capabilities.get("supportELB"));
response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
response.setDiskOffMinSize((Long)capabilities.get("customDiskOffMinSize"));
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled"));
response.setKVMSnapshotEnabled((Boolean)capabilities.get("KVMSnapshotEnabled"));

View File

@ -49,6 +49,10 @@ public class CapabilitiesResponse extends BaseResponse {
@Param(description = "true if regular user is allowed to create projects")
private Boolean allowUsersCreateProjects;
@SerializedName(ApiConstants.CUSTOM_DISK_OFF_MIN_SIZE)
@Param(description = "minimum size that can be specified when " + "create disk from disk offering with custom size")
private Long diskOffMinSize;
@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;
@ -93,6 +97,10 @@ public class CapabilitiesResponse extends BaseResponse {
this.allowUsersCreateProjects = allowUsersCreateProjects;
}
public void setDiskOffMinSize(Long diskOffMinSize) {
this.diskOffMinSize = diskOffMinSize;
}
public void setDiskOffMaxSize(Long diskOffMaxSize) {
this.diskOffMaxSize = diskOffMaxSize;
}

View File

@ -3341,6 +3341,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
}
long diskOffMinSize = VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled"));
@ -3364,6 +3365,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
capabilities.put("supportELB", supportELB);
capabilities.put("projectInviteRequired", _projectMgr.projectInviteRequired());
capabilities.put("allowusercreateprojects", _projectMgr.allowUserToCreateProject());
capabilities.put("customDiskOffMinSize", diskOffMinSize);
capabilities.put("customDiskOffMaxSize", diskOffMaxSize);
capabilities.put("regionSecondaryEnabled", regionSecondaryEnabled);
capabilities.put("KVMSnapshotEnabled", KVMSnapshotEnabled);

View File

@ -254,7 +254,7 @@
<label><fmt:message key="label.disk.size"/></label>
<!-- Slider -->
<label class="size">1 GB</label>
<label class="size min"><span></span> GB</label>
<div class="slider custom-size"></div>
<label class="size max"><span></span> GB</label>

View File

@ -22,6 +22,12 @@
var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone)
cloudStack.instanceWizard = {
//min disk offering size when custom disk size is used
minDiskOfferingSize: function() {
return g_capabilities.customdiskofferingminsize;
},
//max disk offering size when custom disk size is used
maxDiskOfferingSize: function() {
return g_capabilities.customdiskofferingmaxsize;
},

View File

@ -1105,17 +1105,22 @@
$futureSteps.removeClass('loaded');
});
var minCustomDiskSize = args.minDiskOfferingSize ?
args.minDiskOfferingSize() : 1;
var maxCustomDiskSize = args.maxDiskOfferingSize ?
args.maxDiskOfferingSize() : 100;
// Setup tabs and slider
$wizard.find('.section.custom-size .size.min span').html(minCustomDiskSize);
$wizard.find('.section.custom-size input[type=text]').val(minCustomDiskSize);
$wizard.find('.section.custom-size .size.max span').html(maxCustomDiskSize);
$wizard.find('.tab-view').tabs();
$wizard.find('.slider').each(function() {
var $slider = $(this);
$slider.slider({
min: 1,
min: minCustomDiskSize,
max: maxCustomDiskSize,
start: function(event) {
$slider.closest('.section.custom-size').find('input[type=radio]').click();