mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-9407: Refactor
This commit is contained in:
parent
d3f3fb0590
commit
c754a0cf30
|
|
@ -1428,6 +1428,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
advanceStop(vm, cleanUpEvenIfUnableToStop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send StopCommand to stop vm.<br/>
|
||||
* <strong>Not releasing network resources until expunge command is sent</strong>
|
||||
* @param vm virtual machine
|
||||
* @param cleanUpEvenIfUnableToStop if true -> cleanup even if vm cannot be stopped. if false -> not cleaning up if vm cannot be stopped.
|
||||
* @throws AgentUnavailableException
|
||||
* @throws OperationTimedoutException
|
||||
* @throws ConcurrentOperationException
|
||||
*/
|
||||
private void advanceStop(final VMInstanceVO vm, final boolean cleanUpEvenIfUnableToStop) throws AgentUnavailableException, OperationTimedoutException,
|
||||
ConcurrentOperationException {
|
||||
final State state = vm.getState();
|
||||
|
|
@ -1576,14 +1585,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
s_logger.debug(vm + " is stopped on the host. Proceeding to release resource held.");
|
||||
}
|
||||
|
||||
try {
|
||||
s_logger.debug("Not releasing network resources until expunge command is sent");
|
||||
//_networkMgr.release(profile, cleanUpEvenIfUnableToStop);
|
||||
//s_logger.debug("Successfully released network resources for the vm " + vm);
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Unable to release some network resources.", e);
|
||||
}
|
||||
|
||||
try {
|
||||
if (vm.getHypervisorType() != HypervisorType.BareMetal) {
|
||||
volumeMgr.release(profile);
|
||||
|
|
|
|||
|
|
@ -2097,8 +2097,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
*/
|
||||
private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
final VMInstanceVO vmInstance = _vmDao.findById(id);
|
||||
final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance);
|
||||
_networkMgr.release(profile, false);
|
||||
if (vmInstance != null){
|
||||
final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance);
|
||||
_networkMgr.release(profile, false);
|
||||
}
|
||||
else {
|
||||
s_logger.error("Couldn't find vm with id = " + id + ", unable to release network resources");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean cleanupVmResources(long vmId) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue