bug 11490: simulator marks VMs as Stopped and not Expunging when they are Destroyed

status 11490: resolved fixed
reviewed-by: Kishan.Kavala@citrix.com

The simulator should mark the VM as Expunging when the root volume is destroyed
or VM sync will think the VM is still only Stopped and not expunged
(cherry picked from commit 6dd57f3023d3ca3bb323d20298d6a70c0bfb079c)
This commit is contained in:
Prasanna Santhanam 2011-09-19 17:19:24 +05:30
parent 005b37f6d8
commit eaf94145b4
1 changed files with 8 additions and 0 deletions

View File

@ -58,6 +58,7 @@ import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.agent.api.to.VolumeTO;
import com.cloud.simulator.MockVm;
import com.cloud.simulator.MockHost;
import com.cloud.simulator.MockSecStorageVO;
import com.cloud.simulator.MockStoragePoolVO;
@ -76,6 +77,7 @@ import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import com.cloud.storage.template.TemplateInfo;
import com.cloud.utils.component.Inject;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine.State;
@Local(value = { MockStorageManager.class })
@ -293,6 +295,12 @@ public class MockStorageManagerImpl implements MockStorageManager {
if (volume != null) {
_mockVolumeDao.remove(volume.getId());
}
MockVm vm = _mockVMDao.findByVmName(cmd.getVmName());
vm.setState(State.Expunging);
if (vm != null ) {
MockVMVO vmVo = _mockVMDao.createForUpdate(vm.getId());
_mockVMDao.update(vm.getId(), vmVo);
}
return new Answer(cmd);
}