mirror of https://github.com/apache/cloudstack.git
bug 12760: generate vm.destroy event when vm goes from Stopped to Expuning state
status 12760: resolved fixed
This commit is contained in:
parent
bad573168e
commit
bda032b874
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import com.cloud.api.IdentityMapper;
|
|||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.HostResponse;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.user.Account;
|
||||
|
|
|
|||
|
|
@ -149,6 +149,11 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
|
|||
if (oldState == State.Stopped && newState == State.Error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (oldState == State.Stopped && newState == State.Expunging) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -479,13 +479,13 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||
// Destroy the account's VMs
|
||||
List<UserVmVO> vms = _userVmDao.listByAccountId(accountId);
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Destroying # of vms (accountId=" + accountId + "): " + vms.size());
|
||||
s_logger.debug("Expunging # of vms (accountId=" + accountId + "): " + vms.size());
|
||||
}
|
||||
|
||||
//no need to catch exception at this place as expunging vm should pass in order to perform further cleanup
|
||||
for (UserVmVO vm : vms) {
|
||||
if (!_vmMgr.expunge(vm, callerUserId, caller)) {
|
||||
s_logger.error("Unable to destroy vm: " + vm.getId());
|
||||
s_logger.error("Unable to expunge vm: " + vm.getId());
|
||||
accountCleanupNeeded = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1200,6 +1200,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
ctx.setAccountId(vm.getAccountId());
|
||||
|
||||
try {
|
||||
//expunge the vm
|
||||
if (!_itMgr.advanceExpunge(vm, _accountMgr.getSystemUser(), caller)) {
|
||||
s_logger.info("Did not expunge " + vm);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,9 @@
|
|||
package com.cloud.vm.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.ApiConstants.VMDetails;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.vm.UserVmVO;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
|
|
|
|||
Loading…
Reference in New Issue