mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	checkins for problems.
This commit is contained in:
		
							parent
							
								
									29a5b796d4
								
							
						
					
					
						commit
						2bc938c3f8
					
				| @ -17,6 +17,7 @@ | |||||||
|  */ |  */ | ||||||
| package com.cloud.exception; | package com.cloud.exception; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.utils.SerialVersionUID; | ||||||
| import com.cloud.utils.exception.CloudRuntimeException; | import com.cloud.utils.exception.CloudRuntimeException; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -25,7 +26,7 @@ import com.cloud.utils.exception.CloudRuntimeException; | |||||||
|  */ |  */ | ||||||
| public class PermissionDeniedException extends CloudRuntimeException { | public class PermissionDeniedException extends CloudRuntimeException { | ||||||
| 
 | 
 | ||||||
| 	private static final long serialVersionUID = -4631412831814398074L; | 	private static final long serialVersionUID = SerialVersionUID.PermissionDeniedException; | ||||||
| 
 | 
 | ||||||
| 	public PermissionDeniedException(String message) { | 	public PermissionDeniedException(String message) { | ||||||
| 		super(message); | 		super(message); | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ updateResourceLimit=com.cloud.api.commands.UpdateResourceLimitCmd;3 | |||||||
| listResourceLimits=com.cloud.api.commands.ListResourceLimitsCmd;15 | listResourceLimits=com.cloud.api.commands.ListResourceLimitsCmd;15 | ||||||
| 
 | 
 | ||||||
| #### VM commands | #### VM commands | ||||||
| deployVirtualMachine=com.cloud.api.commands.DeployVm2Cmd;11 | deployVirtualMachine=com.cloud.api.commands.DeployVMCmd;11 | ||||||
| destroyVirtualMachine=com.cloud.api.commands.DestroyVMCmd;15 | destroyVirtualMachine=com.cloud.api.commands.DestroyVMCmd;15 | ||||||
| rebootVirtualMachine=com.cloud.api.commands.RebootVMCmd;15 | rebootVirtualMachine=com.cloud.api.commands.RebootVMCmd;15 | ||||||
| startVirtualMachine=com.cloud.api.commands.StartVMCmd;15 | startVirtualMachine=com.cloud.api.commands.StartVMCmd;15 | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ import com.cloud.agent.api.AgentControlCommand; | |||||||
| import com.cloud.agent.api.Answer; | import com.cloud.agent.api.Answer; | ||||||
| import com.cloud.agent.api.Command; | import com.cloud.agent.api.Command; | ||||||
| import com.cloud.agent.api.StartupCommand; | import com.cloud.agent.api.StartupCommand; | ||||||
|  | import com.cloud.exception.ConnectionException; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
| 
 | 
 | ||||||
| @ -73,8 +74,9 @@ public interface Listener { | |||||||
|      * been registered for host events. |      * been registered for host events. | ||||||
|      * @param agentId id of the agent |      * @param agentId id of the agent | ||||||
|      * @param cmd command sent by the agent to the server on startup. |      * @param cmd command sent by the agent to the server on startup. | ||||||
|  |      * @throws ConnectionException if host has problems and needs to put into maintenance state. | ||||||
|      */ |      */ | ||||||
|     boolean processConnect(HostVO host, StartupCommand cmd); |     void processConnect(HostVO host, StartupCommand cmd) throws ConnectionException; | ||||||
|      |      | ||||||
|     /** |     /** | ||||||
|      * This method is called by AgentManager when an agent disconnects |      * This method is called by AgentManager when an agent disconnects | ||||||
|  | |||||||
| @ -96,6 +96,7 @@ import com.cloud.dc.dao.HostPodDao; | |||||||
| import com.cloud.dc.dao.VlanDao; | import com.cloud.dc.dao.VlanDao; | ||||||
| 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.ConnectionException; | ||||||
| import com.cloud.exception.DiscoveryException; | import com.cloud.exception.DiscoveryException; | ||||||
| import com.cloud.exception.InvalidParameterValueException; | import com.cloud.exception.InvalidParameterValueException; | ||||||
| import com.cloud.exception.OperationTimedoutException; | import com.cloud.exception.OperationTimedoutException; | ||||||
| @ -1050,10 +1051,17 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|                 s_logger.debug("Sending Connect to listener: " + monitor.second().getClass().getSimpleName()); |                 s_logger.debug("Sending Connect to listener: " + monitor.second().getClass().getSimpleName()); | ||||||
|             } |             } | ||||||
|             for (int i = 0; i < cmd.length; i++) { |             for (int i = 0; i < cmd.length; i++) { | ||||||
|                 if (!monitor.second().processConnect(host, cmd[i])) { |                 try { | ||||||
|                     s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId); |                     monitor.second().processConnect(host, cmd[i]); | ||||||
|                     handleDisconnect(attache, Event.AgentDisconnected, false); |                 } catch (ConnectionException e) { | ||||||
|                     return attache; |                     if (e.isSetupError()) { | ||||||
|  |                         s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage()); | ||||||
|  |                         handleDisconnect(attache, Event.AgentDisconnected, false); | ||||||
|  |                     } else { | ||||||
|  |                         s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + " due to " + e.getMessage()); | ||||||
|  |                         handleDisconnect(attache, Event.ShutdownRequested, false); | ||||||
|  |                     } | ||||||
|  |                     return null; | ||||||
|                 }  |                 }  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -195,9 +195,8 @@ public class AgentMonitor extends Thread implements Listener { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO host, StartupCommand cmd) { |     public void processConnect(HostVO host, StartupCommand cmd) { | ||||||
|         s_logger.debug("Registering agent monitor for " + host.getId()); |         s_logger.debug("Registering agent monitor for " + host.getId()); | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -80,8 +80,7 @@ public class SynchronousListener implements Listener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     public void processConnect(HostVO agent, StartupCommand cmd) { | ||||||
|         return false; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -50,6 +50,7 @@ public class VMOperationListener implements Listener { | |||||||
| 		_cookie = cookie; | 		_cookie = cookie; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  |     @Override | ||||||
|     public boolean processAnswers(long agentId, long seq, Answer[] answers) { |     public boolean processAnswers(long agentId, long seq, Answer[] answers) { | ||||||
|     	Answer answer = null; |     	Answer answer = null; | ||||||
|     	if(answers != null) |     	if(answers != null) | ||||||
| @ -61,33 +62,40 @@ public class VMOperationListener implements Listener { | |||||||
|     	return true; |     	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean processCommands(long agentId, long seq, Command[] commands) { |     public boolean processCommands(long agentId, long seq, Command[] commands) { | ||||||
|     	return true; |     	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) { |     public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) { | ||||||
|     	return null; |     	return null; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     @Override | ||||||
|     	return true; |     public void processConnect(HostVO agent, StartupCommand cmd) { | ||||||
|  | //    	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean processDisconnect(long agentId, Status state) { |     public boolean processDisconnect(long agentId, Status state) { | ||||||
|     	if(_vm.getHostId() == agentId) |     	if(_vm.getHostId() == agentId) | ||||||
|     		_executor.processDisconnect(this, agentId); |     		_executor.processDisconnect(this, agentId); | ||||||
|     	return true; |     	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean isRecurring() { |     public boolean isRecurring() { | ||||||
|     	return false; |     	return false; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public int getTimeout() { |     public int getTimeout() { | ||||||
|     	// TODO : no time out support for now as underlying support does not work as expected |     	// TODO : no time out support for now as underlying support does not work as expected | ||||||
|     	return -1; |     	return -1; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean processTimeout(long agentId, long seq) { |     public boolean processTimeout(long agentId, long seq) { | ||||||
|     	if(s_logger.isDebugEnabled()) |     	if(s_logger.isDebugEnabled()) | ||||||
|     		s_logger.debug("Process time out for " + agentId + "-" + seq); |     		s_logger.debug("Process time out for " + agentId + "-" + seq); | ||||||
|  | |||||||
| @ -52,6 +52,7 @@ public class VolumeOperationListener implements Listener { | |||||||
| 		_cookie = cookie; | 		_cookie = cookie; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  |     @Override | ||||||
|     public boolean processAnswers(long agentId, long seq, Answer[] answers) { |     public boolean processAnswers(long agentId, long seq, Answer[] answers) { | ||||||
|     	Answer answer = null; |     	Answer answer = null; | ||||||
|     	if(answers != null) |     	if(answers != null) | ||||||
| @ -64,33 +65,39 @@ public class VolumeOperationListener implements Listener { | |||||||
|     	return true; |     	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean processCommands(long agentId, long seq, Command[] commands) { |     public boolean processCommands(long agentId, long seq, Command[] commands) { | ||||||
|     	return true; |     	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) { |     public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) { | ||||||
|     	return null; |     	return null; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     @Override | ||||||
|     	return true; |     public void processConnect(HostVO agent, StartupCommand cmd) { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean processDisconnect(long agentId, Status state) { |     public boolean processDisconnect(long agentId, Status state) { | ||||||
|     	if(_vm.getHostId() == agentId) |     	if(_vm.getHostId() == agentId) | ||||||
|     		_executor.processDisconnect(this, agentId); |     		_executor.processDisconnect(this, agentId); | ||||||
|     	return true; |     	return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean isRecurring() { |     public boolean isRecurring() { | ||||||
|     	return false; |     	return false; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public int getTimeout() { |     public int getTimeout() { | ||||||
|     	// TODO : no time out support for now as underlying support does not work as expected |     	// TODO : no time out support for now as underlying support does not work as expected | ||||||
|     	return -1; |     	return -1; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean processTimeout(long agentId, long seq) { |     public boolean processTimeout(long agentId, long seq) { | ||||||
|     	if(s_logger.isDebugEnabled()) |     	if(s_logger.isDebugEnabled()) | ||||||
|     		s_logger.debug("Process time out for " + agentId + "-" + seq); |     		s_logger.debug("Process time out for " + agentId + "-" + seq); | ||||||
|  | |||||||
| @ -64,9 +64,8 @@ public class ConsoleProxyListener implements Listener { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO host, StartupCommand cmd) { |     public void processConnect(HostVO host, StartupCommand cmd) { | ||||||
|         _proxyMgr.onAgentConnect(host, cmd); |         _proxyMgr.onAgentConnect(host, cmd); | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -33,6 +33,8 @@ import com.cloud.agent.api.StartupCommand; | |||||||
| import com.cloud.agent.api.StartupRoutingCommand; | import com.cloud.agent.api.StartupRoutingCommand; | ||||||
| import com.cloud.agent.manager.Commands; | import com.cloud.agent.manager.Commands; | ||||||
| import com.cloud.exception.AgentUnavailableException; | import com.cloud.exception.AgentUnavailableException; | ||||||
|  | import com.cloud.exception.ConnectionException; | ||||||
|  | import com.cloud.exception.OperationTimedoutException; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
| import com.cloud.host.dao.HostDao; | import com.cloud.host.dao.HostDao; | ||||||
| @ -119,9 +121,9 @@ public class VmSyncListener implements Listener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     public void processConnect(HostVO agent, StartupCommand cmd) throws ConnectionException { | ||||||
|         if (!(cmd instanceof StartupRoutingCommand)) { |         if (!(cmd instanceof StartupRoutingCommand)) { | ||||||
|             return true; |             return; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         long agentId = agent.getId(); |         long agentId = agent.getId(); | ||||||
| @ -135,12 +137,13 @@ public class VmSyncListener implements Listener { | |||||||
|             Commands cmds = new Commands(OnError.Continue); |             Commands cmds = new Commands(OnError.Continue); | ||||||
|             cmds.addCommands(commands); |             cmds.addCommands(commands); | ||||||
|             try { |             try { | ||||||
|                 _agentMgr.send(agentId, cmds, this); |                 Answer[] answers = _agentMgr.send(agentId, cmds); | ||||||
|             } catch (final AgentUnavailableException e) { |             } catch (final AgentUnavailableException e) { | ||||||
|                 s_logger.warn("Agent is unavailable now", e); |                 s_logger.warn("Agent is unavailable now", e); | ||||||
|  |                 throw new ConnectionException(true, "Unable to sync", e); | ||||||
|  |             } catch (final OperationTimedoutException e) { | ||||||
|  |                 throw new ConnectionException(true, "Unable to sync", e); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|          |  | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -71,9 +71,7 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer, | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public boolean processConnect(HostVO host, StartupCommand cmd) { | 	public void processConnect(HostVO host, StartupCommand cmd) { | ||||||
| 		// TODO Auto-generated method stub |  | ||||||
| 		return false; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
|  | |||||||
| @ -45,6 +45,7 @@ import com.cloud.alert.AlertManager; | |||||||
| import com.cloud.configuration.Config; | import com.cloud.configuration.Config; | ||||||
| import com.cloud.dc.ClusterVO; | import com.cloud.dc.ClusterVO; | ||||||
| import com.cloud.dc.dao.ClusterDao; | import com.cloud.dc.dao.ClusterDao; | ||||||
|  | import com.cloud.exception.ConnectionException; | ||||||
| import com.cloud.exception.DiscoveryException; | import com.cloud.exception.DiscoveryException; | ||||||
| import com.cloud.host.HostInfo; | import com.cloud.host.HostInfo; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| @ -521,12 +522,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     public void processConnect(HostVO agent, StartupCommand cmd) throws ConnectionException { | ||||||
|         if (cmd instanceof StartupStorageCommand) { |         if (cmd instanceof StartupStorageCommand) { | ||||||
|             createPVTemplate(agent.getId(), (StartupStorageCommand)cmd); |             createPVTemplate(agent.getId(), (StartupStorageCommand)cmd); | ||||||
|             return true; |  | ||||||
|         } |         } | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -31,6 +31,7 @@ import com.cloud.agent.api.Command; | |||||||
| import com.cloud.agent.api.StartupCommand; | import com.cloud.agent.api.StartupCommand; | ||||||
| import com.cloud.agent.api.StartupRoutingCommand; | import com.cloud.agent.api.StartupRoutingCommand; | ||||||
| import com.cloud.configuration.dao.ConfigurationDao; | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
|  | import com.cloud.exception.ConnectionException; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
| import com.cloud.host.dao.HostDao; | import com.cloud.host.dao.HostDao; | ||||||
| @ -71,10 +72,10 @@ public class SshKeysDistriMonitor implements Listener { | |||||||
| 	    } | 	    } | ||||||
| 	     | 	     | ||||||
| 	    @Override | 	    @Override | ||||||
| 	    public boolean processConnect(HostVO host, StartupCommand cmd) { | 	    public void processConnect(HostVO host, StartupCommand cmd) throws ConnectionException { | ||||||
| 	    	if (cmd instanceof StartupRoutingCommand) { | 	    	if (cmd instanceof StartupRoutingCommand) { | ||||||
| 	    		if (((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.KVM || | 	    		if (((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.KVM || | ||||||
| 	    		        ((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.XenServer) { | 	    		    ((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.XenServer) { | ||||||
| 	    			/*TODO: Get the private/public keys here*/ | 	    			/*TODO: Get the private/public keys here*/ | ||||||
| 	    			 | 	    			 | ||||||
| 	    			Map<String, String> configs = _configDao.getConfiguration("management-server", new HashMap<String, Object>()); | 	    			Map<String, String> configs = _configDao.getConfiguration("management-server", new HashMap<String, Object>()); | ||||||
| @ -82,11 +83,10 @@ public class SshKeysDistriMonitor implements Listener { | |||||||
| 	    			String prvKey = configs.get("ssh.privatekey"); | 	    			String prvKey = configs.get("ssh.privatekey"); | ||||||
| 	    			if (!_routerMgr.sendSshKeysToHost(host.getId(), pubKey, prvKey)) { | 	    			if (!_routerMgr.sendSshKeysToHost(host.getId(), pubKey, prvKey)) { | ||||||
| 	    				s_logger.debug("Failed to send keys to agent: " + host.getId()); | 	    				s_logger.debug("Failed to send keys to agent: " + host.getId()); | ||||||
| 	    				return false; | 	    				throw new ConnectionException(true, "Unable to send keys to the agent"); | ||||||
| 	    			} | 	    			} | ||||||
| 	    		} | 	    		} | ||||||
| 	    	} | 	    	} | ||||||
|     		return true; |  | ||||||
| 	    } | 	    } | ||||||
| 
 | 
 | ||||||
