@Override public V3CpuTopology adapt(CpuTopology from) { V3CpuTopology to = new V3CpuTopology(); if (from.isSetCores()) { to.setCores(from.getCores()); } if (from.isSetSockets()) { to.setSockets(from.getSockets()); } if (from.isSetThreads()) { to.setThreads(from.getThreads()); } return to; } }
static void verifyModelSpecific(InstanceType model) { assertNotNull(model.getCpu()); assertNotNull(model.getCpu().getTopology()); assertEquals(4, model.getCpu().getTopology().getCores().intValue()); assertEquals(2, model.getCpu().getTopology().getSockets().intValue()); assertEquals(1, model.getCpu().getTopology().getThreads().intValue()); }
@Test public void testCpuMapping() { VDS vds = new VDS(); vds.setId(Guid.Empty); vds.setCpuCores(6); vds.setCpuSockets(3); vds.setCpuThreads(12); vds.setCpuModel("some cpu model"); vds.setCpuSpeedMh(5.5); Host host = HostMapper.map(vds, (Host) null); assertNotNull(host.getCpu()); assertEquals(Integer.valueOf(2), host.getCpu().getTopology().getCores()); assertEquals(Integer.valueOf(3), host.getCpu().getTopology().getSockets()); assertEquals(Integer.valueOf(2), host.getCpu().getTopology().getThreads()); assertEquals("some cpu model", host.getCpu().getName()); assertEquals(new BigDecimal(5.5), host.getCpu().getSpeed()); }
static void verifyModelSpecific(Vm model) { assertNotNull(model.getCluster()); assertNotNull(model.getCluster().getId()); assertNotNull(model.getCpu()); assertNotNull(model.getCpu().getTopology()); assertEquals(4, model.getCpu().getTopology().getCores().intValue()); assertEquals(2, model.getCpu().getTopology().getSockets().intValue()); assertEquals(GUIDS[2].toString(), model.getSmallIcon().getId()); assertEquals(GUIDS[3].toString(), model.getLargeIcon().getId()); }
static void verifyModelSpecific(Template model, int index) { assertNotNull(model.getCluster()); assertEquals(GUIDS[2].toString(), model.getCluster().getId()); assertNotNull(model.getCpu()); assertNotNull(model.getCpu().getTopology()); assertEquals(4, model.getCpu().getTopology().getCores().intValue()); assertEquals(2, model.getCpu().getTopology().getSockets().intValue()); assertEquals(1, model.getCpu().getTopology().getThreads().intValue()); if(index == 2) { assertNotNull(model.getVersion()); assertNotSame(model.getVersion().getBaseTemplate().getId(), model.getId()); } assertEquals(GUIDS[2].toString(), model.getSmallIcon().getId()); assertEquals(GUIDS[3].toString(), model.getLargeIcon().getId()); }
@Override protected Template postPopulate(Template from) { from.setType(VmType.DESKTOP); from.setStorageErrorResumeBehaviour(VmStorageErrorResumeBehaviour.AUTO_RESUME); from.setOrigin(OriginType.VMWARE.name().toLowerCase()); List<BootDevice> devices = from.getOs().getBoot().getDevices().getDevices(); for (int i = 0; i < devices.size(); i++) { devices.set(i, BootDevice.NETWORK); } while (from.getCpu().getTopology().getSockets() == 0) { from.getCpu().getTopology().setSockets(MappingTestHelper.rand(100)); } while (from.getCpu().getTopology().getCores() == 0) { from.getCpu().getTopology().setCores(MappingTestHelper.rand(100)); } from.setTimeZone(new TimeZone()); from.getTimeZone().setName("Australia/Darwin"); from.getSerialNumber().setPolicy(SerialNumberPolicy.CUSTOM); from.getMigration().setAutoConverge(InheritableBoolean.TRUE); from.getMigration().setCompressed(InheritableBoolean.TRUE); from.getDisplay().setDisconnectAction(DisplayDisconnectAction.LOCK_SCREEN.toString()); for (NicConfiguration nicConfiguration : from.getInitialization().getNicConfigurations().getNicConfigurations()) { nicConfiguration.setBootProtocol(BootProtocol.STATIC); } return from; }
entity.setCpuPerSocket(model.getCpu().getTopology().getCores()); if (model.getCpu().getTopology().getSockets() != null) { entity.setNumOfSockets(model.getCpu().getTopology().getSockets());
devices.set(i, BootDevice.HD); while (from.getCpu().getTopology().getSockets() == 0) { from.getCpu().getTopology().setSockets(MappingTestHelper.rand(100));
assertNotNull(transform.getCpu().getTopology()); assertTrue(Math.abs(model.getCpu().getTopology().getCores() - transform.getCpu().getTopology().getCores()) < model.getCpu().getTopology().getSockets()); assertEquals(model.getCpu().getTopology().getSockets(), transform.getCpu().getTopology().getSockets()); assertEquals(model.getBios().getBootMenu().isEnabled(), transform.getBios().getBootMenu().isEnabled()); assertNotNull(transform.getOs());
assertNotNull(transform.getCpu().getTopology()); assertTrue(Math.abs(model.getCpu().getTopology().getCores() - transform.getCpu().getTopology().getCores()) < model.getCpu().getTopology().getSockets()); assertEquals(model.getCpu().getTopology().getSockets(), transform.getCpu().getTopology().getSockets()); assertNotNull(transform.isSetOs()); assertEquals(model.getBios().getBootMenu().isEnabled(), transform.getBios().getBootMenu().isEnabled());