mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Add, Delete Storage Pool commands should be able execute on a host in maintenance (#9301)
* Restart agent when host comes out of maintenance * Don't send CreateStoragePoolCommand to hosts in maintenance mode * CreateStoragePoolCommand can run when host in maintenance. Reverted the change to restart agent when host was already up and in maintenance * Reverted changes done to ResourceManagerImplTest
This commit is contained in:
parent
6b25ed7a02
commit
644f3a3f48
@ -126,6 +126,8 @@ public interface ResourceManager extends ResourceService, Configurable {
|
|||||||
|
|
||||||
public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType type, long dcId);
|
public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType type, long dcId);
|
||||||
|
|
||||||
|
public List<HostVO> listAllUpHostsInOneZoneByHypervisor(HypervisorType type, long dcId);
|
||||||
|
|
||||||
public List<HostVO> listAllUpAndEnabledHostsInOneZone(long dcId);
|
public List<HostVO> listAllUpAndEnabledHostsInOneZone(long dcId);
|
||||||
|
|
||||||
public List<HostVO> listAllHostsInOneZoneByType(Host.Type type, long dcId);
|
public List<HostVO> listAllHostsInOneZoneByType(Host.Type type, long dcId);
|
||||||
|
|||||||
@ -44,6 +44,8 @@ import com.cloud.agent.api.CheckOnHostCommand;
|
|||||||
import com.cloud.agent.api.CheckVirtualMachineCommand;
|
import com.cloud.agent.api.CheckVirtualMachineCommand;
|
||||||
import com.cloud.agent.api.CleanupNetworkRulesCmd;
|
import com.cloud.agent.api.CleanupNetworkRulesCmd;
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
|
import com.cloud.agent.api.CreateStoragePoolCommand;
|
||||||
|
import com.cloud.agent.api.DeleteStoragePoolCommand;
|
||||||
import com.cloud.agent.api.MaintainCommand;
|
import com.cloud.agent.api.MaintainCommand;
|
||||||
import com.cloud.agent.api.MigrateCommand;
|
import com.cloud.agent.api.MigrateCommand;
|
||||||
import com.cloud.agent.api.ModifySshKeysCommand;
|
import com.cloud.agent.api.ModifySshKeysCommand;
|
||||||
@ -119,8 +121,9 @@ public abstract class AgentAttache {
|
|||||||
StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(),
|
StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(),
|
||||||
ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(),
|
ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(),
|
||||||
CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString(), CheckOnHostCommand.class.toString(),
|
CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString(), CheckOnHostCommand.class.toString(),
|
||||||
ModifyTargetsCommand.class.toString(), ModifySshKeysCommand.class.toString(), ModifyStoragePoolCommand.class.toString(), SetupMSListCommand.class.toString(), RollingMaintenanceCommand.class.toString(),
|
ModifyTargetsCommand.class.toString(), ModifySshKeysCommand.class.toString(),
|
||||||
CleanupPersistentNetworkResourceCommand.class.toString()};
|
CreateStoragePoolCommand.class.toString(), DeleteStoragePoolCommand.class.toString(), ModifyStoragePoolCommand.class.toString(),
|
||||||
|
SetupMSListCommand.class.toString(), RollingMaintenanceCommand.class.toString(), CleanupPersistentNetworkResourceCommand.class.toString()};
|
||||||
protected final static String[] s_commandsNotAllowedInConnectingMode = new String[] { StartCommand.class.toString(), CreateCommand.class.toString() };
|
protected final static String[] s_commandsNotAllowedInConnectingMode = new String[] { StartCommand.class.toString(), CreateCommand.class.toString() };
|
||||||
static {
|
static {
|
||||||
Arrays.sort(s_commandsAllowedInMaintenanceMode);
|
Arrays.sort(s_commandsAllowedInMaintenanceMode);
|
||||||
|
|||||||
@ -467,7 +467,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) {
|
public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) {
|
||||||
List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(hypervisorType, scope.getScopeId());
|
List<HostVO> hosts = _resourceMgr.listAllUpHostsInOneZoneByHypervisor(hypervisorType, scope.getScopeId());
|
||||||
s_logger.debug("In createPool. Attaching the pool to each of the hosts.");
|
s_logger.debug("In createPool. Attaching the pool to each of the hosts.");
|
||||||
List<HostVO> poolHosts = new ArrayList<HostVO>();
|
List<HostVO> poolHosts = new ArrayList<HostVO>();
|
||||||
for (HostVO host : hosts) {
|
for (HostVO host : hosts) {
|
||||||
|
|||||||
@ -3255,6 +3255,15 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
return sc.list();
|
return sc.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HostVO> listAllUpHostsInOneZoneByHypervisor(final HypervisorType type, final long dcId) {
|
||||||
|
final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
|
||||||
|
sc.and(sc.entity().getHypervisorType(), Op.EQ, type);
|
||||||
|
sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId);
|
||||||
|
sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
|
||||||
|
return sc.list();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HostVO> listAllUpAndEnabledHostsInOneZone(final long dcId) {
|
public List<HostVO> listAllUpAndEnabledHostsInOneZone(final long dcId) {
|
||||||
final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
|
final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
|
||||||
|
|||||||
@ -588,6 +588,12 @@ public class MockResourceManagerImpl extends ManagerBase implements ResourceMana
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HostVO> listAllUpHostsInOneZoneByHypervisor(final HypervisorType type, final long dcId) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HostVO> listAllUpAndEnabledHostsInOneZone(final long dcId) {
|
public List<HostVO> listAllUpAndEnabledHostsInOneZone(final long dcId) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user