mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	start vm not working again
This commit is contained in:
		
							parent
							
								
									fcdd20ca06
								
							
						
					
					
						commit
						f147bf5f94
					
				| @ -1,10 +1,11 @@ | |||||||
| /** | /** | ||||||
|  *  |  *  | ||||||
|  */ |  */ | ||||||
| package com.cloud.network.configuration; | package com.cloud.network.guru; | ||||||
| 
 | 
 | ||||||
| import com.cloud.deploy.DeployDestination; | import com.cloud.deploy.DeployDestination; | ||||||
| import com.cloud.deploy.DeploymentPlan; | import com.cloud.deploy.DeploymentPlan; | ||||||
|  | import com.cloud.exception.ConcurrentOperationException; | ||||||
| import com.cloud.exception.InsufficientAddressCapacityException; | import com.cloud.exception.InsufficientAddressCapacityException; | ||||||
| import com.cloud.exception.InsufficientVirtualNetworkCapcityException; | import com.cloud.exception.InsufficientVirtualNetworkCapcityException; | ||||||
| import com.cloud.network.Network; | import com.cloud.network.Network; | ||||||
| @ -43,7 +44,7 @@ public interface NetworkGuru extends Adapter { | |||||||
|      * @throws InsufficientVirtualNetworkCapcityException |      * @throws InsufficientVirtualNetworkCapcityException | ||||||
|      * @throws InsufficientAddressCapacityException |      * @throws InsufficientAddressCapacityException | ||||||
|      */ |      */ | ||||||
|     NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException; |     NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException; | ||||||
|      |      | ||||||
|     /** |     /** | ||||||
|      * Fully implement the network configuration as specified. |      * Fully implement the network configuration as specified. | ||||||
| @ -63,8 +64,9 @@ public interface NetworkGuru extends Adapter { | |||||||
|      * @return |      * @return | ||||||
|      * @throws InsufficientVirtualNetworkCapcityException |      * @throws InsufficientVirtualNetworkCapcityException | ||||||
|      * @throws InsufficientAddressCapacityException |      * @throws InsufficientAddressCapacityException | ||||||
|  |      * @throws ConcurrentOperationException  | ||||||
|      */ |      */ | ||||||
|     void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException; |     void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException; | ||||||
| 
 | 
 | ||||||
|     boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId); |     boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId); | ||||||
|      |      | ||||||
| @ -39,11 +39,11 @@ | |||||||
|         <adapters key="com.cloud.consoleproxy.ConsoleProxyAllocator"> |         <adapters key="com.cloud.consoleproxy.ConsoleProxyAllocator"> | ||||||
|             <adapter name="Balance" class="com.cloud.consoleproxy.ConsoleProxyBalanceAllocator"/> |             <adapter name="Balance" class="com.cloud.consoleproxy.ConsoleProxyBalanceAllocator"/> | ||||||
|         </adapters> |         </adapters> | ||||||
|         <adapters key="com.cloud.network.configuration.NetworkGuru"> |         <adapters key="com.cloud.network.guru.NetworkGuru"> | ||||||
|             <adapter name="GuestNetworkGuru" class="com.cloud.network.configuration.GuestNetworkGuru"/> |             <adapter name="GuestNetworkGuru" class="com.cloud.network.guru.GuestNetworkGuru"/> | ||||||
|             <adapter name="PublicNetworkGuru" class="com.cloud.network.configuration.PublicNetworkGuru"/> |             <adapter name="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru"/> | ||||||
|             <adapter name="PodBasedNetworkGuru" class="com.cloud.network.configuration.PodBasedNetworkGuru"/> |             <adapter name="PodBasedNetworkGuru" class="com.cloud.network.guru.PodBasedNetworkGuru"/> | ||||||
|             <adapter name="ControlNetworkGuru" class="com.cloud.network.configuration.ControlNetworkGuru"/> |             <adapter name="ControlNetworkGuru" class="com.cloud.network.guru.ControlNetworkGuru"/> | ||||||
|         </adapters> |         </adapters> | ||||||
|         <adapters key="com.cloud.storage.secondary.SecondaryStorageVmAllocator"> |         <adapters key="com.cloud.storage.secondary.SecondaryStorageVmAllocator"> | ||||||
|             <adapter name="Balance" class="com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator"/> |             <adapter name="Balance" class="com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator"/> | ||||||
|  | |||||||
| @ -88,7 +88,6 @@ import com.cloud.event.EventUtils; | |||||||
| import com.cloud.event.EventVO; | import com.cloud.event.EventVO; | ||||||
| import com.cloud.event.dao.EventDao; | import com.cloud.event.dao.EventDao; | ||||||
| import com.cloud.exception.AgentUnavailableException; | import com.cloud.exception.AgentUnavailableException; | ||||||
| import com.cloud.exception.ConcurrentOperationException; |  | ||||||
| import com.cloud.exception.InsufficientCapacityException; | import com.cloud.exception.InsufficientCapacityException; | ||||||
| import com.cloud.exception.OperationTimedoutException; | import com.cloud.exception.OperationTimedoutException; | ||||||
| import com.cloud.exception.ResourceUnavailableException; | import com.cloud.exception.ResourceUnavailableException; | ||||||
| @ -552,16 +551,13 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx | |||||||
|         } catch (InsufficientCapacityException e) { |         } catch (InsufficientCapacityException e) { | ||||||
|             s_logger.warn("Exception while trying to start console proxy", e); |             s_logger.warn("Exception while trying to start console proxy", e); | ||||||
|             return null; |             return null; | ||||||
|         } catch (ConcurrentOperationException e) { |  | ||||||
|             s_logger.warn("Exception while trying to start console proxy", e); |  | ||||||
|             return null; |  | ||||||
|         } catch (ResourceUnavailableException e) { |         } catch (ResourceUnavailableException e) { | ||||||
|             s_logger.warn("Exception while trying to start console proxy", e); |             s_logger.warn("Exception while trying to start console proxy", e); | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public ConsoleProxyVO start2(long proxyVmId, long startEventId) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException { |     public ConsoleProxyVO start2(long proxyVmId, long startEventId) throws ResourceUnavailableException, InsufficientCapacityException { | ||||||
|         if (!_useNewNetworking) { |         if (!_useNewNetworking) { | ||||||
|             return start(proxyVmId, startEventId); |             return start(proxyVmId, startEventId); | ||||||
|         } |         } | ||||||
| @ -574,7 +570,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx | |||||||
|     @Override |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public ConsoleProxyVO start(long proxyId, long startEventId) throws InsufficientCapacityException, |     public ConsoleProxyVO start(long proxyId, long startEventId) throws InsufficientCapacityException, | ||||||
|             ConcurrentOperationException, StorageUnavailableException { |             StorageUnavailableException { | ||||||
| 
 | 
 | ||||||
|         AsyncJobExecutor asyncExecutor = BaseAsyncJobExecutor.getCurrentExecutor(); |         AsyncJobExecutor asyncExecutor = BaseAsyncJobExecutor.getCurrentExecutor(); | ||||||
|         if (asyncExecutor != null) { |         if (asyncExecutor != null) { | ||||||
| @ -843,8 +839,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx | |||||||
| 
 | 
 | ||||||
|                 if (thr instanceof StorageUnavailableException) { |                 if (thr instanceof StorageUnavailableException) { | ||||||
|                     throw (StorageUnavailableException) thr; |                     throw (StorageUnavailableException) thr; | ||||||
|                 } else if (thr instanceof ConcurrentOperationException) { |  | ||||||
|                     throw (ConcurrentOperationException) thr; |  | ||||||
|                 } else if (thr instanceof ExecutionException) { |                 } else if (thr instanceof ExecutionException) { | ||||||
|                     s_logger.error("Error while starting console proxy due to " + thr.getMessage()); |                     s_logger.error("Error while starting console proxy due to " + thr.getMessage()); | ||||||
|                 } else { |                 } else { | ||||||
| @ -1114,6 +1108,9 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx | |||||||
|         } catch (StorageUnavailableException e) { |         } catch (StorageUnavailableException e) { | ||||||
|             s_logger.warn("Unable to contact storage", e); |             s_logger.warn("Unable to contact storage", e); | ||||||
|             throw new CloudRuntimeException("Unable to contact storage", e); |             throw new CloudRuntimeException("Unable to contact storage", e); | ||||||
|  |         } catch (ResourceUnavailableException e) { | ||||||
|  |             s_logger.warn("Unable to contact resource", e); | ||||||
|  |             throw new CloudRuntimeException("Unable to contact resource", e); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         Map<String, Object> context = new HashMap<String, Object>(); |         Map<String, Object> context = new HashMap<String, Object>(); | ||||||
| @ -1539,8 +1536,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx | |||||||
|                         s_logger.warn("Storage unavailable", e); |                         s_logger.warn("Storage unavailable", e); | ||||||
|                     } catch (InsufficientCapacityException e) { |                     } catch (InsufficientCapacityException e) { | ||||||
|                         s_logger.warn("insuffiient capacity", e); |                         s_logger.warn("insuffiient capacity", e); | ||||||
|                     } catch (ConcurrentOperationException e) { |  | ||||||
|                         s_logger.debug("Concurrent operation: " + e.getMessage()); |  | ||||||
|                     } catch (ResourceUnavailableException e) { |                     } catch (ResourceUnavailableException e) { | ||||||
|                         s_logger.debug("Concurrent operation: " + e.getMessage()); |                         s_logger.debug("Concurrent operation: " + e.getMessage()); | ||||||
|                     } |                     } | ||||||
|  | |||||||
| @ -116,7 +116,7 @@ public interface NetworkManager extends NetworkService { | |||||||
|      |      | ||||||
|     List<NetworkOfferingVO> getSystemAccountNetworkOfferings(String... offeringNames); |     List<NetworkOfferingVO> getSystemAccountNetworkOfferings(String... offeringNames); | ||||||
|      |      | ||||||
|     void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException; |     void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException; | ||||||
| 
 | 
 | ||||||
|     void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest, ReservationContext context) throws InsufficientNetworkCapacityException, ConcurrentOperationException, ResourceUnavailableException; |     void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest, ReservationContext context) throws InsufficientNetworkCapacityException, ConcurrentOperationException, ResourceUnavailableException; | ||||||
|     void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile); |     void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile); | ||||||
|  | |||||||
| @ -92,7 +92,6 @@ import com.cloud.network.Networks.AddressFormat; | |||||||
| import com.cloud.network.Networks.BroadcastDomainType; | import com.cloud.network.Networks.BroadcastDomainType; | ||||||
| import com.cloud.network.Networks.TrafficType; | import com.cloud.network.Networks.TrafficType; | ||||||
| import com.cloud.network.addr.PublicIp; | import com.cloud.network.addr.PublicIp; | ||||||
| import com.cloud.network.configuration.NetworkGuru; |  | ||||||
| import com.cloud.network.dao.FirewallRulesDao; | import com.cloud.network.dao.FirewallRulesDao; | ||||||
| import com.cloud.network.dao.IPAddressDao; | import com.cloud.network.dao.IPAddressDao; | ||||||
| import com.cloud.network.dao.LoadBalancerDao; | import com.cloud.network.dao.LoadBalancerDao; | ||||||
| @ -102,6 +101,7 @@ import com.cloud.network.dao.NetworkRuleConfigDao; | |||||||
| import com.cloud.network.dao.RemoteAccessVpnDao; | import com.cloud.network.dao.RemoteAccessVpnDao; | ||||||
| import com.cloud.network.dao.VpnUserDao; | import com.cloud.network.dao.VpnUserDao; | ||||||
| import com.cloud.network.element.NetworkElement; | import com.cloud.network.element.NetworkElement; | ||||||
|  | import com.cloud.network.guru.NetworkGuru; | ||||||
| import com.cloud.network.lb.LoadBalancingRulesManager; | import com.cloud.network.lb.LoadBalancingRulesManager; | ||||||
| import com.cloud.network.router.DomainRouterManager; | import com.cloud.network.router.DomainRouterManager; | ||||||
| import com.cloud.network.rules.FirewallRule; | import com.cloud.network.rules.FirewallRule; | ||||||
| @ -228,7 +228,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag | |||||||
|         txn.start(); |         txn.start(); | ||||||
|         SearchCriteria<IPAddressVO> sc = AssignIpAddressSearch.create(); |         SearchCriteria<IPAddressVO> sc = AssignIpAddressSearch.create(); | ||||||
|         sc.setParameters("dc", dcId); |         sc.setParameters("dc", dcId); | ||||||
|         sc.setJoinParameters("vlan", "vlanType", vlanUse); |         sc.setJoinParameters("vlan", "type", vlanUse); | ||||||
|          |          | ||||||
|         Filter filter = new Filter(IPAddressVO.class, "vlanId", true, 0l, 1l); |         Filter filter = new Filter(IPAddressVO.class, "vlanId", true, 0l, 1l); | ||||||
|          |          | ||||||
| @ -891,7 +891,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override @DB |     @Override @DB | ||||||
|     public void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException { |     public void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException { | ||||||
|         Transaction txn = Transaction.currentTxn(); |         Transaction txn = Transaction.currentTxn(); | ||||||
|         txn.start(); |         txn.start(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| /** | /** | ||||||
|  *  |  *  | ||||||
|  */ |  */ | ||||||
| package com.cloud.network.configuration; | package com.cloud.network.guru; | ||||||
| 
 | 
 | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| @ -21,6 +21,7 @@ import com.cloud.network.Networks.AddressFormat; | |||||||
| import com.cloud.network.Networks.BroadcastDomainType; | import com.cloud.network.Networks.BroadcastDomainType; | ||||||
| import com.cloud.network.Networks.Mode; | import com.cloud.network.Networks.Mode; | ||||||
| import com.cloud.network.Networks.TrafficType; | import com.cloud.network.Networks.TrafficType; | ||||||
|  | import com.cloud.network.guru.NetworkGuru; | ||||||
| import com.cloud.network.Network; | import com.cloud.network.Network; | ||||||
| import com.cloud.network.NetworkVO; | import com.cloud.network.NetworkVO; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
| @ -15,7 +15,7 @@ | |||||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>. |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  *  |  *  | ||||||
|  */ |  */ | ||||||
| package com.cloud.network.configuration; | package com.cloud.network.guru; | ||||||
| 
 | 
 | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Random; | import java.util.Random; | ||||||
| @ -39,6 +39,7 @@ import com.cloud.network.NetworkVO; | |||||||
| import com.cloud.network.Networks.BroadcastDomainType; | import com.cloud.network.Networks.BroadcastDomainType; | ||||||
| import com.cloud.network.Networks.Mode; | import com.cloud.network.Networks.Mode; | ||||||
| import com.cloud.network.Networks.TrafficType; | import com.cloud.network.Networks.TrafficType; | ||||||
|  | import com.cloud.network.guru.NetworkGuru; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
| import com.cloud.offering.NetworkOffering.GuestIpType; | import com.cloud.offering.NetworkOffering.GuestIpType; | ||||||
| import com.cloud.resource.Resource.ReservationStrategy; | import com.cloud.resource.Resource.ReservationStrategy; | ||||||
| @ -1,7 +1,7 @@ | |||||||
| /** | /** | ||||||
|  *  |  *  | ||||||
|  */ |  */ | ||||||
| package com.cloud.network.configuration; | package com.cloud.network.guru; | ||||||
| 
 | 
 | ||||||
| public final class GuruUtils { | public final class GuruUtils { | ||||||
|      |      | ||||||
| @ -1,7 +1,7 @@ | |||||||
| /** | /** | ||||||
|  *  |  *  | ||||||
|  */ |  */ | ||||||
| package com.cloud.network.configuration; | package com.cloud.network.guru; | ||||||
| 
 | 
 | ||||||
| import javax.ejb.Local; | import javax.ejb.Local; | ||||||
| 
 | 
 | ||||||
| @ -18,6 +18,7 @@ import com.cloud.network.Networks.AddressFormat; | |||||||
| import com.cloud.network.Networks.BroadcastDomainType; | import com.cloud.network.Networks.BroadcastDomainType; | ||||||
| import com.cloud.network.Networks.Mode; | import com.cloud.network.Networks.Mode; | ||||||
| import com.cloud.network.Networks.TrafficType; | import com.cloud.network.Networks.TrafficType; | ||||||
|  | import com.cloud.network.guru.NetworkGuru; | ||||||
| import com.cloud.network.Network; | import com.cloud.network.Network; | ||||||
| import com.cloud.network.NetworkVO; | import com.cloud.network.NetworkVO; | ||||||
| import com.cloud.network.NetworkManager; | import com.cloud.network.NetworkManager; | ||||||
| @ -1,7 +1,9 @@ | |||||||
| /** | /** | ||||||
|  *  |  *  | ||||||
|  */ |  */ | ||||||
| package com.cloud.network.configuration; | package com.cloud.network.guru; | ||||||
|  | 
 | ||||||
|  | import java.util.Random; | ||||||
| 
 | 
 | ||||||
| import javax.ejb.Local; | import javax.ejb.Local; | ||||||
| 
 | 
 | ||||||
| @ -9,12 +11,11 @@ import org.apache.log4j.Logger; | |||||||
| 
 | 
 | ||||||
| import com.cloud.dc.DataCenter; | import com.cloud.dc.DataCenter; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| import com.cloud.dc.Vlan.VlanType; |  | ||||||
| import com.cloud.dc.VlanVO; |  | ||||||
| import com.cloud.dc.dao.DataCenterDao; | import com.cloud.dc.dao.DataCenterDao; | ||||||
| import com.cloud.dc.dao.VlanDao; | import com.cloud.dc.dao.VlanDao; | ||||||
| import com.cloud.deploy.DeployDestination; | import com.cloud.deploy.DeployDestination; | ||||||
| import com.cloud.deploy.DeploymentPlan; | import com.cloud.deploy.DeploymentPlan; | ||||||
|  | import com.cloud.exception.ConcurrentOperationException; | ||||||
| import com.cloud.exception.InsufficientAddressCapacityException; | import com.cloud.exception.InsufficientAddressCapacityException; | ||||||
| import com.cloud.exception.InsufficientVirtualNetworkCapcityException; | import com.cloud.exception.InsufficientVirtualNetworkCapcityException; | ||||||
| import com.cloud.network.Network; | import com.cloud.network.Network; | ||||||
| @ -28,12 +29,13 @@ import com.cloud.network.Networks.TrafficType; | |||||||
| import com.cloud.network.addr.PublicIp; | import com.cloud.network.addr.PublicIp; | ||||||
| import com.cloud.network.dao.IPAddressDao; | import com.cloud.network.dao.IPAddressDao; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
|  | import com.cloud.offering.NetworkOffering.GuestIpType; | ||||||
| import com.cloud.resource.Resource.ReservationStrategy; | import com.cloud.resource.Resource.ReservationStrategy; | ||||||
| import com.cloud.user.Account; | import com.cloud.user.Account; | ||||||
| import com.cloud.user.UserContext; | import com.cloud.user.UserContext; | ||||||
| import com.cloud.utils.Pair; |  | ||||||
| import com.cloud.utils.component.AdapterBase; | import com.cloud.utils.component.AdapterBase; | ||||||
| import com.cloud.utils.component.Inject; | import com.cloud.utils.component.Inject; | ||||||
|  | import com.cloud.utils.net.NetUtils; | ||||||
| import com.cloud.vm.NicProfile; | import com.cloud.vm.NicProfile; | ||||||
| import com.cloud.vm.ReservationContext; | import com.cloud.vm.ReservationContext; | ||||||
| import com.cloud.vm.VirtualMachine; | import com.cloud.vm.VirtualMachine; | ||||||
| @ -47,49 +49,51 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { | |||||||
|     @Inject VlanDao _vlanDao; |     @Inject VlanDao _vlanDao; | ||||||
|     @Inject NetworkManager _networkMgr; |     @Inject NetworkManager _networkMgr; | ||||||
|     @Inject IPAddressDao _ipAddressDao; |     @Inject IPAddressDao _ipAddressDao; | ||||||
|  |     Random _rand = new Random(System.currentTimeMillis()); | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public Network design(NetworkOffering offering, DeploymentPlan plan, Network config, Account owner) { |     public Network design(NetworkOffering offering, DeploymentPlan plan, Network network, Account owner) { | ||||||
|         if (offering.getTrafficType() != TrafficType.Public) { |         if (offering.getTrafficType() != TrafficType.Public || (offering.getTrafficType() == TrafficType.Guest && offering.getGuestIpType() != GuestIpType.Direct)) { | ||||||
|  |             s_logger.trace("We only take care of two types of networks.  Public or Guest direct so this is no ours"); | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|  |         if (offering.getTrafficType() == TrafficType.Public) { | ||||||
|             NetworkVO network = new NetworkVO(offering.getTrafficType(), offering.getGuestIpType(), Mode.Static, BroadcastDomainType.Vlan, offering.getId(), plan.getDataCenterId()); |             NetworkVO network = new NetworkVO(offering.getTrafficType(), offering.getGuestIpType(), Mode.Static, BroadcastDomainType.Vlan, offering.getId(), plan.getDataCenterId()); | ||||||
|             DataCenterVO dc = _dcDao.findById(plan.getDataCenterId()); |             DataCenterVO dc = _dcDao.findById(plan.getDataCenterId()); | ||||||
|             network.setDns1(dc.getDns1()); |             network.setDns1(dc.getDns1()); | ||||||
|             network.setDns2(dc.getDns2()); |             network.setDns2(dc.getDns2()); | ||||||
|             return network; |             return network; | ||||||
|  |         } else { | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     protected PublicNetworkGuru() { |     protected PublicNetworkGuru() { | ||||||
|         super(); |         super(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException { |     protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { | ||||||
|         if (nic.getIp4Address() == null) { |         if (nic.getIp4Address() == null) { | ||||||
|             PublicIp ip = _networkMgr.assignSourceNatIpAddress(dc, vm.getOwner(), network, UserContext.current().getUserId()); |             PublicIp ip = _networkMgr.assignSourceNatIpAddress(vm.getOwner(), network, UserContext.current().getUserId()); | ||||||
|             Pair<String, VlanVO> ipAndVlan = __vlanDao.assignIpAddress(dc.getId(), vm.getVirtualMachine().getAccountId(), vm.getVirtualMachine().getDomainId(), VlanType.VirtualNetwork, true); |             nic.setIp4Address(ip.getAddress()); | ||||||
|             if (ipAndVlan == null) { |             nic.setGateway(ip.getGateway()); | ||||||
|                 throw new InsufficientVirtualNetworkCapcityException("Unable to get public ip address in " + dc.getId(), DataCenter.class, dc.getId()); |             nic.setNetmask(ip.getNetmask()); | ||||||
|             } |             nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag())); | ||||||
|             VlanVO vlan = ipAndVlan.second(); |  | ||||||
|             nic.setIp4Address(ipAndVlan.first()); |  | ||||||
|             nic.setGateway(vlan.getVlanGateway()); |  | ||||||
|             nic.setNetmask(vlan.getVlanNetmask()); |  | ||||||
|             nic.setIsolationUri(IsolationType.Vlan.toUri(vlan.getVlanId())); |  | ||||||
|             nic.setBroadcastType(BroadcastDomainType.Vlan); |             nic.setBroadcastType(BroadcastDomainType.Vlan); | ||||||
|             nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(vlan.getVlanId())); |             nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag())); | ||||||
|             nic.setFormat(AddressFormat.Ip4); |             nic.setFormat(AddressFormat.Ip4); | ||||||
|             nic.setReservationId(Long.toString(vlan.getId())); |             nic.setReservationId(ip.getVlanTag()); | ||||||
|  |             nic.setMacAddress(NetUtils.long2Mac(ip.getMacAddress() | 0x060000000000l | (((long)_rand.nextInt(32768) << 25) & 0x00fffe000000l))); | ||||||
|         } |         } | ||||||
|         nic.setDns1(dc.getDns1()); |         nic.setDns1(dc.getDns1()); | ||||||
|         nic.setDns2(dc.getDns2()); |         nic.setDns2(dc.getDns2()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, |     public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, | ||||||
|             InsufficientAddressCapacityException { |             InsufficientAddressCapacityException, ConcurrentOperationException { | ||||||
|         if (config.getTrafficType() != TrafficType.Public) { |         if (network.getTrafficType() != TrafficType.Public) { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|          |          | ||||||
| @ -97,11 +101,8 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { | |||||||
|             nic = new NicProfile(ReservationStrategy.Create, null, null, null, null); |             nic = new NicProfile(ReservationStrategy.Create, null, null, null, null); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId()); |         DataCenter dc = _dcDao.findById(network.getDataCenterId()); | ||||||
|         nic.setMacAddress(mac); |         getIp(nic, dc, vm, network); | ||||||
|          |  | ||||||
|         DataCenter dc = _dcDao.findById(config.getDataCenterId()); |  | ||||||
|         getIp(nic, dc, vm); |  | ||||||
|          |          | ||||||
|         if (nic.getIp4Address() == null) { |         if (nic.getIp4Address() == null) { | ||||||
|             nic.setStrategy(ReservationStrategy.Start); |             nic.setStrategy(ReservationStrategy.Start); | ||||||
| @ -113,9 +114,9 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void reserve(NicProfile nic, Network configuration, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException { |     public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { | ||||||
|         if (nic.getIp4Address() == null) { |         if (nic.getIp4Address() == null) { | ||||||
|             getIp(nic, dest.getDataCenter(), vm); |             getIp(nic, dest.getDataCenter(), vm, network); | ||||||
|         }  |         }  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -126,20 +127,20 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public Network implement(Network config, NetworkOffering offering, DeployDestination destination, ReservationContext context) { |     public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context) { | ||||||
|         return config; |         return network; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) { |     public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public void destroy(Network config, NetworkOffering offering) { |     public void destroy(Network network, NetworkOffering offering) { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean trash(Network config, NetworkOffering offering, Account owner) { |     public boolean trash(Network network, NetworkOffering offering, Account owner) { | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -2421,15 +2421,9 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute | |||||||
|          |          | ||||||
|         UserVO user = _userDao.findById(context.getUserId()); |         UserVO user = _userDao.findById(context.getUserId()); | ||||||
| 
 | 
 | ||||||
|         try { |  | ||||||
|         if (!_itMgr.stop(router, user, account)) { |         if (!_itMgr.stop(router, user, account)) { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|         } catch (AgentUnavailableException e) { |  | ||||||
|             throw new ResourceUnavailableException("Unable to reach the server to stop the vm", e); |  | ||||||
|         } catch (OperationTimedoutException e) { |  | ||||||
|             throw new ResourceUnavailableException("Stop operation timed out", e); |  | ||||||
|         } |  | ||||||
|          |          | ||||||
|         return router; |         return router; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -62,14 +62,11 @@ import com.cloud.configuration.Config; | |||||||
| import com.cloud.configuration.dao.ConfigurationDao; | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| import com.cloud.dc.HostPodVO; | import com.cloud.dc.HostPodVO; | ||||||
| import com.cloud.dc.Vlan.VlanType; |  | ||||||
| import com.cloud.dc.VlanVO; |  | ||||||
| import com.cloud.dc.dao.DataCenterDao; | import com.cloud.dc.dao.DataCenterDao; | ||||||
| import com.cloud.dc.dao.HostPodDao; | import com.cloud.dc.dao.HostPodDao; | ||||||
| import com.cloud.dc.dao.VlanDao; | import com.cloud.dc.dao.VlanDao; | ||||||
| import com.cloud.deploy.DataCenterDeployment; | import com.cloud.deploy.DataCenterDeployment; | ||||||
| import com.cloud.deploy.DeployDestination; | import com.cloud.deploy.DeployDestination; | ||||||
| import com.cloud.domain.DomainVO; |  | ||||||
| import com.cloud.event.Event; | import com.cloud.event.Event; | ||||||
| import com.cloud.event.EventTypes; | import com.cloud.event.EventTypes; | ||||||
| import com.cloud.event.EventVO; | import com.cloud.event.EventVO; | ||||||
| @ -772,9 +769,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V | |||||||
| 	        } catch (InsufficientCapacityException e) { | 	        } catch (InsufficientCapacityException e) { | ||||||
| 	            s_logger.warn("InsufficientCapacity", e); | 	            s_logger.warn("InsufficientCapacity", e); | ||||||
| 	            throw new CloudRuntimeException("Insufficient capacity exception", e); | 	            throw new CloudRuntimeException("Insufficient capacity exception", e); | ||||||
| 	        } catch (StorageUnavailableException e) { | 	        } catch (ResourceUnavailableException e) { | ||||||
| 	            s_logger.warn("Unable to contact storage", e); | 	            s_logger.warn("Unable to contact resource", e); | ||||||
| 	            throw new CloudRuntimeException("Unable to contact storage", e); | 	            throw new CloudRuntimeException("Unable to contact resource", e); | ||||||
| 	        } | 	        } | ||||||
| 	         | 	         | ||||||
| 	        Map<String, Object> context = new HashMap<String, Object>(); | 	        Map<String, Object> context = new HashMap<String, Object>(); | ||||||
| @ -923,21 +920,21 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V | |||||||
| 			return net; | 			return net; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
|         Pair<String, VlanVO> ipAndVlan = _vlanDao.assignIpAddress(dcId, Account.ACCOUNT_ID_SYSTEM, DomainVO.ROOT_DOMAIN, VlanType.VirtualNetwork, true); | //FIXME am I even needed any more?        Pair<String, VlanVO> ipAndVlan = _vlanDao.assignIpAddress(dcId, Account.ACCOUNT_ID_SYSTEM, DomainVO.ROOT_DOMAIN, VlanType.VirtualNetwork, true); | ||||||
| 		 | //		 | ||||||
|         if (ipAndVlan == null) { | //        if (ipAndVlan == null) { | ||||||
|         	s_logger.debug("Unable to get public ip address (type=Virtual) for secondary storage vm for data center  : " + dcId); | //        	s_logger.debug("Unable to get public ip address (type=Virtual) for secondary storage vm for data center  : " + dcId); | ||||||
|         	ipAndVlan = _vlanDao.assignPodDirectAttachIpAddress(dcId, podId, Account.ACCOUNT_ID_SYSTEM, DomainVO.ROOT_DOMAIN); | //        	ipAndVlan = _vlanDao.assignPodDirectAttachIpAddress(dcId, podId, Account.ACCOUNT_ID_SYSTEM, DomainVO.ROOT_DOMAIN); | ||||||
|         	if (ipAndVlan == null) { | //        	if (ipAndVlan == null) { | ||||||
|                 s_logger.debug("Unable to get public ip address (type=DirectAttach) for secondary storage vm for data center  : " + dcId); | //                s_logger.debug("Unable to get public ip address (type=DirectAttach) for secondary storage vm for data center  : " + dcId); | ||||||
|             } | //            } | ||||||
| 
 | // | ||||||
|         } | //        } | ||||||
|         if (ipAndVlan != null) { | //        if (ipAndVlan != null) { | ||||||
| 			VlanVO vlan = ipAndVlan.second(); | //			VlanVO vlan = ipAndVlan.second(); | ||||||
| 			networkInfo net = new networkInfo(ipAndVlan.first(), vlan.getVlanNetmask(), vlan.getVlanGateway(), vlan.getId(), vlan.getVlanId()); | //			networkInfo net = new networkInfo(ipAndVlan.first(), vlan.getVlanNetmask(), vlan.getVlanGateway(), vlan.getId(), vlan.getVlanId()); | ||||||
| 			return net; | //			return net; | ||||||
| 		} | //		} | ||||||
| 		return null; | 		return null; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,7 +19,6 @@ package com.cloud.vm; | |||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.HashSet; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
| @ -32,7 +31,6 @@ import org.apache.log4j.Logger; | |||||||
| import com.cloud.agent.AgentManager; | import com.cloud.agent.AgentManager; | ||||||
| import com.cloud.agent.AgentManager.OnError; | import com.cloud.agent.AgentManager.OnError; | ||||||
| import com.cloud.agent.api.Answer; | import com.cloud.agent.api.Answer; | ||||||
| import com.cloud.agent.api.PrepareForMigrationCommand; |  | ||||||
| import com.cloud.agent.api.Start2Command; | import com.cloud.agent.api.Start2Command; | ||||||
| import com.cloud.agent.api.StopAnswer; | import com.cloud.agent.api.StopAnswer; | ||||||
| import com.cloud.agent.api.StopCommand; | import com.cloud.agent.api.StopCommand; | ||||||
| @ -45,8 +43,6 @@ import com.cloud.cluster.ManagementServerHostVO; | |||||||
| import com.cloud.configuration.Config; | import com.cloud.configuration.Config; | ||||||
| import com.cloud.configuration.dao.ConfigurationDao; | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
| import com.cloud.dc.DataCenter; | import com.cloud.dc.DataCenter; | ||||||
| import com.cloud.dc.DataCenterVO; |  | ||||||
| import com.cloud.dc.HostPodVO; |  | ||||||
| import com.cloud.deploy.DataCenterDeployment; | import com.cloud.deploy.DataCenterDeployment; | ||||||
| import com.cloud.deploy.DeployDestination; | import com.cloud.deploy.DeployDestination; | ||||||
| import com.cloud.deploy.DeploymentPlan; | import com.cloud.deploy.DeploymentPlan; | ||||||
| @ -62,20 +58,16 @@ import com.cloud.exception.InsufficientServerCapacityException; | |||||||
| import com.cloud.exception.OperationTimedoutException; | import com.cloud.exception.OperationTimedoutException; | ||||||
| import com.cloud.exception.ResourceUnavailableException; | import com.cloud.exception.ResourceUnavailableException; | ||||||
| import com.cloud.exception.StorageUnavailableException; | import com.cloud.exception.StorageUnavailableException; | ||||||
| import com.cloud.host.Host; |  | ||||||
| import com.cloud.host.HostVO; |  | ||||||
| import com.cloud.hypervisor.Hypervisor.HypervisorType; | import com.cloud.hypervisor.Hypervisor.HypervisorType; | ||||||
| import com.cloud.hypervisor.HypervisorGuru; | import com.cloud.hypervisor.HypervisorGuru; | ||||||
| import com.cloud.network.NetworkVO; |  | ||||||
| import com.cloud.network.NetworkManager; | import com.cloud.network.NetworkManager; | ||||||
|  | import com.cloud.network.NetworkVO; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.service.dao.ServiceOfferingDao; | import com.cloud.service.dao.ServiceOfferingDao; | ||||||
| import com.cloud.storage.DiskOfferingVO; | import com.cloud.storage.DiskOfferingVO; | ||||||
| import com.cloud.storage.Storage.ImageFormat; | import com.cloud.storage.Storage.ImageFormat; | ||||||
| import com.cloud.storage.StorageManager; | import com.cloud.storage.StorageManager; | ||||||
| import com.cloud.storage.StoragePoolVO; |  | ||||||
| import com.cloud.storage.VMTemplateVO; | import com.cloud.storage.VMTemplateVO; | ||||||
| import com.cloud.storage.VolumeVO; |  | ||||||
| import com.cloud.storage.Volume.VolumeType; | import com.cloud.storage.Volume.VolumeType; | ||||||
| import com.cloud.storage.dao.VMTemplateDao; | import com.cloud.storage.dao.VMTemplateDao; | ||||||
| import com.cloud.user.Account; | import com.cloud.user.Account; | ||||||
| @ -172,7 +164,11 @@ public class MauriceMoss implements VmManager, ClusterManagerListener { | |||||||
|         if (s_logger.isDebugEnabled()) { |         if (s_logger.isDebugEnabled()) { | ||||||
|             s_logger.debug("Allocating nics for " + vm); |             s_logger.debug("Allocating nics for " + vm); | ||||||
|         } |         } | ||||||
|  |         try { | ||||||
|             _networkMgr.allocate(vmProfile, networks); |             _networkMgr.allocate(vmProfile, networks); | ||||||
|  |         } catch (ConcurrentOperationException e) { | ||||||
|  |             throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         if (dataDiskOfferings == null) { |         if (dataDiskOfferings == null) { | ||||||
|             dataDiskOfferings = new ArrayList<Pair<DiskOfferingVO, Long>>(0); |             dataDiskOfferings = new ArrayList<Pair<DiskOfferingVO, Long>>(0); | ||||||
| @ -232,7 +228,18 @@ public class MauriceMoss implements VmManager, ClusterManagerListener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public <T extends VMInstanceVO> boolean destroy(T vm, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException { |     public <T extends VMInstanceVO> boolean destroy(T vm, User caller, Account account) throws ResourceUnavailableException { | ||||||
|  |         try { | ||||||
|  |             return advanceDestroy(vm, caller, account); | ||||||
|  |         } catch (OperationTimedoutException e) { | ||||||
|  |             throw new CloudRuntimeException("Operation timed out", e); | ||||||
|  |         } catch (ConcurrentOperationException e) { | ||||||
|  |             throw new CloudRuntimeException("Concurrent operation ", e); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> boolean advanceDestroy(T vm, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException { | ||||||
|         if (vm == null || vm.getState() == State.Destroyed || vm.getState() == State.Expunging || vm.getRemoved() != null) { |         if (vm == null || vm.getState() == State.Destroyed || vm.getState() == State.Expunging || vm.getRemoved() != null) { | ||||||
|             if (s_logger.isDebugEnabled()) { |             if (s_logger.isDebugEnabled()) { | ||||||
|                 s_logger.debug("Unable to find vm or vm is destroyed: " + vm); |                 s_logger.debug("Unable to find vm or vm is destroyed: " + vm); | ||||||
| @ -309,7 +316,16 @@ public class MauriceMoss implements VmManager, ClusterManagerListener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public <T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { |     public <T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException { | ||||||
|  |         try { | ||||||
|  |             return advanceStart(vm, params, caller, account); | ||||||
|  |         } catch (ConcurrentOperationException e) { | ||||||
|  |             throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> T advanceStart(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { | ||||||
|         State state = vm.getState(); |         State state = vm.getState(); | ||||||
|         if (state == State.Starting || state == State.Running) { |         if (state == State.Starting || state == State.Running) { | ||||||
|             s_logger.debug("VM is already started: " + vm); |             s_logger.debug("VM is already started: " + vm); | ||||||
| @ -424,7 +440,18 @@ public class MauriceMoss implements VmManager, ClusterManagerListener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public <T extends VMInstanceVO> boolean stop(T vm, User user, Account account) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException { |     public <T extends VMInstanceVO> boolean stop(T vm, User user, Account account) throws ResourceUnavailableException { | ||||||
|  |         try { | ||||||
|  |             return advanceStop(vm, user, account); | ||||||
|  |         } catch (OperationTimedoutException e) { | ||||||
|  |             throw new ResourceUnavailableException("Unable to stop vm because the operation to stop timed out", e); | ||||||
|  |         } catch (ConcurrentOperationException e) { | ||||||
|  |             throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation", e); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> boolean advanceStop(T vm, User user, Account account) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException { | ||||||
|         State state = vm.getState(); |         State state = vm.getState(); | ||||||
|         if (state == State.Stopped) { |         if (state == State.Stopped) { | ||||||
|             if (s_logger.isDebugEnabled()) { |             if (s_logger.isDebugEnabled()) { | ||||||
|  | |||||||
| @ -3856,10 +3856,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM | |||||||
| 
 | 
 | ||||||
|         try { |         try { | ||||||
|             _itMgr.stop(vm, user, caller); |             _itMgr.stop(vm, user, caller); | ||||||
|         } catch (AgentUnavailableException e) { |         } catch (ResourceUnavailableException e) { | ||||||
|             throw new CloudRuntimeException("Unable to contact the agent to stop the virtual machine " + vm, e); |             throw new CloudRuntimeException("Unable to contact the agent to stop the virtual machine " + vm, e); | ||||||
|         } catch (OperationTimedoutException e) { |  | ||||||
|             throw new CloudRuntimeException("Waiting too long for agent to stop the virtual machine " + vm, e); |  | ||||||
|         }  |         }  | ||||||
|          |          | ||||||
|         return _vmDao.findById(vmId); |         return _vmDao.findById(vmId); | ||||||
| @ -3915,11 +3913,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM | |||||||
|         EventUtils.saveScheduledEvent(userId, vm.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Destroying Vm with Id: "+vmId); |         EventUtils.saveScheduledEvent(userId, vm.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Destroying Vm with Id: "+vmId); | ||||||
|          |          | ||||||
|         boolean status; |         boolean status; | ||||||
|         try { |  | ||||||
|         status = _itMgr.destroy(vm, caller, account); |         status = _itMgr.destroy(vm, caller, account); | ||||||
|         } catch (OperationTimedoutException e) { |  | ||||||
|             throw new ResourceUnavailableException("Resource not available to complete the command", e); |  | ||||||
|         } |  | ||||||
|          |          | ||||||
|         if (status) { |         if (status) { | ||||||
|             EventUtils.saveEvent(userId, vm.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Successfully destroyed vm with id:"+vmId); |             EventUtils.saveEvent(userId, vm.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Successfully destroyed vm with id:"+vmId); | ||||||
|  | |||||||
| @ -21,13 +21,10 @@ import java.util.List; | |||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| import com.cloud.deploy.DeploymentPlan; | import com.cloud.deploy.DeploymentPlan; | ||||||
| import com.cloud.exception.AgentUnavailableException; |  | ||||||
| import com.cloud.exception.ConcurrentOperationException; | import com.cloud.exception.ConcurrentOperationException; | ||||||
| import com.cloud.exception.InsufficientCapacityException; | import com.cloud.exception.InsufficientCapacityException; | ||||||
| import com.cloud.exception.OperationTimedoutException; | import com.cloud.exception.OperationTimedoutException; | ||||||
| import com.cloud.exception.ResourceUnavailableException; | import com.cloud.exception.ResourceUnavailableException; | ||||||
| import com.cloud.exception.StorageUnavailableException; |  | ||||||
| import com.cloud.host.HostVO; |  | ||||||
| import com.cloud.network.NetworkVO; | import com.cloud.network.NetworkVO; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.storage.DiskOfferingVO; | import com.cloud.storage.DiskOfferingVO; | ||||||
| @ -51,7 +48,7 @@ public interface VmManager extends Manager { | |||||||
|             List<Pair<NetworkVO, NicProfile>> networks, |             List<Pair<NetworkVO, NicProfile>> networks, | ||||||
|             Map<String, Object> params, |             Map<String, Object> params, | ||||||
|             DeploymentPlan plan, |             DeploymentPlan plan, | ||||||
|             Account owner) throws InsufficientCapacityException, StorageUnavailableException; |             Account owner) throws InsufficientCapacityException, ResourceUnavailableException; | ||||||
|      |      | ||||||
|     <T extends VMInstanceVO> T allocate(T vm, |     <T extends VMInstanceVO> T allocate(T vm, | ||||||
|             VMTemplateVO template, |             VMTemplateVO template, | ||||||
| @ -60,25 +57,29 @@ public interface VmManager extends Manager { | |||||||
|             Pair<DiskOfferingVO, Long> dataDiskOffering, |             Pair<DiskOfferingVO, Long> dataDiskOffering, | ||||||
|             List<Pair<NetworkVO, NicProfile>> networks, |             List<Pair<NetworkVO, NicProfile>> networks, | ||||||
|             DeploymentPlan plan, |             DeploymentPlan plan, | ||||||
|             Account owner) throws InsufficientCapacityException, StorageUnavailableException; |             Account owner) throws InsufficientCapacityException, ResourceUnavailableException; | ||||||
|      |      | ||||||
|     <T extends VMInstanceVO> T allocate(T vm, |     <T extends VMInstanceVO> T allocate(T vm, | ||||||
|             VMTemplateVO template, |             VMTemplateVO template, | ||||||
|             ServiceOfferingVO serviceOffering, |             ServiceOfferingVO serviceOffering, | ||||||
|             List<Pair<NetworkVO, NicProfile>> networkProfiles, |             List<Pair<NetworkVO, NicProfile>> networkProfiles, | ||||||
|             DeploymentPlan plan, |             DeploymentPlan plan, | ||||||
|             Account owner) throws InsufficientCapacityException, StorageUnavailableException; |             Account owner) throws InsufficientCapacityException, ResourceUnavailableException; | ||||||
|      |      | ||||||
|     <T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, StorageUnavailableException, ConcurrentOperationException, ResourceUnavailableException; |     <T extends VMInstanceVO> T start(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException; | ||||||
|      |      | ||||||
|     <T extends VMInstanceVO> boolean stop(T vm, User caller, Account account) throws AgentUnavailableException, ConcurrentOperationException, OperationTimedoutException; |     <T extends VMInstanceVO> boolean stop(T vm, User caller, Account account) throws ResourceUnavailableException; | ||||||
|      |      | ||||||
|     <T extends VMInstanceVO> boolean destroy(T vm, User caller, Account account) throws ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException; |     <T extends VMInstanceVO> boolean destroy(T vm, User caller, Account account) throws ResourceUnavailableException; | ||||||
| ; |  | ||||||
|      |      | ||||||
|     <T extends VMInstanceVO> void registerGuru(VirtualMachine.Type type, VirtualMachineGuru<T> guru); |     <T extends VMInstanceVO> void registerGuru(VirtualMachine.Type type, VirtualMachineGuru<T> guru); | ||||||
| 
 | 
 | ||||||
| 	boolean stateTransitTo(VMInstanceVO vm, Event e, Long id); | 	boolean stateTransitTo(VMInstanceVO vm, Event e, Long id); | ||||||
| 
 | 
 | ||||||
| 	 | 	 | ||||||
|  |     <T extends VMInstanceVO> T advanceStart(T vm, Map<String, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException; | ||||||
|  |      | ||||||
|  | 	<T extends VMInstanceVO> boolean advanceStop(T vm, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException; | ||||||
|  | 	 | ||||||
|  | 	<T extends VMInstanceVO> boolean advanceDestroy(T vm, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException; | ||||||
| } | } | ||||||
|  | |||||||
| @ -140,6 +140,7 @@ CREATE TABLE `cloud`.`networks` ( | |||||||
|   `set_fields` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'which fields are set already', |   `set_fields` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'which fields are set already', | ||||||
|   `guest_type` char(32) COMMENT 'type of guest network', |   `guest_type` char(32) COMMENT 'type of guest network', | ||||||
|   `shared` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '0 if network is shared, 1 if network dedicated', |   `shared` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '0 if network is shared, 1 if network dedicated', | ||||||
|  |   `network_domain` varchar(255) COMMENT 'domain', | ||||||
|   PRIMARY KEY (`id`) |   PRIMARY KEY (`id`) | ||||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user