mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-13 09:02:26 +01:00
CLOUDSTACK-2085: VM weight on xen remain same as before vmscaleup ;because "Add-To-VCPUs-Params-Live.sh" is not getting copied on xs host
Fixed by updating the patch files that has entries to copy scipts on xenserver. Here we added Add-To-VCPUs-Params-Live.sh Added a check on Host params whether host restricts Dynamic memory control(DMC) to able to allow scale up VM. If DMC is not enabled then static max and min are set to SO. Signed Off by - Nitin Mehta <nitin.mehta@citrix.com>
This commit is contained in:
parent
88422248cc
commit
ca0d2ef8c2
@ -691,7 +691,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
if (vmSpec.getLimitCpuUse()) {
|
||||
long utilization = 0; // max CPU cap, default is unlimited
|
||||
utilization = ((long)speed * 100 * vmSpec.getCpus()) / _host.speed ;
|
||||
vm.addToVCPUsParamsLive(conn, "cap", Long.toString(utilization));
|
||||
//vm.addToVCPUsParamsLive(conn, "cap", Long.toString(utilization)); currently xenserver doesnot support Xapi to add VCPUs params live.
|
||||
callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "cap", "value", Long.toString(utilization), "vmname", vmSpec.getName() );
|
||||
}
|
||||
//vm.addToVCPUsParamsLive(conn, "weight", Integer.toString(cpuWeight));
|
||||
callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "weight", "value", Integer.toString(cpuWeight), "vmname", vmSpec.getName() );
|
||||
@ -724,6 +725,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
for (VM vm : vms) {
|
||||
VM.Record vmr = vm.getRecord(conn);
|
||||
try {
|
||||
Map<String, String> hostParams = new HashMap<String, String>();
|
||||
hostParams = host.getLicenseParams(conn);
|
||||
if (hostParams.get("restrict_dmc").equalsIgnoreCase("true")) {
|
||||
throw new CloudRuntimeException("Host "+ _host.uuid + " does not support Dynamic Memory Control, so we cannot scale up the vm");
|
||||
}
|
||||
scaleVM(conn, vm, vmSpec, host);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -142,8 +142,17 @@ public class XenServer56FP1Resource extends XenServer56Resource {
|
||||
record.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
|
||||
record.memoryDynamicMax = vmSpec.getMaxRam();
|
||||
record.memoryDynamicMin = vmSpec.getMinRam();
|
||||
record.memoryStaticMax = 8589934592L; //128GB
|
||||
record.memoryStaticMin = 134217728L; //128MB
|
||||
Map<String, String> hostParams = new HashMap<String, String>();
|
||||
hostParams = host.getLicenseParams(conn);
|
||||
if (hostParams.get("restrict_dmc").equalsIgnoreCase("false")) {
|
||||
record.memoryStaticMax = 8589934592L; //8GB
|
||||
record.memoryStaticMin = 134217728L; //128MB
|
||||
} else {
|
||||
s_logger.warn("Host "+ _host.uuid + " does not support Dynamic Memory Control, so we cannot scale up the vm");
|
||||
record.memoryStaticMax = vmSpec.getMaxRam();
|
||||
record.memoryStaticMin = vmSpec.getMinRam();
|
||||
}
|
||||
|
||||
if (guestOsTypeName.toLowerCase().contains("windows")) {
|
||||
record.VCPUsMax = (long) vmSpec.getCpus();
|
||||
} else {
|
||||
|
||||
@ -110,7 +110,7 @@ public class CitrixResourceBaseTest {
|
||||
@Test
|
||||
public void testScaleVMF2() throws Types.XenAPIException, XmlRpcException {
|
||||
|
||||
doReturn(null).when(vm).setMemoryDynamicRangeAsync(conn, 536870912L, 536870912L);
|
||||
doNothing().when(vm).setMemoryDynamicRange(conn, 536870912L, 536870912L);
|
||||
doReturn(1).when(vmSpec).getCpus();
|
||||
doNothing().when(vm).setVCPUsNumberLive(conn, 1L);
|
||||
doReturn(500).when(vmSpec).getSpeed();
|
||||
@ -129,12 +129,12 @@ public class CitrixResourceBaseTest {
|
||||
@Test
|
||||
public void testScaleVMF3() throws Types.XenAPIException, XmlRpcException {
|
||||
|
||||
doReturn(null).when(vm).setMemoryDynamicRangeAsync(conn, 536870912L, 536870912L);
|
||||
doNothing().when(vm).setMemoryDynamicRange(conn, 536870912L, 536870912L);
|
||||
doReturn(1).when(vmSpec).getCpus();
|
||||
doNothing().when(vm).setVCPUsNumberLive(conn, 1L);
|
||||
doReturn(500).when(vmSpec).getSpeed();
|
||||
doReturn(true).when(vmSpec).getLimitCpuUse();
|
||||
doNothing().when(vm).addToVCPUsParamsLive(conn, "cap", "100");
|
||||
doReturn(null).when(_resource).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "cap", "value", "100", "vmname", "i-2-3-VM");
|
||||
Map<String, String> args = (Map<String, String>)mock(HashMap.class);
|
||||
when(host.callPlugin(conn, "vmops", "add_to_VCPUs_params_live", args)).thenReturn("Success");
|
||||
doReturn(null).when(_resource).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "weight", "value", "253", "vmname", "i-2-3-VM");
|
||||
@ -143,6 +143,6 @@ public class CitrixResourceBaseTest {
|
||||
|
||||
verify(vmSpec, times(1)).getLimitCpuUse();
|
||||
verify(_resource, times(1)).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "weight", "value", "253", "vmname", "i-2-3-VM");
|
||||
verify(vm, times(1)).addToVCPUsParamsLive(conn, "cap", "100");
|
||||
verify(_resource, times(1)).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "cap", "value", "100", "vmname", "i-2-3-VM");
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ def add_to_VCPUs_params_live(session, args):
|
||||
value = args['value']
|
||||
vmname = args['vmname']
|
||||
try:
|
||||
cmd = ["bash", "/opt/xensource/bin/Add-To-VCPUs-Params-Live.sh", vmname, key, value]
|
||||
cmd = ["bash", "/opt/xensource/bin/add_to_vcpus_params_live.sh", vmname, key, value]
|
||||
txt = util.pread2(cmd)
|
||||
except:
|
||||
return 'false'
|
||||
|
||||
@ -64,3 +64,4 @@ cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
|
||||
getRouterStatus.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||
bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||
getDomRVersion.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
|
||||
|
||||
@ -65,4 +65,5 @@ bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||
swift=..,0755,/opt/xensource/bin
|
||||
swiftxen=..,0755,/etc/xapi.d/plugins
|
||||
s3xen=..,0755,/etc/xapi.d/plugins
|
||||
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
|
||||
|
||||
|
||||
@ -64,4 +64,5 @@ bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||
swift=..,0755,/opt/xensource/bin
|
||||
swiftxen=..,0755,/etc/xapi.d/plugins
|
||||
s3xen=..,0755,/etc/xapi.d/plugins
|
||||
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
|
||||
|
||||
|
||||
@ -69,4 +69,5 @@ bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||
swift=..,0755,/opt/xensource/bin
|
||||
swiftxen=..,0755,/etc/xapi.d/plugins
|
||||
s3xen=..,0755,/etc/xapi.d/plugins
|
||||
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user