Package com.cloud.network

Examples of com.cloud.network.Network$Service


    @Override
    public void execute() throws InsufficientCapacityException, ConcurrentOperationException{
        User callerUser = _accountService.getActiveUser(UserContext.current().getCallerUserId());
        Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId());
        Network network = _networkService.getNetwork(id);
        if (network == null) {
            throw new InvalidParameterValueException("Couldn't find network by id");
        }

        Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
                    callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork());
       

        if (result != null) {
            NetworkResponse response = _responseGenerator.createNetworkResponse(result);
View Full Code Here


            Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
            if (vpc != null) {
                return vpc.getZoneId();
            }
        } else if (networkId != null) {
            Network ntwk = _entityMgr.findById(Network.class, networkId);
            if (ntwk != null) {
                return ntwk.getDataCenterId();
            }
        }

        throw new InvalidParameterValueException("Unable to figure out zone to assign ip to");
    }
View Full Code Here

                throw new InvalidParameterValueException("Account has more than one Isolated network in the zone");
            }

            return networks.get(0).getId();
        } else {
            Network defaultGuestNetwork = _networkService.getExclusiveGuestNetwork(zoneId);
            if (defaultGuestNetwork == null) {
                throw new InvalidParameterValueException("Unable to find a default Guest network for account " +
                        getAccountName() + " in domain id=" + getDomainId());
            } else {
                return defaultGuestNetwork.getId();
            }
        }
    }
View Full Code Here

                }
            } else {
                throw new InvalidParameterValueException("Unable to find project by id");
            }
       } else if (networkId != null){
            Network network = _networkService.getNetwork(networkId);
            if (network == null) {
                throw new InvalidParameterValueException("Unable to find network by network id specified");
            }

            NetworkOffering offering = _configService.getNetworkOffering(network.getNetworkOfferingId());

            DataCenter zone = _configService.getZone(network.getDataCenterId());
            if (zone.getNetworkType() == NetworkType.Basic && offering.getElasticIp() && offering.getElasticLb()) {
                // Since the basic zone network is owned by 'Root' domain, domain access checkers will fail for the
                // accounts in non-root domains while acquiring public IP. So add an exception for the 'Basic' zone
                // shared network with EIP/ELB service.
                return caller.getAccountId();
            }

            return network.getAccountId();
        } else if (vpcId != null) {
            Vpc vpc = _vpcService.getVpc(getVpcId());
            if (vpc == null) {
                throw new InvalidParameterValueException("Can't find Enabled vpc by id specified");
            }
View Full Code Here

            return oneCidrList;
        }
    }

    public Long getVpcId() {
        Network network = _networkService.getNetwork(getNetworkId());
        if (network == null) {
            throw new InvalidParameterValueException("Invalid networkId is given");
        }

        Long vpcId = network.getVpcId();
        return vpcId;
    }
View Full Code Here

        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
    }

    @Override
    public long getDomainId() {
            Network network =_networkService.getNetwork(networkId);
            return  network.getDomainId();
        }
View Full Code Here

        return EventTypes.EVENT_FIREWALL_OPEN;
    }

    @Override
    public String getEventDescription() {
         Network network = _networkService.getNetwork(networkId);
         return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol());
    }
View Full Code Here

    }


    @Override
    public long getAccountId() {
        Network network = _networkService.getNetwork(networkId);
        return network.getAccountId();
    }
View Full Code Here

                    throw new InvalidParameterValueException("Account has more than one Isolated network in the zone");
                }

                return networks.get(0).getId();
            } else {
                Network defaultGuestNetwork = _networkService.getExclusiveGuestNetwork(zoneId);
                if (defaultGuestNetwork == null) {
                    throw new InvalidParameterValueException("Unable to find a default Guest network for account " + getAccountName() + " in domain id=" + getDomainId());
                } else {
                    return defaultGuestNetwork.getId();
                }
            }
        } else {
            IpAddress ipAddr = _networkService.getIp(publicIpId);
            if (ipAddr.getAssociatedWithNetworkId() != null) {
View Full Code Here

        s_logger.debug("Allocated a storage nic " + nic + " for " + vm);
  }

  @Override
  public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
      Network nw = _nwDao.findById(nic.getNetworkId());
    if (!_sNwMgr.isStorageIpRangeAvailable(nw.getDataCenterId())) {
      return super.release(nic, vm, reservationId);
    }
   
    _sNwMgr.releaseIpAddress(nic.getIp4Address());
    s_logger.debug("Release an storage ip " + nic.getIp4Address());
View Full Code Here

TOP

Related Classes of com.cloud.network.Network$Service

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.