mirror of https://github.com/apache/cloudstack.git
Renamed MauricMoss now that we're going public with this.
This commit is contained in:
parent
9bae18d915
commit
e49fab6903
|
|
@ -1,120 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.utils.exception.ExecutionException;
|
||||
|
||||
/**
|
||||
* HighAvailabilityHandler specifies the methods that are used to control
|
||||
* VMs during the sync process and the HA process. While different types of
|
||||
* VMs have a lot in common, they allocate resources differently and it
|
||||
* doesn't make sense to
|
||||
*
|
||||
*/
|
||||
public interface VirtualMachineManager<T extends VMInstanceVO> {
|
||||
|
||||
/**
|
||||
* Returns the id parsed from the name. If it cannot parse the name,
|
||||
* then return null. This method is used to determine if this is
|
||||
* the right handler for this vm.
|
||||
*
|
||||
* @param vmName vm name coming form the agent.
|
||||
* @return id if the handler works for this vm and can parse id. null if not.
|
||||
*/
|
||||
Long convertToId(String vmName);
|
||||
|
||||
/**
|
||||
* Retrieves the vm based on the id given.
|
||||
*
|
||||
* @param id id of the vm.
|
||||
* @return VMInstanceVO
|
||||
*/
|
||||
T get(long id);
|
||||
|
||||
/**
|
||||
* Complete the start command. HA calls this when it determines that
|
||||
* a vm was starting but the state was not complete.
|
||||
*
|
||||
* @param vm vm to execute this on.
|
||||
*/
|
||||
void completeStartCommand(T vm);
|
||||
|
||||
/**
|
||||
* Complete the stop command. HA calls this when it determines that
|
||||
* a vm was being stopped but it didn't complete.
|
||||
*
|
||||
* @param vm vm to stop.
|
||||
*/
|
||||
void completeStopCommand(T vm);
|
||||
|
||||
/**
|
||||
* start the vm
|
||||
*
|
||||
* @param vm to start.
|
||||
* @return true if started. false if not.
|
||||
* @throws InsufficientCapacityException if there's not enough capacity to start the vm.
|
||||
* @throws StorageUnavailableException if the storage is unavailable.
|
||||
* @throws ConcurrentOperationException there's multiple threads working on this vm.
|
||||
* @throws ExecutionException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
T start(long vmId, long startEventId) throws InsufficientCapacityException, StorageUnavailableException, ConcurrentOperationException, ExecutionException;
|
||||
|
||||
/**
|
||||
* stop the vm
|
||||
*
|
||||
* @param vm vm to Stop.
|
||||
* @return true if stopped and false if not.
|
||||
* @throws AgentUnavailableException if the agent is unavailable.
|
||||
*/
|
||||
boolean stop(T vm, long startEventId) throws AgentUnavailableException;
|
||||
|
||||
/**
|
||||
* Produce a cleanup command to be sent to the agent to cleanup anything
|
||||
* out of the ordinary.
|
||||
* @param vm vm to cleanup. It's possible this is null.
|
||||
* @param vmName name of the vm from the agent.
|
||||
* @return Command to clean it up. If not cleanup is needed, then return null.
|
||||
*/
|
||||
Command cleanup(T vm, String vmName);
|
||||
|
||||
/**
|
||||
* Prepare for migration.
|
||||
*
|
||||
* @param vm vm to migrate.
|
||||
* @return HostVO if a host is found.
|
||||
*/
|
||||
HostVO prepareForMigration(T vm) throws InsufficientCapacityException, StorageUnavailableException;
|
||||
|
||||
/**
|
||||
* Migrate the vm.
|
||||
*/
|
||||
boolean migrate(T vm, HostVO host) throws AgentUnavailableException, OperationTimedoutException;
|
||||
|
||||
boolean completeMigration(T vm, HostVO host) throws AgentUnavailableException, OperationTimedoutException;
|
||||
|
||||
boolean destroy(T vm) throws AgentUnavailableException;
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ import com.cloud.user.dao.AccountDao;
|
|||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.vm.UserVmManager;
|
||||
import com.cloud.vm.VmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
|
|
@ -52,5 +52,5 @@ public interface AsyncJobExecutorContext extends Manager {
|
|||
public IPAddressDao getIpAddressDao();
|
||||
public AsyncJobDao getJobDao();
|
||||
public UserDao getUserDao();
|
||||
public VmManager getItMgr();
|
||||
public VirtualMachineManager getItMgr();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.cloud.user.dao.AccountDao;
|
|||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.vm.UserVmManager;
|
||||
import com.cloud.vm.VmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ public class AsyncJobExecutorContextImpl implements AsyncJobExecutorContext {
|
|||
private IPAddressDao _ipAddressDao;
|
||||
private AsyncJobDao _jobDao;
|
||||
private UserDao _userDao;
|
||||
private VmManager _itMgr;
|
||||
private VirtualMachineManager _itMgr;
|
||||
|
||||
private ManagementServer _managementServer;
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ public class AsyncJobExecutorContextImpl implements AsyncJobExecutorContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public VmManager getItMgr() {
|
||||
public VirtualMachineManager getItMgr() {
|
||||
return _itMgr;
|
||||
}
|
||||
|
||||
|
|
@ -226,9 +226,9 @@ public class AsyncJobExecutorContextImpl implements AsyncJobExecutorContext {
|
|||
throw new ConfigurationException("unable to get " + UserDao.class.getName());
|
||||
}
|
||||
|
||||
_itMgr = locator.getManager(VmManager.class);
|
||||
_itMgr = locator.getManager(VirtualMachineManager.class);
|
||||
if (_itMgr == null) {
|
||||
throw new ConfigurationException("unable to get " + VmManager.class.getName());
|
||||
throw new ConfigurationException("unable to get " + VirtualMachineManager.class.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ import com.cloud.utils.component.ComponentLocator.ComponentInfo;
|
|||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.vm.ItWorkDaoImpl;
|
||||
import com.cloud.vm.MauriceMoss;
|
||||
import com.cloud.vm.VirtualMachineManagerImpl;
|
||||
import com.cloud.vm.UserVmManagerImpl;
|
||||
import com.cloud.vm.dao.ConsoleProxyDaoImpl;
|
||||
import com.cloud.vm.dao.DomainRouterDaoImpl;
|
||||
|
|
@ -279,7 +279,7 @@ public class DefaultComponentLibrary implements ComponentLibrary {
|
|||
addManager("Snapshot Manager", SnapshotManagerImpl.class);
|
||||
addManager("SnapshotScheduler", SnapshotSchedulerImpl.class);
|
||||
addManager("NetworkGroupManager", NetworkGroupManagerImpl.class);
|
||||
addManager("VmManager", MauriceMoss.class);
|
||||
addManager("VmManager", VirtualMachineManagerImpl.class);
|
||||
addManager("DomainRouterManager", DomainRouterManagerImpl.class);
|
||||
addManager("EntityManager", EntityManagerImpl.class);
|
||||
addManager("LoadBalancingRulesManager", LoadBalancingRulesManagerImpl.class);
|
||||
|
|
|
|||
|
|
@ -158,10 +158,9 @@ import com.cloud.vm.State;
|
|||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineGuru;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VirtualMachineName;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.VmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
|
@ -187,7 +186,7 @@ import com.google.gson.GsonBuilder;
|
|||
// because sooner or later, it will be driven into Running state
|
||||
//
|
||||
@Local(value = { ConsoleProxyManager.class, ConsoleProxyService.class })
|
||||
public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProxyService, Manager, VirtualMachineManager<ConsoleProxyVO>, AgentHook, VirtualMachineGuru<ConsoleProxyVO> {
|
||||
public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProxyService, Manager, AgentHook, VirtualMachineGuru<ConsoleProxyVO> {
|
||||
private static final Logger s_logger = Logger.getLogger(ConsoleProxyManagerImpl.class);
|
||||
|
||||
private static final int DEFAULT_FIND_HOST_RETRY_COUNT = 2;
|
||||
|
|
@ -266,7 +265,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
|
|||
private AsyncJobManager _asyncMgr;
|
||||
|
||||
@Inject
|
||||
private VmManager _itMgr;
|
||||
private VirtualMachineManager _itMgr;
|
||||
|
||||
@Inject
|
||||
private ClusterManager _clMgr;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ import com.cloud.vm.VMInstanceVO;
|
|||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Event;
|
||||
import com.cloud.vm.VirtualMachineGuru;
|
||||
import com.cloud.vm.VmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
/**
|
||||
|
|
@ -131,7 +131,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
|
|||
@Inject StorageManager _storageMgr;
|
||||
@Inject GuestOSDao _guestOSDao;
|
||||
@Inject GuestOSCategoryDao _guestOSCategoryDao;
|
||||
@Inject VmManager _itMgr;
|
||||
@Inject VirtualMachineManager _itMgr;
|
||||
|
||||
String _instance;
|
||||
ScheduledExecutorService _executor;
|
||||
|
|
|
|||
|
|
@ -176,10 +176,9 @@ import com.cloud.vm.State;
|
|||
import com.cloud.vm.UserVmVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineGuru;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VirtualMachineName;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.VmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
|
@ -188,7 +187,7 @@ import com.cloud.vm.dao.UserVmDao;
|
|||
* NetworkManagerImpl implements NetworkManager.
|
||||
*/
|
||||
@Local(value={DomainRouterManager.class, DomainRouterService.class})
|
||||
public class DomainRouterManagerImpl implements DomainRouterManager, DomainRouterService, VirtualMachineManager<DomainRouterVO>, VirtualMachineGuru<DomainRouterVO> {
|
||||
public class DomainRouterManagerImpl implements DomainRouterManager, DomainRouterService, VirtualMachineGuru<DomainRouterVO> {
|
||||
private static final Logger s_logger = Logger.getLogger(DomainRouterManagerImpl.class);
|
||||
|
||||
String _name;
|
||||
|
|
@ -233,7 +232,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
|
|||
@Inject NicDao _nicDao;
|
||||
@Inject GuestOSDao _guestOSDao = null;
|
||||
@Inject NetworkManager _networkMgr;
|
||||
@Inject VmManager _itMgr;
|
||||
@Inject VirtualMachineManager _itMgr;
|
||||
@Inject VpnUserDao _vpnUsersDao;
|
||||
@Inject RemoteAccessVpnDao _remoteAccessVpnDao;
|
||||
@Inject RulesManager _rulesMgr;
|
||||
|
|
|
|||
|
|
@ -137,10 +137,9 @@ import com.cloud.vm.SecondaryStorageVmVO;
|
|||
import com.cloud.vm.State;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineGuru;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VirtualMachineName;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.VmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
|
@ -165,7 +164,7 @@ import com.cloud.vm.dao.VMInstanceDao;
|
|||
// because sooner or later, it will be driven into Running state
|
||||
//
|
||||
@Local(value={SecondaryStorageVmManager.class})
|
||||
public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, VirtualMachineManager<SecondaryStorageVmVO>, VirtualMachineGuru<SecondaryStorageVmVO> {
|
||||
public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, VirtualMachineGuru<SecondaryStorageVmVO> {
|
||||
private static final Logger s_logger = Logger.getLogger(SecondaryStorageManagerImpl.class);
|
||||
|
||||
private static final int DEFAULT_FIND_HOST_RETRY_COUNT = 2;
|
||||
|
|
@ -222,7 +221,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
@Inject private ServiceOfferingDao _offeringDao;
|
||||
@Inject private AccountService _accountMgr;
|
||||
@Inject GuestOSDao _guestOSDao = null;
|
||||
@Inject private VmManager _itMgr;
|
||||
@Inject private VirtualMachineManager _itMgr;
|
||||
@Inject private NicDao _nicDao;
|
||||
@Inject private NetworkDao _networkDao;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import com.cloud.vm.VirtualMachine.Event;
|
|||
* UserVmManager contains all of the code to work with user VMs.
|
||||
*
|
||||
*/
|
||||
public interface UserVmManager extends VirtualMachineManager<UserVmVO> {
|
||||
public interface UserVmManager extends VirtualMachineGuru<UserVmVO>{
|
||||
|
||||
static final int MAX_USER_DATA_LENGTH_BYTES = 2048;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ import com.cloud.vm.dao.InstanceGroupVMMapDao;
|
|||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
@Local(value={UserVmManager.class, UserVmService.class})
|
||||
public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualMachineGuru<UserVmVO>, Manager, VirtualMachineManager<UserVmVO> {
|
||||
public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualMachineGuru<UserVmVO>, Manager {
|
||||
private static final Logger s_logger = Logger.getLogger(UserVmManagerImpl.class);
|
||||
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3; // 3 seconds
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM
|
|||
@Inject EventDao _eventDao = null;
|
||||
@Inject InstanceGroupDao _vmGroupDao;
|
||||
@Inject InstanceGroupVMMapDao _groupVMMapDao;
|
||||
@Inject VmManager _itMgr;
|
||||
@Inject VirtualMachineManager _itMgr;
|
||||
@Inject NetworkDao _networkDao;
|
||||
@Inject DomainRouterManager _routerMgr;
|
||||
@Inject NicDao _nicDao;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import com.cloud.vm.VirtualMachine.Event;
|
|||
/**
|
||||
* Manages allocating resources to vms.
|
||||
*/
|
||||
public interface VmManager extends Manager {
|
||||
public interface VirtualMachineManager extends Manager {
|
||||
|
||||
<T extends VMInstanceVO> T allocate(T vm,
|
||||
VMTemplateVO template,
|
||||
|
|
@ -95,9 +95,9 @@ import com.cloud.vm.dao.SecondaryStorageVmDao;
|
|||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
@Local(value=VmManager.class)
|
||||
public class MauriceMoss implements VmManager, ClusterManagerListener {
|
||||
private static final Logger s_logger = Logger.getLogger(MauriceMoss.class);
|
||||
@Local(value=VirtualMachineManager.class)
|
||||
public class VirtualMachineManagerImpl implements VirtualMachineManager, ClusterManagerListener {
|
||||
private static final Logger s_logger = Logger.getLogger(VirtualMachineManagerImpl.class);
|
||||
|
||||
String _name;
|
||||
@Inject private StorageManager _storageMgr;
|
||||
|
|
@ -317,7 +317,7 @@ public class MauriceMoss implements VmManager, ClusterManagerListener {
|
|||
return _name;
|
||||
}
|
||||
|
||||
protected MauriceMoss() {
|
||||
protected VirtualMachineManagerImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
Loading…
Reference in New Issue