You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ha...@apache.org on 2021/02/03 05:36:55 UTC

[cloudstack] branch VMDynamicScalabilityGranularity created (now 74ded95)

This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a change to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git.


      at 74ded95  Added tool tip during VM deployment

This branch includes the following new commits:

     new b60de9c  Dynamic Scaling option granularity
     new 4a65590  UI changes
     new 75e764b  UI changes, added new labels
     new bc1d24f  Added response param in UI for system service offering
     new 60ddbad  Filter service offerings based on dynamic scalable flag while listing offerings for scaling VM
     new 74ded95  Added tool tip during VM deployment

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[cloudstack] 02/06: UI changes

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 4a65590eaef0455044f995719202e2d245eb9598
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Mon Feb 1 11:43:06 2021 +0530

    UI changes
---
 ui/src/views/compute/DeployVM.vue            | 11 +++++++++++
 ui/src/views/offering/AddComputeOffering.vue | 15 +++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue
index bee2a38..f2271b3 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -501,6 +501,15 @@
                         v-decorator="['bootintosetup']">
                       </a-switch>
                     </a-form-item>
+                    <a-form-item>
+                      <span slot="label">
+                        {{ $t('label.isdynamicallyscalable') }}
+                        <a-tooltip :title="$t('label.isdynamicallyscalable')">
+                          <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
+                        </a-tooltip>
+                      </span>
+                      <a-switch v-decorator="['dynamicscalingenabled', {initialValue: dynamicscalingenabled}]" :checked="dynamicscalingenabled" @change="val => { dynamicscalingenabled = val }"/>
+                    </a-form-item>
                     <a-form-item :label="$t('label.userdata')">
                       <a-textarea
                         v-decorator="['userdata']">
