private static void populateModelWithIpv4Details(VmInitNetwork entity, NicConfiguration model) { if (entity.getBootProtocol() != null) { model.setBootProtocol(Ipv4BootProtocolMapper.map(entity.getBootProtocol())); } model.setIp(createIpModel(new VmInitNetworkIpv4InfoFetcher(entity))); }
@Override public NicConfiguration adapt(V3GuestNicConfiguration from) { NicConfiguration to = new NicConfiguration(); if (from.isSetBootProtocol()) { to.setBootProtocol(BootProtocol.fromValue(from.getBootProtocol())); } if (from.isSetIp()) { to.setIp(adaptIn(from.getIp())); } if (from.isSetName()) { to.setName(from.getName()); } if (from.isSetOnBoot()) { to.setOnBoot(from.isOnBoot()); } return to; } }
@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; }
guestNic.setBootProtocol(BootProtocol.STATIC);