Skip to content

Fix for dynamic scaling toggle for instance #11086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
response.setSharedFsVmMinCpuCount((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_CPU_COUNT));
response.setSharedFsVmMinRamSize((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_RAM_SIZE));
response.setInstanceLeaseEnabled((Boolean) capabilities.get(ApiConstants.INSTANCE_LEASE_ENABLED));
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));

Check warning on line 76 in api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java#L76

Added line #L76 was not covered by tests
response.setObjectName("capability");
response.setResponseName(getCommandName());
this.setResponseObject(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
@Param(description = "true if instance lease feature is enabled", since = "4.21.0")
private Boolean instanceLeaseEnabled;

@SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED)
@Param(description = "true if dynamically scaling for instances is enabled", since = "4.21.0")
private Boolean dynamicScalingEnabled;

public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
this.securityGroupsEnabled = securityGroupsEnabled;
}
Expand Down Expand Up @@ -255,4 +259,8 @@
public void setInstanceLeaseEnabled(Boolean instanceLeaseEnabled) {
this.instanceLeaseEnabled = instanceLeaseEnabled;
}

public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
this.dynamicScalingEnabled = dynamicScalingEnabled;
}

Check warning on line 265 in api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java#L263-L265

Added lines #L263 - L265 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -4690,6 +4690,7 @@
capabilities.put(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_ENABLED, StatsCollector.vmDiskStatsRetentionEnabled.value());
capabilities.put(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME, StatsCollector.vmDiskStatsMaxRetentionTime.value());
capabilities.put(ApiConstants.INSTANCE_LEASE_ENABLED, VMLeaseManager.InstanceLeaseEnabled.value());
capabilities.put(ApiConstants.DYNAMIC_SCALING_ENABLED, UserVmManager.EnableDynamicallyScaleVm.value());

Check warning on line 4693 in server/src/main/java/com/cloud/server/ManagementServerImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/server/ManagementServerImpl.java#L4693

Added line #L4693 was not covered by tests
if (apiLimitEnabled) {
capabilities.put("apiLimitInterval", apiLimitInterval);
capabilities.put("apiLimitMax", apiLimitMax);
Expand Down
14 changes: 3 additions & 11 deletions ui/src/views/compute/DeployVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,7 @@ export default {
keyboards: [],
bootTypes: [],
bootModes: [],
ioPolicyTypes: [],
dynamicScalingVmConfig: false
ioPolicyTypes: []
},
rowCount: {},
loading: {
Expand Down Expand Up @@ -1284,13 +1283,6 @@ export default {
},
field: 'hostid'
},
dynamicScalingVmConfig: {
list: 'listConfigurations',
options: {
zoneid: _.get(this.zone, 'id'),
name: 'enable.dynamic.scale.vm'
}
},
guestOsCategories: {
list: 'listOsCategories',
options: {
Expand Down Expand Up @@ -1449,7 +1441,7 @@ export default {
return Boolean('listUserData' in this.$store.getters.apis)
},
dynamicScalingVmConfigValue () {
return this.options.dynamicScalingVmConfig?.[0]?.value === 'true'
return this.$store.getters.features.dynamicscalingenabled
},
isCustomizedDiskIOPS () {
return this.diskSelected?.iscustomizediops || false
Expand Down Expand Up @@ -2504,7 +2496,7 @@ export default {
param.loading = true
param.opts = []
const options = param.options || {}
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'dynamicScalingVmConfig', 'hypervisors'].includes(name)) {
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'hypervisors'].includes(name)) {
options.listall = true
}
postAPI(param.list, options).then((response) => {
Expand Down
14 changes: 3 additions & 11 deletions ui/src/views/compute/DeployVnfAppliance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,7 @@ export default {
keyboards: [],
bootTypes: [],
bootModes: [],
ioPolicyTypes: [],
dynamicScalingVmConfig: false
ioPolicyTypes: []
},
rowCount: {},
loading: {
Expand Down Expand Up @@ -1177,13 +1176,6 @@ export default {
},
field: 'hostid'
},
dynamicScalingVmConfig: {
list: 'listConfigurations',
options: {
zoneid: _.get(this.zone, 'id'),
name: 'enable.dynamic.scale.vm'
}
},
guestOsCategories: {
list: 'listOsCategories',
options: {
Expand Down Expand Up @@ -1330,7 +1322,7 @@ export default {
return Boolean('listUserData' in this.$store.getters.apis)
},
dynamicScalingVmConfigValue () {
return this.options.dynamicScalingVmConfig?.[0]?.value === 'true'
return this.$store.getters.features.dynamicscalingenabled
},
isCustomizedDiskIOPS () {
return this.diskSelected?.iscustomizediops || false
Expand Down Expand Up @@ -2475,7 +2467,7 @@ export default {
param.loading = true
param.opts = []
const options = param.options || {}
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'dynamicScalingVmConfig', 'hypervisors'].includes(name)) {
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'hypervisors'].includes(name)) {
options.listall = true
}
postAPI(param.list, options).then((response) => {
Expand Down
16 changes: 2 additions & 14 deletions ui/src/views/compute/EditVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export default {
template: {},
userDataEnabled: false,
securityGroupsEnabled: false,
dynamicScalingVmConfig: false,
loading: false,
securitygroups: {
loading: false,
Expand Down Expand Up @@ -239,7 +238,6 @@ export default {
this.fetchInstaceGroups()
this.fetchServiceOfferingData()
this.fetchTemplateData()
this.fetchDynamicScalingVmConfig()
this.fetchUserData()
},
fetchZoneDetails () {
Expand Down Expand Up @@ -291,18 +289,8 @@ export default {
this.template = templateResponses[0]
})
},
fetchDynamicScalingVmConfig () {
const params = {}
params.name = 'enable.dynamic.scale.vm'
params.zoneid = this.resource.zoneid
var apiName = 'listConfigurations'
getAPI(apiName, params).then(json => {
const configResponse = json.listconfigurationsresponse.configuration
this.dynamicScalingVmConfig = configResponse[0]?.value === 'true'
})
},
canDynamicScalingEnabled () {
return this.template.isdynamicallyscalable && this.serviceOffering.dynamicscalingenabled && this.dynamicScalingVmConfig
isDynamicScalingEnabled () {
return this.template.isdynamicallyscalable && this.serviceOffering.dynamicscalingenabled && this.$store.getters.features.dynamicscalingenabled
},
fetchOsTypes () {
this.osTypes.loading = true
Expand Down
Loading