|
40 | 40 | import javax.inject.Inject; |
41 | 41 | import javax.naming.ConfigurationException; |
42 | 42 |
|
43 | | -import com.cloud.hypervisor.Hypervisor; |
44 | | - |
45 | | -import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; |
46 | | -import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService; |
47 | | -import org.apache.log4j.Logger; |
48 | | -import org.springframework.stereotype.Component; |
49 | 43 | import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; |
50 | 44 | import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd; |
51 | 45 | import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; |
|
66 | 60 | import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; |
67 | 61 | import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; |
68 | 62 | import org.apache.cloudstack.engine.subsystem.api.storage.ImageStoreProvider; |
| 63 | +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; |
69 | 64 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; |
70 | 65 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; |
71 | 66 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; |
72 | 67 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; |
73 | 68 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; |
| 69 | +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService; |
74 | 70 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; |
75 | 71 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; |
76 | 72 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService; |
|
84 | 80 | import org.apache.cloudstack.framework.config.ConfigKey; |
85 | 81 | import org.apache.cloudstack.framework.config.Configurable; |
86 | 82 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
87 | | -import org.apache.cloudstack.storage.command.DettachCommand; |
88 | 83 | import org.apache.cloudstack.managed.context.ManagedContextRunnable; |
| 84 | +import org.apache.cloudstack.storage.command.DettachCommand; |
89 | 85 | import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; |
90 | 86 | import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; |
91 | 87 | import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; |
|
100 | 96 | import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO; |
101 | 97 | import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity; |
102 | 98 | import org.apache.cloudstack.storage.to.VolumeObjectTO; |
| 99 | +import org.apache.log4j.Logger; |
| 100 | +import org.springframework.stereotype.Component; |
103 | 101 |
|
104 | 102 | import com.cloud.agent.AgentManager; |
105 | 103 | import com.cloud.agent.api.Answer; |
|
143 | 141 | import com.cloud.host.HostVO; |
144 | 142 | import com.cloud.host.Status; |
145 | 143 | import com.cloud.host.dao.HostDao; |
| 144 | +import com.cloud.hypervisor.Hypervisor; |
146 | 145 | import com.cloud.hypervisor.Hypervisor.HypervisorType; |
147 | 146 | import com.cloud.hypervisor.HypervisorGuruManager; |
148 | 147 | import com.cloud.offering.DiskOffering; |
@@ -861,11 +860,6 @@ public boolean deletePool(DeletePoolCmd cmd) { |
861 | 860 | s_logger.warn("Unable to delete storage id: " + id + " due to it is not in Maintenance state"); |
862 | 861 | throw new InvalidParameterValueException("Unable to delete storage due to it is not in Maintenance state, id: " + id); |
863 | 862 | } |
864 | | - if (sPool.isLocal()) { |
865 | | - s_logger.warn("Unable to delete local storage id:" + id); |
866 | | - throw new InvalidParameterValueException("Unable to delete local storage id: " + id); |
867 | | - } |
868 | | - |
869 | 863 | Pair<Long, Long> vlms = _volsDao.getCountAndTotalByPool(id); |
870 | 864 | if (forced) { |
871 | 865 | if (vlms.first() > 0) { |
@@ -1071,15 +1065,15 @@ public void cleanupStorage(boolean recurring) { |
1071 | 1065 | for (VMTemplateStoragePoolVO templatePoolVO : unusedTemplatesInPool) { |
1072 | 1066 | if (templatePoolVO.getDownloadState() != VMTemplateStorageResourceAssoc.Status.DOWNLOADED) { |
1073 | 1067 | s_logger.debug("Storage pool garbage collector is skipping template with ID: " + templatePoolVO.getTemplateId() + |
1074 | | - " on pool " + templatePoolVO.getPoolId() + " because it is not completely downloaded."); |
| 1068 | + " on pool " + templatePoolVO.getPoolId() + " because it is not completely downloaded."); |
1075 | 1069 | continue; |
1076 | 1070 | } |
1077 | 1071 |
|
1078 | 1072 | if (!templatePoolVO.getMarkedForGC()) { |
1079 | 1073 | templatePoolVO.setMarkedForGC(true); |
1080 | 1074 | _vmTemplatePoolDao.update(templatePoolVO.getId(), templatePoolVO); |
1081 | 1075 | s_logger.debug("Storage pool garbage collector has marked template with ID: " + templatePoolVO.getTemplateId() + |
1082 | | - " on pool " + templatePoolVO.getPoolId() + " for garbage collection."); |
| 1076 | + " on pool " + templatePoolVO.getPoolId() + " for garbage collection."); |
1083 | 1077 | continue; |
1084 | 1078 | } |
1085 | 1079 |
|
@@ -1484,8 +1478,6 @@ protected void runInContext() { |
1484 | 1478 |
|
1485 | 1479 | @Override |
1486 | 1480 | public void onManagementNodeJoined(List<? extends ManagementServerHost> nodeList, long selfNodeId) { |
1487 | | - // TODO Auto-generated method stub |
1488 | | - |
1489 | 1481 | } |
1490 | 1482 |
|
1491 | 1483 | @Override |
@@ -1876,21 +1868,6 @@ private HypervisorType getHypervisorType(Volume volume) { |
1876 | 1868 | return null; |
1877 | 1869 | } |
1878 | 1870 |
|
1879 | | - private long getDataObjectSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool pool) { |
1880 | | - DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName()); |
1881 | | - DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); |
1882 | | - |
1883 | | - if (storeDriver instanceof PrimaryDataStoreDriver) { |
1884 | | - PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver)storeDriver; |
1885 | | - |
1886 | | - VolumeInfo volumeInfo = volFactory.getVolume(volume.getId()); |
1887 | | - |
1888 | | - return primaryStoreDriver.getDataObjectSizeIncludingHypervisorSnapshotReserve(volumeInfo, pool); |
1889 | | - } |
1890 | | - |
1891 | | - return volume.getSize(); |
1892 | | - } |
1893 | | - |
1894 | 1871 | private long getBytesRequiredForTemplate(VMTemplateVO tmpl, StoragePool pool) { |
1895 | 1872 | DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName()); |
1896 | 1873 | DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); |
@@ -1920,19 +1897,16 @@ public synchronized boolean registerHostListener(String providerName, Hypervisor |
1920 | 1897 |
|
1921 | 1898 | @Override |
1922 | 1899 | public Answer sendToPool(long poolId, Command cmd) throws StorageUnavailableException { |
1923 | | - // TODO Auto-generated method stub |
1924 | 1900 | return null; |
1925 | 1901 | } |
1926 | 1902 |
|
1927 | 1903 | @Override |
1928 | 1904 | public Answer[] sendToPool(long poolId, Commands cmd) throws StorageUnavailableException { |
1929 | | - // TODO Auto-generated method stub |
1930 | 1905 | return null; |
1931 | 1906 | } |
1932 | 1907 |
|
1933 | 1908 | @Override |
1934 | 1909 | public String getName() { |
1935 | | - // TODO Auto-generated method stub |
1936 | 1910 | return null; |
1937 | 1911 | } |
1938 | 1912 |
|
@@ -1995,7 +1969,7 @@ public ImageStore discoverImageStore(String name, String url, String providerNam |
1995 | 1969 | } |
1996 | 1970 | } |
1997 | 1971 |
|
1998 | | - Map<String, Object> params = new HashMap(); |
| 1972 | + Map<String, Object> params = new HashMap<>(); |
1999 | 1973 | params.put("zoneId", zoneId); |
2000 | 1974 | params.put("url", url); |
2001 | 1975 | params.put("name", name); |
@@ -2036,7 +2010,7 @@ public ImageStore discoverImageStore(String name, String url, String providerNam |
2036 | 2010 | } |
2037 | 2011 |
|
2038 | 2012 | @Override |
2039 | | - public ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, |
| 2013 | + public ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException, |
2040 | 2014 | InvalidParameterValueException { |
2041 | 2015 | // check if current cloud is ready to migrate, we only support cloud with only NFS secondary storages |
2042 | 2016 | List<ImageStoreVO> imgStores = _imageStoreDao.listImageStores(); |
@@ -2303,7 +2277,7 @@ public void cleanupDownloadUrls(){ |
2303 | 2277 | ImageStoreEntity secStore = (ImageStoreEntity) _dataStoreMgr.getDataStore(volumeOnImageStore.getDataStoreId(), DataStoreRole.Image); |
2304 | 2278 | secStore.deleteExtractUrl(volumeOnImageStore.getInstallPath(), volumeOnImageStore.getExtractUrl(), Upload.Type.VOLUME); |
2305 | 2279 |
|
2306 | | - // Now expunge it from DB since this entry was created only for download purpose |
| 2280 | + // Now expunge it from DB since this entry was created only for download purpose |
2307 | 2281 | _volumeStoreDao.expunge(volumeOnImageStore.getId()); |
2308 | 2282 | }catch(Throwable th){ |
2309 | 2283 | s_logger.warn("Caught exception while deleting download url " +volumeOnImageStore.getExtractUrl() + |
|
0 commit comments