http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/configuration/ConfigurationManagerImpl.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/configuration/ConfigurationManagerImpl.java index b34c939,47c5482..e132ec6 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@@ -65,9 -71,8 +68,17 @@@ import org.apache.cloudstack.api.comman import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd; import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; -import org.apache.cloudstack.region.*; +import org.apache.cloudstack.config.ConfigKey; +import org.apache.cloudstack.config.ConfigRepo; +import org.apache.cloudstack.config.ConfigValue; ++import org.apache.cloudstack.region.PortableIp; ++import org.apache.cloudstack.region.PortableIpDao; ++import org.apache.cloudstack.region.PortableIpRange; ++import org.apache.cloudstack.region.PortableIpRangeDao; ++import org.apache.cloudstack.region.PortableIpRangeVO; ++import org.apache.cloudstack.region.PortableIpVO; ++import org.apache.cloudstack.region.Region; + import org.apache.cloudstack.region.dao.RegionDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; @@@ -185,10 -192,6 +196,11 @@@ import com.cloud.utils.NumbersUtil import com.cloud.utils.StringUtils; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.crypt.DBEncryptionUtil; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Filter; ++import com.cloud.utils.db.GlobalLock; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.vm.NicIpAlias; @@@ -4667,7 -4728,151 +4685,156 @@@ public class ConfigurationManagerImpl e } @Override + public <T> ConfigValue<T> get(ConfigKey<T> config) { + return new ConfigValue<T>(_configDao, config); + } ++ ++ @Override + @DB + @ActionEvent(eventType = EventTypes.EVENT_PORTABLE_IP_RANGE_CREATE, eventDescription = "creating portable ip range", async = false) + public PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException { + Integer regionId = cmd.getRegionId(); + String startIP = cmd.getStartIp(); + String endIP = cmd.getEndIp(); + String gateway = cmd.getGateway(); + String netmask = cmd.getNetmask(); + Long userId = UserContext.current().getCallerUserId(); + String vlanId = cmd.getVlan(); + + Region region = _regionDao.findById(regionId); + if (region == null) { + throw new InvalidParameterValueException("Invalid region ID: " + regionId); + } + + if (!NetUtils.isValidIp(startIP) || !NetUtils.isValidIp(endIP) || !NetUtils.validIpRange(startIP, endIP)) { + throw new InvalidParameterValueException("Invalid portable ip range: " + startIP + "-" + endIP); + } + + if (!NetUtils.sameSubnet(startIP, gateway, netmask)) { + throw new InvalidParameterValueException("Please ensure that your start IP is in the same subnet as " + + "your portable IP range's gateway and as per the IP range's netmask."); + } + + if (!NetUtils.sameSubnet(endIP, gateway, netmask)) { + throw new InvalidParameterValueException("Please ensure that your end IP is in the same subnet as " + + "your portable IP range's gateway and as per the IP range's netmask."); + } + + if (checkOverlapPortableIpRange(regionId, startIP, endIP)) { + throw new InvalidParameterValueException("Ip range: " + startIP + "-" + endIP + " overlaps with a portable" + + " IP range already configured in the region " + regionId); + } + + if (vlanId == null) { + vlanId = Vlan.UNTAGGED; + } else { + if (!NetUtils.isValidVlan(vlanId)) { + throw new InvalidParameterValueException("Invalid vlan id " + vlanId); + } + } + GlobalLock portableIpLock = GlobalLock.getInternLock("PortablePublicIpRange"); + portableIpLock.lock(5); + Transaction txn = Transaction.currentTxn(); + txn.start(); + + PortableIpRangeVO portableIpRange = new PortableIpRangeVO(regionId, vlanId, gateway, netmask, startIP, endIP); + portableIpRange = _portableIpRangeDao.persist(portableIpRange); + + long startIpLong = NetUtils.ip2Long(startIP); + long endIpLong = NetUtils.ip2Long(endIP); + while(startIpLong <= endIpLong) { + PortableIpVO portableIP = new PortableIpVO(regionId, portableIpRange.getId(), vlanId, + gateway, netmask,NetUtils.long2Ip(startIpLong)); + _portableIpDao.persist(portableIP); + startIpLong++; + } + + txn.commit(); + portableIpLock.unlock(); + return portableIpRange; + } + + @Override + @DB + @ActionEvent(eventType = EventTypes.EVENT_PORTABLE_IP_RANGE_DELETE, eventDescription = "deleting portable ip range", async = false) + public boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd) { + long rangeId = cmd.getId(); + PortableIpRangeVO portableIpRange = _portableIpRangeDao.findById(rangeId); + if (portableIpRange == null) { + throw new InvalidParameterValueException("Please specify a valid portable IP range id."); + } + + List<PortableIpVO> fullIpRange = _portableIpDao.listByRangeId(portableIpRange.getId()); + List<PortableIpVO> freeIpRange = _portableIpDao.listByRangeIdAndState(portableIpRange.getId(), PortableIp.State.Free); + + if (fullIpRange != null && freeIpRange != null) { + if (fullIpRange.size() == freeIpRange.size()) { + _portableIpRangeDao.expunge(portableIpRange.getId()); + return true; + } else { + throw new InvalidParameterValueException("Can't delete portable IP range as there are IP's assigned."); + } + } + + return false; + } + + @Override + public List<? extends PortableIpRange> listPortableIpRanges(ListPortableIpRangesCmd cmd) { + Integer regionId = cmd.getRegionIdId(); + Long rangeId = cmd.getPortableIpRangeId(); + + List <PortableIpRangeVO> ranges = new ArrayList<PortableIpRangeVO>(); + if (regionId != null) { + Region region = _regionDao.findById(regionId); + if (region == null) { + throw new InvalidParameterValueException("Invalid region ID: " + regionId); + } + return _portableIpRangeDao.listByRegionId(regionId); + } + + if (rangeId != null) { + PortableIpRangeVO range = _portableIpRangeDao.findById(rangeId); + if (range == null) { + throw new InvalidParameterValueException("Invalid portable IP range ID: " + regionId); + } + ranges.add(range); + return ranges; + } + + return _portableIpRangeDao.listAll(); + } + + @Override + public List<? extends PortableIp> listPortableIps(long id) { + + PortableIpRangeVO portableIpRange = _portableIpRangeDao.findById(id); + if (portableIpRange == null) { + throw new InvalidParameterValueException("Please specify a valid portable IP range id."); + } + + return _portableIpDao.listByRangeId(portableIpRange.getId()); + } + + private boolean checkOverlapPortableIpRange(int regionId, String newStartIpStr, String newEndIpStr) { + long newStartIp = NetUtils.ip2Long(newStartIpStr); + long newEndIp = NetUtils.ip2Long(newEndIpStr); + + List<PortableIpRangeVO> existingPortableIPRanges = _portableIpRangeDao.listByRegionId(regionId); + for (PortableIpRangeVO portableIpRange : existingPortableIPRanges) { + String ipRangeStr = portableIpRange.getIpRange(); + String[] range = ipRangeStr.split("-"); + long startip = NetUtils.ip2Long(range[0]); + long endIp = NetUtils.ip2Long(range[1]); + + if ((newStartIp >= startip && newStartIp <= endIp) || (newEndIp >= startip && newEndIp <= endIp)) { + return true; + } + + if ((startip >= newStartIp && startip <= newEndIp) || (endIp >= newStartIp && endIp <= newEndIp)) { + return true; + } + } + return false; + } }
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/network/NetworkManagerImpl.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/network/NetworkManagerImpl.java index 1cef3d6,0f43b87..eb18eaa --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@@ -16,43 -16,9 +16,47 @@@ // under the License. package com.cloud.network; +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.ControlledEntity.ACLType; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; ++import org.apache.cloudstack.region.PortableIp; ++import org.apache.cloudstack.region.PortableIpDao; ++import org.apache.cloudstack.region.PortableIpVO; ++import org.apache.cloudstack.region.Region; + import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; -import com.cloud.agent.api.*; +import com.cloud.agent.api.AgentControlAnswer; +import com.cloud.agent.api.AgentControlCommand; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.CheckNetworkAnswer; +import com.cloud.agent.api.CheckNetworkCommand; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.api.StartupRoutingCommand; import com.cloud.agent.api.to.NicTO; import com.cloud.alert.AlertManager; import com.cloud.api.ApiDBUtils; @@@ -174,13 -91,9 +178,14 @@@ import com.cloud.utils.Pair import com.cloud.utils.component.AdapterBase; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; -import com.cloud.utils.db.*; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Filter; ++import com.cloud.utils.db.GlobalLock; import com.cloud.utils.db.JoinBuilder.JoinType; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.fsm.NoTransitionException; import com.cloud.utils.fsm.StateMachine2; @@@ -827,13 -803,15 +890,15 @@@ public class NetworkManagerImpl extend } DataCenter zone = _configMgr.getZone(network.getDataCenterId()); - if (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced) { + if (zone.getNetworkType() == NetworkType.Advanced) { + if (network.getGuestType() == Network.GuestType.Shared) { - if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) { - _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network); - } else { - throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if " + - "network services Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network"); - } + if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) { + _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network); + } else { + throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if " + + "network services Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network"); + } + } } else { _accountMgr.checkAccess(caller, null, true, ipToAssoc); } @@@ -1836,23 -2000,93 +2087,93 @@@ } @Override - public void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest) { + public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) { List<NicVO> nics = _nicDao.listByVmId(vm.getId()); + ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null); for (NicVO nic : nics) { NetworkVO network = _networksDao.findById(nic.getNetworkId()); Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId()); NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName()); - NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate, + 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 + } + } + for (NetworkElement element : _networkElements) { + 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); } } - private NicProfile findNicProfileById(VirtualMachineProfile<? extends VMInstanceVO> vm, long id){ ++ private NicProfile findNicProfileById(VirtualMachineProfile vm, long id) { + for(NicProfile nic: vm.getNics()){ + if(nic.getId() == id){ + return nic; + } + } + return null; + } + + @Override + public void commitNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> src, - VirtualMachineProfile<? extends VMInstanceVO> dst) { ++ VirtualMachineProfile src, ++ VirtualMachineProfile dst) { + for(NicProfile nicSrc: src.getNics()){ + NetworkVO network = _networksDao.findById(nicSrc.getNetworkId()); + NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName()); + NicProfile nicDst = findNicProfileById(dst, nicSrc.getId()); + ReservationContext src_context = new ReservationContextImpl(nicSrc.getReservationId(), null, null); + ReservationContext dst_context = new ReservationContextImpl(nicDst.getReservationId(), null, null); + + if(guru instanceof NetworkMigrationResponder){ + ((NetworkMigrationResponder) guru).commitMigration(nicSrc, network, src, src_context, dst_context); + } + for (NetworkElement element : _networkElements) { + if(element instanceof NetworkMigrationResponder){ + ((NetworkMigrationResponder) element).commitMigration(nicSrc, network, src, src_context, dst_context); + } + } + // update the reservation id + NicVO nicVo = _nicDao.findById(nicDst.getId()); + nicVo.setReservationId(nicDst.getReservationId()); + _nicDao.persist(nicVo); + } + } + + @Override + public void rollbackNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> src, - VirtualMachineProfile<? extends VMInstanceVO> dst) { ++ VirtualMachineProfile src, ++ VirtualMachineProfile dst) { + for(NicProfile nicDst: dst.getNics()){ + NetworkVO network = _networksDao.findById(nicDst.getNetworkId()); + NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName()); + NicProfile nicSrc = findNicProfileById(src, nicDst.getId()); + ReservationContext src_context = new ReservationContextImpl(nicSrc.getReservationId(), null, null); + ReservationContext dst_context = new ReservationContextImpl(nicDst.getReservationId(), null, null); + + if(guru instanceof NetworkMigrationResponder){ + ((NetworkMigrationResponder) guru).rollbackMigration(nicDst, network, dst, src_context, dst_context); + } + for (NetworkElement element : _networkElements) { + if(element instanceof NetworkMigrationResponder){ + ((NetworkMigrationResponder) element).rollbackMigration(nicDst, network, dst, src_context, dst_context); + } + } + } + } + @Override @DB - public void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) throws + public void release(VirtualMachineProfile vmProfile, boolean forced) throws ConcurrentOperationException, ResourceUnavailableException { List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId()); for (NicVO nic : nics) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/network/element/VirtualRouterElement.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/network/element/VirtualRouterElement.java index 0d6fbbf,1916678..22eb86a --- a/server/src/com/cloud/network/element/VirtualRouterElement.java +++ b/server/src/com/cloud/network/element/VirtualRouterElement.java @@@ -49,7 -47,10 +49,9 @@@ import com.cloud.network.Network import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; + import com.cloud.network.NetworkMigrationResponder; import com.cloud.network.NetworkModel; + import com.cloud.network.Networks; -import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.PublicIpAddress; @@@ -85,20 -87,39 +87,25 @@@ import com.cloud.utils.db.SearchCriteri import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.DomainRouterVO; import com.cloud.vm.NicProfile; -import com.cloud.vm.NicVO; import com.cloud.vm.ReservationContext; + import com.cloud.vm.UserVmManager; + import com.cloud.vm.UserVmVO; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; + import com.cloud.vm.VirtualMachine.Type; import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.DomainRouterDao; import com.cloud.vm.dao.UserVmDao; -import com.google.gson.Gson; -import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd; -import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElementCmd; -import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd; -import org.apache.log4j.Logger; -import javax.ejb.Local; -import javax.inject.Inject; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -@Local(value = {NetworkElement.class, FirewallServiceProvider.class, - DhcpServiceProvider.class, UserDataServiceProvider.class, +@Local(value = {NetworkElement.class, FirewallServiceProvider.class, + DhcpServiceProvider.class, UserDataServiceProvider.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class, - PortForwardingServiceProvider.class, IpDeployer.class, RemoteAccessVPNServiceProvider.class} ) + PortForwardingServiceProvider.class, IpDeployer.class, + RemoteAccessVPNServiceProvider.class, NetworkMigrationResponder.class} ) -public class VirtualRouterElement extends AdapterBase implements VirtualRouterElementService, DhcpServiceProvider, +public class VirtualRouterElement extends AdapterBase implements VirtualRouterElementService, DhcpServiceProvider, UserDataServiceProvider, SourceNatServiceProvider, StaticNatServiceProvider, FirewallServiceProvider, - LoadBalancingServiceProvider, PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer { + LoadBalancingServiceProvider, PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, + NetworkMigrationResponder { private static final Logger s_logger = Logger.getLogger(VirtualRouterElement.class); protected static final Map<Service, Map<Capability, String>> capabilities = setCapabilities(); @@@ -993,9 -1034,8 +1002,8 @@@ // TODO Auto-generated method stub return null; } - private boolean canHandleLbRules(List<LoadBalancingRule> rules) { - Map<Capability, String> lbCaps = this.getCapabilities().get(Service.Lb); + Map<Capability, String> lbCaps = getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null) { @@@ -1008,5 -1048,60 +1016,60 @@@ } } return true; - } + } + + @Override + public boolean prepareMigration(NicProfile nic, Network network, - VirtualMachineProfile<? extends VirtualMachine> vm, ++ VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) { + if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) { + return true; + } + if (vm.getType() == Type.DomainRouter) { + assert vm instanceof DomainRouterVO; + DomainRouterVO router = (DomainRouterVO)vm.getVirtualMachine(); + _routerMgr.setupDhcpForPvlan(false, router, router.getHostId(), nic); + } else if (vm.getType() == Type.User){ + assert vm instanceof UserVmVO; + UserVmVO userVm = (UserVmVO)vm.getVirtualMachine(); + _userVmMgr.setupVmForPvlan(false, userVm.getHostId(), nic); + } + return true; + } + + @Override + public void rollbackMigration(NicProfile nic, Network network, - VirtualMachineProfile<? extends VirtualMachine> vm, ++ VirtualMachineProfile vm, + ReservationContext src, ReservationContext dst) { + if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) { + return; + } + if (vm.getType() == Type.DomainRouter) { + assert vm instanceof DomainRouterVO; + DomainRouterVO router = (DomainRouterVO)vm.getVirtualMachine(); + _routerMgr.setupDhcpForPvlan(true, router, router.getHostId(), nic); + } else if (vm.getType() == Type.User){ + assert vm instanceof UserVmVO; + UserVmVO userVm = (UserVmVO)vm.getVirtualMachine(); + _userVmMgr.setupVmForPvlan(true, userVm.getHostId(), nic); + } + } + + @Override + public void commitMigration(NicProfile nic, Network network, - VirtualMachineProfile<? extends VirtualMachine> vm, ++ VirtualMachineProfile vm, + ReservationContext src, ReservationContext dst) { + if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) { + return; + } + if (vm.getType() == Type.DomainRouter) { + assert vm instanceof DomainRouterVO; + DomainRouterVO router = (DomainRouterVO)vm.getVirtualMachine(); + _routerMgr.setupDhcpForPvlan(true, router, router.getHostId(), nic); + } else if (vm.getType() == Type.User){ + assert vm instanceof UserVmVO; + UserVmVO userVm = (UserVmVO)vm.getVirtualMachine(); + _userVmMgr.setupVmForPvlan(true, userVm.getHostId(), nic); + } + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 34d5ac5,b969be2..fd11e80 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@@ -2230,15 -2234,22 +2231,22 @@@ public class VirtualNetworkApplianceMan } Network network = _networkDao.findById(nic.getNetworkId()); String networkTag = _networkModel.getNetworkTag(router.getHypervisorType(), network); - PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadcastUri(), networkTag, router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address()); - Commands cmds = new Commands(cmd); + PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadCastUri(), networkTag, router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address()); // In fact we send command to the host of router, we're not programming router but the host + Answer answer = null; - try { + try { - sendCommandsToRouter(router, cmds); + answer = _agentMgr.send(hostId, cmd); + } catch (OperationTimedoutException e) { + s_logger.warn("Timed Out", e); + return false; - } catch (AgentUnavailableException e) { + } catch (AgentUnavailableException e) { s_logger.warn("Agent Unavailable ", e); - return false; - } + return false; + } + + if (answer == null || !answer.getResult()) { + return false; + } return true; } @@@ -2558,10 -2571,11 +2566,11 @@@ if (network.getTrafficType() == TrafficType.Guest) { guestNetworks.add(network); if (nic.getBroadcastUri().getScheme().equals("pvlan")) { - result = setupDhcpForPvlan(true, router, nic); + NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic"); + result = setupDhcpForPvlan(true, router, router.getHostId(), nicProfile); - } } } + } if (!result) { return result; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/server/ManagementServerImpl.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/server/ManagementServerImpl.java index 995a357,8323af8..e2f15b4 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@@ -43,11 -43,18 +43,19 @@@ import javax.crypto.spec.SecretKeySpec import javax.inject.Inject; import javax.naming.ConfigurationException; -import com.cloud.exception.*; -import com.cloud.vm.*; +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; + import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.acl.SecurityChecker.AccessType; + import org.apache.cloudstack.api.ApiConstants; + + import com.cloud.event.ActionEventUtils; + import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd; + import org.apache.cloudstack.api.command.admin.region.*; + import org.apache.cloudstack.api.response.ExtractResponse; + import org.apache.commons.codec.binary.Base64; + import org.apache.log4j.Logger; import org.apache.cloudstack.affinity.AffinityGroupProcessor; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.api.ApiConstants; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/storage/VolumeManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/user/AccountManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/vm/UserVmManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 5fd6b02,f487537..2501cb4 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@@ -1697,163 -1373,168 +1697,174 @@@ public class VirtualMachineManagerImpl } @Override - public <T extends VMInstanceVO> T migrate(T vm, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, - VirtualMachineMigrationException { + public VirtualMachine migrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException, + ManagementServerException, + VirtualMachineMigrationException { + VMInstanceVO vm = _vmDao.findByUuid(vmUuid); s_logger.info("Migrating " + vm + " to " + dest); + + return vm; + + /* + long dstHostId = dest.getHost().getId(); + Host fromHost = _hostDao.findById(srcHostId); + if (fromHost == null) { + s_logger.info("Unable to find the host to migrate from: " + srcHostId); + throw new CloudRuntimeException("Unable to find the host to migrate from: " + srcHostId); + } - long dstHostId = dest.getHost().getId(); - Host fromHost = _hostDao.findById(srcHostId); - if (fromHost == null) { - s_logger.info("Unable to find the host to migrate from: " + srcHostId); - throw new CloudRuntimeException("Unable to find the host to migrate from: " + srcHostId); - } - - if (fromHost.getClusterId().longValue() != dest.getCluster().getId()) { - s_logger.info("Source and destination host are not in same cluster, unable to migrate to host: " + dest.getHost().getId()); - throw new CloudRuntimeException("Source and destination host are not in same cluster, unable to migrate to host: " + dest.getHost().getId()); - } + if (fromHost.getClusterId().longValue() != dest.getCluster().getId()) { + s_logger.info("Source and destination host are not in same cluster, unable to migrate to host: " + dest.getHost().getId()); + throw new CloudRuntimeException("Source and destination host are not in same cluster, unable to migrate to host: " + dest.getHost().getId()); + } - VirtualMachineGuru<T> vmGuru = getVmGuru(vm); + VirtualMachineGuru<T> vmGuru = getVmGuru(vm); - long vmId = vm.getId(); - vm = vmGuru.findById(vmId); - if (vm == null) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Unable to find the vm " + vm); - } - throw new ManagementServerException("Unable to find a virtual machine with id " + vmId); - } + long vmId = vm.getId(); + vm = vmGuru.findById(vmId); + if (vm == null) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to find the vm " + vm); + } + throw new ManagementServerException("Unable to find a virtual machine with id " + vmId); + } - if (vm.getState() != State.Running) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("VM is not Running, unable to migrate the vm " + vm); - } - throw new VirtualMachineMigrationException("VM is not Running, unable to migrate the vm currently " + vm + " , current state: " + vm.getState().toString()); - } + if (vm.getState() != State.Running) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("VM is not Running, unable to migrate the vm " + vm); + } + throw new VirtualMachineMigrationException("VM is not Running, unable to migrate the vm currently " + vm + " , current state: " + vm.getState().toString()); + } - short alertType = AlertManager.ALERT_TYPE_USERVM_MIGRATE; - if (VirtualMachine.Type.DomainRouter.equals(vm.getType())) { - alertType = AlertManager.ALERT_TYPE_DOMAIN_ROUTER_MIGRATE; - } else if (VirtualMachine.Type.ConsoleProxy.equals(vm.getType())) { - alertType = AlertManager.ALERT_TYPE_CONSOLE_PROXY_MIGRATE; - } + short alertType = AlertManager.ALERT_TYPE_USERVM_MIGRATE; + if (VirtualMachine.Type.DomainRouter.equals(vm.getType())) { + alertType = AlertManager.ALERT_TYPE_DOMAIN_ROUTER_MIGRATE; + } else if (VirtualMachine.Type.ConsoleProxy.equals(vm.getType())) { + alertType = AlertManager.ALERT_TYPE_CONSOLE_PROXY_MIGRATE; + } + VirtualMachineProfile<VMInstanceVO> vmSrc = new VirtualMachineProfileImpl<VMInstanceVO>(vm); + for(NicProfile nic: _networkMgr.getNicProfiles(vm)){ + vmSrc.addNic(nic); + } + - VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm); - _networkMgr.prepareNicForMigration(profile, dest); - this.volumeMgr.prepareForMigration(profile, dest); + VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm); + _networkMgr.prepareNicForMigration(profile, dest); + this.volumeMgr.prepareForMigration(profile, dest); - VirtualMachineTO to = toVmTO(profile); - PrepareForMigrationCommand pfmc = new PrepareForMigrationCommand(to); + VirtualMachineTO to = toVmTO(profile); + PrepareForMigrationCommand pfmc = new PrepareForMigrationCommand(to); - ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Migrating, vm.getType(), vm.getId()); - work.setStep(Step.Prepare); - work.setResourceType(ItWorkVO.ResourceType.Host); - work.setResourceId(dstHostId); - work = _workDao.persist(work); + VmWorkJobVO work = new VmWorkJobVO(UUID.randomUUID().toString(), _nodeId, State.Migrating, vm.getType(), vm.getId()); + work.setStep(Step.Prepare); + work.setResourceType(VmWorkJobVO.ResourceType.Host); + work.setResourceId(dstHostId); + work = _workDao.persist(work); - PrepareForMigrationAnswer pfma = null; - try { - pfma = (PrepareForMigrationAnswer) _agentMgr.send(dstHostId, pfmc); - if (!pfma.getResult()) { - String msg = "Unable to prepare for migration due to " + pfma.getDetails(); - pfma = null; - throw new AgentUnavailableException(msg, dstHostId); - } - } catch (OperationTimedoutException e1) { - throw new AgentUnavailableException("Operation timed out", dstHostId); - } finally { - if (pfma == null) { + PrepareForMigrationAnswer pfma = null; + try { + pfma = (PrepareForMigrationAnswer) _agentMgr.send(dstHostId, pfmc); + if (!pfma.getResult()) { + String msg = "Unable to prepare for migration due to " + pfma.getDetails(); + pfma = null; + throw new AgentUnavailableException(msg, dstHostId); + } + } catch (OperationTimedoutException e1) { + throw new AgentUnavailableException("Operation timed out", dstHostId); + } finally { + if (pfma == null) { + _networkMgr.rollbackNicForMigration(vmSrc, profile); - work.setStep(Step.Done); - _workDao.update(work.getId(), work); - } - } + work.setStep(Step.Done); + _workDao.update(work.getId(), work); + } + } - vm.setLastHostId(srcHostId); - try { - if (vm == null || vm.getHostId() == null || vm.getHostId() != srcHostId || !changeState(vm, Event.MigrationRequested, dstHostId, work, Step.Migrating)) { + vm.setLastHostId(srcHostId); + try { + if (vm == null || vm.getHostId() == null || vm.getHostId() != srcHostId || !changeState(vm, Event.MigrationRequested, dstHostId, work, Step.Migrating)) { + _networkMgr.rollbackNicForMigration(vmSrc, profile); - s_logger.info("Migration cancelled because state has changed: " + vm); - throw new ConcurrentOperationException("Migration cancelled because state has changed: " + vm); - } - } catch (NoTransitionException e1) { + s_logger.info("Migration cancelled because state has changed: " + vm); + throw new ConcurrentOperationException("Migration cancelled because state has changed: " + vm); + } + } catch (NoTransitionException e1) { + _networkMgr.rollbackNicForMigration(vmSrc, profile); - s_logger.info("Migration cancelled because " + e1.getMessage()); - throw new ConcurrentOperationException("Migration cancelled because " + e1.getMessage()); - } + s_logger.info("Migration cancelled because " + e1.getMessage()); + throw new ConcurrentOperationException("Migration cancelled because " + e1.getMessage()); + } - boolean migrated = false; - try { - boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); - MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows); - mc.setHostGuid(dest.getHost().getGuid()); + boolean migrated = false; + try { + boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); + MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows); + mc.setHostGuid(dest.getHost().getGuid()); - try { - MigrateAnswer ma = (MigrateAnswer) _agentMgr.send(vm.getLastHostId(), mc); - if (!ma.getResult()) { - s_logger.error("Unable to migrate due to " + ma.getDetails()); - return null; - } - } catch (OperationTimedoutException e) { - if (e.isActive()) { - s_logger.warn("Active migration command so scheduling a restart for " + vm); - _haMgr.scheduleRestart(vm, true); - } - throw new AgentUnavailableException("Operation timed out on migrating " + vm, dstHostId); - } + try { + MigrateAnswer ma = (MigrateAnswer) _agentMgr.send(vm.getLastHostId(), mc); + if (!ma.getResult()) { + s_logger.error("Unable to migrate due to " + ma.getDetails()); + return null; + } + } catch (OperationTimedoutException e) { + if (e.isActive()) { + s_logger.warn("Active migration command so scheduling a restart for " + vm); + _haMgr.scheduleRestart(vm, true); + } + throw new AgentUnavailableException("Operation timed out on migrating " + vm, dstHostId); + } - try { - if (!changeState(vm, VirtualMachine.Event.OperationSucceeded, dstHostId, work, Step.Started)) { - throw new ConcurrentOperationException("Unable to change the state for " + vm); - } - } catch (NoTransitionException e1) { - throw new ConcurrentOperationException("Unable to change state due to " + e1.getMessage()); - } + try { + if (!changeState(vm, VirtualMachine.Event.OperationSucceeded, dstHostId, work, Step.Started)) { + throw new ConcurrentOperationException("Unable to change the state for " + vm); + } + } catch (NoTransitionException e1) { + throw new ConcurrentOperationException("Unable to change state due to " + e1.getMessage()); + } - try { - if (!checkVmOnHost(vm, dstHostId)) { - s_logger.error("Unable to complete migration for " + vm); try { - _agentMgr.send(srcHostId, new Commands(cleanup(vm)), null); - } catch (AgentUnavailableException e) { - s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId); + if (!checkVmOnHost(vm, dstHostId)) { + s_logger.error("Unable to complete migration for " + vm); + try { + _agentMgr.send(srcHostId, new Commands(cleanup(vm)), null); + } catch (AgentUnavailableException e) { + s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId); + } + cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount()); + return null; + } + } catch (OperationTimedoutException e) { } - cleanup(vmGuru, new VirtualMachineProfileImpl<T>(vm), work, Event.AgentReportStopped, true, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount()); - return null; - } - } catch (OperationTimedoutException e) { - } - migrated = true; - return vm; - } finally { - if (!migrated) { - s_logger.info("Migration was unsuccessful. Cleaning up: " + vm); + migrated = true; + return vm; + } finally { + if (!migrated) { + s_logger.info("Migration was unsuccessful. Cleaning up: " + vm); + _networkMgr.rollbackNicForMigration(vmSrc, profile); - _alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " - + dest.getDataCenter().getName() + " and pod " + dest.getPod().getName(), "Migrate Command failed. Please check logs."); - try { - _agentMgr.send(dstHostId, new Commands(cleanup(vm)), null); - } catch (AgentUnavailableException ae) { - s_logger.info("Looks like the destination Host is unavailable for cleanup"); - } + _alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " + + dest.getDataCenter().getName() + " and pod " + dest.getPod().getName(), "Migrate Command failed. Please check logs."); + try { + _agentMgr.send(dstHostId, new Commands(cleanup(vm)), null); + } catch (AgentUnavailableException ae) { + s_logger.info("Looks like the destination Host is unavailable for cleanup"); + } - try { - stateTransitTo(vm, Event.OperationFailed, srcHostId); - } catch (NoTransitionException e) { - s_logger.warn(e.getMessage()); - } + try { + stateTransitTo(vm, Event.OperationFailed, srcHostId); + } catch (NoTransitionException e) { + s_logger.warn(e.getMessage()); + } + }else{ + _networkMgr.commitNicForMigration(vmSrc, profile); - } + } - work.setStep(Step.Done); - _workDao.update(work.getId(), work); - } + work.setStep(Step.Done); + _workDao.update(work.getId(), work); + } + */ } - private Map<VolumeVO, StoragePoolVO> getPoolListForVolumesForMigration(VirtualMachineProfile<VMInstanceVO> profile, + private Map<VolumeVO, StoragePoolVO> getPoolListForVolumesForMigration(VirtualMachineProfile profile, Host host, Map<VolumeVO, StoragePoolVO> volumeToPool) { List<VolumeVO> allVolumes = _volsDao.findUsableVolumesForInstance(profile.getId()); for (VolumeVO volume : allVolumes) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/test/com/cloud/network/MockNetworkManagerImpl.java ---------------------------------------------------------------------- diff --cc server/test/com/cloud/network/MockNetworkManagerImpl.java index b722167,e5d34fb..ed6e224 --- a/server/test/com/cloud/network/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java @@@ -70,14 -68,26 +70,13 @@@ import com.cloud.utils.Pair import com.cloud.utils.component.ManagerBase; import com.cloud.vm.Nic; import com.cloud.vm.NicProfile; +import com.cloud.vm.NicSecondaryIp; import com.cloud.vm.NicVO; import com.cloud.vm.ReservationContext; -import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.*; import com.cloud.vm.VirtualMachine.Type; import com.cloud.vm.VirtualMachineProfile; -import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd; -import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd; -import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd; -import org.apache.cloudstack.api.command.user.network.*; -import org.apache.cloudstack.api.command.user.vm.ListNicsCmd; -import org.springframework.stereotype.Component; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; -import java.util.List; -import java.util.Map; -import java.util.Set; - @Component @Local(value = { NetworkManager.class, NetworkService.class }) public class MockNetworkManagerImpl extends ManagerBase implements NetworkManager, NetworkService { @@@ -918,4 -960,27 +949,27 @@@ public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException { return null; //To change body of implemented methods use File | Settings | File Templates. } + + @Override + public void prepareNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> vm, ++ VirtualMachineProfile vm, + DeployDestination dest) { + // TODO Auto-generated method stub + + } + + @Override + public void commitNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> src, - VirtualMachineProfile<? extends VMInstanceVO> dst) { ++ VirtualMachineProfile src, ++ VirtualMachineProfile dst) { + // TODO Auto-generated method stub + + } + + @Override + public void rollbackNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> src, - VirtualMachineProfile<? extends VMInstanceVO> dst) { ++ VirtualMachineProfile src, ++ VirtualMachineProfile dst) { + // TODO Auto-generated method stub + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/test/com/cloud/vm/MockUserVmManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java ---------------------------------------------------------------------- diff --cc server/test/com/cloud/vpc/MockConfigurationManagerImpl.java index 85eb865,21b3590..c766fa4 --- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java +++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java @@@ -47,6 -50,9 +50,8 @@@ import org.apache.cloudstack.api.comman import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd; import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; + import org.apache.cloudstack.region.PortableIp; + import org.apache.cloudstack.region.PortableIpRange; -import org.springframework.stereotype.Component; import com.cloud.configuration.Configuration; import com.cloud.configuration.ConfigurationManager; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/test/com/cloud/vpc/MockNetworkManagerImpl.java ---------------------------------------------------------------------- diff --cc server/test/com/cloud/vpc/MockNetworkManagerImpl.java index f3200dd,7129273..5e0f054 --- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java @@@ -197,13 -197,36 +197,36 @@@ public class MockNetworkManagerImpl ext return null; } + @Override + public IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID) + throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException { + return null;// TODO Auto-generated method stub + } + @Override + public IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException, + InsufficientAddressCapacityException, ConcurrentOperationException { + return null; + } + @Override + public boolean releasePortableIpAddress(long ipAddressId) throws InsufficientAddressCapacityException { + return false;// TODO Auto-generated method stub + } + @Override + public boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId) { + return false; + } + + @Override + public void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId) throws ResourceAllocationException, ResourceUnavailableException, + InsufficientAddressCapacityException, ConcurrentOperationException { + } /* (non-Javadoc) - * @see com.cloud.network.NetworkService#releaseIpAddress(long) - */ + * @see com.cloud.network.NetworkService#releaseIpAddress(long) + */ @Override public boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException { // TODO Auto-generated method stub @@@ -1441,4 -1459,40 +1459,40 @@@ } + + + + @Override + public void prepareNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> vm, ++ VirtualMachineProfile vm, + DeployDestination dest) { + // TODO Auto-generated method stub + + } + + + + + + @Override + public void commitNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> src, - VirtualMachineProfile<? extends VMInstanceVO> dst) { ++ VirtualMachineProfile src, ++ VirtualMachineProfile dst) { + // TODO Auto-generated method stub + + } + + + + + + @Override + public void rollbackNicForMigration( - VirtualMachineProfile<? extends VMInstanceVO> src, - VirtualMachineProfile<? extends VMInstanceVO> dst) { ++ VirtualMachineProfile src, ++ VirtualMachineProfile dst) { + // TODO Auto-generated method stub + + } + + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/setup/db/db/schema-410to420.sql ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/utils/src/com/cloud/utils/exception/ErrorContext.java ---------------------------------------------------------------------- diff --cc utils/src/com/cloud/utils/exception/ErrorContext.java index 0000000,0000000..7680a88 new file mode 100644 --- /dev/null +++ b/utils/src/com/cloud/utils/exception/ErrorContext.java @@@ -1,0 -1,0 +1,28 @@@ ++// Licensed to the Apache Software Foundation (ASF) under one ++// or more contributor license agreements. See the NOTICE file ++// distributed with this work for additional information ++// regarding copyright ownership. The ASF licenses this file ++// to you under the Apache License, Version 2.0 (the ++// "License"); you may not use this file except in compliance ++// with the License. You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, ++// software distributed under the License is distributed on an ++// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++// KIND, either express or implied. See the License for the ++// specific language governing permissions and limitations ++// under the License. ++package com.cloud.utils.exception; ++ ++import java.util.List; ++ ++import com.cloud.utils.Pair; ++ ++public interface ErrorContext { ++ ++ ErrorContext add(Class<?> entity, String uuid); ++ ++ List<Pair<Class<?>, String>> getEntitiesInError(); ++}
