mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Refactored the destroy vm command
This commit is contained in:
parent
6070948e16
commit
2bdaaa48a6
@ -18,30 +18,18 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseAsyncCmd;
|
||||||
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.user.Account;
|
|
||||||
import com.cloud.utils.Pair;
|
@Implementation(method="destroyVm", manager=Manager.UserVmManager)
|
||||||
import com.cloud.vm.UserVmVO;
|
public class DestroyVMCmd extends BaseAsyncCmd {
|
||||||
|
|
||||||
public class DestroyVMCmd extends BaseCmd {
|
|
||||||
public static final Logger s_logger = Logger.getLogger(DestroyVMCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(DestroyVMCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "destroyvirtualmachineresponse";
|
private static final String s_name = "destroyvirtualmachineresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
//////////////// API parameters /////////////////////
|
//////////////// API parameters /////////////////////
|
||||||
@ -68,48 +56,51 @@ public class DestroyVMCmd extends BaseCmd {
|
|||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
// @Override
|
||||||
return s_properties;
|
// public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
}
|
// Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
||||||
|
// Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
||||||
@Override
|
// Long vmId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
//
|
||||||
Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());
|
// // Verify input parameters
|
||||||
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
// UserVmVO vmInstance = getManagementServer().findUserVMInstanceById(vmId.longValue());
|
||||||
Long vmId = (Long)params.get(BaseCmd.Properties.ID.getName());
|
// if (vmInstance == null) {
|
||||||
|
// throw new ServerApiException (BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (account != null) {
|
||||||
|
// if (!isAdmin(account.getType())) {
|
||||||
|
// if (account.getId().longValue() != vmInstance.getAccountId()) {
|
||||||
|
// throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + "for this account");
|
||||||
|
// }
|
||||||
|
// } else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
||||||
|
// throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to destroy virtual machine with id " + vmId + ", permission denied.");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // If command is executed via 8096 port, set userId to the id of System account (1)
|
||||||
|
// if (userId == null) {
|
||||||
|
// userId = Long.valueOf(1);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// long jobId = getManagementServer().destroyVirtualMachineAsync(userId.longValue(), vmId.longValue());
|
||||||
|
// if (jobId == 0) {
|
||||||
|
// s_logger.warn("Unable to schedule async-job for DestroyVM command");
|
||||||
|
// } else {
|
||||||
|
// if (s_logger.isDebugEnabled())
|
||||||
|
// s_logger.debug("DestroyVM command has been accepted, job id: " + jobId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||||
|
// returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
||||||
|
//
|
||||||
|
// return returnValues;
|
||||||
|
// }
|
||||||
|
|
||||||
// Verify input parameters
|
|
||||||
UserVmVO vmInstance = getManagementServer().findUserVMInstanceById(vmId.longValue());
|
|
||||||
if (vmInstance == null) {
|
|
||||||
throw new ServerApiException (BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (account != null) {
|
@Override
|
||||||
if (!isAdmin(account.getType())) {
|
public String getResponse() {
|
||||||
if (account.getId().longValue() != vmInstance.getAccountId()) {
|
// TODO Auto-generated method stub
|
||||||
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId + "for this account");
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!getManagementServer().isChildDomain(account.getDomainId(), vmInstance.getDomainId())) {
|
|
||||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to destroy virtual machine with id " + vmId + ", permission denied.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If command is executed via 8096 port, set userId to the id of System account (1)
|
|
||||||
if (userId == null) {
|
|
||||||
userId = Long.valueOf(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
long jobId = getManagementServer().destroyVirtualMachineAsync(userId.longValue(), vmId.longValue());
|
|
||||||
if (jobId == 0) {
|
|
||||||
s_logger.warn("Unable to schedule async-job for DestroyVM command");
|
|
||||||
} else {
|
|
||||||
if (s_logger.isDebugEnabled())
|
|
||||||
s_logger.debug("DestroyVM command has been accepted, job id: " + jobId);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
|
||||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.JOB_ID.getName(), Long.valueOf(jobId)));
|
|
||||||
|
|
||||||
return returnValues;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import java.util.List;
|
|||||||
import com.cloud.agent.api.VmStatsEntry;
|
import com.cloud.agent.api.VmStatsEntry;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.api.commands.CreateTemplateCmd;
|
import com.cloud.api.commands.CreateTemplateCmd;
|
||||||
|
import com.cloud.api.commands.DestroyVMCmd;
|
||||||
import com.cloud.api.commands.DetachVolumeCmd;
|
import com.cloud.api.commands.DetachVolumeCmd;
|
||||||
import com.cloud.api.commands.RebootVMCmd;
|
import com.cloud.api.commands.RebootVMCmd;
|
||||||
import com.cloud.api.commands.RecoverVMCmd;
|
import com.cloud.api.commands.RecoverVMCmd;
|
||||||
@ -102,8 +103,9 @@ public interface UserVmManager extends Manager, VirtualMachineManager<UserVmVO>
|
|||||||
* @param userId the id of the user performing the action
|
* @param userId the id of the user performing the action
|
||||||
* @param vmId the id of the virtual machine.
|
* @param vmId the id of the virtual machine.
|
||||||
*/
|
*/
|
||||||
|
boolean destroyVm(DestroyVMCmd cmd);
|
||||||
boolean destroyVirtualMachine(long userId, long vmId);
|
boolean destroyVirtualMachine(long userId, long vmId);
|
||||||
OperationResponse executeDestroyVM(DestroyVMExecutor executor, VMOperationParam param);
|
// OperationResponse executeDestroyVM(DestroyVMExecutor executor, VMOperationParam param);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -65,6 +65,7 @@ import com.cloud.alert.AlertManager;
|
|||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.api.commands.CreateTemplateCmd;
|
import com.cloud.api.commands.CreateTemplateCmd;
|
||||||
|
import com.cloud.api.commands.DestroyVMCmd;
|
||||||
import com.cloud.api.commands.DetachVolumeCmd;
|
import com.cloud.api.commands.DetachVolumeCmd;
|
||||||
import com.cloud.api.commands.RebootVMCmd;
|
import com.cloud.api.commands.RebootVMCmd;
|
||||||
import com.cloud.api.commands.RecoverVMCmd;
|
import com.cloud.api.commands.RecoverVMCmd;
|
||||||
@ -1789,112 +1790,112 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DB
|
// @Override @DB
|
||||||
public OperationResponse executeDestroyVM(DestroyVMExecutor executor, VMOperationParam param) {
|
// public OperationResponse executeDestroyVM(DestroyVMExecutor executor, VMOperationParam param) {
|
||||||
UserVmVO vm = _vmDao.findById(param.getVmId());
|
// UserVmVO vm = _vmDao.findById(param.getVmId());
|
||||||
State state = vm.getState();
|
// State state = vm.getState();
|
||||||
OperationResponse response;
|
// OperationResponse response;
|
||||||
String resultDescription = "Success";
|
// String resultDescription = "Success";
|
||||||
|
//
|
||||||
if (vm == null || state == State.Destroyed || state == State.Expunging || vm.getRemoved() != null) {
|
// if (vm == null || state == State.Destroyed || state == State.Expunging || vm.getRemoved() != null) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
// if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Unable to find vm or vm is destroyed: " + param.getVmId());
|
// s_logger.debug("Unable to find vm or vm is destroyed: " + param.getVmId());
|
||||||
}
|
// }
|
||||||
resultDescription = "VM does not exist or already in destroyed state";
|
// resultDescription = "VM does not exist or already in destroyed state";
|
||||||
response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
// AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(state == State.Stopping) {
|
// if(state == State.Stopping) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
// if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("VM is being stopped: " + param.getVmId());
|
// s_logger.debug("VM is being stopped: " + param.getVmId());
|
||||||
}
|
// }
|
||||||
resultDescription = "VM is being stopped, please re-try later";
|
// resultDescription = "VM is being stopped, please re-try later";
|
||||||
response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
// AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (state == State.Running) {
|
// if (state == State.Running) {
|
||||||
if (vm.getHostId() == null) {
|
// if (vm.getHostId() == null) {
|
||||||
resultDescription = "VM host is null (invalid VM)";
|
// resultDescription = "VM host is null (invalid VM)";
|
||||||
response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
// AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
||||||
if(s_logger.isDebugEnabled())
|
// if(s_logger.isDebugEnabled())
|
||||||
s_logger.debug("Execute asynchronize destroy VM command: " + resultDescription);
|
// s_logger.debug("Execute asynchronize destroy VM command: " + resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!_vmDao.updateIf(vm, Event.StopRequested, vm.getHostId())) {
|
// if (!_vmDao.updateIf(vm, Event.StopRequested, vm.getHostId())) {
|
||||||
resultDescription = "Failed to issue stop command, please re-try later";
|
// resultDescription = "Failed to issue stop command, please re-try later";
|
||||||
response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
// AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
||||||
if(s_logger.isDebugEnabled())
|
// if(s_logger.isDebugEnabled())
|
||||||
s_logger.debug("Execute asynchronize destroy VM command:" + resultDescription);
|
// s_logger.debug("Execute asynchronize destroy VM command:" + resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
long childEventId = EventUtils.saveStartedEvent(param.getUserId(), param.getAccountId(),
|
// long childEventId = EventUtils.saveStartedEvent(param.getUserId(), param.getAccountId(),
|
||||||
EventTypes.EVENT_VM_STOP, "stopping vm " + vm.getName(), 0);
|
// EventTypes.EVENT_VM_STOP, "stopping vm " + vm.getName(), 0);
|
||||||
param.setChildEventId(childEventId);
|
// param.setChildEventId(childEventId);
|
||||||
StopCommand cmd = new StopCommand(vm, vm.getInstanceName(), vm.getVnet());
|
// StopCommand cmd = new StopCommand(vm, vm.getInstanceName(), vm.getVnet());
|
||||||
try {
|
// try {
|
||||||
long seq = _agentMgr.send(vm.getHostId(), new Command[] {cmd}, true,
|
// long seq = _agentMgr.send(vm.getHostId(), new Command[] {cmd}, true,
|
||||||
new VMOperationListener(executor, param, vm, 0));
|
// new VMOperationListener(executor, param, vm, 0));
|
||||||
resultDescription = "Execute asynchronize destroy VM command: sending stop command to agent, seq - " + seq;
|
// resultDescription = "Execute asynchronize destroy VM command: sending stop command to agent, seq - " + seq;
|
||||||
if(s_logger.isDebugEnabled())
|
// if(s_logger.isDebugEnabled())
|
||||||
s_logger.debug(resultDescription);
|
// s_logger.debug(resultDescription);
|
||||||
response = new OperationResponse(OperationResponse.STATUS_IN_PROGRESS, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_IN_PROGRESS, resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
} catch (AgentUnavailableException e) {
|
// } catch (AgentUnavailableException e) {
|
||||||
resultDescription = "Agent is not available";
|
// resultDescription = "Agent is not available";
|
||||||
response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
// AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Transaction txn = Transaction.currentTxn();
|
// Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
// txn.start();
|
||||||
|
//
|
||||||
_accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
|
// _accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
|
||||||
if (!_vmDao.updateIf(vm, VirtualMachine.Event.DestroyRequested, vm.getHostId()) ) {
|
// if (!_vmDao.updateIf(vm, VirtualMachine.Event.DestroyRequested, vm.getHostId()) ) {
|
||||||
resultDescription = "Unable to destroy the vm because it is not in the correct state";
|
// resultDescription = "Unable to destroy the vm because it is not in the correct state";
|
||||||
s_logger.debug(resultDescription + vm.toString());
|
// s_logger.debug(resultDescription + vm.toString());
|
||||||
|
//
|
||||||
txn.rollback();
|
// txn.rollback();
|
||||||
response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_FAILED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
// AsyncJobResult.STATUS_FAILED, 0, resultDescription);
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Now that the VM is destroyed, clean the network rules associated with it.
|
// // Now that the VM is destroyed, clean the network rules associated with it.
|
||||||
cleanNetworkRules(param.getUserId(), vm.getId());
|
// cleanNetworkRules(param.getUserId(), vm.getId());
|
||||||
|
//
|
||||||
// Mark the VM's root disk as destroyed
|
// // Mark the VM's root disk as destroyed
|
||||||
List<VolumeVO> volumes = _volsDao.findByInstanceAndType(vm.getId(), VolumeType.ROOT);
|
// List<VolumeVO> volumes = _volsDao.findByInstanceAndType(vm.getId(), VolumeType.ROOT);
|
||||||
for (VolumeVO volume : volumes) {
|
// for (VolumeVO volume : volumes) {
|
||||||
_storageMgr.destroyVolume(volume);
|
// _storageMgr.destroyVolume(volume);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Mark the VM's data disks as detached
|
// // Mark the VM's data disks as detached
|
||||||
volumes = _volsDao.findByInstanceAndType(vm.getId(), VolumeType.DATADISK);
|
// volumes = _volsDao.findByInstanceAndType(vm.getId(), VolumeType.DATADISK);
|
||||||
for (VolumeVO volume : volumes) {
|
// for (VolumeVO volume : volumes) {
|
||||||
_volsDao.detachVolume(volume.getId());
|
// _volsDao.detachVolume(volume.getId());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
txn.commit();
|
// txn.commit();
|
||||||
response = new OperationResponse(OperationResponse.STATUS_SUCCEEDED, resultDescription);
|
// response = new OperationResponse(OperationResponse.STATUS_SUCCEEDED, resultDescription);
|
||||||
executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
// executor.getAsyncJobMgr().completeAsyncJob(executor.getJob().getId(),
|
||||||
AsyncJobResult.STATUS_SUCCEEDED, 0, "success");
|
// AsyncJobResult.STATUS_SUCCEEDED, 0, "success");
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB
|
||||||
public boolean recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationException, InternalErrorException {
|
public boolean recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationException, InternalErrorException {
|
||||||
@ -3413,6 +3414,37 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean destroyVm(DestroyVMCmd cmd) {
|
||||||
|
|
||||||
|
Account account = (Account)UserContext.current().getAccountObject();
|
||||||
|
Long userId = UserContext.current().getUserId();
|
||||||
|
Long vmId = cmd.getId();
|
||||||
|
|
||||||
|
//Verify input parameters
|
||||||
|
UserVmVO vmInstance = _vmDao.findById(vmId.longValue());
|
||||||
|
if (vmInstance == null) {
|
||||||
|
throw new ServerApiException(BaseCmd.VM_INVALID_PARAM_ERROR, "unable to find a virtual machine with id " + vmId);
|
||||||
|
}
|
||||||
|
|
||||||
|
userId = accountAndUserValidation(vmId, account, userId, vmInstance);
|
||||||
|
|
||||||
|
EventUtils.saveScheduledEvent(userId, vmInstance.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Destroying Vm with Id: "+vmId);
|
||||||
|
|
||||||
|
boolean status = destroyVirtualMachine(userId, vmId);
|
||||||
|
|
||||||
|
if(status)
|
||||||
|
{
|
||||||
|
EventUtils.saveEvent(userId, vmInstance.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Successfully destroyed vm with id:"+vmId);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventUtils.saveEvent(userId, vmInstance.getAccountId(), EventTypes.EVENT_VM_DESTROY, "Failed to destroy vm with id:"+vmId);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user