mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Fix for dynamic scaling toggle for instance (#11086)
* Fix for dynamic scaling toggle for instance * Update api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java --------- Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
This commit is contained in:
parent
3fc02ddd45
commit
264e404108
@ -71,6 +71,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
|
|||||||
response.setInstancesStatsUserOnly((Boolean) capabilities.get(ApiConstants.INSTANCES_STATS_USER_ONLY));
|
response.setInstancesStatsUserOnly((Boolean) capabilities.get(ApiConstants.INSTANCES_STATS_USER_ONLY));
|
||||||
response.setInstancesDisksStatsRetentionEnabled((Boolean) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_ENABLED));
|
response.setInstancesDisksStatsRetentionEnabled((Boolean) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_ENABLED));
|
||||||
response.setInstancesDisksStatsRetentionTime((Integer) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME));
|
response.setInstancesDisksStatsRetentionTime((Integer) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME));
|
||||||
|
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
|
||||||
response.setObjectName("capability");
|
response.setObjectName("capability");
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
|
|||||||
@ -124,6 +124,10 @@ public class CapabilitiesResponse extends BaseResponse {
|
|||||||
@Param(description = "the retention time for Instances disks stats", since = "4.18.0")
|
@Param(description = "the retention time for Instances disks stats", since = "4.18.0")
|
||||||
private Integer instancesDisksStatsRetentionTime;
|
private Integer instancesDisksStatsRetentionTime;
|
||||||
|
|
||||||
|
@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) {
|
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
|
||||||
this.securityGroupsEnabled = securityGroupsEnabled;
|
this.securityGroupsEnabled = securityGroupsEnabled;
|
||||||
}
|
}
|
||||||
@ -223,4 +227,8 @@ public class CapabilitiesResponse extends BaseResponse {
|
|||||||
public void setCustomHypervisorDisplayName(String customHypervisorDisplayName) {
|
public void setCustomHypervisorDisplayName(String customHypervisorDisplayName) {
|
||||||
this.customHypervisorDisplayName = customHypervisorDisplayName;
|
this.customHypervisorDisplayName = customHypervisorDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
|
||||||
|
this.dynamicScalingEnabled = dynamicScalingEnabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4408,6 +4408,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
capabilities.put(ApiConstants.INSTANCES_STATS_USER_ONLY, StatsCollector.vmStatsCollectUserVMOnly.value());
|
capabilities.put(ApiConstants.INSTANCES_STATS_USER_ONLY, StatsCollector.vmStatsCollectUserVMOnly.value());
|
||||||
capabilities.put(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_ENABLED, StatsCollector.vmDiskStatsRetentionEnabled.value());
|
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.INSTANCES_DISKS_STATS_RETENTION_TIME, StatsCollector.vmDiskStatsMaxRetentionTime.value());
|
||||||
|
capabilities.put(ApiConstants.DYNAMIC_SCALING_ENABLED, UserVmManager.EnableDynamicallyScaleVm.value());
|
||||||
if (apiLimitEnabled) {
|
if (apiLimitEnabled) {
|
||||||
capabilities.put("apiLimitInterval", apiLimitInterval);
|
capabilities.put("apiLimitInterval", apiLimitInterval);
|
||||||
capabilities.put("apiLimitMax", apiLimitMax);
|
capabilities.put("apiLimitMax", apiLimitMax);
|
||||||
|
|||||||
@ -944,8 +944,7 @@ export default {
|
|||||||
keyboards: [],
|
keyboards: [],
|
||||||
bootTypes: [],
|
bootTypes: [],
|
||||||
bootModes: [],
|
bootModes: [],
|
||||||
ioPolicyTypes: [],
|
ioPolicyTypes: []
|
||||||
dynamicScalingVmConfig: false
|
|
||||||
},
|
},
|
||||||
rowCount: {},
|
rowCount: {},
|
||||||
loading: {
|
loading: {
|
||||||
@ -1175,13 +1174,6 @@ export default {
|
|||||||
type: 'Routing'
|
type: 'Routing'
|
||||||
},
|
},
|
||||||
field: 'hostid'
|
field: 'hostid'
|
||||||
},
|
|
||||||
dynamicScalingVmConfig: {
|
|
||||||
list: 'listConfigurations',
|
|
||||||
options: {
|
|
||||||
zoneid: _.get(this.zone, 'id'),
|
|
||||||
name: 'enable.dynamic.scale.vm'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1312,7 +1304,7 @@ export default {
|
|||||||
return Boolean('listUserData' in this.$store.getters.apis)
|
return Boolean('listUserData' in this.$store.getters.apis)
|
||||||
},
|
},
|
||||||
dynamicScalingVmConfigValue () {
|
dynamicScalingVmConfigValue () {
|
||||||
return this.options.dynamicScalingVmConfig?.[0]?.value === 'true'
|
return this.$store.getters.features.dynamicscalingenabled
|
||||||
},
|
},
|
||||||
isCustomizedDiskIOPS () {
|
isCustomizedDiskIOPS () {
|
||||||
return this.diskSelected?.iscustomizediops || false
|
return this.diskSelected?.iscustomizediops || false
|
||||||
@ -2215,7 +2207,7 @@ export default {
|
|||||||
param.loading = true
|
param.loading = true
|
||||||
param.opts = []
|
param.opts = []
|
||||||
const options = param.options || {}
|
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
|
options.listall = true
|
||||||
}
|
}
|
||||||
api(param.list, options).then((response) => {
|
api(param.list, options).then((response) => {
|
||||||
|
|||||||
@ -960,8 +960,7 @@ export default {
|
|||||||
keyboards: [],
|
keyboards: [],
|
||||||
bootTypes: [],
|
bootTypes: [],
|
||||||
bootModes: [],
|
bootModes: [],
|
||||||
ioPolicyTypes: [],
|
ioPolicyTypes: []
|
||||||
dynamicScalingVmConfig: false
|
|
||||||
},
|
},
|
||||||
rowCount: {},
|
rowCount: {},
|
||||||
loading: {
|
loading: {
|
||||||
@ -1194,13 +1193,6 @@ export default {
|
|||||||
type: 'Routing'
|
type: 'Routing'
|
||||||
},
|
},
|
||||||
field: 'hostid'
|
field: 'hostid'
|
||||||
},
|
|
||||||
dynamicScalingVmConfig: {
|
|
||||||
list: 'listConfigurations',
|
|
||||||
options: {
|
|
||||||
zoneid: _.get(this.zone, 'id'),
|
|
||||||
name: 'enable.dynamic.scale.vm'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1332,7 +1324,7 @@ export default {
|
|||||||
return Boolean('listUserData' in this.$store.getters.apis)
|
return Boolean('listUserData' in this.$store.getters.apis)
|
||||||
},
|
},
|
||||||
dynamicScalingVmConfigValue () {
|
dynamicScalingVmConfigValue () {
|
||||||
return this.options.dynamicScalingVmConfig?.[0]?.value === 'true'
|
return this.$store.getters.features.dynamicscalingenabled
|
||||||
},
|
},
|
||||||
isCustomizedDiskIOPS () {
|
isCustomizedDiskIOPS () {
|
||||||
return this.diskSelected?.iscustomizediops || false
|
return this.diskSelected?.iscustomizediops || false
|
||||||
@ -2403,7 +2395,7 @@ export default {
|
|||||||
param.loading = true
|
param.loading = true
|
||||||
param.opts = []
|
param.opts = []
|
||||||
const options = param.options || {}
|
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
|
options.listall = true
|
||||||
}
|
}
|
||||||
api(param.list, options).then((response) => {
|
api(param.list, options).then((response) => {
|
||||||
|
|||||||
@ -145,7 +145,6 @@ export default {
|
|||||||
template: {},
|
template: {},
|
||||||
userDataEnabled: false,
|
userDataEnabled: false,
|
||||||
securityGroupsEnabled: false,
|
securityGroupsEnabled: false,
|
||||||
dynamicScalingVmConfig: false,
|
|
||||||
loading: false,
|
loading: false,
|
||||||
securitygroups: {
|
securitygroups: {
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -189,7 +188,6 @@ export default {
|
|||||||
this.fetchInstaceGroups()
|
this.fetchInstaceGroups()
|
||||||
this.fetchServiceOfferingData()
|
this.fetchServiceOfferingData()
|
||||||
this.fetchTemplateData()
|
this.fetchTemplateData()
|
||||||
this.fetchDynamicScalingVmConfig()
|
|
||||||
this.fetchUserData()
|
this.fetchUserData()
|
||||||
},
|
},
|
||||||
fetchZoneDetails () {
|
fetchZoneDetails () {
|
||||||
@ -241,18 +239,8 @@ export default {
|
|||||||
this.template = templateResponses[0]
|
this.template = templateResponses[0]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchDynamicScalingVmConfig () {
|
isDynamicScalingEnabled () {
|
||||||
const params = {}
|
return this.template.isdynamicallyscalable && this.serviceOffering.dynamicscalingenabled && this.$store.getters.features.dynamicscalingenabled
|
||||||
params.name = 'enable.dynamic.scale.vm'
|
|
||||||
params.zoneid = this.resource.zoneid
|
|
||||||
var apiName = 'listConfigurations'
|
|
||||||
api(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
|
|
||||||
},
|
},
|
||||||
fetchOsTypes () {
|
fetchOsTypes () {
|
||||||
this.osTypes.loading = true
|
this.osTypes.loading = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user