Quantcast
Viewing all articles
Browse latest Browse all 60069

Cannot customize host name

Error:

A specified parameter is  not correct: spec.identity.hostName

My hostName is normal:"pigtails"

 

[Code]

protected CustomizationSpec customizeVM(ManagedObjectReference vmRef, String ipAddress, String hostName)
    throws Exception {
        CustomizationSpec customsSpec = new CustomizationSpec();
        CustomizationAdapterMapping adapterMap = new CustomizationAdapterMapping();
        CustomizationIPSettings adapter = new CustomizationIPSettings();
        CustomizationFixedIp fixedIP = new CustomizationFixedIp();
        fixedIP.setIpAddress(ipAddress);
        adapter.setIp(new CustomizationIpGenerator());

 

        adapterMap.setAdapter(adapter);
        adapter.setIp(fixedIP);
        adapter.setSubnetMask("255.255.255.0");
        adapter.setDnsDomain("lss.emc.com");
        customsSpec
                .setNicSettingMap(new CustomizationAdapterMapping[] { adapterMap });
        customsSpec.setOptions(new CustomizationOptions());

 

        customsSpec.setGlobalIPSettings(new CustomizationGlobalIPSettings());

 

        //set hostname
        CustomizationLinuxPrep identity = new CustomizationLinuxPrep();
        CustomizationFixedName fixedHostName = new CustomizationFixedName();
        fixedHostName.setName(hostName);
        identity.setDomain("lss.emc.com");
        identity.setHostName(fixedHostName);
        System.out.println("fixedHostName.setName(hostName):"
                + fixedHostName.getName());

 

        customsSpec.setIdentity(identity);

 

        return customsSpec;
}


Viewing all articles
Browse latest Browse all 60069

Trending Articles