@Override public String getEventDescription() { StringBuilder eventMsg = new StringBuilder("Updating network: " + getId()); if (getNetworkOfferingId() != null) { Network network = _networkService.getNetwork(getId()); if (network == null) { throw new InvalidParameterValueException("Networkd ID=" + id + " doesn't exist"); } if (network.getNetworkOfferingId() != getNetworkOfferingId()) { NetworkOffering oldOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); NetworkOffering newOff = _entityMgr.findById(NetworkOffering.class, getNetworkOfferingId()); if (newOff == null) { throw new InvalidParameterValueException("Networkd offering ID supplied is invalid"); } eventMsg.append(". Original network offering ID: " + oldOff.getUuid() + ", new network offering ID: " + newOff.getUuid()); } } return eventMsg.toString(); }
@Override public String getEventDescription() { StringBuilder eventMsg = new StringBuilder("Migrating network: " + getId()); if (getNetworkOfferingId() != null) { Network network = _networkService.getNetwork(getId()); if (network == null) { throw new InvalidParameterValueException("Network id=" + id + " doesn't exist"); } if (network.getNetworkOfferingId() != getNetworkOfferingId()) { NetworkOffering oldOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); NetworkOffering newOff = _entityMgr.findById(NetworkOffering.class, getNetworkOfferingId()); if (newOff == null) { throw new InvalidParameterValueException("Network offering id supplied is invalid"); } eventMsg.append(". Original network offering id: " + oldOff.getUuid() + ", new network offering id: " + newOff.getUuid()); } } return eventMsg.toString(); }
protected boolean canUpgrade(Network network, long oldNetworkOfferingId, long newNetworkOfferingId) { NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId); NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId); // security group service should be the same if (areServicesSupportedByNetworkOffering(oldNetworkOfferingId, Service.SecurityGroup) != areServicesSupportedByNetworkOffering(newNetworkOfferingId, Service.SecurityGroup)) { s_logger.debug("Offerings " + newNetworkOfferingId + " and " + oldNetworkOfferingId + " have different securityGroupProperty, can't upgrade"); return false; } // tags should be the same if (newNetworkOffering.getTags() != null) { if (oldNetworkOffering.getTags() == null) { s_logger.debug("New network offering id=" + newNetworkOfferingId + " has tags and old network offering id=" + oldNetworkOfferingId + " doesn't, can't upgrade"); return false; } if (!StringUtils.areTagsEqual(oldNetworkOffering.getTags(), newNetworkOffering.getTags())) { s_logger.debug("Network offerings " + newNetworkOffering.getUuid() + " and " + oldNetworkOffering.getUuid() + " have different tags, can't upgrade"); return false; } } // specify vlan should be the same if (oldNetworkOffering.isSpecifyVlan() != newNetworkOffering.isSpecifyVlan()) { s_logger.debug("Network offerings " + newNetworkOfferingId + " and " + oldNetworkOfferingId + " have different values for specifyVlan, can't upgrade"); return false; } return canMoveToPhysicalNetwork(network, oldNetworkOfferingId, newNetworkOfferingId); }
final InvalidParameterValueException ex = new InvalidParameterValueException( "Found existing network configuration (with specified id) for offering (with specified id)"); ex.addProxyObject(offering.getUuid(), "offeringId"); ex.addProxyObject(configs.get(0).getUuid(), "networkConfigId"); throw ex; ex.addProxyObject(offering.getUuid(), "offeringId"); throw ex;
@Override public NetworkOfferingResponse createNetworkOfferingResponse(NetworkOffering offering) { NetworkOfferingResponse response = new NetworkOfferingResponse(); response.setId(offering.getUuid()); response.setName(offering.getName()); response.setDisplayText(offering.getDisplayText());
throw new InvalidParameterValueException("Failed to resume migrating network as network offering does not match previously specified network offering (" + newNtwkOff.getUuid() + ")");
throw new InvalidParameterValueException("Can't upgrade from network offering " + oldNtwkOff.getUuid() + " to " + networkOffering.getUuid() + "; check logs for more information");
response.setNetworkOfferingId(networkOffering.getUuid()); response.setNetworkOfferingName(networkOffering.getName()); response.setNetworkOfferingDisplayText(networkOffering.getDisplayText());
@Override public String getEventDescription() { final StringBuilder eventMsg = new StringBuilder("Updating network: " + getId()); if (getNetworkOfferingId() != null) { final Network network = _networkService.getNetwork(getId()); if (network == null) { throw new InvalidParameterValueException("Networkd ID=" + id + " doesn't exist"); } if (network.getNetworkOfferingId() != getNetworkOfferingId()) { final NetworkOffering oldOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); final NetworkOffering newOff = _entityMgr.findById(NetworkOffering.class, getNetworkOfferingId()); if (newOff == null) { throw new InvalidParameterValueException("Networkd offering ID supplied is invalid"); } eventMsg.append(". Original network offering ID: " + oldOff.getUuid() + ", new network offering ID: " + newOff.getUuid()); } } return eventMsg.toString(); }