@@ -663,6 +672,7 @@ export default {
       podId: null,
       clusterId: null,
       zoneSelected: false,
+      dynamicscalingenabled: true,
       vm: {
         name: null,
         zoneid: null,
@@ -1404,6 +1414,7 @@ export default {
         deployVmData.keyboard = values.keyboard
         deployVmData.boottype = values.boottype
         deployVmData.bootmode = values.bootmode
+        deployVmData.dynamicscalingenabled = values.dynamicscalingenabled
         if (values.userdata && values.userdata.length > 0) {
           deployVmData.userdata = encodeURIComponent(btoa(this.sanitizeReverse(values.userdata)))
         }
diff --git a/ui/src/views/offering/AddComputeOffering.vue b/ui/src/views/offering/AddComputeOffering.vue
index fe5895d..e14afe5 100644
--- a/ui/src/views/offering/AddComputeOffering.vue
+++ b/ui/src/views/offering/AddComputeOffering.vue
@@ -531,6 +531,15 @@
           </span>
           <a-switch v-decorator="['offerha', {initialValue: false}]" />
         </a-form-item>
+        <a-form-item>
+          <span slot="label">
+            {{ $t('label.isdynamicallyscalable') }}
+            <a-tooltip :title="apiParams.dynamicscalingenabled.description">
+              <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
+            </a-tooltip>
+          </span>
+          <a-switch v-decorator="['dynamicscalingenabled', {initialValue: dynamicscalingenabled}]" :checked="dynamicscalingenabled" @change="val => { dynamicscalingenabled = val }"/>
+        </a-form-item>
         <a-form-item v-if="this.isAdmin()">
           <span slot="label">
             {{ $t('label.hosttags') }}
@@ -796,7 +805,8 @@ export default {
       ],
       vGpuVisible: false,
       vGpuTypes: [],
-      loading: false
+      loading: false,
+      dynamicscalingenabled: true
     }
   },
   beforeCreate () {
@@ -960,7 +970,8 @@ export default {
           cachemode: values.cachemode,
           customized: values.offeringtype !== 'fixed',
           offerha: values.offerha === true,
-          limitcpuuse: values.limitcpuuse === true
+          limitcpuuse: values.limitcpuuse === true,
+          dynamicscalingenabled: values.dynamicscalingenabled
         }
 
         // custom fields (begin)


[cloudstack] 03/06: UI changes, added new labels

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 75e764bafd7f9fb44b0b7ece675d81dc73ccd7be
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Mon Feb 1 13:05:02 2021 +0530

    UI changes, added new labels
---
 ui/public/locales/ar.json                    | 1 +
 ui/public/locales/ca.json                    | 1 +
 ui/public/locales/de_DE.json                 | 1 +
 ui/public/locales/en.json                    | 1 +
 ui/public/locales/es.json                    | 1 +
 ui/public/locales/fr_FR.json                 | 1 +
 ui/public/locales/hu.json                    | 1 +
 ui/public/locales/it_IT.json                 | 1 +
 ui/public/locales/ja_JP.json                 | 1 +
 ui/public/locales/ko_KR.json                 | 1 +
 ui/public/locales/nb_NO.json                 | 1 +
 ui/public/locales/nl_NL.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 +
 ui/src/config/section/offering.js            | 2 +-
 ui/src/views/compute/DeployVM.vue            | 4 ++--
 ui/src/views/offering/AddComputeOffering.vue | 2 +-
 19 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/ui/public/locales/ar.json b/ui/public/locales/ar.json
index bcb3976..eadfeef 100644
--- a/ui/public/locales/ar.json
+++ b/ui/public/locales/ar.json
@@ -659,6 +659,7 @@
 "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 743d82f..29248f6 100644
--- a/ui/public/locales/ca.json
+++ b/ui/public/locales/ca.json
@@ -659,6 +659,7 @@
 "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/de_DE.json b/ui/public/locales/de_DE.json
index 4a3e7dc..5f381b5 100644
--- a/ui/public/locales/de_DE.json
+++ b/ui/public/locales/de_DE.json
@@ -783,6 +783,7 @@
 "label.drag.new.position": "Ziehe zu neuer Position",
 "label.driver": "Treiber",
 "label.duration.in.sec": "Dauer (in Sekunden)",
+"label.dynamicscalingenabled": "Dynamische Skalierung aktiviert",
 "label.edit": "Bearbeiten",
 "label.edit.acl.list": "Edit ACL List",
 "label.edit.acl.rule": "ACL-Regel bearbeiten",
diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 5b1cc6a..a44e5ee 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -804,6 +804,7 @@
 "label.drag.new.position": "Drag to new position",
 "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/es.json b/ui/public/locales/es.json
index c05967b..df225b9 100644
--- a/ui/public/locales/es.json
+++ b/ui/public/locales/es.json
@@ -670,6 +670,7 @@
 "label.drag.new.position": "Arrastrar a una nueva ubicaci\u00f3n",
 "label.driver": "Controlador",
 "label.duration.in.sec": "Duraci\u00f3n (en seg)",
+"label.dynamicscalingenabled": "Escalado din\u00e1mico habilitado",
 "label.edit": "Editar",
 "label.edit.acl.list": "Edit ACL List",
 "label.edit.acl.rule": "Editar regla ACL",
diff --git a/ui/public/locales/fr_FR.json b/ui/public/locales/fr_FR.json
index 447b864..138d515 100644
--- a/ui/public/locales/fr_FR.json
+++ b/ui/public/locales/fr_FR.json
@@ -659,6 +659,7 @@
 "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/hu.json b/ui/public/locales/hu.json
index 5a010ff..46efd90 100644
--- a/ui/public/locales/hu.json
+++ b/ui/public/locales/hu.json
@@ -658,6 +658,7 @@
 "label.drag.new.position": "\u00daj helyre h\u00faz\u00e1s",
 "label.driver": "Driver",
 "label.duration.in.sec": "Id\u0151tartam (mp)",
+"label.dynamicscalingenabled": "dinamikus méretezés engedélyezve",
 "label.edit": "Szerkeszt\u00e9s",
 "label.edit.acl.list": "Edit ACL List",
 "label.edit.acl.rule": "ACL szab\u00e1ly szerkeszt\u00e9se",
diff --git a/ui/public/locales/it_IT.json b/ui/public/locales/it_IT.json
index 9a6be06..1285931 100644
--- a/ui/public/locales/it_IT.json
+++ b/ui/public/locales/it_IT.json
@@ -659,6 +659,7 @@
 "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 5b64375..89bb22b 100644
--- a/ui/public/locales/ja_JP.json
+++ b/ui/public/locales/ja_JP.json
@@ -658,6 +658,7 @@
 "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/ko_KR.json b/ui/public/locales/ko_KR.json
index e9654cc..37c2bcb 100644
--- a/ui/public/locales/ko_KR.json
+++ b/ui/public/locales/ko_KR.json
@@ -657,6 +657,7 @@
 "label.dpd": "\uc815\uc9c0 \ud53c\uc5b4 \uac10\uc9c0",
 "label.drag.new.position": "\uc0c8\ub85c\uc6b4 \uc704\uce58\uc5d0 \ub04c\uc5b4\uc624\uae30",
 "label.driver": "Driver",
+"label.dynamicscalingenabled": "Dynamic Scaling Enabled",
 "label.duration.in.sec": "Duration (in sec)",
 "label.edit": "\ud3b8\uc9d1",
 "label.edit.acl.list": "Edit ACL List",
diff --git a/ui/public/locales/nb_NO.json b/ui/public/locales/nb_NO.json
index 7225293..aa9af92 100644
--- a/ui/public/locales/nb_NO.json
+++ b/ui/public/locales/nb_NO.json
@@ -658,6 +658,7 @@
 "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/nl_NL.json b/ui/public/locales/nl_NL.json
index 4a5e606..2b338a5 100644
--- a/ui/public/locales/nl_NL.json
+++ b/ui/public/locales/nl_NL.json
@@ -658,6 +658,7 @@
 "label.dpd": "Dead Peer detectie",
 "label.drag.new.position": "Sleep naar nieuwe positie",
 "label.driver": "Driver",
+"label.dynamicscalingenabled": "Dynamisch schalen ingeschakeld\n",
 "label.duration.in.sec": "duur (in sec)",
 "label.edit": "Wijzig",
 "label.edit.acl.list": "Verander een ACL lijst",
diff --git a/ui/public/locales/pl.json b/ui/public/locales/pl.json
index 29c1c06..f14d43a 100644
--- a/ui/public/locales/pl.json
+++ b/ui/public/locales/pl.json
@@ -658,6 +658,7 @@
 "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 9dd3c63..8b43e07 100644
--- a/ui/public/locales/pt_BR.json
+++ b/ui/public/locales/pt_BR.json
@@ -657,6 +657,7 @@
 "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 5fd7d81..1fe07d1 100644
--- a/ui/public/locales/ru_RU.json
+++ b/ui/public/locales/ru_RU.json
@@ -657,6 +657,7 @@
 "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 511a048..dc0f9f9 100644
--- a/ui/public/locales/zh_CN.json
+++ b/ui/public/locales/zh_CN.json
@@ -657,6 +657,7 @@
 "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",
diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js
index 085d859..af3ae9d 100644
--- a/ui/src/config/section/offering.js
+++ b/ui/src/config/section/offering.js
@@ -31,7 +31,7 @@ export default {
       params: { isrecursive: 'true' },
       columns: ['name', 'displaytext', 'cpunumber', 'cpuspeed', 'memory', 'domain', 'zone', 'order'],
       details: () => {
-        var fields = ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'domain', 'zone', 'created']
+        var fields = ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'domain', 'zone', 'created', 'dynamicscalingenabled']
         if (store.getters.apis.createServiceOffering &&
           store.getters.apis.createServiceOffering.params.filter(x => x.name === 'storagepolicy').length > 0) {
           fields.splice(6, 0, 'vspherestoragepolicy')
diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue
index f2271b3..506665b 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -503,8 +503,8 @@
                     </a-form-item>
                     <a-form-item>
                       <span slot="label">
-                        {{ $t('label.isdynamicallyscalable') }}
-                        <a-tooltip :title="$t('label.isdynamicallyscalable')">
+                        {{ $t('label.dynamicscalingenabled') }}
+                        <a-tooltip :title="$t('label.dynamicscalingenabled')">
                           <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
                         </a-tooltip>
                       </span>
diff --git a/ui/src/views/offering/AddComputeOffering.vue b/ui/src/views/offering/AddComputeOffering.vue
index e14afe5..d483c03 100644
--- a/ui/src/views/offering/AddComputeOffering.vue
+++ b/ui/src/views/offering/AddComputeOffering.vue
@@ -533,7 +533,7 @@
         </a-form-item>
         <a-form-item>
           <span slot="label">
-            {{ $t('label.isdynamicallyscalable') }}
+            {{ $t('label.dynamicscalingenabled') }}
             <a-tooltip :title="apiParams.dynamicscalingenabled.description">
               <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
             </a-tooltip>


[cloudstack] 05/06: Filter service offerings based on dynamic scalable flag while listing offerings for scaling VM

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 60ddbadfcf87799f9149836807a34a676f3895d1
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Wed Feb 3 10:47:13 2021 +0530

    Filter service offerings based on dynamic scalable flag while listing offerings for scaling VM
---
 server/src/main/java/com/cloud/api/query/QueryManagerImpl.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
index cf01b8d..0c3486a 100644
--- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
@@ -2962,11 +2962,12 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
             // 1. Only return offerings with the same storage type
             sc.addAnd("useLocalStorage", SearchCriteria.Op.EQ, currentVmOffering.isUseLocalStorage());
 
-            // 2.In case vm is running return only offerings greater than equal to current offering compute.
+            // 2.In case vm is running return only offerings greater than equal to current offering compute and offering's dynamic scalability should match
             if (vmInstance.getState() == VirtualMachine.State.Running) {
                 sc.addAnd("cpu", Op.GTEQ, currentVmOffering.getCpu());
                 sc.addAnd("speed", Op.GTEQ, currentVmOffering.getSpeed());
                 sc.addAnd("ramSize", Op.GTEQ, currentVmOffering.getRamSize());
+                sc.addAnd("dynamicallyScalable", Op.EQ, currentVmOffering.isDynamicallyScalable());
             }
         }
 


[cloudstack] 04/06: Added response param in UI for system service offering

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit bc1d24fc130593d0b54eb187322d26b0ba7fa429
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Mon Feb 1 15:15:40 2021 +0530

    Added response param in UI for system service offering
---
 ui/src/config/section/offering.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js
index af3ae9d..5410122 100644
--- a/ui/src/config/section/offering.js
+++ b/ui/src/config/section/offering.js
@@ -83,7 +83,7 @@ export default {
       permission: ['listServiceOfferings', 'listInfrastructure'],
       params: { issystem: 'true', isrecursive: 'true' },
       columns: ['name', 'systemvmtype', 'cpunumber', 'cpuspeed', 'memory', 'storagetype', 'order'],
-      details: ['name', 'id', 'displaytext', 'systemvmtype', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'domain', 'zone', 'created'],
+      details: ['name', 'id', 'displaytext', 'systemvmtype', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'domain', 'zone', 'created', 'dynamicscalingenabled'],
       actions: [{
         api: 'createServiceOffering',
         icon: 'plus',


[cloudstack] 01/06: Dynamic Scaling option granularity

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit b60de9c01e347569525516f29a80afbfadb79e5e
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Fri Jan 29 10:48:07 2021 +0530

    Dynamic Scaling option granularity
---
 .../java/com/cloud/offering/ServiceOffering.java   |  2 +
 api/src/main/java/com/cloud/vm/UserVmService.java  |  6 +-
 api/src/main/java/com/cloud/vm/VirtualMachine.java |  2 +
 .../org/apache/cloudstack/api/ApiConstants.java    |  1 +
 .../admin/offering/CreateServiceOfferingCmd.java   |  9 +++
 .../api/command/user/vm/DeployVMCmd.java           |  9 +++
 .../api/response/ServiceOfferingResponse.java      | 13 +++-
 .../cloudstack/api/response/SystemVmResponse.java  | 12 +++
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |  2 +
 .../java/com/cloud/service/ServiceOfferingVO.java  | 67 +++++-----------
 .../engine/cloud/entity/api/db/VMEntityVO.java     |  8 ++
 .../resources/META-INF/db/schema-41400to41500.sql  |  2 +-
 .../resources/META-INF/db/schema-41510to41600.sql  | 90 ++++++++++++++++++++++
 .../cloudstack/quota/vo/ServiceOfferingVO.java     |  8 ++
 ...ernetesClusterResourceModifierActionWorker.java |  2 +-
 .../KubernetesClusterStartWorker.java              |  7 +-
 .../main/java/com/cloud/api/ApiResponseHelper.java |  1 +
 .../api/query/dao/ServiceOfferingJoinDaoImpl.java  |  1 +
 .../cloud/api/query/vo/ServiceOfferingJoinVO.java  | 11 +++
 .../configuration/ConfigurationManagerImpl.java    |  6 +-
 .../com/cloud/hypervisor/HypervisorGuruBase.java   |  3 +-
 .../com/cloud/network/as/AutoScaleManagerImpl.java |  6 +-
 .../main/java/com/cloud/vm/UserVmManagerImpl.java  | 71 +++++++++++------
 .../vm/DeploymentPlanningManagerImplTest.java      |  6 +-
 24 files changed, 254 insertions(+), 91 deletions(-)

diff --git a/api/src/main/java/com/cloud/offering/ServiceOffering.java b/api/src/main/java/com/cloud/offering/ServiceOffering.java
index 2a80ba5..1637622 100644
--- a/api/src/main/java/com/cloud/offering/ServiceOffering.java
+++ b/api/src/main/java/com/cloud/offering/ServiceOffering.java
@@ -116,4 +116,6 @@ public interface ServiceOffering extends DiskOffering, InfrastructureEntity, Int
     String getDeploymentPlanner();
 
     boolean isDynamic();
+
+    boolean isDynamicallyScalable();
 }
diff --git a/api/src/main/java/com/cloud/vm/UserVmService.java b/api/src/main/java/com/cloud/vm/UserVmService.java
index 56a6dfd..ec95972 100644
--- a/api/src/main/java/com/cloud/vm/UserVmService.java
+++ b/api/src/main/java/com/cloud/vm/UserVmService.java
@@ -218,7 +218,7 @@ public interface UserVmService {
         String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
         List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
         Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
-        Map<String, String> userVmOVFProperties) throws InsufficientCapacityException,
+        Map<String, String> userVmOVFProperties, Boolean dynamicScalingEnabled) throws InsufficientCapacityException,
         ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
 
     /**
@@ -300,7 +300,7 @@ public interface UserVmService {
         HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
         List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
         Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
-        Map<String, String> userVmOVFProperties) throws InsufficientCapacityException,
+        Map<String, String> userVmOVFProperties, Boolean dynamicScalingEnabled) throws InsufficientCapacityException,
         ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
 
     /**
@@ -379,7 +379,7 @@ public interface UserVmService {
         String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
         String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
         Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap, Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
-        Map<String, String> templateOvfPropertiesMap)
+        Map<String, String> templateOvfPropertiesMap, Boolean dynamicScalingEnabled)
 
         throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
 
diff --git a/api/src/main/java/com/cloud/vm/VirtualMachine.java b/api/src/main/java/com/cloud/vm/VirtualMachine.java
index 4d6014f..e216b08 100644
--- a/api/src/main/java/com/cloud/vm/VirtualMachine.java
+++ b/api/src/main/java/com/cloud/vm/VirtualMachine.java
@@ -339,4 +339,6 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Partition,
     @Override
     boolean isDisplay();
 
+    Boolean isDynamicallyScalable();
+
 }
diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
index 0087fee..27b0f7a 100644
--- a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
@@ -831,6 +831,7 @@ public class ApiConstants {
     public static final String CROSS_ZONES = "crossZones";
     public static final String TEMPLATETYPE = "templatetype";
     public static final String SOURCETEMPLATEID = "sourcetemplateid";
+    public static final String DynamicScalingEnabled = "dynamicscalingenabled";
 
     public enum BootType {
         UEFI, BIOS;
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 3219422..3c8ca79 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
@@ -223,6 +223,11 @@ public class CreateServiceOfferingCmd extends BaseCmd {
     @Parameter(name = ApiConstants.STORAGE_POLICY, type = CommandType.UUID, entityType = VsphereStoragePoliciesResponse.class,required = false, description = "Name of the storage policy defined at vCenter, this is applicable only for VMware", since = "4.15")
     private Long storagePolicy;
 
+    @Parameter(name = ApiConstants.DynamicScalingEnabled,
+            type = CommandType.BOOLEAN,
+            description = "true if virtual machine needs to be dynamically scalable of cpu or memory")
+    protected Boolean isDynamicScalingEnabled;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -433,6 +438,10 @@ public class CreateServiceOfferingCmd extends BaseCmd {
         return storagePolicy;
     }
 
+    public Boolean getDynamicScalingEnabled() {
+        return isDynamicScalingEnabled == null ? Boolean.TRUE : isDynamicScalingEnabled;
+    }
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index 6d7cc9c..d6f3727 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -235,6 +235,11 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
     @LogLevel(LogLevel.Log4jLevel.Off)
     private Map vAppNetworks;
 
+    @Parameter(name = ApiConstants.DynamicScalingEnabled,
+            type = CommandType.BOOLEAN,
+            description = "true if virtual machine needs to be dynamically scalable")
+    protected Boolean isDynamicScalingEnabled;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -623,6 +628,10 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
         return bootIntoSetup;
     }
 
+    public Boolean getDynamicScalingEnabled() {
+        return isDynamicScalingEnabled == null ? Boolean.TRUE : isDynamicScalingEnabled;
+    }
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
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 05fcfbd..40be57c 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
@@ -204,6 +204,10 @@ public class ServiceOfferingResponse extends BaseResponse {
     @Param(description = "Root disk size in GB", since = "4.15")
     private Long rootDiskSize;
 
+    @SerializedName("dynamicscalingenabled")
+    @Param(description = "true if virtual machine needs to be dynamically scalable of cpu or memory")
+    private Boolean dynamicscalingenabled;
+
     public ServiceOfferingResponse() {
     }
 
@@ -457,7 +461,6 @@ public class ServiceOfferingResponse extends BaseResponse {
 
     public void setIscutomized(boolean iscutomized) {
         this.isCustomized = iscutomized;
-
     }
 
     public void setCacheMode(String cacheMode) {
@@ -475,4 +478,12 @@ public class ServiceOfferingResponse extends BaseResponse {
     public void setRootDiskSize(Long rootDiskSize) {
         this.rootDiskSize = rootDiskSize;
     }
+
+    public Boolean getDynamicscalingenabled() {
+        return dynamicscalingenabled;
+    }
+
+    public void setDynamicscalingenabled(Boolean dynamicscalingenabled) {
+        this.dynamicscalingenabled = dynamicscalingenabled;
+    }
 }
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java
index 934e84f..bfc9f9a 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java
@@ -170,6 +170,10 @@ public class SystemVmResponse extends BaseResponse {
     @Param(description = "the systemvm agent version", since = "4.13.1")
     private String version;
 
+    @SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE)
+    @Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.")
+    private Boolean isDynamicallyScalable;
+
     @Override
     public String getObjectId() {
         return this.getId();
@@ -442,4 +446,12 @@ public class SystemVmResponse extends BaseResponse {
     public void setVersion(String version) {
         this.version = version;
     }
+
+    public Boolean getDynamicallyScalable() {
+        return isDynamicallyScalable;
+    }
+
+    public void setDynamicallyScalable(Boolean dynamicallyScalable) {
+        isDynamicallyScalable = dynamicallyScalable;
+    }
 }
diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
index f1ab9cd..d3c9c37 100755
--- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3685,6 +3685,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         if (currentServiceOffering.isDynamic() && !newServiceOffering.isDynamic()) {
             removeCustomOfferingDetails(vmId);
         }
+        Boolean dynamicScalingEnabled = vmForUpdate.isDynamicallyScalable() && newServiceOffering.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(vmForUpdate.getDataCenterId());
+        vmForUpdate.setDynamicallyScalable(dynamicScalingEnabled);
         return _vmDao.update(vmId, vmForUpdate);
     }
 
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 3a5f318..c265bcd 100644
--- a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java
+++ b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java
@@ -75,6 +75,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     @Column(name = "deployment_planner")
     private String deploymentPlanner = null;
 
+    @Column(name = "dynamically_scalable")
+    private boolean dynamicallyScalable;
+
     // This is a delayed load value.  If the value is null,
     // then this field has not been loaded yet.
     // Call service offering dao to load it.
@@ -91,7 +94,7 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     }
 
     public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText,
-            ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vmType, boolean defaultUse) {
+                             ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vmType, boolean defaultUse) {
         super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true);
         this.cpu = cpu;
         this.ramSize = ramSize;
@@ -105,8 +108,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
         this.vmType = vmType == null ? null : vmType.toString().toLowerCase();
     }
 
-    public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
-                             boolean volatileVm, String displayText, ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vmType) {
+    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) {
         super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true);
         this.cpu = cpu;
         this.ramSize = ramSize;
@@ -114,55 +118,12 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
         this.rateMbps = rateMbps;
         this.multicastRateMbps = multicastRateMbps;
         this.offerHA = offerHA;
-        this.limitCpuUse = limitCpuUse;
+        this.limitCpuUse = limitResourceUse;
         this.volatileVm = volatileVm;
         this.vmType = vmType == null ? null : vmType.toString().toLowerCase();
-    }
-
-    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) {
-        this(name,
-            cpu,
-            ramSize,
-            speed,
-            rateMbps,
-            multicastRateMbps,
-            offerHA,
-            limitResourceUse,
-            volatileVm,
-            displayText,
-            provisioningType,
-            useLocalStorage,
-            recreatable,
-            tags,
-            systemUse,
-            vmType
-        );
         this.hostTag = hostTag;
-    }
-
-    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) {
-        this(name,
-            cpu,
-            ramSize,
-            speed,
-            rateMbps,
-            multicastRateMbps,
-            offerHA,
-            limitResourceUse,
-            volatileVm,
-            displayText,
-            provisioningType,
-            useLocalStorage,
-            recreatable,
-            tags,
-            systemUse,
-            vmType,
-                hostTag);
         this.deploymentPlanner = deploymentPlanner;
+        this.dynamicallyScalable = dynamicScalingEnabled;
     }
 
     public ServiceOfferingVO(ServiceOfferingVO offering) {
@@ -189,6 +150,7 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
         volatileVm = offering.isVolatileVm();
         hostTag = offering.getHostTag();
         vmType = offering.getSystemVmType();
+        dynamicallyScalable = offering.isDynamicallyScalable();
     }
 
     @Override
@@ -334,4 +296,13 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     public boolean isCustomCpuSpeedSupported() {
         return isCustomized() && getDetail("minCPU") != null;
     }
+
+    @Override
+    public boolean isDynamicallyScalable() {
+        return dynamicallyScalable;
+    }
+
+    public void setDynamicallyScalable(boolean dynamicallyScalable) {
+        this.dynamicallyScalable = dynamicallyScalable;
+    }
 }
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java b/engine/schema/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
index 4ab5f42..494ffc6 100644
--- a/engine/schema/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
+++ b/engine/schema/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
@@ -189,6 +189,9 @@ public class VMEntityVO implements VirtualMachine, FiniteStateObject<State, Virt
     @Column(name = "backup_volumes")
     private String backupVolumes;
 
+    @Column(name = "dynamically_scalable")
+    protected boolean dynamicallyScalable;
+
     @Transient
     private VMReservationVO vmReservation;
 
@@ -561,6 +564,11 @@ public class VMEntityVO implements VirtualMachine, FiniteStateObject<State, Virt
         return display;
     }
 
+    @Override
+    public Boolean isDynamicallyScalable() {
+        return dynamicallyScalable;
+    }
+
     public void setDisplay(boolean display) {
         this.display = display;
     }
diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql b/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
index 9ead785..055061f 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
@@ -842,4 +842,4 @@ ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT N
 UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;
 
 -- Fix description of volume.stats.interval which is in milliseconds not seconds
-UPDATE `cloud`.`configuration` SET `description` = 'Interval (in milliseconds) to report volume statistics' WHERE `name` = 'volume.stats.interval';
+UPDATE `cloud`.`configuration` SET `description` = 'Interval (in milliseconds) to report volume statistics' WHERE `name` = 'volume.stats.interval';
\ No newline at end of file
diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql b/engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql
index 0588c6d..d47cdc7 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql
@@ -19,3 +19,93 @@
 -- Schema upgrade from 4.15.1.0 to 4.16.0.0
 --;
 
+-- Adding dynamic scalable flag for service offering table
+ALTER TABLE `cloud`.`service_offering` ADD COLUMN `dynamically_scalable` tinyint(1) unsigned NOT NULL DEFAULT 1  COMMENT 'true(1) if VM needs to be dynamically scalable of cpu or memory';
+DROP VIEW IF EXISTS `cloud`.`service_offering_view`;
+CREATE VIEW `cloud`.`service_offering_view` AS
+    SELECT
+        `service_offering`.`id` AS `id`,
+        `disk_offering`.`uuid` AS `uuid`,
+        `disk_offering`.`name` AS `name`,
+        `disk_offering`.`display_text` AS `display_text`,
+        `disk_offering`.`provisioning_type` AS `provisioning_type`,
+        `disk_offering`.`created` AS `created`,
+        `disk_offering`.`tags` AS `tags`,
+        `disk_offering`.`removed` AS `removed`,
+        `disk_offering`.`use_local_storage` AS `use_local_storage`,
+        `disk_offering`.`system_use` AS `system_use`,
+        `disk_offering`.`customized_iops` AS `customized_iops`,
+        `disk_offering`.`min_iops` AS `min_iops`,
+        `disk_offering`.`max_iops` AS `max_iops`,
+        `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`,
+        `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`,
+        `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`,
+        `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`,
+        `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`,
+        `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`,
+        `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`,
+        `disk_offering`.`iops_read_rate` AS `iops_read_rate`,
+        `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`,
+        `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`,
+        `disk_offering`.`iops_write_rate` AS `iops_write_rate`,
+        `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`,
+        `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`,
+        `disk_offering`.`cache_mode` AS `cache_mode`,
+        `disk_offering`.`disk_size` AS `root_disk_size`,
+        `service_offering`.`cpu` AS `cpu`,
+        `service_offering`.`speed` AS `speed`,
+        `service_offering`.`ram_size` AS `ram_size`,
+        `service_offering`.`nw_rate` AS `nw_rate`,
+        `service_offering`.`mc_rate` AS `mc_rate`,
+        `service_offering`.`ha_enabled` AS `ha_enabled`,
+        `service_offering`.`limit_cpu_use` AS `limit_cpu_use`,
+        `service_offering`.`host_tag` AS `host_tag`,
+        `service_offering`.`default_use` AS `default_use`,
+        `service_offering`.`vm_type` AS `vm_type`,
+        `service_offering`.`sort_key` AS `sort_key`,
+        `service_offering`.`is_volatile` AS `is_volatile`,
+        `service_offering`.`deployment_planner` AS `deployment_planner`,
+        `service_offering`.`dynamically_scalable` AS `dynamically_scalable`,
+        `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`,
+        GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
+        GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
+        GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name,
+        GROUP_CONCAT(DISTINCT(domain.path)) AS domain_path,
+        GROUP_CONCAT(DISTINCT(zone.id)) AS zone_id,
+        GROUP_CONCAT(DISTINCT(zone.uuid)) AS zone_uuid,
+        GROUP_CONCAT(DISTINCT(zone.name)) AS zone_name,
+        IFNULL(`min_compute_details`.`value`, `cpu`) AS min_cpu,
+        IFNULL(`max_compute_details`.`value`, `cpu`) AS max_cpu,
+        IFNULL(`min_memory_details`.`value`, `ram_size`) AS min_memory,
+        IFNULL(`max_memory_details`.`value`, `ram_size`) AS max_memory
+    FROM
+        `cloud`.`service_offering`
+            INNER JOIN
+        `cloud`.`disk_offering_view` AS `disk_offering` ON service_offering.id = disk_offering.id
+            LEFT JOIN
+        `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid'
+            LEFT JOIN
+        `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`)
+            LEFT JOIN
+        `cloud`.`service_offering_details` AS `zone_details` ON `zone_details`.`service_offering_id` = `disk_offering`.`id` AND `zone_details`.`name`='zoneid'
+            LEFT JOIN
+        `cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`)
+			LEFT JOIN
+		`cloud`.`service_offering_details` AS `min_compute_details` ON `min_compute_details`.`service_offering_id` = `disk_offering`.`id`
+				AND `min_compute_details`.`name` = 'mincpunumber'
+			LEFT JOIN
+		`cloud`.`service_offering_details` AS `max_compute_details` ON `max_compute_details`.`service_offering_id` = `disk_offering`.`id`
+				AND `max_compute_details`.`name` = 'maxcpunumber'
+			LEFT JOIN
+		`cloud`.`service_offering_details` AS `min_memory_details` ON `min_memory_details`.`service_offering_id` = `disk_offering`.`id`
+				AND `min_memory_details`.`name` = 'minmemory'
+			LEFT JOIN
+		`cloud`.`service_offering_details` AS `max_memory_details` ON `max_memory_details`.`service_offering_id` = `disk_offering`.`id`
+				AND `max_memory_details`.`name` = 'maxmemory'
+			LEFT JOIN
+		`cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `disk_offering`.`id`
+				AND `vsphere_storage_policy`.`name` = 'storagepolicy'
+    WHERE
+        `disk_offering`.`state`='Active'
+    GROUP BY
+        `service_offering`.`id`;
\ No newline at end of file
diff --git a/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java b/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java
index 5ac401e..873aa38 100644
--- a/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java
+++ b/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java
@@ -75,6 +75,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     @Column(name = "deployment_planner")
     private String deploymentPlanner = null;
 
+    @Column(name = "dynamically_scalable")
+    private boolean dynamicallyScalable;
+
     @Transient
     Map<String, String> details = new HashMap<String, String>();
 
@@ -284,4 +287,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     public void setDynamicFlag(boolean isdynamic) {
         isDynamic = isdynamic;
     }
+
+    @Override
+    public boolean isDynamicallyScalable() {
+        return dynamicallyScalable;
+    }
 }
diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java
index b715f09..e998bf1 100644
--- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java
+++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java
@@ -339,7 +339,7 @@ public class KubernetesClusterResourceModifierActionWorker extends KubernetesClu
         nodeVm = userVmService.createAdvancedVirtualMachine(zone, serviceOffering, clusterTemplate, networkIds, owner,
                 hostName, hostName, null, null, null,
                 Hypervisor.HypervisorType.None, BaseCmd.HTTPMethod.POST, base64UserData, kubernetesCluster.getKeyPair(),
-                null, addrs, null, null, null, customParameterMap, null, null, null, null);
+                null, addrs, null, null, null, customParameterMap, null, null, null, null, true);
         if (LOGGER.isInfoEnabled()) {
             LOGGER.info(String.format("Created node VM : %s, %s in the Kubernetes cluster : %s", hostName, nodeVm.getUuid(), kubernetesCluster.getName()));
         }
diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java
index 855c264..a1d533b 100644
--- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java
+++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterStartWorker.java
@@ -72,6 +72,7 @@ import com.cloud.vm.Nic;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.ReservationContextImpl;
 import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.UserVmManager;
 import com.google.common.base.Strings;
 
 public class KubernetesClusterStartWorker extends KubernetesClusterResourceModifierActionWorker {
@@ -208,10 +209,11 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif
             logAndThrow(Level.ERROR, "Failed to read Kubernetes master configuration file", e);
         }
         String base64UserData = Base64.encodeBase64String(k8sMasterConfig.getBytes(StringUtils.getPreferredCharset()));
+        Boolean dynamicScalingEnabled = serviceOffering.isDynamicallyScalable() && clusterTemplate.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(zone.getId());
         masterVm = userVmService.createAdvancedVirtualMachine(zone, serviceOffering, clusterTemplate, networkIds, owner,
                 hostName, hostName, null, null, null,
                 Hypervisor.HypervisorType.None, BaseCmd.HTTPMethod.POST, base64UserData, kubernetesCluster.getKeyPair(),
-                requestedIps, addrs, null, null, null, customParameterMap, null, null, null, null);
+                requestedIps, addrs, null, null, null, customParameterMap, null, null, null, null, dynamicScalingEnabled);
         if (LOGGER.isInfoEnabled()) {
             LOGGER.info(String.format("Created master VM ID: %s, %s in the Kubernetes cluster : %s", masterVm.getUuid(), hostName, kubernetesCluster.getName()));
         }
@@ -262,10 +264,11 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif
             logAndThrow(Level.ERROR, "Failed to read Kubernetes master configuration file", e);
         }
         String base64UserData = Base64.encodeBase64String(k8sMasterConfig.getBytes(StringUtils.getPreferredCharset()));
+        Boolean dynamicScalingEnabled = serviceOffering.isDynamicallyScalable() && clusterTemplate.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(zone.getId());
         additionalMasterVm = userVmService.createAdvancedVirtualMachine(zone, serviceOffering, clusterTemplate, networkIds, owner,
                 hostName, hostName, null, null, null,
                 Hypervisor.HypervisorType.None, BaseCmd.HTTPMethod.POST, base64UserData, kubernetesCluster.getKeyPair(),
-                null, addrs, null, null, null, customParameterMap, null, null, null, null);
+                null, addrs, null, null, null, customParameterMap, null, null, null, null, dynamicScalingEnabled);
         if (LOGGER.isInfoEnabled()) {
             LOGGER.info(String.format("Created master VM ID : %s, %s in the Kubernetes cluster : %s", additionalMasterVm.getUuid(), hostName, kubernetesCluster.getName()));
         }
diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java b/server/src/main/java/com/cloud/api/ApiResponseHelper.java
index b03fa7d..8657038 100644
--- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java
@@ -1415,6 +1415,7 @@ public class ApiResponseHelper implements ResponseGenerator {
                 vmResponse.setState(vm.getState().toString());
             }
 
+            vmResponse.setDynamicallyScalable(vm.isDynamicallyScalable());
             // for console proxies, add the active sessions
             if (vm.getType() == Type.ConsoleProxy) {
                 ConsoleProxyVO proxy = ApiDBUtils.findConsoleProxy(vm.getId());
diff --git a/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
index 87b0374..7692f54 100644
--- a/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
+++ b/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
@@ -113,6 +113,7 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
         offeringResponse.setObjectName("serviceoffering");
         offeringResponse.setIscutomized(offering.isDynamic());
         offeringResponse.setCacheMode(offering.getCacheMode());
+        offeringResponse.setDynamicscalingenabled(offering.isDynamicallyScalable());
 
         if (offeringDetails != null && !offeringDetails.isEmpty()) {
             String vsphereStoragePolicyId = offeringDetails.get(ApiConstants.STORAGE_POLICY);
diff --git a/server/src/main/java/com/cloud/api/query/vo/ServiceOfferingJoinVO.java b/server/src/main/java/com/cloud/api/query/vo/ServiceOfferingJoinVO.java
index 4d9b2cd..e549bac 100644
--- a/server/src/main/java/com/cloud/api/query/vo/ServiceOfferingJoinVO.java
+++ b/server/src/main/java/com/cloud/api/query/vo/ServiceOfferingJoinVO.java
@@ -193,6 +193,9 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit
     @Column(name = "root_disk_size")
     private Long rootDiskSize;
 
+    @Column(name = "dynamically_scalable")
+    private boolean dynamicallyScalable;
+
     public ServiceOfferingJoinVO() {
     }
 
@@ -397,4 +400,12 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit
     public Long getRootDiskSize() {
         return rootDiskSize ;
     }
+
+    public boolean isDynamicallyScalable() {
+        return dynamicallyScalable;
+    }
+
+    public void setDynamicallyScalable(boolean dynamicallyScalable) {
+        this.dynamicallyScalable = dynamicallyScalable;
+    }
 }
diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index 1db461d..3f6991b 100755
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2480,7 +2480,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
                 cmd.getBytesWriteRate(), cmd.getBytesWriteRateMax(), cmd.getBytesWriteRateMaxLength(),
                 cmd.getIopsReadRate(), cmd.getIopsReadRateMax(), cmd.getIopsReadRateMaxLength(),
                 cmd.getIopsWriteRate(), cmd.getIopsWriteRateMax(), cmd.getIopsWriteRateMaxLength(),
-                cmd.getHypervisorSnapshotReserve(), cmd.getCacheMode(), storagePolicyId);
+                cmd.getHypervisorSnapshotReserve(), cmd.getCacheMode(), storagePolicyId, cmd.getDynamicScalingEnabled());
     }
 
     protected ServiceOfferingVO createServiceOffering(final long userId, final boolean isSystem, final VirtualMachine.Type vmType,
@@ -2491,7 +2491,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 Integer hypervisorSnapshotReserve, String cacheMode, final Long storagePolicyID, final Boolean dynamicScalingEnabled) {
         // Filter child domains when both parent and child domains are present
         List<Long> filteredDomainIds = filterChildSubDomains(domainIds);
 
@@ -2523,7 +2523,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
 
         ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, null, offerHA,
                 limitResourceUse, volatileVm, displayText, typedProvisioningType, localStorageRequired, false, tags, isSystem, vmType,
-                hostTag, deploymentPlanner);
+                hostTag, deploymentPlanner, dynamicScalingEnabled);
 
         if (Boolean.TRUE.equals(isCustomizedIops) || isCustomizedIops == null) {
                 minIops = null;
diff --git a/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
index 2ae35fc..3e3885d 100644
--- a/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -52,7 +52,6 @@ import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.NicVO;
-import com.cloud.vm.UserVmManager;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
@@ -240,7 +239,7 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
         // Workaround to make sure the TO has the UUID we need for Niciri integration
         VMInstanceVO vmInstance = _virtualMachineDao.findById(to.getId());
         // check if XStools/VMWare tools are present in the VM and dynamic scaling feature is enabled (per zone/global)
-        Boolean isDynamicallyScalable = vmInstance.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(vm.getDataCenterId());
+        Boolean isDynamicallyScalable = vmInstance.isDynamicallyScalable();
         to.setEnableDynamicallyScaleVm(isDynamicallyScalable);
         to.setUuid(vmInstance.getUuid());
 
diff --git a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java
index c710549..5e7f0a9 100644
--- a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java
@@ -1325,18 +1325,18 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
                 vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, null, owner, "autoScaleVm-" + asGroup.getId() + "-" +
                     getCurrentTimeStampString(),
                     "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(), null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null, null,
-                    null, true, null, null, null, null, null, null, null);
+                    null, true, null, null, null, null, null, null, null, true);
             } else {
                 if (zone.isSecurityGroupEnabled()) {
                     vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, null, null,
                         owner, "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(),
                         "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(), null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null,
-                        null, null, true, null, null, null, null, null, null, null);
+                        null, null, true, null, null, null, null, null, null, null, true);
 
                 } else {
                     vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, null, owner, "autoScaleVm-" + asGroup.getId() + "-" +
                         getCurrentTimeStampString(), "autoScaleVm-" + asGroup.getId() + "-" + getCurrentTimeStampString(),
-                        null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null, null, addrs, true, null, null, null, null, null, null, null);
+                        null, null, null, HypervisorType.XenServer, HTTPMethod.GET, null, null, null, addrs, true, null, null, null, null, null, null, null, true);
 
                 }
             }
diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
index 286fe2e..96daf19 100644
--- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
@@ -1850,6 +1850,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         _itMgr.checkIfCanUpgrade(vmInstance, newServiceOffering);
 
         ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
+        if (newServiceOffering.isDynamicallyScalable() != currentServiceOffering.isDynamicallyScalable()) {
+            throw new InvalidParameterValueException("Unable to Scale VM: since dynamicscalingenabled flag is not same for new service offering and old service offering");
+        }
+
         int newCpu = newServiceOffering.getCpu();
         int newMemory = newServiceOffering.getRamSize();
         int newSpeed = newServiceOffering.getSpeed();
@@ -2716,10 +2720,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             userData = vm.getUserData();
         }
 
-        if (isDynamicallyScalable == null) {
-            isDynamicallyScalable = vm.isDynamicallyScalable();
-        }
-
         if (osTypeId == null) {
             osTypeId = vm.getGuestOSId();
         }
@@ -2730,6 +2730,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         if (isDynamicallyScalable == null) {
             isDynamicallyScalable = vm.isDynamicallyScalable();
+        } else {
+            if (isDynamicallyScalable == true) {
+                if (!offering.isDynamicallyScalable()) {
+                    throw new InvalidParameterValueException("Dynamic Scaling cannot be enabled on the VM since service offering is not dynamic scaling enabled");
+                }
+                if (!UserVmManager.EnableDynamicallyScaleVm.valueIn(vm.getDataCenterId())) {
+                    throw new InvalidParameterValueException("Dynamic Scaling cannot be enabled on the VM since global configuration \"enable.dynamic.scale.vm\" is false");
+                }
+            }
         }
 
         boolean isVMware = (vm.getHypervisorType() == HypervisorType.VMware);
@@ -3180,7 +3189,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
             String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
             Map<String, String> customParametes, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
-            Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
+            Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, Boolean dynamicScalingEnabled) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
     StorageUnavailableException, ResourceAllocationException {
 
         Account caller = CallContext.current().getCallingAccount();
@@ -3229,7 +3238,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId, diskSize, networkList, securityGroupIdList, group, httpmethod,
                 userData, sshKeyPair, hypervisor, caller, requestedIps, defaultIps, displayVm, keyboard, affinityGroupIdList, customParametes, customId, dhcpOptionMap,
-                dataDiskTemplateToDiskOfferingMap, userVmOVFProperties);
+                dataDiskTemplateToDiskOfferingMap, userVmOVFProperties, dynamicScalingEnabled);
 
     }
 
@@ -3239,7 +3248,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
             HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
             List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
-            Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties) throws InsufficientCapacityException, ConcurrentOperationException,
+            Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, Boolean dynamicScalingEnabled) throws InsufficientCapacityException, ConcurrentOperationException,
     ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
 
         Account caller = CallContext.current().getCallingAccount();
@@ -3340,7 +3349,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId, diskSize, networkList, securityGroupIdList, group, httpmethod,
                 userData, sshKeyPair, hypervisor, caller, requestedIps, defaultIps, displayVm, keyboard, affinityGroupIdList, customParameters, customId, dhcpOptionMap, dataDiskTemplateToDiskOfferingMap,
-                userVmOVFProperties);
+                userVmOVFProperties, dynamicScalingEnabled);
     }
 
     @Override
@@ -3349,7 +3358,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
             String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayvm, String keyboard, List<Long> affinityGroupIdList,
             Map<String, String> customParametrs, String customId, Map<String, Map<Integer, String>> dhcpOptionsMap, Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
-            Map<String, String> userVmOVFPropertiesMap) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
+            Map<String, String> userVmOVFPropertiesMap, Boolean dynamicScalingEnabled) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
     StorageUnavailableException, ResourceAllocationException {
 
         Account caller = CallContext.current().getCallingAccount();
@@ -3401,7 +3410,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId, diskSize, networkList, null, group, httpmethod, userData,
                 sshKeyPair, hypervisor, caller, requestedIps, defaultIps, displayvm, keyboard, affinityGroupIdList, customParametrs, customId, dhcpOptionsMap,
-                dataDiskTemplateToDiskOfferingMap, userVmOVFPropertiesMap);
+                dataDiskTemplateToDiskOfferingMap, userVmOVFPropertiesMap, dynamicScalingEnabled);
     }
 
     private NetworkVO getNetworkToAddToNetworkList(VirtualMachineTemplate template, Account owner, HypervisorType hypervisor,
@@ -3516,11 +3525,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     @DB
     private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate tmplt, String hostName, String displayName, Account owner,
-            Long diskOfferingId, Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod, String userData,
-            String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean isDisplayVm, String keyboard,
-            List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
-            Map<Long, DiskOffering> datadiskTemplateToDiskOfferringMap,
-            Map<String, String> userVmOVFPropertiesMap) throws InsufficientCapacityException, ResourceUnavailableException,
+                                        Long diskOfferingId, Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod, String userData,
+                                        String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean isDisplayVm, String keyboard,
+                                        List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
+                                        Map<Long, DiskOffering> datadiskTemplateToDiskOfferringMap,
+                                        Map<String, String> userVmOVFPropertiesMap, Boolean dynamicScalingEnabled) throws InsufficientCapacityException, ResourceUnavailableException,
     ConcurrentOperationException, StorageUnavailableException, ResourceAllocationException {
 
         _accountMgr.checkAccess(caller, null, true, owner);
@@ -3873,9 +3882,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             }
         }
 
+        dynamicScalingEnabled = checkIfDynamicScalingCanBeEnabled(dynamicScalingEnabled, offering, template, zone.getId());
+
         UserVmVO vm = commitUserVm(zone, template, hostName, displayName, owner, diskOfferingId, diskSize, userData, caller, isDisplayVm, keyboard, accountId, userId, offering,
                 isIso, sshPublicKey, networkNicMap, id, instanceName, uuidName, hypervisorType, customParameters, dhcpOptionMap,
-                datadiskTemplateToDiskOfferringMap, userVmOVFPropertiesMap);
+                datadiskTemplateToDiskOfferringMap, userVmOVFPropertiesMap, dynamicScalingEnabled);
 
         // Assign instance to the group
         try {
@@ -3899,6 +3910,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         return vm;
     }
 
+    private Boolean checkIfDynamicScalingCanBeEnabled(Boolean dynamicScalingEnabled, ServiceOfferingVO offering, VMTemplateVO template, Long zoneId) {
+        if (dynamicScalingEnabled) {
+            if (!(offering.isDynamicallyScalable() && template.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(zoneId))) {
+                s_logger.info("VM cannot be configured to be dynamically scalable if any of the service offering's dynamic scaling property, template's dynamic scaling property or global setting is false");
+            }
+        }
+        return dynamicScalingEnabled && offering.isDynamicallyScalable() && template.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(zoneId);
+    }
+
     /**
      * Configures the Root disk size via User`s custom parameters.
      * If the Service Offering has the Root Disk size field configured then the User`s root disk custom parameter is overwritten by the service offering.
@@ -3977,14 +3997,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                                   final long accountId, final long userId, final ServiceOffering offering, final boolean isIso, final String sshPublicKey, final LinkedHashMap<String, List<NicProfile>> networkNicMap,
                                   final long id, final String instanceName, final String uuidName, final HypervisorType hypervisorType, final Map<String, String> customParameters,
                                   final Map<String, Map<Integer, String>> extraDhcpOptionMap, final Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
-                                  final Map<String, String> userVmOVFPropertiesMap, final VirtualMachine.PowerState powerState) throws InsufficientCapacityException {
+                                  final Map<String, String> userVmOVFPropertiesMap, final VirtualMachine.PowerState powerState, final Boolean dynamicScalingEnabled) throws InsufficientCapacityException {
         return Transaction.execute(new TransactionCallbackWithException<UserVmVO, InsufficientCapacityException>() {
             @Override
             public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
                 UserVmVO vm = new UserVmVO(id, instanceName, displayName, template.getId(), hypervisorType, template.getGuestOSId(), offering.isOfferHA(),
                         offering.getLimitCpuUse(), owner.getDomainId(), owner.getId(), userId, offering.getId(), userData, hostName, diskOfferingId);
                 vm.setUuid(uuidName);
-                vm.setDynamicallyScalable(template.isDynamicallyScalable());
+                vm.setDynamicallyScalable(dynamicScalingEnabled);
 
                 Map<String, String> details = template.getDetails();
                 if (details != null && !details.isEmpty()) {
@@ -4164,13 +4184,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             final long accountId, final long userId, final ServiceOfferingVO offering, final boolean isIso, final String sshPublicKey, final LinkedHashMap<String, List<NicProfile>> networkNicMap,
             final long id, final String instanceName, final String uuidName, final HypervisorType hypervisorType, final Map<String, String> customParameters, final Map<String,
             Map<Integer, String>> extraDhcpOptionMap, final Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
-            Map<String, String> userVmOVFPropertiesMap) throws InsufficientCapacityException {
+            Map<String, String> userVmOVFPropertiesMap, final Boolean dynamicScalingEnabled) throws InsufficientCapacityException {
         return commitUserVm(false, zone, null, null, template, hostName, displayName, owner,
                 diskOfferingId, diskSize, userData, caller, isDisplayVm, keyboard,
                 accountId, userId, offering, isIso, sshPublicKey, networkNicMap,
                 id, instanceName, uuidName, hypervisorType, customParameters,
                 extraDhcpOptionMap, dataDiskTemplateToDiskOfferingMap,
-                userVmOVFPropertiesMap, null);
+                userVmOVFPropertiesMap, null, dynamicScalingEnabled);
     }
 
     public void validateRootDiskResize(final HypervisorType hypervisorType, Long rootDiskSize, VMTemplateVO templateVO, UserVmVO vm, final Map<String, String> customParameters) throws InvalidParameterValueException
@@ -5253,6 +5273,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             }
         }
 
+        Boolean dynamicScalingEnabled = cmd.getDynamicScalingEnabled();
+
         VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);
         // Make sure a valid template ID was specified
         if (template == null) {
@@ -5310,14 +5332,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                 vm = createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(cmd), owner, name, displayName, diskOfferingId,
                         size , group , cmd.getHypervisor(), cmd.getHttpMethod(), userData , sshKeyPairName , cmd.getIpToNetworkMap(), addrs, displayVm , keyboard , cmd.getAffinityGroupIdList(),
                         cmd.getDetails(), cmd.getCustomId(), cmd.getDhcpOptionsMap(),
-                        dataDiskTemplateToDiskOfferingMap, userVmOVFProperties);
+                        dataDiskTemplateToDiskOfferingMap, userVmOVFProperties, dynamicScalingEnabled);
             }
         } else {
             if (zone.isSecurityGroupEnabled())  {
                 vm = createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, networkIds, getSecurityGroupIdList(cmd), owner, name,
                         displayName, diskOfferingId, size, group, cmd.getHypervisor(), cmd.getHttpMethod(), userData, sshKeyPairName, cmd.getIpToNetworkMap(), addrs, displayVm, keyboard,
                         cmd.getAffinityGroupIdList(), cmd.getDetails(), cmd.getCustomId(), cmd.getDhcpOptionsMap(),
-                        dataDiskTemplateToDiskOfferingMap, userVmOVFProperties);
+                        dataDiskTemplateToDiskOfferingMap, userVmOVFProperties, dynamicScalingEnabled);
 
             } else {
                 if (cmd.getSecurityGroupIdList() != null && !cmd.getSecurityGroupIdList().isEmpty()) {
@@ -5325,7 +5347,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                 }
                 vm = createAdvancedVirtualMachine(zone, serviceOffering, template, networkIds, owner, name, displayName, diskOfferingId, size, group,
                         cmd.getHypervisor(), cmd.getHttpMethod(), userData, sshKeyPairName, cmd.getIpToNetworkMap(), addrs, displayVm, keyboard, cmd.getAffinityGroupIdList(), cmd.getDetails(),
-                        cmd.getCustomId(), cmd.getDhcpOptionsMap(), dataDiskTemplateToDiskOfferingMap, userVmOVFProperties);
+                        cmd.getCustomId(), cmd.getDhcpOptionsMap(), dataDiskTemplateToDiskOfferingMap, userVmOVFProperties, dynamicScalingEnabled);
             }
         }
         // check if this templateId has a child ISO
@@ -7351,11 +7373,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         final String uuidName = _uuidMgr.generateUuid(UserVm.class, null);
         final Host lastHost = powerState != VirtualMachine.PowerState.PowerOn ? host : null;
+        final Boolean dynamicScalingEnabled = serviceOffering.isDynamicallyScalable() && template.isDynamicallyScalable() && UserVmManager.EnableDynamicallyScaleVm.valueIn(zone.getId());
         return commitUserVm(true, zone, host, lastHost, template, hostName, displayName, owner,
                 null, null, userData, caller, isDisplayVm, keyboard,
                 accountId, userId, serviceOffering, template.getFormat().equals(ImageFormat.ISO), sshPublicKey, null,
                 id, instanceName, uuidName, hypervisorType, customParameters,
-                null, null, null, powerState);
+                null, null, null, powerState, dynamicScalingEnabled);
     }
 
     @Override
diff --git a/server/src/test/java/com/cloud/vm/DeploymentPlanningManagerImplTest.java b/server/src/test/java/com/cloud/vm/DeploymentPlanningManagerImplTest.java
index d356570..20e9ea6 100644
--- a/server/src/test/java/com/cloud/vm/DeploymentPlanningManagerImplTest.java
+++ b/server/src/test/java/com/cloud/vm/DeploymentPlanningManagerImplTest.java
@@ -196,7 +196,7 @@ public class DeploymentPlanningManagerImplTest {
         ServiceOfferingVO svcOffering =
             new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false, "test dpm",
                     ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User,
-                    null, "FirstFitPlanner");
+                    null, "FirstFitPlanner", true);
         Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
 
         DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
@@ -211,7 +211,7 @@ public class DeploymentPlanningManagerImplTest {
         ServiceOfferingVO svcOffering =
             new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false, "test dpm",
                     ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User,
-                    null, "UserDispersingPlanner");
+                    null, "UserDispersingPlanner", true);
         Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
 
         DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
@@ -227,7 +227,7 @@ public class DeploymentPlanningManagerImplTest {
         ServiceOfferingVO svcOffering =
             new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false, "test dpm",
                 ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User,
-                    null, "FirstFitPlanner");
+                    null, "FirstFitPlanner", true);
         Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
 
         DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);


[cloudstack] 06/06: Added tool tip during VM deployment

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch VMDynamicScalabilityGranularity
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 74ded959a8f66f0e645eef006bcd73b205aea26d
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Wed Feb 3 10:56:57 2021 +0530

    Added tool tip during VM deployment
---
 ui/public/locales/en.json         | 1 +
 ui/src/views/compute/DeployVM.vue | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index a44e5ee..422f1d0 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -805,6 +805,7 @@
 "label.driver": "Driver",
 "label.duration.in.sec": "Duration (in sec)",
 "label.dynamicscalingenabled": "Dynamic Scaling Enabled",
+"label.dynamicscalingenabled.tooltip": "VM can dynamically scale only when dynamic scalability is enabled on template, service offering and global setting",
 "label.edit": "Edit",
 "label.edit.acl.list": "Edit ACL List",
 "label.edit.acl.rule": "Edit ACL rule",
diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue
index 506665b..19695f9 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -504,7 +504,7 @@
                     <a-form-item>
                       <span slot="label">
                         {{ $t('label.dynamicscalingenabled') }}
-                        <a-tooltip :title="$t('label.dynamicscalingenabled')">
+                        <a-tooltip :title="$t('label.dynamicscalingenabled.tooltip')">
                           <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
                         </a-tooltip>
                       </span>