mirror of https://github.com/apache/cloudstack.git
bug 8103: don't allow to remove host if it has Running/Stopping/Starting vms
status 8103: resolved fixed
This commit is contained in:
parent
a8cc285ca9
commit
bb895a7b75
|
|
@ -143,7 +143,6 @@ public enum Status {
|
|||
s_fsm.addTransition(Status.PrepareForMaintenance, Event.AgentConnected, Status.PrepareForMaintenance);
|
||||
s_fsm.addTransition(Status.PrepareForMaintenance, Event.HostDown, Status.PrepareForMaintenance);
|
||||
s_fsm.addTransition(Status.PrepareForMaintenance, Event.UnableToMigrate, Status.ErrorInMaintenance);
|
||||
s_fsm.addTransition(Status.PrepareForMaintenance, Event.Remove, Status.Removed);
|
||||
s_fsm.addTransition(Status.PrepareForMaintenance, Event.Ping, Status.PrepareForMaintenance);
|
||||
s_fsm.addTransition(Status.PrepareForMaintenance, Event.ManagementServerDown, Status.PrepareForMaintenance);
|
||||
s_fsm.addTransition(Status.ErrorInMaintenance, Event.MaintenanceRequested, Status.PrepareForMaintenance);
|
||||
|
|
|
|||
|
|
@ -1144,6 +1144,14 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
|
|||
@Override
|
||||
@DB
|
||||
public boolean deleteHost(long hostId) {
|
||||
|
||||
//Check if there are vms running/starting/stopping on this host
|
||||
List<VMInstanceVO> vms = _vmDao.listByHostId(hostId);
|
||||
|
||||
if (!vms.isEmpty()) {
|
||||
throw new CloudRuntimeException("Unable to delete the host as there are vms in " + vms.get(0).getState() + " state using this host");
|
||||
}
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue