bug 7673,7645: fixing the vm expunge issue. also modifying the delete pod flow to only check for hosts that are NOT removed from the pod. also, checking for alerts on the pod whilst deleting pod is not right. we should be able to delete a pod regardless of alerts issued on the pod. the resolution of alerts is a separate issue

status 7673, 7645: resolved fixed
This commit is contained in:
abhishek 2010-12-27 11:26:54 -08:00
parent ecc9aabbcc
commit 0da33ad39a
3 changed files with 12 additions and 7 deletions

View File

@ -397,11 +397,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
vmInstance.add(2, "there are virtual machines running in this pod");
tablesToCheck.add(vmInstance);
List<String> alert = new ArrayList<String>();
alert.add(0, "alert");
alert.add(1, "pod_id");
alert.add(2, "there are alerts for this pod");
tablesToCheck.add(alert);
// List<String> alert = new ArrayList<String>();
// alert.add(0, "alert");
// alert.add(1, "pod_id");
// alert.add(2, "there are alerts for this pod");
// tablesToCheck.add(alert);
for (List<String> table : tablesToCheck) {
String tableName = table.get(0);
@ -418,7 +418,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
String selectSql = "SELECT * FROM `" + dbName + "`.`" + tableName + "` WHERE " + column + " = ?";
if(tableName.equals("host")){
selectSql += " and removed IS NULL";
}
Transaction txn = Transaction.currentTxn();
try {
PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql);

View File

@ -1470,7 +1470,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
vm.setGuestNetmask(null);
vm.setGuestMacAddress(null);
if (!_itMgr.stateTransitTo(vm, VirtualMachine.Event.ExpungeOperation, null)) {
s_logger.info("vm " + vmId + " is skipped because it is no longer in Destroyed state");
s_logger.info("vm " + vmId + " is skipped because it is no longer in Destroyed or Error state");
continue;
}

View File

@ -586,6 +586,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
_stateMachine.addTransition(State.Creating, VirtualMachine.Event.OperationFailed, State.Error);
_stateMachine.addTransition(State.Stopped, VirtualMachine.Event.StartRequested, State.Starting);
_stateMachine.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
_stateMachine.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
_stateMachine.addTransition(State.Stopped, VirtualMachine.Event.DestroyRequested, State.Destroyed);
_stateMachine.addTransition(State.Stopped, VirtualMachine.Event.StopRequested, State.Stopped);
_stateMachine.addTransition(State.Stopped, VirtualMachine.Event.AgentReportStopped, State.Stopped);