private void setRestartRequired(final NetworkVO network, final boolean restartRequired) { s_logger.debug("Marking network " + network + " with restartRequired=" + restartRequired); network.setRestartRequired(restartRequired); _networksDao.update(network.getId(), network); }
/** * Swaps the UUID's of the given networks * @param oldNetwork * @param newNetwork */ private void swapUuids(NetworkVO oldNetwork, NetworkVO newNetwork) { String realUuid = oldNetwork.getUuid(); String dummyUuid = newNetwork.getUuid(); oldNetwork.setUuid(dummyUuid.replace("-","+")); newNetwork.setUuid(realUuid); _networksDao.update(oldNetwork.getId(), oldNetwork); _networksDao.update(newNetwork.getId(), newNetwork); oldNetwork.setUuid(dummyUuid); _networksDao.update(oldNetwork.getId(), oldNetwork); }
@Override public boolean isReady(PhysicalNetworkServiceProvider provider) { Map<String, String> serviceMap = ((ConfigurationServerImpl)_configServer).getServicesAndProvidersForNetwork( _manager.getRouterOffering().getId()); List<TrafficType> types = new ArrayList<TrafficType>(); types.add(TrafficType.Control); types.add(TrafficType.Management); types.add(TrafficType.Storage); List<NetworkVO> systemNets = _manager.findSystemNetworks(types); if (systemNets != null && !systemNets.isEmpty()) { for (NetworkVO net: systemNets) { s_logger.debug("update system network service: " + net.getName() + "; service provider: " + serviceMap); _networksDao.update(net.getId(), net, serviceMap); } } else { s_logger.debug("no system networks created yet"); } serviceMap = ((ConfigurationServerImpl)_configServer).getServicesAndProvidersForNetwork( _manager.getPublicRouterOffering().getId()); types = new ArrayList<TrafficType>(); types.add(TrafficType.Public); systemNets = _manager.findSystemNetworks(types); if (systemNets != null && !systemNets.isEmpty()) { for (NetworkVO net: systemNets) { s_logger.debug("update system network service: " + net.getName() + "; service provider: " + serviceMap); _networksDao.update(net.getId(), net, serviceMap); } } else { s_logger.debug("no system networks created yet"); } return true; }
@Override public void updateBroadcastUri(Network network) throws InsufficientVirtualNetworkCapacityException { NetworkVO updatedNetwork = _networkDao.createForUpdate(network.getId()); URI broadcastUri = calculateBroadcastUri(network); if (!broadcastUri.equals(network.getBroadcastUri())) { updatedNetwork.setBroadcastUri(broadcastUri); _networkDao.update(network.getId(), updatedNetwork); } }
@Override public void doInTransactionWithoutResult(TransactionStatus status) { network.setNetworkOfferingId(networkOfferingId); _networksDao.update(networkId, network, newSvcProviders); // get all nics using this network // log remove usage events for old offering // log assign usage events for new offering List<NicVO> nics = _nicDao.listByNetworkId(networkId); for (NicVO nic : nics) { long vmId = nic.getInstanceId(); VMInstanceVO vm = _vmDao.findById(vmId); if (vm == null) { s_logger.error("Vm for nic " + nic.getId() + " not found with Vm Id:" + vmId); continue; } long isDefault = (nic.isDefaultNic()) ? 1 : 0; String nicIdString = Long.toString(nic.getId()); UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), nicIdString, oldNetworkOfferingId, null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay()); UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), nicIdString, networkOfferingId, null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay()); } } });
if (!_networksDao.update(network.getId(), network)) { throw new CloudRuntimeException("Failed to update network into a redundant one, please try again");
network.setMode(result.getMode()); network.setPhysicalNetworkId(result.getPhysicalNetworkId()); _networksDao.update(networkId, network); _networksDao.update(network.getId(), network); implemented.set(guru, network); return implemented; if (isSharedNetworkWithServices(network)) { network.setState(Network.State.Shutdown); _networksDao.update(networkId, network); } else { stateTransitTo(network, Event.OperationFailed);
@DB @Override public Network createVpcGuestNetwork(final long ntwkOffId, final String name, final String displayText, final String gateway, final String cidr, final String vlanId, String networkDomain, final Account owner, final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType, final Boolean subdomainAccess, final long vpcId, final Long aclId, final Account caller, final Boolean isDisplayNetworkEnabled, String externalId) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { final Vpc vpc = getActiveVpc(vpcId); if (vpc == null) { final InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find Enabled VPC "); ex.addProxyObject(String.valueOf(vpcId), "VPC"); throw ex; } _accountMgr.checkAccess(caller, null, false, vpc); if (networkDomain == null) { networkDomain = vpc.getNetworkDomain(); } if (!vpc.isRegionLevelVpc() && vpc.getZoneId() != zoneId) { throw new InvalidParameterValueException("New network doesn't belong to vpc zone"); } // 1) Validate if network can be created for VPC validateNtwkOffForNtwkInVpc(null, ntwkOffId, cidr, networkDomain, vpc, gateway, owner, aclId); // 2) Create network final Network guestNetwork = _ntwkMgr.createGuestNetwork(ntwkOffId, name, displayText, gateway, cidr, vlanId, false, networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, null, null, isDisplayNetworkEnabled, null, externalId); if (guestNetwork != null) { guestNetwork.setNetworkACLId(aclId); _ntwkDao.update(guestNetwork.getId(), (NetworkVO) guestNetwork); } return guestNetwork; }
if (_networkDao.update(network.getId(), network)) { s_logger.debug("Updated network: " + network.getId() + " with Network ACL Id: " + acl.getId() + ", Applying ACL items");
String broadcastUriStr = networkToUpdate.getUuid() + "/" + vspNetwork.getVirtualRouterIp(); networkToUpdate.setBroadcastUri(Networks.BroadcastDomainType.Vsp.toUri(broadcastUriStr)); _networkDao.update(network.getId(), networkToUpdate); if (network instanceof NetworkVO) { ((NetworkVO) network).setBroadcastUri(networkToUpdate.getBroadcastUri());
_networkDao.update(networkId, forUpdate);
_networksDao.update(networkId, network); s_logger.info("IP Reservation has been applied. The new CIDR for Guests Vms is " + guestVmCidr); } else { network.setNetworkOfferingId(networkOfferingId); _networksDao.update(networkId, network, _networkMgr.finalizeServicesAndProvidersForNetwork(_entityMgr.findById(NetworkOffering.class, networkOfferingId), network.getPhysicalNetworkId())); _networksDao.update(networkId, network);
network.setVpcId(vpcId); _networksDao.update(network.getId(), network, _networkMgr.finalizeServicesAndProvidersForNetwork(_entityMgr.findById(NetworkOffering.class, networkOfferingId), newPhysicalNetworkId)); return network;