Java 类com.vmware.vim25.VirtualE1000 实例源码

项目:primecloud-controller    文件:VmwareNetworkProcess.java   
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;
}
项目:photon-model    文件:InstanceClient.java   
private VirtualEthernetCard createNic(NetworkInterfaceStateWithDetails nicWithDetails,
        Integer controllerKey)
        throws FinderException, InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    VirtualEthernetCard nic = new VirtualE1000();
    nic.setAddressType(VirtualEthernetCardMacType.GENERATED.value());
    nic.setKey(-1);
    nic.setControllerKey(controllerKey);

    // Currently the network backing information is stored in both places subnet and network
    // If it were to exist at one state object, then it would reduce complexity further.
    // Question: Is it acceptable for querying subnet first and network later? Or the order
    // should be reversed?

    QueryConfigTargetRequest queryConfigTargetRequest = new
            QueryConfigTargetRequest(this.get, getVimPort(), this.ctx.computeMoRef);

    VirtualDeviceBackingInfo deviceBackingInfo = NetworkDeviceBackingFactory
            .getNetworkDeviceBackingInfo(nicWithDetails.subnet, queryConfigTargetRequest);

    if (deviceBackingInfo == null) {
        deviceBackingInfo = NetworkDeviceBackingFactory
                .getNetworkDeviceBackingInfo(nicWithDetails.network, queryConfigTargetRequest);
    }

    nic.setBacking(deviceBackingInfo);

    return nic;
}