|
129 | 129 | import com.cloud.storage.allocator.StoragePoolAllocator; |
130 | 130 | import com.cloud.storage.dao.DiskOfferingDao; |
131 | 131 | import com.cloud.storage.dao.SnapshotDao; |
| 132 | +import com.cloud.storage.dao.SnapshotPolicyDao; |
132 | 133 | import com.cloud.storage.dao.StoragePoolDao; |
133 | 134 | import com.cloud.storage.dao.StoragePoolHostDao; |
134 | 135 | import com.cloud.storage.dao.StoragePoolWorkDao; |
@@ -205,6 +206,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag |
205 | 206 | @Inject protected ConsoleProxyDao _consoleProxyDao; |
206 | 207 | @Inject protected DetailsDao _detailsDao; |
207 | 208 | @Inject protected SnapshotDao _snapshotDao; |
| 209 | + @Inject protected SnapshotPolicyDao _snapshotPolicyDao; |
208 | 210 | @Inject protected StoragePoolHostDao _storagePoolHostDao; |
209 | 211 | @Inject protected AlertManager _alertMgr; |
210 | 212 | @Inject protected VMTemplateHostDao _vmTemplateHostDao = null; |
@@ -1323,6 +1325,17 @@ public boolean addPoolToHost(long hostId, StoragePoolVO pool) { |
1323 | 1325 |
|
1324 | 1326 | @Override |
1325 | 1327 | public VolumeVO moveVolume(VolumeVO volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType) { |
| 1328 | + |
| 1329 | + List<SnapshotVO> snapshots = _snapshotDao.listByVolumeId(volume.getId()); |
| 1330 | + if( snapshots != null && snapshots.size() > 0) { |
| 1331 | + throw new CloudRuntimeException("Unable to move volume " + volume.getId() + " due to there are snapshots for this volume"); |
| 1332 | + } |
| 1333 | + |
| 1334 | + List<SnapshotPolicyVO> snapshotPolicys = _snapshotPolicyDao.listByVolumeId(volume.getId()); |
| 1335 | + if( snapshotPolicys != null && snapshotPolicys.size() > 0) { |
| 1336 | + throw new CloudRuntimeException("Unable to move volume " + volume.getId() + " due to there are snapshot policyes for this volume"); |
| 1337 | + } |
| 1338 | + |
1326 | 1339 | // Find a destination storage pool with the specified criteria |
1327 | 1340 | DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId()); |
1328 | 1341 | DiskProfile dskCh = new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), |
|
0 commit comments