| 		@Override | 		@Override | ||||||
|  | |||||||
| @ -111,9 +111,7 @@ public class NetworkGroupListener implements Listener { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public boolean processConnect(HostVO host, StartupCommand cmd) { | 	public void processConnect(HostVO host, StartupCommand cmd) { | ||||||
| 		 |  | ||||||
| 		return true; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -27,9 +27,9 @@ import com.cloud.agent.api.Command; | |||||||
| import com.cloud.agent.api.StartupCommand; | import com.cloud.agent.api.StartupCommand; | ||||||
| import com.cloud.agent.api.StartupStorageCommand; | import com.cloud.agent.api.StartupStorageCommand; | ||||||
| import com.cloud.agent.api.StoragePoolInfo; | import com.cloud.agent.api.StoragePoolInfo; | ||||||
|  | import com.cloud.exception.ConnectionException; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
| import com.cloud.storage.Storage.StorageResourceType; |  | ||||||
| import com.cloud.storage.dao.StoragePoolDao; | import com.cloud.storage.dao.StoragePoolDao; | ||||||
| import com.cloud.storage.dao.StoragePoolHostDao; | import com.cloud.storage.dao.StoragePoolHostDao; | ||||||
| import com.cloud.utils.component.Inject; | import com.cloud.utils.component.Inject; | ||||||
| @ -65,20 +65,20 @@ public class LocalStoragePoolListener implements Listener { | |||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public boolean processConnect(HostVO host, StartupCommand cmd) { |     public void processConnect(HostVO host, StartupCommand cmd) throws ConnectionException { | ||||||
|         if (!(cmd instanceof StartupStorageCommand)) { |         if (!(cmd instanceof StartupStorageCommand)) { | ||||||
|             return true; |             return; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         StartupStorageCommand ssCmd = (StartupStorageCommand)cmd; |         StartupStorageCommand ssCmd = (StartupStorageCommand)cmd; | ||||||
|          |          | ||||||
|         if (ssCmd.getResourceType() != Storage.StorageResourceType.STORAGE_POOL) { |         if (ssCmd.getResourceType() != Storage.StorageResourceType.STORAGE_POOL) { | ||||||
|             return true; |             return; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         StoragePoolInfo pInfo = ssCmd.getPoolInfo(); |         StoragePoolInfo pInfo = ssCmd.getPoolInfo(); | ||||||
|         if (pInfo == null) { |         if (pInfo == null) { | ||||||
|             return true; |             return; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         try { |         try { | ||||||
| @ -114,9 +114,8 @@ public class LocalStoragePoolListener implements Listener { | |||||||
|             } |             } | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             s_logger.warn("Unable to setup the local storage pool for " + host, e); |             s_logger.warn("Unable to setup the local storage pool for " + host, e); | ||||||
|             return false; |             throw new ConnectionException(true, "Unable to setup the local storage pool for " + host, e); | ||||||
|         } |         } | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     |     | ||||||
|  | |||||||
| @ -39,6 +39,7 @@ import com.cloud.agent.api.storage.DownloadProgressCommand; | |||||||
| import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType; | import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType; | ||||||
| import com.cloud.event.EventTypes; | import com.cloud.event.EventTypes; | ||||||
| import com.cloud.event.EventVO; | import com.cloud.event.EventVO; | ||||||
|  | import com.cloud.exception.ConnectionException; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.storage.Storage; | import com.cloud.storage.Storage; | ||||||
| import com.cloud.storage.VMTemplateHostVO; | import com.cloud.storage.VMTemplateHostVO; | ||||||
| @ -274,13 +275,13 @@ public class DownloadListener implements Listener { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	@Override | 	@Override | ||||||
| 	public boolean processConnect(HostVO agent, StartupCommand cmd) { | 	public void processConnect(HostVO agent, StartupCommand cmd) throws ConnectionException { | ||||||
| 	    if (!(cmd instanceof StartupStorageCommand)) { | 	    if (!(cmd instanceof StartupStorageCommand)) { | ||||||
| 	        return true; | 	        return; | ||||||
| 	    } | 	    } | ||||||
| 	    if (cmd.getGuid().startsWith("iso:")) { | 	    if (cmd.getGuid().startsWith("iso:")) { | ||||||
| 	        //FIXME: do not download template for ISO secondary | 	        //FIXME: do not download template for ISO secondary | ||||||
| 	        return true; | 	        return; | ||||||
| 	    } | 	    } | ||||||
| 	     | 	     | ||||||
| 	    long agentId = agent.getId(); | 	    long agentId = agent.getId(); | ||||||
| @ -294,8 +295,6 @@ public class DownloadListener implements Listener { | |||||||
| 	    	//downloadMonitor.handlePoolTemplateSync(storage.getPoolInfo(), storage.getTemplateInfo()); | 	    	//downloadMonitor.handlePoolTemplateSync(storage.getPoolInfo(), storage.getTemplateInfo()); | ||||||
| 	    	//no need to do anything. The storagepoolmonitor will initiate template sync. | 	    	//no need to do anything. The storagepoolmonitor will initiate template sync. | ||||||
| 	    } | 	    } | ||||||
| 	     |  | ||||||
| 	    return true; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public void setCommand(DownloadCommand _cmd) { | 	public void setCommand(DownloadCommand _cmd) { | ||||||
|  | |||||||
| @ -66,7 +66,7 @@ public class StoragePoolMonitor implements Listener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO host, StartupCommand cmd) { |     public void processConnect(HostVO host, StartupCommand cmd) { | ||||||
|     	if (cmd instanceof StartupRoutingCommand) { |     	if (cmd instanceof StartupRoutingCommand) { | ||||||
|     		StartupRoutingCommand scCmd = (StartupRoutingCommand)cmd; |     		StartupRoutingCommand scCmd = (StartupRoutingCommand)cmd; | ||||||
|     		if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType() ==  HypervisorType.KVM || |     		if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType() ==  HypervisorType.KVM || | ||||||
| @ -81,7 +81,6 @@ public class StoragePoolMonitor implements Listener { | |||||||
|     			} |     			} | ||||||
|     		} |     		} | ||||||
|     	} |     	} | ||||||
|     	return true; |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -52,8 +52,7 @@ public class StorageSyncListener implements Listener { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     public void processConnect(HostVO agent, StartupCommand cmd) { | ||||||
|         return false; |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -29,7 +29,6 @@ import com.cloud.agent.api.StartupStorageCommand; | |||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
| import com.cloud.storage.Storage; | import com.cloud.storage.Storage; | ||||||
| import com.cloud.storage.Storage.StorageResourceType; |  | ||||||
| 
 | 
 | ||||||
| public class SecondaryStorageListener implements Listener { | public class SecondaryStorageListener implements Listener { | ||||||
|     private final static Logger s_logger = Logger.getLogger(SecondaryStorageListener.class); |     private final static Logger s_logger = Logger.getLogger(SecondaryStorageListener.class); | ||||||
| @ -76,11 +75,10 @@ public class SecondaryStorageListener implements Listener { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean processConnect(HostVO agent, StartupCommand cmd) { |     public void processConnect(HostVO agent, StartupCommand cmd) { | ||||||
|         if(s_logger.isInfoEnabled()) |  | ||||||
|             s_logger.info("Received a host startup notification"); |  | ||||||
|          |  | ||||||
|         if (cmd instanceof StartupStorageCommand) { |         if (cmd instanceof StartupStorageCommand) { | ||||||
|  |             if(s_logger.isInfoEnabled()) | ||||||
|  |                 s_logger.info("Received a host startup notification"); | ||||||
|              |              | ||||||
|             StartupStorageCommand ss = (StartupStorageCommand)cmd; |             StartupStorageCommand ss = (StartupStorageCommand)cmd; | ||||||
|             if (ss.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE) { |             if (ss.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE) { | ||||||
| @ -89,8 +87,6 @@ public class SecondaryStorageListener implements Listener { | |||||||
|             	_ssVmMgr.generateSetupCommand(agent.getDataCenterId()); |             	_ssVmMgr.generateSetupCommand(agent.getDataCenterId()); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -24,15 +24,13 @@ import com.cloud.agent.api.storage.UploadProgressCommand.RequestType; | |||||||
| import com.cloud.async.AsyncJobManager; | import com.cloud.async.AsyncJobManager; | ||||||
| import com.cloud.async.AsyncJobResult; | import com.cloud.async.AsyncJobResult; | ||||||
| import com.cloud.async.executor.ExtractJobResultObject; | import com.cloud.async.executor.ExtractJobResultObject; | ||||||
| import com.cloud.event.EventTypes; |  | ||||||
| import com.cloud.event.EventVO; | import com.cloud.event.EventVO; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.storage.Storage; | import com.cloud.storage.Storage; | ||||||
| import com.cloud.storage.UploadVO; |  | ||||||
| import com.cloud.storage.dao.UploadDao; |  | ||||||
| import com.cloud.storage.Upload.Status; | import com.cloud.storage.Upload.Status; | ||||||
| import com.cloud.storage.Upload.Type; | import com.cloud.storage.Upload.Type; | ||||||
| import com.cloud.storage.upload.UploadMonitorImpl; | import com.cloud.storage.UploadVO; | ||||||
|  | import com.cloud.storage.dao.UploadDao; | ||||||
| import com.cloud.storage.upload.UploadState.UploadEvent; | import com.cloud.storage.upload.UploadState.UploadEvent; | ||||||
| import com.cloud.utils.exception.CloudRuntimeException; | import com.cloud.utils.exception.CloudRuntimeException; | ||||||
| 
 | 
 | ||||||
| @ -210,9 +208,9 @@ public class UploadListener implements Listener { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public boolean processConnect(HostVO agent, StartupCommand cmd) {		 | 	public void processConnect(HostVO agent, StartupCommand cmd) {		 | ||||||
| 		if (!(cmd instanceof StartupStorageCommand)) { | 		if (!(cmd instanceof StartupStorageCommand)) { | ||||||
| 	        return true; | 	        return; | ||||||
| 	    } | 	    } | ||||||
| 	    | 	    | ||||||
| 	    long agentId = agent.getId(); | 	    long agentId = agent.getId(); | ||||||
| @ -223,7 +221,6 @@ public class UploadListener implements Listener { | |||||||
| 	    { | 	    { | ||||||
| 	    	uploadMonitor.handleUploadSync(agentId); | 	    	uploadMonitor.handleUploadSync(agentId); | ||||||
| 	    } | 	    } | ||||||
| 		return true; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
|  | |||||||
| @ -63,7 +63,6 @@ import com.cloud.agent.api.VmStatsEntry; | |||||||
| import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; | import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; | ||||||
| import com.cloud.agent.manager.Commands; | import com.cloud.agent.manager.Commands; | ||||||
| import com.cloud.alert.AlertManager; | import com.cloud.alert.AlertManager; | ||||||
| import com.cloud.api.ApiDBUtils; |  | ||||||
| import com.cloud.api.BaseCmd; | import com.cloud.api.BaseCmd; | ||||||
| import com.cloud.api.ServerApiException; | import com.cloud.api.ServerApiException; | ||||||
| import com.cloud.api.commands.AttachVolumeCmd; | import com.cloud.api.commands.AttachVolumeCmd; | ||||||
| @ -3804,18 +3803,18 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM | |||||||
|     public UserVm createVirtualMachine(DeployVm2Cmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException { |     public UserVm createVirtualMachine(DeployVm2Cmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException { | ||||||
|         Account caller = UserContext.current().getAccount(); |         Account caller = UserContext.current().getAccount(); | ||||||
|          |          | ||||||
|         Domain domain = _domainDao.findById(cmd.getDomainId()); |         AccountVO owner = _accountDao.findById(cmd.getAccountId()); | ||||||
|  |         if (owner == null || owner.getRemoved() != null) { | ||||||
|  |             throw new InvalidParameterValueException("Unable to find account: " + cmd.getAccountId()); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         Domain domain = _domainDao.findById(owner.getDomainId()); | ||||||
|         if (domain == null || domain.getRemoved() != null) { |         if (domain == null || domain.getRemoved() != null) { | ||||||
|             throw new InvalidParameterValueException("Unable to find domain: " + cmd.getDomainId()); |             throw new InvalidParameterValueException("Unable to find domain: " + cmd.getDomainId()); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         _accountMgr.checkAccess(caller, domain); |         _accountMgr.checkAccess(caller, domain); | ||||||
|          |          | ||||||
|         AccountVO owner = _accountDao.findById(cmd.getAccountId()); |  | ||||||
|         if (owner == null || owner.getRemoved() != null) { |  | ||||||
|             throw new InvalidParameterValueException("Unable to find account: " + cmd.getAccountId()); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         DataCenterVO dc = _dcDao.findById(cmd.getZoneId()); |         DataCenterVO dc = _dcDao.findById(cmd.getZoneId()); | ||||||
|         if (dc == null) { |         if (dc == null) { | ||||||
|             throw new InvalidParameterValueException("Unable to find zone: " + cmd.getZoneId()); |             throw new InvalidParameterValueException("Unable to find zone: " + cmd.getZoneId()); | ||||||
|  | |||||||
| @ -32,12 +32,6 @@ public interface SerialVersionUID { | |||||||
|     public static final long CloudRuntimeException = Base | 0x2; |     public static final long CloudRuntimeException = Base | 0x2; | ||||||
|     public static final long CloudStartupServlet = Base | 0x3; |     public static final long CloudStartupServlet = Base | 0x3; | ||||||
|     public static final long CloudServiceImpl = Base | 0x4; |     public static final long CloudServiceImpl = Base | 0x4; | ||||||
|     public static final long UserRemote = Base | 0x5; |  | ||||||
|     public static final long ServiceOfferingRemote = Base | 0x6; |  | ||||||
|     public static final long VMTemplateRemote = Base | 0x7; |  | ||||||
|     public static final long VMInstanceRemote = Base | 0x8; |  | ||||||
|     public static final long IPAddressRemote = Base | 0x9; |  | ||||||
|     public static final long IPForwardingRemote = Base | 0xa; |  | ||||||
|     public static final long UnsupportedVersionException = Base | 0xb; |     public static final long UnsupportedVersionException = Base | 0xb; | ||||||
|     public static final long DataCenterIpAddressPK = Base | 0xc; |     public static final long DataCenterIpAddressPK = Base | 0xc; | ||||||
|     public static final long UnableToExecuteException = Base | 0xd; |     public static final long UnableToExecuteException = Base | 0xd; | ||||||
| @ -59,4 +53,6 @@ public interface SerialVersionUID { | |||||||
|     public static final long CloudAuthenticationException = Base | 0x1d; |     public static final long CloudAuthenticationException = Base | 0x1d; | ||||||
|     public static final long AsyncCommandQueued = Base | 0x1e; |     public static final long AsyncCommandQueued = Base | 0x1e; | ||||||
|     public static final long ResourceUnavailableException = Base | 0x1f; |     public static final long ResourceUnavailableException = Base | 0x1f; | ||||||
|  |     public static final long ConnectionException = Base | 0x20; | ||||||
|  |     public static final long PermissionDeniedException = Base | 0x21; | ||||||
| } | } | ||||||
|  | |||||||
| @ -803,7 +803,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene | |||||||
|      |      | ||||||
|     protected T findById(ID id, boolean removed, Boolean lock) { |     protected T findById(ID id, boolean removed, Boolean lock) { | ||||||
|         StringBuilder sql = new StringBuilder(_selectByIdSql); |         StringBuilder sql = new StringBuilder(_selectByIdSql); | ||||||
|         if (!removed) { |         if (!removed && _removed != null) { | ||||||
|             sql.append(" AND ").append(_removed.first()); |             sql.append(" AND ").append(_removed.first()); | ||||||
|         } |         } | ||||||
|         if (lock != null) { |         if (lock != null) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user