com.vmware.vim25.CustomizationGuiUnattended Java Examples

The following examples show how to use com.vmware.vim25.CustomizationGuiUnattended. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuestConfigSpecs.java    From cs-actions with Apache License 2.0 6 votes vote down vote up
private CustomizationSysprep getPopulatedCustomizationSysprep(GuestInputs guestInputs) {
    CustomizationSysprep customizationSysprep = new CustomizationSysprep();

    CustomizationGuiUnattended guiUnattended = getGuiUnattended(guestInputs);
    customizationSysprep.setGuiUnattended(guiUnattended);

    CustomizationIdentification identification = getCustomizationIdentification(guestInputs);
    customizationSysprep.setIdentification(identification);

    if (StringUtils.isNotBlank(guestInputs.getLicenseDataMode())) {
        CustomizationLicenseFilePrintData licenseFilePrintData = getCustomizationLicenseFilePrintData(guestInputs);
        customizationSysprep.setLicenseFilePrintData(licenseFilePrintData);
    }

    return customizationSysprep;
}
 
Example #2
Source File: GuestConfigSpecs.java    From cs-actions with Apache License 2.0 5 votes vote down vote up
private CustomizationGuiUnattended getGuiUnattended(GuestInputs guestInputs) {
    CustomizationGuiUnattended guiUnattended = new CustomizationGuiUnattended();
    guiUnattended.setAutoLogon(guestInputs.isAutoLogon());
    guiUnattended.setAutoLogonCount(guestInputs.getAutoLogonCount());
    guiUnattended.setTimeZone(guestInputs.getTimeZone());

    CustomizationPassword password = getCustomizationPassword(guestInputs.getComputerPassword());
    guiUnattended.setPassword(password);

    return guiUnattended;
}
 
Example #3
Source File: VmwareCustomizeProcess.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
protected void customizeWindows(VmwareProcessClient vmwareProcessClient, VmwareInstance vmwareInstance,
        VirtualMachine machine) {
    CustomizationSpec customSpec = new CustomizationSpec();

    // Windows設定
    CustomizationSysprep identity = new CustomizationSysprep();

    CustomizationGuiUnattended guiUnattended = new CustomizationGuiUnattended();
    guiUnattended.setAutoLogon(false);
    guiUnattended.setAutoLogonCount(1);
    guiUnattended.setTimeZone(235);
    CustomizationPassword password = new CustomizationPassword();
    password.setPlainText(true);

    // Adminパスワードのデフォルトはユーザのパスワードをセットする
    Instance instance = instanceDao.read(vmwareInstance.getInstanceNo());
    Farm farm = farmDao.read(instance.getFarmNo());
    User user = userDao.read(farm.getUserNo());
    PccSystemInfo pccSystemInfo = pccSystemInfoDao.read();
    if (pccSystemInfo == null) {
        // PCC_SYSTEM_INFOのレコードが存在しない場合
        log.error(MessageUtils.getMessage("EPROCESS-000532"));
        throw new AutoException("EPROCESS-000532");
    }
    PasswordEncryptor encryptor = new PasswordEncryptor();
    String decryptPassword = encryptor.decrypt(user.getPassword(), pccSystemInfo.getSecretKey());
    password.setValue(decryptPassword);
    guiUnattended.setPassword(password);
    identity.setGuiUnattended(guiUnattended);

    CustomizationUserData userData = new CustomizationUserData();
    userData.setProductId("");
    userData.setFullName(windowsFullName);
    userData.setOrgName(windowsOrgName);
    CustomizationFixedName computerName = new CustomizationFixedName();
    computerName.setName(instance.getInstanceName());
    userData.setComputerName(computerName);
    identity.setUserData(userData);

    CustomizationIdentification identification = new CustomizationIdentification();
    identification.setJoinWorkgroup(windowsWorkgroup);
    identity.setIdentification(identification);

    // Windows Server 2000, 2003のみ必要
    CustomizationLicenseFilePrintData printData = new CustomizationLicenseFilePrintData();
    printData.setAutoMode(CustomizationLicenseDataMode.perSeat);
    identity.setLicenseFilePrintData(printData);

    customSpec.setIdentity(identity);

    // Windowsオプション設定
    CustomizationWinOptions options = new CustomizationWinOptions();
    options.setChangeSID(true);
    options.setReboot(CustomizationSysprepRebootOption.shutdown);
    customSpec.setOptions(options);

    // グローバル設定
    CustomizationGlobalIPSettings globalIpSettings = new CustomizationGlobalIPSettings();

    // DNSサーバ設定
    List<String> dnsServerList = new ArrayList<String>();
    // Primary DNSサーバ
    dnsServerList.add(Config.getProperty("dns.server"));
    // Secondry DNSサーバ
    String dns2 = Config.getProperty("dns.server2");
    if (dns2 != null && dns2.length() > 0) {
        dnsServerList.add(Config.getProperty("dns.server2"));
    }

    globalIpSettings.setDnsServerList(dnsServerList.toArray(new String[dnsServerList.size()]));
    List<String> dnsSuffixList = new ArrayList<String>();
    dnsSuffixList.add(farm.getDomainName());
    globalIpSettings.setDnsSuffixList(dnsSuffixList.toArray(new String[dnsSuffixList.size()]));
    customSpec.setGlobalIPSettings(globalIpSettings);

    // NIC設定
    List<CustomizationAdapterMapping> nicSettingMap = createCustomizationAdapterMappings(vmwareProcessClient,
            machine);
    customSpec.setNicSettingMap(nicSettingMap.toArray(new CustomizationAdapterMapping[nicSettingMap.size()]));

    vmwareProcessClient.customize(vmwareInstance.getMachineName(), customSpec);

}