From cb693af78abe08827fc774869fbba9ecc5c49aac Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Fri, 30 Apr 2021 16:25:05 +0530 Subject: [PATCH] Updated marvin tests and removed redundant translations --- .../offering/CreateServiceOfferingCmd.java | 4 ++-- .../api/response/ServiceOfferingResponse.java | 2 +- .../com/cloud/service/ServiceOfferingVO.java | 2 +- .../configuration/ConfigurationManagerImpl.java | 2 +- .../java/com/cloud/vm/UserVmManagerImpl.java | 17 ++++++++++------- test/integration/smoke/test_scale_vm.py | 10 +++++----- ui/public/locales/ar.json | 1 - ui/public/locales/ca.json | 1 - ui/public/locales/fr_FR.json | 1 - ui/public/locales/it_IT.json | 1 - ui/public/locales/ja_JP.json | 1 - ui/public/locales/nb_NO.json | 1 - ui/public/locales/pl.json | 1 - ui/public/locales/pt_BR.json | 1 - ui/public/locales/ru_RU.json | 1 - ui/public/locales/zh_CN.json | 1 - 16 files changed, 20 insertions(+), 27 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java index 638319f02a0..b30156097f3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java @@ -445,8 +445,8 @@ public class CreateServiceOfferingCmd extends BaseCmd { return storagePolicy; } - public Boolean getDynamicScalingEnabled() { - return isDynamicScalingEnabled == null ? Boolean.TRUE : isDynamicScalingEnabled; + public boolean getDynamicScalingEnabled() { + return isDynamicScalingEnabled == null ? true : isDynamicScalingEnabled; } ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java index 3e0113e65a7..59bd72ce88e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java @@ -205,7 +205,7 @@ public class ServiceOfferingResponse extends BaseResponse { private Long rootDiskSize; @SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED) - @Param(description = "true if virtual machine needs to be dynamically scalable of cpu or memory") + @Param(description = "true if virtual machine needs to be dynamically scalable of cpu or memory", since = "4.16") private Boolean dynamicScalingEnabled; public ServiceOfferingResponse() { diff --git a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java index ff9481947a0..44f39a1050b 100644 --- a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java @@ -110,7 +110,7 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, - VirtualMachine.Type vmType, String hostTag, String deploymentPlanner, Boolean dynamicScalingEnabled) { + VirtualMachine.Type vmType, String hostTag, String deploymentPlanner, boolean dynamicScalingEnabled) { super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true); this.cpu = cpu; this.ramSize = ramSize; diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java index 668acc1676c..86bd210d3d2 100755 --- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2492,7 +2492,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati Long bytesWriteRate, Long bytesWriteRateMax, Long bytesWriteRateMaxLength, Long iopsReadRate, Long iopsReadRateMax, Long iopsReadRateMaxLength, Long iopsWriteRate, Long iopsWriteRateMax, Long iopsWriteRateMaxLength, - final Integer hypervisorSnapshotReserve, String cacheMode, final Long storagePolicyID, final Boolean dynamicScalingEnabled) { + final Integer hypervisorSnapshotReserve, String cacheMode, final Long storagePolicyID, final boolean dynamicScalingEnabled) { // Filter child domains when both parent and child domains are present List filteredDomainIds = filterChildSubDomains(domainIds); diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index 1ca37258d39..ca8c474a94d 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -7101,13 +7101,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir vm.setGuestOSId(template.getGuestOSId()); vm.setTemplateId(newTemplateId); } - // check if VM can be dynamically scalable with the new template - ServiceOfferingVO serviceOffering = _offeringDao.findById(vm.getServiceOfferingId()); - VMTemplateVO newTemplate = _templateDao.findById(newTemplateId); - boolean dynamicScalingEnabled = checkIfDynamicScalingCanBeEnabled(vm, serviceOffering, newTemplate, vm.getDataCenterId()); - vm.setDynamicallyScalable(dynamicScalingEnabled); - _vmDao.update(vmId, vm); - + // check and update VM if it can be dynamically scalable with the new template + updateVMDynamicallyScalabilityUsingTemplate(vm, newTemplateId); } else { newVol = volumeMgr.allocateDuplicateVolume(root, null); } @@ -7195,6 +7190,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } + private void updateVMDynamicallyScalabilityUsingTemplate(UserVmVO vm, Long newTemplateId) { + ServiceOfferingVO serviceOffering = _offeringDao.findById(vm.getServiceOfferingId()); + VMTemplateVO newTemplate = _templateDao.findById(newTemplateId); + boolean dynamicScalingEnabled = checkIfDynamicScalingCanBeEnabled(vm, serviceOffering, newTemplate, vm.getDataCenterId()); + vm.setDynamicallyScalable(dynamicScalingEnabled); + _vmDao.update(vm.getId(), vm); + } + /** * Perform basic checkings to make sure restore is possible. If not, #InvalidParameterValueException is thrown. * diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py index 05cd54b73e0..6fb6ef3db34 100644 --- a/test/integration/smoke/test_scale_vm.py +++ b/test/integration/smoke/test_scale_vm.py @@ -160,6 +160,11 @@ class TestScaleVm(cloudstackTestCase): @classmethod def tearDownClass(cls): + Configurations.update( + cls.apiclient, + name="enable.dynamic.scale.vm", + value="false" + ) super(TestScaleVm,cls).tearDownClass() return @@ -173,11 +178,6 @@ class TestScaleVm(cloudstackTestCase): %s" % self.hypervisor) def tearDown(self): - Configurations.update( - self.apiclient, - name="enable.dynamic.scale.vm", - value="false" - ) # Clean up, terminate the created ISOs super(TestScaleVm,self).tearDown() return diff --git a/ui/public/locales/ar.json b/ui/public/locales/ar.json index eadfeef88b9..bcb39769107 100644 --- a/ui/public/locales/ar.json +++ b/ui/public/locales/ar.json @@ -659,7 +659,6 @@ "label.drag.new.position": "\u0627\u0633\u062d\u0628 \u0644\u0645\u0648\u0642\u0641 \u062c\u062f\u064a\u062f", "label.driver": "Driver", "label.duration.in.sec": "Duration (in sec)", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.edit": "Edit", "label.edit.acl.list": "Edit ACL List", "label.edit.acl.rule": "Edit ACL rule", diff --git a/ui/public/locales/ca.json b/ui/public/locales/ca.json index 959740d3b10..1e312e9965b 100644 --- a/ui/public/locales/ca.json +++ b/ui/public/locales/ca.json @@ -659,7 +659,6 @@ "label.drag.new.position": "Arrosegar a la nova posici\u00f3", "label.driver": "Driver", "label.duration.in.sec": "Duration (in sec)", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.edit": "Edit", "label.edit.acl.list": "Edit ACL List", "label.edit.acl.rule": "Edit ACL rule", diff --git a/ui/public/locales/fr_FR.json b/ui/public/locales/fr_FR.json index 138d515a96b..447b864f29c 100644 --- a/ui/public/locales/fr_FR.json +++ b/ui/public/locales/fr_FR.json @@ -659,7 +659,6 @@ "label.drag.new.position": "D\u00e9placer sur une autre position", "label.driver": "Pilote", "label.duration.in.sec": "Dur\u00e9e (en sec)", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.edit": "Modifier", "label.edit.acl.list": "Edit ACL List", "label.edit.acl.rule": "Modifier r\u00e8gle ACL", diff --git a/ui/public/locales/it_IT.json b/ui/public/locales/it_IT.json index da83f5ddd8f..a8308a0bc05 100644 --- a/ui/public/locales/it_IT.json +++ b/ui/public/locales/it_IT.json @@ -659,7 +659,6 @@ "label.drag.new.position": "Trascina nella nuova posizione", "label.driver": "Driver", "label.duration.in.sec": "Duration (in sec)", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.edit": "Modifica", "label.edit.acl.list": "Edit ACL List", "label.edit.acl.rule": "Edit ACL rule", diff --git a/ui/public/locales/ja_JP.json b/ui/public/locales/ja_JP.json index 89bb22be784..5b64375f80f 100644 --- a/ui/public/locales/ja_JP.json +++ b/ui/public/locales/ja_JP.json @@ -658,7 +658,6 @@ "label.drag.new.position": "\u65b0\u3057\u3044\u4f4d\u7f6e\u306b\u30c9\u30e9\u30c3\u30b0", "label.driver": "Driver", "label.duration.in.sec": "\u6301\u7d9a\u6642\u9593(\u79d2)", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.edit": "\u7de8\u96c6", "label.edit.acl.list": "Edit ACL List", "label.edit.acl.rule": "ACL \u898f\u5247\u306e\u7de8\u96c6", diff --git a/ui/public/locales/nb_NO.json b/ui/public/locales/nb_NO.json index 627a92ebdb3..81cbbbe3668 100644 --- a/ui/public/locales/nb_NO.json +++ b/ui/public/locales/nb_NO.json @@ -658,7 +658,6 @@ "label.dpd": "D\u00f8d endepunkt-deteksjon", "label.drag.new.position": "Dra til ny posisjon", "label.driver": "Driver", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.duration.in.sec": "Varighet (i sek.)", "label.edit": "Editer", "label.edit.acl.list": "Edit ACL List", diff --git a/ui/public/locales/pl.json b/ui/public/locales/pl.json index 179c1cec39f..163f1a2a727 100644 --- a/ui/public/locales/pl.json +++ b/ui/public/locales/pl.json @@ -658,7 +658,6 @@ "label.dpd": "Dead Peer Detection", "label.drag.new.position": "Przenie\u015b w nowe miejsce", "label.driver": "Driver", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.duration.in.sec": "Duration (in sec)", "label.edit": "Edytuj", "label.edit.acl.list": "Edit ACL List", diff --git a/ui/public/locales/pt_BR.json b/ui/public/locales/pt_BR.json index 8b43e07fa9c..9dd3c63000e 100644 --- a/ui/public/locales/pt_BR.json +++ b/ui/public/locales/pt_BR.json @@ -657,7 +657,6 @@ "label.dpd": "Detec\u00e7\u00e3o de correspondente morto", "label.drag.new.position": "Arrastar para uma nova posi\u00e7\u00e3o", "label.driver": "Driver", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.duration.in.sec": "Dura\u00e7\u00e3o (em seg)", "label.edit": "Editar", "label.edit.acl.list": "Edit ACL List", diff --git a/ui/public/locales/ru_RU.json b/ui/public/locales/ru_RU.json index 1fe07d11f98..5fd7d81b7b8 100644 --- a/ui/public/locales/ru_RU.json +++ b/ui/public/locales/ru_RU.json @@ -657,7 +657,6 @@ "label.dpd": "Dead Peer Detection", "label.drag.new.position": "\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e", "label.driver": "Driver", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.duration.in.sec": "Duration (in sec)", "label.edit": "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c", "label.edit.acl.list": "Edit ACL List", diff --git a/ui/public/locales/zh_CN.json b/ui/public/locales/zh_CN.json index dc0f9f9db64..511a048b842 100644 --- a/ui/public/locales/zh_CN.json +++ b/ui/public/locales/zh_CN.json @@ -657,7 +657,6 @@ "label.dpd": "\u5931\u6548\u5bf9\u7b49\u4f53\u68c0\u6d4b", "label.drag.new.position": "\u62d6\u52a8\u5230\u65b0\u4f4d\u7f6e", "label.driver": "Driver", -"label.dynamicscalingenabled": "Dynamic Scaling Enabled", "label.duration.in.sec": "\u6301\u7eed\u65f6\u95f4 (\u79d2)", "label.edit": "\u7f16\u8f91", "label.edit.acl.list": "Edit ACL List",