public void customizeDns(List<String> dnsServers, List<String> dnsSearchDomains, CustomizationSpec template) { CustomizationGlobalIPSettings settings = new CustomizationGlobalIPSettings(); if (dnsServers != null) { settings.getDnsServerList().addAll(dnsServers); } if (dnsSearchDomains != null) { settings.getDnsSuffixList().addAll(dnsSearchDomains); } template.setGlobalIPSettings(settings); }
private VirtualMachineCloneSpec configureVirtualMachineCloneSpec(VirtualMachineRelocateSpec rSpec, String linuxName, boolean postConfiguration) throws Exception { VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec(); cloneSpec.setPowerOn(true); cloneSpec.setTemplate(false); //cloneSpec.setSnapshot(currentSnapshot.getMOR()); cloneSpec.setLocation(rSpec); if (postConfiguration) { CustomizationSpec customizationSpec = new CustomizationSpec(); CustomizationLinuxPrep linuxPrep = new CustomizationLinuxPrep(); CustomizationFixedName fixedName = new CustomizationFixedName(); fixedName.setName(linuxName); linuxPrep.setHostName(fixedName); linuxPrep.setDomain(""); linuxPrep.setHwClockUTC(true); //linuxPrep.setTimeZone("Etc/UTC"); customizationSpec.setIdentity(linuxPrep); customizationSpec.setGlobalIPSettings(new CustomizationGlobalIPSettings()); CustomizationAdapterMapping[] nicSettingMap = new CustomizationAdapterMapping[1]; nicSettingMap[0] = new CustomizationAdapterMapping(); nicSettingMap[0].adapter = new CustomizationIPSettings(); nicSettingMap[0].adapter.setIp(new CustomizationDhcpIpGenerator()); customizationSpec.setNicSettingMap(nicSettingMap); cloneSpec.setCustomization(customizationSpec); } return cloneSpec; }
public CustomizationSpec getWinCustomizationSpec(GuestInputs guestInputs) { CustomizationSpec customizationSpec = new CustomizationSpec(); CustomizationSysprep customizationSysprep = getCustomizationSysprep(guestInputs); customizationSpec.setIdentity(customizationSysprep); CustomizationWinOptions winOptions = getCustomizationWinOptions(guestInputs); customizationSpec.setOptions(winOptions); customizationSpec.setGlobalIPSettings(new CustomizationGlobalIPSettings()); setAdapter(guestInputs, customizationSpec); return customizationSpec; }
public CustomizationSpec getLinuxCustomizationSpec(GuestInputs guestInputs) { CustomizationSpec customizationSpec = new CustomizationSpec(); CustomizationLinuxPrep customizationLinuxPrep = getCustomizationLinuxPrep(guestInputs); customizationSpec.setIdentity(customizationLinuxPrep); CustomizationGlobalIPSettings customizationGlobalIPSettings = new CustomizationGlobalIPSettings(); customizationSpec.setGlobalIPSettings(customizationGlobalIPSettings); setAdapter(guestInputs, customizationSpec); return customizationSpec; }