當前位置: 首頁>>代碼示例>>Java>>正文


Java NicVO.getIsolationUri方法代碼示例

本文整理匯總了Java中com.cloud.vm.NicVO.getIsolationUri方法的典型用法代碼示例。如果您正苦於以下問題:Java NicVO.getIsolationUri方法的具體用法?Java NicVO.getIsolationUri怎麽用?Java NicVO.getIsolationUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.cloud.vm.NicVO的用法示例。


在下文中一共展示了NicVO.getIsolationUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNicProfile

import com.cloud.vm.NicVO; //導入方法依賴的package包/類
@Override
public NicProfile getNicProfile(final VirtualMachine vm, final long networkId, final String broadcastUri) {
    final NicVO nic;
    if (broadcastUri != null) {
        nic = _nicDao.findByNetworkIdInstanceIdAndBroadcastUri(networkId, vm.getId(), broadcastUri);
    } else {
        nic = _nicDao.findByNtwkIdAndInstanceId(networkId, vm.getId());
    }
    if (nic == null) {
        return null;
    }
    final NetworkVO network = _networksDao.findById(networkId);
    final Integer networkRate = getNetworkRate(network.getId(), vm.getId());

    //        NetworkGuru guru = _networkGurus.get(network.getGuruName());
    final NicProfile profile =
            new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate, isSecurityGroupSupportedInNetwork(network), getNetworkTag(
                    vm.getHypervisorType(), network));
    //        guru.updateNicProfile(profile, network);
    return profile;
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:22,代碼來源:NetworkModelImpl.java

示例2: prepareNicForMigration

import com.cloud.vm.NicVO; //導入方法依賴的package包/類
@Override
public void prepareNicForMigration(final VirtualMachineProfile vm, final DeployDestination dest) {
    if (vm.getType().equals(VirtualMachine.Type.DomainRouter) && vm.getHypervisorType().equals(HypervisorType.KVM)) {
        //Include nics hot plugged and not stored in DB
        prepareAllNicsForMigration(vm, dest);
        return;
    }
    final List<NicVO> nics = _nicDao.listByVmId(vm.getId());
    final ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null);
    for (final NicVO nic : nics) {
        final NetworkVO network = _networksDao.findById(nic.getNetworkId());
        final Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());

        final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
        final NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork
                (network),
                _networkModel.getNetworkTag(vm.getHypervisorType(), network));
        if (guru instanceof NetworkMigrationResponder) {
            if (!((NetworkMigrationResponder) guru).prepareMigration(profile, network, vm, dest, context)) {
                s_logger.error("NetworkGuru " + guru + " prepareForMigration failed."); // XXX: Transaction error
            }
        }
        final List<Provider> providersToImplement = getNetworkProviders(network.getId());
        for (final NetworkElement element : networkElements) {
            if (providersToImplement.contains(element.getProvider())) {
                if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                    throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: "
                            + network.getPhysicalNetworkId());
                }
                if (element instanceof NetworkMigrationResponder) {
                    if (!((NetworkMigrationResponder) element).prepareMigration(profile, network, vm, dest, context)) {
                        s_logger.error("NetworkElement " + element + " prepareForMigration failed."); // XXX: Transaction error
                    }
                }
            }
        }
        guru.updateNicProfile(profile, network);
        vm.addNic(profile);
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:41,代碼來源:NetworkOrchestrator.java

示例3: allocateNic

import com.cloud.vm.NicVO; //導入方法依賴的package包/類
@DB
@Override
public Pair<NicProfile, Integer> allocateNic(final NicProfile requested, final Network network, final Boolean isDefaultNic, int deviceId, final VirtualMachineProfile vm)
        throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException {

    final NetworkVO ntwkVO = _networksDao.findById(network.getId());
    s_logger.debug("Allocating nic for vm " + vm.getVirtualMachine() + " in network " + network + " with requested profile " + requested);
    final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, ntwkVO.getGuruName());

    if (requested != null && requested.getMode() == null) {
        requested.setMode(network.getMode());
    }
    final NicProfile profile = guru.allocate(network, requested, vm);
    if (profile == null) {
        return null;
    }

    if (isDefaultNic != null) {
        profile.setDefaultNic(isDefaultNic);
    }

    if (requested != null && requested.getMode() == null) {
        profile.setMode(requested.getMode());
    } else {
        profile.setMode(network.getMode());
    }

    NicVO vo = new NicVO(guru.getName(), vm.getId(), network.getId(), vm.getType());

    deviceId = applyProfileToNic(vo, profile, deviceId);

    vo = _nicDao.persist(vo);

    final Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());
    final NicProfile vmNic = new NicProfile(vo, network, vo.getBroadcastUri(), vo.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network),
            _networkModel.getNetworkTag(vm.getHypervisorType(), network));

    return new Pair<>(vmNic, Integer.valueOf(deviceId));
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:40,代碼來源:NetworkOrchestrator.java


注:本文中的com.cloud.vm.NicVO.getIsolationUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。