@Override protected Integer maxNumOfVcpus() { return VmCpuCountHelper.calcMaxVCpu(vm, getVersion()); }
/** * Computes the maximum allowed number of vCPUs that can be assigned * to a VM according to the specified compatibility level. * * @param vmTemplate The VM template for which we want to know the maximum * @param compatibilityVersion The compatibility level * @return The maximum supported number of vCPUs */ public static Integer calcMaxVCpu(VmTemplate vmTemplate, Version compatibilityVersion) { return calcMaxVCpu(vmTemplate, compatibilityVersion, architectureFamily(vmTemplate)); }
/** * Validates CPU count configuration. It may not be possible to use * configurations with too many threads or cores. * * @param vm The VM for which we want to check the CPU count configuration * @return Whether the CPU count configuration is valid */ public static boolean validateCpuCounts(VM vm) { ArchitectureType architecture = architectureFamily(vm); if (architecture == null || architecture == ArchitectureType.x86) { return bitWidth(vm.getThreadsPerCpu()) + bitWidth(vm.getCpuPerSocket()) <= maxBitWidth; } return true; } }
@Override protected Integer maxNumOfVcpus() { return VmCpuCountHelper.calcMaxVCpu(template, getVersion()); }
/** * Computes the maximum allowed number of vCPUs that can be assigned * to a VM according to the specified compatibility level. * * @param vm The VM for which we want to know the maximum * @param compatibilityVersion The compatibility level * @return The maximum supported number of vCPUs */ public static Integer calcMaxVCpu(VM vm, Version compatibilityVersion) { return calcMaxVCpu(vm.getStaticData(), compatibilityVersion, architectureFamily(vm)); }
@Override protected Integer maxNumOfVcpus() { return VmCpuCountHelper.calcMaxVCpu(vm, getVersion()); }
@Override protected Integer maxNumOfVcpus() { return VmCpuCountHelper.calcMaxVCpu(vmTemplate, getVersion()); }
@Test public void test256() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(null, new Integer(16), new Integer(288), 2, 8); assertEquals(new Integer(240), maxVCpu); }
@Test public void testPowerOf2() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(null, new Integer(16), new Integer(288), 2, 4); assertEquals(new Integer(128), maxVCpu); }
@Test public void testCommonX86() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.x86, new Integer(16), new Integer(288), 2, 12); assertEquals(new Integer(192), maxVCpu); }
@Test public void test256Ppc() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.ppc, new Integer(16), new Integer(288), 2, 8); assertEquals(new Integer(256), maxVCpu); }
@Test public void testPowerOf2X86() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.x86, new Integer(16), new Integer(288), 2, 4); assertEquals(new Integer(128), maxVCpu); }
@Test public void testPowerOf2Ppc() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.ppc, new Integer(16), new Integer(288), 2, 4); assertEquals(new Integer(128), maxVCpu); }
@Test public void testCommon() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(null, new Integer(16), new Integer(288), 2, 12); assertEquals(new Integer(192), maxVCpu); }
@Test public void testLimit() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(null, new Integer(16), new Integer(100), 2, 8); assertEquals(new Integer(96), maxVCpu); }
@Test public void test256X86() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.x86, new Integer(16), new Integer(288), 2, 8); assertEquals(new Integer(240), maxVCpu); }
@Test public void testAtLimitX86() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.x86, new Integer(16), new Integer(240), 2, 8); assertEquals(new Integer(240), maxVCpu); }
@Test public void testLimitX86() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.x86, new Integer(16), new Integer(240), 2, 16); assertEquals(new Integer(224), maxVCpu); }
@Test public void testCommonPpc() { Integer maxVCpu = VmCpuCountHelper.calcMaxVCpu(ArchitectureType.ppc, new Integer(16), new Integer(288), 2, 12); assertEquals(new Integer(288), maxVCpu); }