com.vmware.vim25.CustomizationDhcpIpGenerator Java Examples

The following examples show how to use com.vmware.vim25.CustomizationDhcpIpGenerator. 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: VmwareCustomizeProcess.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
protected List<CustomizationAdapterMapping> createCustomizationAdapterMappings(
        VmwareProcessClient vmwareProcessClient, VirtualMachine machine) {

    List<CustomizationAdapterMapping> nicSettingMap = new ArrayList<CustomizationAdapterMapping>();

    // VirtualEthernetCardを取得
    VirtualMachineConfigInfo configInfo = machine.getConfig();
    for (VirtualDevice device : configInfo.getHardware().getDevice()) {
        if (device instanceof VirtualEthernetCard) {
            VirtualEthernetCard virtualEthernetCard = VirtualEthernetCard.class.cast(device);
            CustomizationAdapterMapping mapping = new CustomizationAdapterMapping();
            CustomizationIPSettings settings = new CustomizationIPSettings();

            // すべてのNICをDHCPにする
            CustomizationDhcpIpGenerator dhcpIp = new CustomizationDhcpIpGenerator();
            settings.setIp(dhcpIp);

            mapping.setMacAddress(virtualEthernetCard.getMacAddress());
            mapping.setAdapter(settings);
            nicSettingMap.add(mapping);
        }
    }

    return nicSettingMap;
}