|
40 | 40 | import javax.inject.Inject; |
41 | 41 | import javax.naming.ConfigurationException; |
42 | 42 |
|
43 | | -import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; |
44 | | -import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService; |
45 | | -import org.apache.log4j.Logger; |
46 | | -import org.springframework.stereotype.Component; |
47 | 43 | import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; |
48 | 44 | import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd; |
49 | 45 | import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; |
|
64 | 60 | import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; |
65 | 61 | import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; |
66 | 62 | import org.apache.cloudstack.engine.subsystem.api.storage.ImageStoreProvider; |
| 63 | +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; |
67 | 64 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; |
68 | 65 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; |
69 | 66 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; |
70 | 67 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; |
71 | 68 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; |
| 69 | +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService; |
72 | 70 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; |
73 | 71 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; |
74 | 72 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService; |
|
82 | 80 | import org.apache.cloudstack.framework.config.ConfigKey; |
83 | 81 | import org.apache.cloudstack.framework.config.Configurable; |
84 | 82 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
85 | | -import org.apache.cloudstack.storage.command.DettachCommand; |
86 | 83 | import org.apache.cloudstack.managed.context.ManagedContextRunnable; |
| 84 | +import org.apache.cloudstack.storage.command.DettachCommand; |
87 | 85 | import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; |
88 | 86 | import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; |
89 | 87 | import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; |
|
98 | 96 | import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO; |
99 | 97 | import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity; |
100 | 98 | import org.apache.cloudstack.storage.to.VolumeObjectTO; |
| 99 | +import org.apache.log4j.Logger; |
| 100 | +import org.springframework.stereotype.Component; |
101 | 101 |
|
102 | 102 | import com.cloud.agent.AgentManager; |
103 | 103 | import com.cloud.agent.api.Answer; |
@@ -887,11 +887,6 @@ public boolean deletePool(DeletePoolCmd cmd) { |
887 | 887 | s_logger.warn("Unable to delete storage id: " + id + " due to it is not in Maintenance state"); |
888 | 888 | throw new InvalidParameterValueException("Unable to delete storage due to it is not in Maintenance state, id: " + id); |
889 | 889 | } |
890 | | - if (sPool.isLocal()) { |
891 | | - s_logger.warn("Unable to delete local storage id:" + id); |
892 | | - throw new InvalidParameterValueException("Unable to delete local storage id: " + id); |
893 | | - } |
894 | | - |
895 | 890 | Pair<Long, Long> vlms = _volsDao.getCountAndTotalByPool(id); |
896 | 891 | if (forced) { |
897 | 892 | if (vlms.first() > 0) { |
@@ -1097,15 +1092,15 @@ public void cleanupStorage(boolean recurring) { |
1097 | 1092 | for (VMTemplateStoragePoolVO templatePoolVO : unusedTemplatesInPool) { |
1098 | 1093 | if (templatePoolVO.getDownloadState() != VMTemplateStorageResourceAssoc.Status.DOWNLOADED) { |
1099 | 1094 | s_logger.debug("Storage pool garbage collector is skipping template with ID: " + templatePoolVO.getTemplateId() + |
1100 | | - " on pool " + templatePoolVO.getPoolId() + " because it is not completely downloaded."); |
| 1095 | + " on pool " + templatePoolVO.getPoolId() + " because it is not completely downloaded."); |
1101 | 1096 | continue; |
1102 | 1097 | } |
1103 | 1098 |
|
1104 | 1099 | if (!templatePoolVO.getMarkedForGC()) { |
1105 | 1100 | templatePoolVO.setMarkedForGC(true); |
1106 | 1101 | _vmTemplatePoolDao.update(templatePoolVO.getId(), templatePoolVO); |
1107 | 1102 | s_logger.debug("Storage pool garbage collector has marked template with ID: " + templatePoolVO.getTemplateId() + |
1108 | | - " on pool " + templatePoolVO.getPoolId() + " for garbage collection."); |
| 1103 | + " on pool " + templatePoolVO.getPoolId() + " for garbage collection."); |
1109 | 1104 | continue; |
1110 | 1105 | } |
1111 | 1106 |
|
@@ -1523,8 +1518,6 @@ protected void runInContext() { |
1523 | 1518 |
|
1524 | 1519 | @Override |
1525 | 1520 | public void onManagementNodeJoined(List<? extends ManagementServerHost> nodeList, long selfNodeId) { |
1526 | | - // TODO Auto-generated method stub |
1527 | | - |
1528 | 1521 | } |
1529 | 1522 |
|
1530 | 1523 | @Override |
@@ -1915,21 +1908,6 @@ private HypervisorType getHypervisorType(Volume volume) { |
1915 | 1908 | return null; |
1916 | 1909 | } |
1917 | 1910 |
|
1918 | | - private long getDataObjectSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool pool) { |
1919 | | - DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName()); |
1920 | | - DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); |
1921 | | - |
1922 | | - if (storeDriver instanceof PrimaryDataStoreDriver) { |
1923 | | - PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver)storeDriver; |
1924 | | - |
1925 | | - VolumeInfo volumeInfo = volFactory.getVolume(volume.getId()); |
1926 | | - |
1927 | | - return primaryStoreDriver.getDataObjectSizeIncludingHypervisorSnapshotReserve(volumeInfo, pool); |
1928 | | - } |
1929 | | - |
1930 | | - return volume.getSize(); |
1931 | | - } |
1932 | | - |
1933 | 1911 | private long getBytesRequiredForTemplate(VMTemplateVO tmpl, StoragePool pool) { |
1934 | 1912 | DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName()); |
1935 | 1913 | DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); |
@@ -1959,19 +1937,16 @@ public synchronized boolean registerHostListener(String providerName, Hypervisor |
1959 | 1937 |
|
1960 | 1938 | @Override |
1961 | 1939 | public Answer sendToPool(long poolId, Command cmd) throws StorageUnavailableException { |
1962 | | - // TODO Auto-generated method stub |
1963 | 1940 | return null; |
1964 | 1941 | } |
1965 | 1942 |
|
1966 | 1943 | @Override |
1967 | 1944 | public Answer[] sendToPool(long poolId, Commands cmd) throws StorageUnavailableException { |
1968 | | - // TODO Auto-generated method stub |
1969 | 1945 | return null; |
1970 | 1946 | } |
1971 | 1947 |
|
1972 | 1948 | @Override |
1973 | 1949 | public String getName() { |
1974 | | - // TODO Auto-generated method stub |
1975 | 1950 | return null; |
1976 | 1951 | } |
1977 | 1952 |
|
@@ -2034,7 +2009,7 @@ public ImageStore discoverImageStore(String name, String url, String providerNam |
2034 | 2009 | } |
2035 | 2010 | } |
2036 | 2011 |
|
2037 | | - Map<String, Object> params = new HashMap(); |
| 2012 | + Map<String, Object> params = new HashMap<>(); |
2038 | 2013 | params.put("zoneId", zoneId); |
2039 | 2014 | params.put("url", url); |
2040 | 2015 | params.put("name", name); |
@@ -2075,7 +2050,7 @@ public ImageStore discoverImageStore(String name, String url, String providerNam |
2075 | 2050 | } |
2076 | 2051 |
|
2077 | 2052 | @Override |
2078 | | - public ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, |
| 2053 | + public ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException, |
2079 | 2054 | InvalidParameterValueException { |
2080 | 2055 | // check if current cloud is ready to migrate, we only support cloud with only NFS secondary storages |
2081 | 2056 | List<ImageStoreVO> imgStores = _imageStoreDao.listImageStores(); |
@@ -2342,7 +2317,7 @@ public void cleanupDownloadUrls(){ |
2342 | 2317 | ImageStoreEntity secStore = (ImageStoreEntity) _dataStoreMgr.getDataStore(volumeOnImageStore.getDataStoreId(), DataStoreRole.Image); |
2343 | 2318 | secStore.deleteExtractUrl(volumeOnImageStore.getInstallPath(), volumeOnImageStore.getExtractUrl(), Upload.Type.VOLUME); |
2344 | 2319 |
|
2345 | | - // Now expunge it from DB since this entry was created only for download purpose |
| 2320 | + // Now expunge it from DB since this entry was created only for download purpose |
2346 | 2321 | _volumeStoreDao.expunge(volumeOnImageStore.getId()); |
2347 | 2322 | }catch(Throwable th){ |
2348 | 2323 | s_logger.warn("Caught exception while deleting download url " +volumeOnImageStore.getExtractUrl() + |
|
0 commit comments