Java Code Examples for com.vmware.vim25.VirtualEthernetCard#setBacking()

The following examples show how to use com.vmware.vim25.VirtualEthernetCard#setBacking() . 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: VmwareNetworkProcess.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
protected VirtualEthernetCard editEthernetCards(VirtualMachine machine, String networkName) {
    // ネットワークアダプタ E1000を使用する
    VirtualEthernetCard ethernetCard = new VirtualE1000();

    // 分散ポートグループ情報取得
    DistributedVirtualPortgroupInfo dvPortgroupInfo = getDVPortgroupInfo(machine, networkName);

    if (dvPortgroupInfo != null) {
        // 分散ポートグループの場合
        VirtualEthernetCardDistributedVirtualPortBackingInfo nicBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo();
        nicBacking.setPort(new DistributedVirtualSwitchPortConnection());
        nicBacking.getPort().setPortgroupKey(dvPortgroupInfo.getPortgroupKey());
        nicBacking.getPort().setSwitchUuid(dvPortgroupInfo.getSwitchUuid());
        ethernetCard.setBacking(nicBacking);
    } else {
        // 標準ポートグループの場合
        VirtualEthernetCardNetworkBackingInfo backingInfo = new VirtualEthernetCardNetworkBackingInfo();
        backingInfo.setDeviceName(networkName);
        ethernetCard.setBacking(backingInfo);
    }

    return ethernetCard;
}
 
Example 2
Source File: VmwareHelper.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
public static VirtualDevice prepareNicOpaque(VirtualMachineMO vmMo, VirtualEthernetCardType deviceType, String portGroupName,
        String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {

    assert(vmMo.getRunningHost().hasOpaqueNSXNetwork());

    VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);

    VirtualEthernetCardOpaqueNetworkBackingInfo nicBacking = new VirtualEthernetCardOpaqueNetworkBackingInfo();
    nicBacking.setOpaqueNetworkId("br-int");
    nicBacking.setOpaqueNetworkType("nsx.network");

    nic.setBacking(nicBacking);

    nic.setAddressType("Manual");
    nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
    nic.setMacAddress(macAddress);
    nic.setKey(-contextNumber);
    return nic;
}
 
Example 3
Source File: VmwareHelper.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String portGroupName,
        String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {

    VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);

    VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
    nicBacking.setDeviceName(portGroupName);
    nicBacking.setNetwork(morNetwork);
    nic.setBacking(nicBacking);

    nic.setAddressType("Manual");
    nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
    nic.setMacAddress(macAddress);
    nic.setKey(-contextNumber);
    return nic;
}
 
Example 4
Source File: VmwareHelper.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
public static VirtualDevice prepareDvNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String dvPortGroupName,
        String dvSwitchUuid, String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {

    VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);

    final VirtualEthernetCardDistributedVirtualPortBackingInfo dvPortBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo();
    final DistributedVirtualSwitchPortConnection dvPortConnection = new DistributedVirtualSwitchPortConnection();

    dvPortConnection.setSwitchUuid(dvSwitchUuid);
    dvPortConnection.setPortgroupKey(morNetwork.getValue());
    dvPortBacking.setPort(dvPortConnection);
    nic.setBacking(dvPortBacking);

    nic.setAddressType("Manual");
    nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
    nic.setMacAddress(macAddress);
    nic.setKey(-contextNumber);
    return nic;
}
 
Example 5
Source File: VmUtils.java    From cs-actions with Apache License 2.0 5 votes vote down vote up
private VirtualEthernetCard getEth(String fileName, String addressType, Integer key) {
    VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
    nicBacking.setDeviceName(fileName);

    VirtualEthernetCard nic = new VirtualPCNet32();
    nic.setBacking(nicBacking);
    nic.setAddressType(addressType);
    nic.setKey(key);

    return nic;
}