Updated Branches: refs/heads/master 143fbc37a -> 918bc7405
fix compile Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/918bc740 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/918bc740 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/918bc740 Branch: refs/heads/master Commit: 918bc74050d478625ed78af44dc60f8ff0532c63 Parents: 143fbc3 Author: Edison Su <[email protected]> Authored: Fri Nov 1 16:16:03 2013 -0700 Committer: Edison Su <[email protected]> Committed: Fri Nov 1 16:16:03 2013 -0700 ---------------------------------------------------------------------- .../core/spring-engine-storage-core-context.xml | 4 +- ...-engine-storage-snapshot-storage-context.xml | 2 - .../vmsnapshot/DefaultVMSnapshotStrategy.java | 1 - .../vmsnapshot/VMSnapshotHelperImpl.java | 148 ------------------- .../test/src/VMSnapshotStrategyTest.java | 2 +- .../storage/helper/HypervisorHelperImpl.java | 2 +- .../storage/helper/VMSnapshotHelperImpl.java | 148 +++++++++++++++++++ .../storage/snapshot/VMSnapshotHelper.java | 38 ----- .../storage/vmsnapshot/VMSnapshotHelper.java | 38 +++++ 9 files changed, 191 insertions(+), 192 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/resources/META-INF/cloudstack/core/spring-engine-storage-core-context.xml ---------------------------------------------------------------------- diff --git a/engine/storage/resources/META-INF/cloudstack/core/spring-engine-storage-core-context.xml b/engine/storage/resources/META-INF/cloudstack/core/spring-engine-storage-core-context.xml index b17e410..8040d80 100644 --- a/engine/storage/resources/META-INF/cloudstack/core/spring-engine-storage-core-context.xml +++ b/engine/storage/resources/META-INF/cloudstack/core/spring-engine-storage-core-context.xml @@ -37,7 +37,9 @@ <bean id="BAREMETAL" class="org.apache.cloudstack.storage.image.format.BAREMETAL" /> <bean id="hypervisorHelperImpl" class="org.apache.cloudstack.storage.helper.HypervisorHelperImpl" /> - <bean id="vmSnapshotHelper" class="org.apache.cloudstack.storage.vmsnapshot.VMSnapshotHelperImpl" /> + + <bean id="VMSnapshotHelperImpl" + class="org.apache.cloudstack.storage.helper.VMSnapshotHelperImpl" /> <bean id="objectInDataStoreManagerImpl" class="org.apache.cloudstack.storage.datastore.ObjectInDataStoreManagerImpl" /> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml b/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml index d25aeea..7299750 100644 --- a/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml +++ b/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml @@ -33,6 +33,4 @@ <bean id="DefaultVMSnapshotStrategy" class="org.apache.cloudstack.storage.vmsnapshot.DefaultVMSnapshotStrategy" /> - <bean id="VMSnapshotHelperImpl" - class="org.apache.cloudstack.storage.vmsnapshot.VMSnapshotHelperImpl" /> </beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java index ad165cc..be3cce9 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java @@ -27,7 +27,6 @@ import javax.naming.ConfigurationException; import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority; import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotStrategy; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.cloudstack.storage.snapshot.VMSnapshotHelper; import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.log4j.Logger; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelperImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelperImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelperImpl.java deleted file mode 100644 index 05d4044..0000000 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelperImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.storage.vmsnapshot; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; - -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; -import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; -import org.apache.cloudstack.storage.snapshot.VMSnapshotHelper; -import org.apache.cloudstack.storage.to.VolumeObjectTO; - -import com.cloud.agent.api.VMSnapshotTO; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.host.Host; -import com.cloud.host.HostVO; -import com.cloud.host.dao.HostDao; -import com.cloud.storage.VolumeVO; -import com.cloud.storage.dao.VolumeDao; -import com.cloud.utils.fsm.NoTransitionException; -import com.cloud.utils.fsm.StateMachine2; -import com.cloud.vm.UserVmVO; -import com.cloud.vm.VirtualMachine; -import com.cloud.vm.dao.UserVmDao; -import com.cloud.vm.snapshot.VMSnapshot; -import com.cloud.vm.snapshot.VMSnapshotVO; -import com.cloud.vm.snapshot.dao.VMSnapshotDao; - -public class VMSnapshotHelperImpl implements VMSnapshotHelper { - @Inject - VMSnapshotDao _vmSnapshotDao; - @Inject - UserVmDao userVmDao; - @Inject - HostDao hostDao; - @Inject - VolumeDao volumeDao; - @Inject - PrimaryDataStoreDao primaryDataStoreDao; - @Inject - VolumeDataFactory volumeDataFactory; - - StateMachine2<VMSnapshot.State, VMSnapshot.Event, VMSnapshot> _vmSnapshottateMachine ; - public VMSnapshotHelperImpl() { - _vmSnapshottateMachine = VMSnapshot.State.getStateMachine(); - } - @Override - public boolean vmSnapshotStateTransitTo(VMSnapshot vsnp, VMSnapshot.Event event) throws NoTransitionException { - return _vmSnapshottateMachine.transitTo(vsnp, event, null, _vmSnapshotDao); - } - - @Override - public Long pickRunningHost(Long vmId) { - UserVmVO vm = userVmDao.findById(vmId); - // use VM's host if VM is running - if(vm.getState() == VirtualMachine.State.Running) - return vm.getHostId(); - - // check if lastHostId is available - if(vm.getLastHostId() != null){ - HostVO lastHost = hostDao.findById(vm.getLastHostId()); - if(lastHost.getStatus() == com.cloud.host.Status.Up && !lastHost.isInMaintenanceStates()) - return lastHost.getId(); - } - - List<VolumeVO> listVolumes = volumeDao.findByInstance(vmId); - if (listVolumes == null || listVolumes.size() == 0) { - throw new InvalidParameterValueException("vmInstance has no volumes"); - } - VolumeVO volume = listVolumes.get(0); - Long poolId = volume.getPoolId(); - if (poolId == null) { - throw new InvalidParameterValueException("pool id is not found"); - } - StoragePoolVO storagePool = primaryDataStoreDao.findById(poolId); - if (storagePool == null) { - throw new InvalidParameterValueException("storage pool is not found"); - } - List<HostVO> listHost = hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, storagePool.getClusterId(), storagePool.getPodId(), - storagePool.getDataCenterId(), null); - if (listHost == null || listHost.size() == 0) { - throw new InvalidParameterValueException("no host in up state is found"); - } - return listHost.get(0).getId(); - } - - @Override - public List<VolumeObjectTO> getVolumeTOList(Long vmId) { - List<VolumeObjectTO> volumeTOs = new ArrayList<VolumeObjectTO>(); - List<VolumeVO> volumeVos = volumeDao.findByInstance(vmId); - VolumeInfo volumeInfo = null; - for (VolumeVO volume : volumeVos) { - volumeInfo = volumeDataFactory.getVolume(volume.getId()); - - volumeTOs.add((VolumeObjectTO)volumeInfo.getTO()); - } - return volumeTOs; - } - - - private VMSnapshotTO convert2VMSnapshotTO(VMSnapshotVO vo) { - return new VMSnapshotTO(vo.getId(), vo.getName(), vo.getType(), vo.getCreated().getTime(), vo.getDescription(), - vo.getCurrent(), null); - } - - @Override - public VMSnapshotTO getSnapshotWithParents(VMSnapshotVO snapshot) { - Map<Long, VMSnapshotVO> snapshotMap = new HashMap<Long, VMSnapshotVO>(); - List<VMSnapshotVO> allSnapshots = _vmSnapshotDao.findByVm(snapshot.getVmId()); - for (VMSnapshotVO vmSnapshotVO : allSnapshots) { - snapshotMap.put(vmSnapshotVO.getId(), vmSnapshotVO); - } - - VMSnapshotTO currentTO = convert2VMSnapshotTO(snapshot); - VMSnapshotTO result = currentTO; - VMSnapshotVO current = snapshot; - while (current.getParent() != null) { - VMSnapshotVO parent = snapshotMap.get(current.getParent()); - currentTO.setParent(convert2VMSnapshotTO(parent)); - current = snapshotMap.get(current.getParent()); - currentTO = currentTO.getParent(); - } - return result; - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java b/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java index d68eb36..8e36faf 100644 --- a/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java +++ b/engine/storage/snapshot/test/src/VMSnapshotStrategyTest.java @@ -29,7 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotStrategy; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.cloudstack.storage.vmsnapshot.DefaultVMSnapshotStrategy; -import org.apache.cloudstack.storage.snapshot.VMSnapshotHelper; +import org.apache.cloudstack.storage.vmsnapshot.VMSnapshotHelper; import org.apache.cloudstack.test.utils.SpringUtils; import org.junit.Before; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java index 713c2a9..86c90a1 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java @@ -30,7 +30,7 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.storage.command.ForgetObjectCmd; import org.apache.cloudstack.storage.command.IntroduceObjectAnswer; import org.apache.cloudstack.storage.command.IntroduceObjectCmd; -import org.apache.cloudstack.storage.snapshot.VMSnapshotHelper; +import org.apache.cloudstack.storage.vmsnapshot.VMSnapshotHelper; import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.log4j.Logger; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java b/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java new file mode 100644 index 0000000..1200be8 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java @@ -0,0 +1,148 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.helper; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; +import org.apache.cloudstack.storage.vmsnapshot.VMSnapshotHelper; + +import com.cloud.agent.api.VMSnapshotTO; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.utils.fsm.StateMachine2; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.snapshot.VMSnapshot; +import com.cloud.vm.snapshot.VMSnapshotVO; +import com.cloud.vm.snapshot.dao.VMSnapshotDao; + +public class VMSnapshotHelperImpl implements VMSnapshotHelper { + @Inject + VMSnapshotDao _vmSnapshotDao; + @Inject + UserVmDao userVmDao; + @Inject + HostDao hostDao; + @Inject + VolumeDao volumeDao; + @Inject + PrimaryDataStoreDao primaryDataStoreDao; + @Inject + VolumeDataFactory volumeDataFactory; + + StateMachine2<VMSnapshot.State, VMSnapshot.Event, VMSnapshot> _vmSnapshottateMachine ; + public VMSnapshotHelperImpl() { + _vmSnapshottateMachine = VMSnapshot.State.getStateMachine(); + } + @Override + public boolean vmSnapshotStateTransitTo(VMSnapshot vsnp, VMSnapshot.Event event) throws NoTransitionException { + return _vmSnapshottateMachine.transitTo(vsnp, event, null, _vmSnapshotDao); + } + + @Override + public Long pickRunningHost(Long vmId) { + UserVmVO vm = userVmDao.findById(vmId); + // use VM's host if VM is running + if(vm.getState() == VirtualMachine.State.Running) + return vm.getHostId(); + + // check if lastHostId is available + if(vm.getLastHostId() != null){ + HostVO lastHost = hostDao.findById(vm.getLastHostId()); + if(lastHost.getStatus() == com.cloud.host.Status.Up && !lastHost.isInMaintenanceStates()) + return lastHost.getId(); + } + + List<VolumeVO> listVolumes = volumeDao.findByInstance(vmId); + if (listVolumes == null || listVolumes.size() == 0) { + throw new InvalidParameterValueException("vmInstance has no volumes"); + } + VolumeVO volume = listVolumes.get(0); + Long poolId = volume.getPoolId(); + if (poolId == null) { + throw new InvalidParameterValueException("pool id is not found"); + } + StoragePoolVO storagePool = primaryDataStoreDao.findById(poolId); + if (storagePool == null) { + throw new InvalidParameterValueException("storage pool is not found"); + } + List<HostVO> listHost = hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, storagePool.getClusterId(), storagePool.getPodId(), + storagePool.getDataCenterId(), null); + if (listHost == null || listHost.size() == 0) { + throw new InvalidParameterValueException("no host in up state is found"); + } + return listHost.get(0).getId(); + } + + @Override + public List<VolumeObjectTO> getVolumeTOList(Long vmId) { + List<VolumeObjectTO> volumeTOs = new ArrayList<VolumeObjectTO>(); + List<VolumeVO> volumeVos = volumeDao.findByInstance(vmId); + VolumeInfo volumeInfo = null; + for (VolumeVO volume : volumeVos) { + volumeInfo = volumeDataFactory.getVolume(volume.getId()); + + volumeTOs.add((VolumeObjectTO)volumeInfo.getTO()); + } + return volumeTOs; + } + + + private VMSnapshotTO convert2VMSnapshotTO(VMSnapshotVO vo) { + return new VMSnapshotTO(vo.getId(), vo.getName(), vo.getType(), vo.getCreated().getTime(), vo.getDescription(), + vo.getCurrent(), null); + } + + @Override + public VMSnapshotTO getSnapshotWithParents(VMSnapshotVO snapshot) { + Map<Long, VMSnapshotVO> snapshotMap = new HashMap<Long, VMSnapshotVO>(); + List<VMSnapshotVO> allSnapshots = _vmSnapshotDao.findByVm(snapshot.getVmId()); + for (VMSnapshotVO vmSnapshotVO : allSnapshots) { + snapshotMap.put(vmSnapshotVO.getId(), vmSnapshotVO); + } + + VMSnapshotTO currentTO = convert2VMSnapshotTO(snapshot); + VMSnapshotTO result = currentTO; + VMSnapshotVO current = snapshot; + while (current.getParent() != null) { + VMSnapshotVO parent = snapshotMap.get(current.getParent()); + currentTO.setParent(convert2VMSnapshotTO(parent)); + current = snapshotMap.get(current.getParent()); + currentTO = currentTO.getParent(); + } + return result; + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/src/org/apache/cloudstack/storage/snapshot/VMSnapshotHelper.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/VMSnapshotHelper.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/VMSnapshotHelper.java deleted file mode 100644 index 262ec77..0000000 --- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/VMSnapshotHelper.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.storage.snapshot; - -import java.util.List; - -import org.apache.cloudstack.storage.to.VolumeObjectTO; - -import com.cloud.agent.api.VMSnapshotTO; -import com.cloud.utils.fsm.NoTransitionException; -import com.cloud.vm.snapshot.VMSnapshot; -import com.cloud.vm.snapshot.VMSnapshotVO; - -public interface VMSnapshotHelper { - boolean vmSnapshotStateTransitTo(VMSnapshot vsnp, VMSnapshot.Event event) throws NoTransitionException; - - Long pickRunningHost(Long vmId); - - List<VolumeObjectTO> getVolumeTOList(Long vmId); - - VMSnapshotTO getSnapshotWithParents(VMSnapshotVO snapshot); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/918bc740/engine/storage/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelper.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelper.java b/engine/storage/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelper.java new file mode 100644 index 0000000..9ee2f85 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotHelper.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.vmsnapshot; + +import java.util.List; + +import org.apache.cloudstack.storage.to.VolumeObjectTO; + +import com.cloud.agent.api.VMSnapshotTO; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.vm.snapshot.VMSnapshot; +import com.cloud.vm.snapshot.VMSnapshotVO; + +public interface VMSnapshotHelper { + boolean vmSnapshotStateTransitTo(VMSnapshot vsnp, VMSnapshot.Event event) throws NoTransitionException; + + Long pickRunningHost(Long vmId); + + List<VolumeObjectTO> getVolumeTOList(Long vmId); + + VMSnapshotTO getSnapshotWithParents(VMSnapshotVO snapshot); +}
