diff --git a/api/src/com/cloud/storage/StorageService.java b/api/src/com/cloud/storage/StorageService.java index 11f03aa9292..7fc1e16ff3a 100644 --- a/api/src/com/cloud/storage/StorageService.java +++ b/api/src/com/cloud/storage/StorageService.java @@ -95,20 +95,20 @@ public interface StorageService { public ImageStore discoverImageStore(String name, String url, String providerName, Long dcId, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException; - /** - * Prepare NFS secondary storage for object store migration - * - * @param cmd - * - the command specifying secondaryStorageId - * @return the storage pool - * @throws ResourceUnavailableException - * TODO - * @throws InsufficientCapacityException - * TODO + + /** + * Migrate existing NFS to use object store. + * @param name object store name. + * @param url object store url. + * @param providerName object store provider Name. + * @param details object store other details + * @return Object store created. + * @throws IllegalArgumentException + * @throws DiscoveryException + * @throws InvalidParameterValueException */ public ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException; - public ImageStore prepareSecondaryStorageForObjectStoreMigration(Long storeId) throws ResourceUnavailableException, - InsufficientCapacityException; + } diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 4fda2dd1e41..9afd47a869c 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1225,28 +1225,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C return (PrimaryDataStoreInfo)dataStoreMgr.getDataStore(primaryStorage.getId(), DataStoreRole.Primary); } - @Override - @DB - public ImageStore prepareSecondaryStorageForObjectStoreMigration(Long storeId) throws ResourceUnavailableException, InsufficientCapacityException { - // Verify that image store exists - ImageStoreVO store = _imageStoreDao.findById(storeId); - if (store == null) { - throw new InvalidParameterValueException("Image store with id " + storeId + " doesn't exist"); - } else if (!store.getProviderName().equals(DataStoreProvider.NFS_IMAGE)) { - throw new InvalidParameterValueException("We only support migrate NFS secondary storage to use object store!"); - } - _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), store.getDataCenterId()); - - DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider(store.getProviderName()); - DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle(); - DataStore secStore = dataStoreMgr.getDataStore(storeId, DataStoreRole.Image); - lifeCycle.migrateToObjectStore(secStore); - // update store_role in template_store_ref and snapshot_store_ref to ImageCache - _templateStoreDao.updateStoreRoleToCachce(storeId); - _snapshotStoreDao.updateStoreRoleToCache(storeId); - // converted to an image cache store - return (ImageStore)_dataStoreMgr.getDataStore(storeId, DataStoreRole.ImageCache); - } protected class StorageGarbageCollector extends ManagedContextRunnable {