GitHub user sudhansu7 opened a pull request:
https://github.com/apache/cloudstack/pull/1849
CLOUDSTACK-9690: Scale CentOS7 VM fails with error
Scale CentOS7 VM fails with error "Cannot scale up the vm because of memory
constraint violation"
When creating VM from CentOS 7 template on the XenServer with dynamically
scaling enabled, instance starts with base specified memory instead of memory *
4 as static limit.
As the result, attempt to scale VM throws error in MS log:
```
java.lang.RuntimeException: Job failed due to exception Unable to scale vm
due to Catch exception com.cloud.utils.exception.CloudRuntimeException when
scaling VM:i-24-3976-VM due to com.cloud.utils.exception.CloudRuntimeException:
Cannot scale up the vm because of memory constraint violation: 0 <=
memory-static-min(2147483648) <= memory-dynamic-min(8589934592) <=
memory-dynamic-max(8589934592) <= memory-static-max(2147483648)
```
REPO STEPS
=============================
1. Enable dynamic scaling in Global settings
2. Register an CentOS 7 tempplate(with tools) and tick dynamic scaling
3. Deploy VM with this template
4. Start the VM and try to change service offering
EXPECTED RESULT: VM should start with static limit 4x<assigned memory> and
scale up when offering is changed
ACTUAL RESULT: VM starts with maximum static limit of <assigned memory> and
doesn't scale up with error in ms log :
Cannot scale up the vm because of memory constraint violation:
Root Cause: Xensever guest OS memory values are missing for 'CentOS 7'.
Solution: Add Xensever guest OS memory values for 'CentOS 7'. But this
needs patching and restart of management server. In this fix the hardcoded
values are moved from Java files to database.
1. Removed XenServerGuestOsMemoryMap from CitrixHelper.java
This java file was holding a static in memory map named
XenServerGuestOsMemoryMap. This was the source for xenserver dynamic memory
values(max and min). These values were moved to guest_os_details table.
2. DAO layer was modified to access these values.
3. VirtualMachineTo object was modified to populate the dynamic memory
values.
4. addGuestOs and UpdateGuestOS api has been modified to update memory
values.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9690
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/1849.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1849
----
commit 60021defea46b8ef8a87660070b4ad6c1c73af79
Author: Sudhansu <[email protected]>
Date: 2016-12-21T17:41:12Z
CLOUDSTACK-9690: Scale CentOS7 VM fails with error
1. Removed XenServerGuestOsMemoryMap from CitrixHelper.java
This java file was holding a static in memory map named
XenServerGuestOsMemoryMap. This was the source for xenserver dynamic memory
values(max and min). These values were moved to guest_os_details table.
2. DAO layer was modified to access these values.
3. VirtualMachineTo object was modified to populate the dynamic memory
values.
4. addGuestOs and UpdateGuestOS api has been modified to update memory
values.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---