当前位置: 首页>>代码示例>>Java>>正文


Java DistributedVirtualSwitchPortConnection.setPortgroupKey方法代码示例

本文整理汇总了Java中com.vmware.vim25.DistributedVirtualSwitchPortConnection.setPortgroupKey方法的典型用法代码示例。如果您正苦于以下问题:Java DistributedVirtualSwitchPortConnection.setPortgroupKey方法的具体用法?Java DistributedVirtualSwitchPortConnection.setPortgroupKey怎么用?Java DistributedVirtualSwitchPortConnection.setPortgroupKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vmware.vim25.DistributedVirtualSwitchPortConnection的用法示例。


在下文中一共展示了DistributedVirtualSwitchPortConnection.setPortgroupKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareDvNicDevice

import com.vmware.vim25.DistributedVirtualSwitchPortConnection; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VmwareHelper.java

示例2: getDvPortBackingInfo

import com.vmware.vim25.DistributedVirtualSwitchPortConnection; //导入方法依赖的package包/类
public VirtualEthernetCardDistributedVirtualPortBackingInfo getDvPortBackingInfo(Pair<ManagedObjectReference, String> networkInfo) throws Exception {
    assert (networkInfo != null);
    assert (networkInfo.first() != null && networkInfo.first().getType().equalsIgnoreCase("DistributedVirtualPortgroup"));
    final VirtualEthernetCardDistributedVirtualPortBackingInfo dvPortBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo();
    final DistributedVirtualSwitchPortConnection dvPortConnection = new DistributedVirtualSwitchPortConnection();
    ManagedObjectReference dvsMor = getDvSwitchMor(networkInfo.first());
    String dvSwitchUuid = getDvSwitchUuid(dvsMor);
    dvPortConnection.setSwitchUuid(dvSwitchUuid);
    dvPortConnection.setPortgroupKey(networkInfo.first().getValue());
    dvPortBacking.setPort(dvPortConnection);
    System.out.println("Plugging NIC device into network " + networkInfo.second() + " backed by dvSwitch: " + dvSwitchUuid);
    return dvPortBacking;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:14,代码来源:DatacenterMO.java

示例3: updateDvNicDevice

import com.vmware.vim25.DistributedVirtualSwitchPortConnection; //导入方法依赖的package包/类
public static void updateDvNicDevice(VirtualDevice nic, ManagedObjectReference morNetwork, String dvSwitchUuid) throws Exception {
    final VirtualEthernetCardDistributedVirtualPortBackingInfo dvPortBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo();
    final DistributedVirtualSwitchPortConnection dvPortConnection = new DistributedVirtualSwitchPortConnection();

    dvPortConnection.setSwitchUuid(dvSwitchUuid);
    dvPortConnection.setPortgroupKey(morNetwork.getValue());
    dvPortBacking.setPort(dvPortConnection);
    nic.setBacking(dvPortBacking);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:10,代码来源:VmwareHelper.java

示例4: getDistributedPortBackingInfo

import com.vmware.vim25.DistributedVirtualSwitchPortConnection; //导入方法依赖的package包/类
/**
 * Backing info for distributed virtual switch port or portgroup
 */
private static VirtualEthernetCardDistributedVirtualPortBackingInfo getDistributedPortBackingInfo(
        CustomProperties props, QueryConfigTargetRequest queryConfigTargetRequest) {

    DistributedVirtualSwitchPortConnection port = new DistributedVirtualSwitchPortConnection();

    String portGroupKey = props.getString(DvsProperties.PORT_GROUP_KEY);
    String dvsUuid = props.getString(DvsProperties.DVS_UUID);

    if (StringUtil.isNullOrEmpty(dvsUuid)) {
        // NSX-V sets the value to a list of dvPortGroupsKeys as the logical switch is
        // created in a transport zone which could be associated with multiple clusters.
        // Hence dvPortGroup is created per cluster. The configTarget will filter based on
        // the cluster where machine is being provisioned.
        Type listType = new TypeToken<ArrayList<String>>(){}.getType();
        final List<String> portGroupIds = Utils.fromJson(portGroupKey, listType);

        // NSX-V doesn't have UUID information in its API response
        DistributedVirtualPortgroupInfo info = null;

        try {
            ConfigTarget configTarget = queryConfigTargetRequest.getConfigTarget();
            info = configTarget.getDistributedVirtualPortgroup()
                    .stream()
                    .filter(d -> {
                        return portGroupIds.contains(d.getPortgroupKey());
                    })
                    .findFirst()
                    .orElse(null);
        } catch (Exception e) {
            logger.error("getDistributedPortBackingInfo::Failed to get dvportgroup info.", e);
        }

        if (info == null) {
            throw new IllegalArgumentException("getDistributedPortBackingInfo::The port group "
                   + "information is not found for key: " + portGroupKey);
        }

        portGroupKey = info.getPortgroupKey();
        dvsUuid = info.getSwitchUuid();
    }

    port.setPortgroupKey(portGroupKey);
    port.setSwitchUuid(dvsUuid);

    VirtualEthernetCardDistributedVirtualPortBackingInfo backing =
            new VirtualEthernetCardDistributedVirtualPortBackingInfo();
    backing.setPort(port);

    return backing;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:54,代码来源:NetworkDeviceBackingFactory.java


注:本文中的com.vmware.vim25.DistributedVirtualSwitchPortConnection.setPortgroupKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。