@Override
public int cleanup(CheckPointManager checkPointMgr) {
StateMachine2<Volume.State, Volume.Event, Volume> _stateMachine = Volume.State.getStateMachine();
ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
VolumeDao volDao = locator.getDao(VolumeDao.class);
VMInstanceDao vmDao = locator.getDao(VMInstanceDao.class);
VirtualMachineManager vmMgr = locator.getManager(VirtualMachineManager.class);
Long vmInstanceId = null;
boolean success = true;
Transaction txn = Transaction.open(Transaction.CLOUD_DB);
try {
txn.start();
for (Long volumeId : _volumesIds) {
VolumeVO volume = volDao.findById(volumeId);
if (volume == null) {
continue;
}
vmInstanceId = volume.getInstanceId();
if (_migrateState == StorageMigrationState.MIGRATING && volume.getState() == Volume.State.Migrating) {