Skip to content

Commit a8d6d28

Browse files
[CLOUDSTACK-10226] CloudStack is not importing Local storage properly (apache#2401)
* [CLOUDSTACK-10226] CloudStack is not importing Local storage properly CloudStack is importing as Local storage any XenServer SR that is of type LVM or EXT. This causes a problem when one wants to use both Direct attach storage and local storage. Moreover, CloudStack was not importing all of the local storage that a host has available when local storage is enabled. It was only importing the First SR it sees. To fix the first problem we started ignoring SRs that have the flag shared=true when discovering local storages. SRs configured to be shared are used as direct attached storage, and therefore should not be imported again as local ones. To fix the second problem, we started loading all Local storage and importing them accordingly to ACS. * Cleanups and formatting
1 parent bbc9204 commit a8d6d28

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

api/src/main/java/com/cloud/storage/StorageService.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,16 @@ public interface StorageService {
9090

9191
boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd);
9292

93-
ImageStore discoverImageStore(String name, String url, String providerName, Long zoneId, Map details) throws IllegalArgumentException, DiscoveryException,
94-
InvalidParameterValueException;
93+
ImageStore discoverImageStore(String name, String url, String providerName, Long zoneId, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
9594

96-
97-
/**
95+
/**
9896
* Migrate existing NFS to use object store.
9997
* @param name object store name.
100-
* @param url object store url.
98+
* @param url object store URL.
10199
* @param providerName object store provider Name.
102100
* @param details object store other details
103101
* @return Object store created.
104-
* @throws IllegalArgumentException
105-
* @throws DiscoveryException
106-
* @throws InvalidParameterValueException
107102
*/
108-
ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException,
109-
InvalidParameterValueException;
110-
103+
ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException;
111104

112105
}

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -891,11 +891,6 @@ public boolean deletePool(DeletePoolCmd cmd) {
891891
s_logger.warn("Unable to delete storage id: " + id + " due to it is not in Maintenance state");
892892
throw new InvalidParameterValueException("Unable to delete storage due to it is not in Maintenance state, id: " + id);
893893
}
894-
if (sPool.isLocal()) {
895-
s_logger.warn("Unable to delete local storage id:" + id);
896-
throw new InvalidParameterValueException("Unable to delete local storage id: " + id);
897-
}
898-
899894
Pair<Long, Long> vlms = _volsDao.getCountAndTotalByPool(id);
900895
if (forced) {
901896
if (vlms.first() > 0) {
@@ -1126,7 +1121,6 @@ public void cleanupStorage(boolean recurring) {
11261121
s_logger.debug("Failed to delete snapshot: " + ssSnapshotVO.getId() + " from storage");
11271122
}
11281123
}
1129-
11301124
cleanupSecondaryStorage(recurring);
11311125

11321126
List<VolumeVO> vols = _volsDao.listVolumesToBeDestroyed(new Date(System.currentTimeMillis() - ((long)StorageCleanupDelay.value() << 10)));
@@ -1931,19 +1925,16 @@ public synchronized boolean registerHostListener(String providerName, Hypervisor
19311925

19321926
@Override
19331927
public Answer sendToPool(long poolId, Command cmd) throws StorageUnavailableException {
1934-
// TODO Auto-generated method stub
19351928
return null;
19361929
}
19371930

19381931
@Override
19391932
public Answer[] sendToPool(long poolId, Commands cmd) throws StorageUnavailableException {
1940-
// TODO Auto-generated method stub
19411933
return null;
19421934
}
19431935

19441936
@Override
19451937
public String getName() {
1946-
// TODO Auto-generated method stub
19471938
return null;
19481939
}
19491940

@@ -2044,7 +2035,7 @@ public ImageStore discoverImageStore(String name, String url, String providerNam
20442035
}
20452036

20462037
@Override
2047-
public ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException {
2038+
public ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException, InvalidParameterValueException {
20482039
// check if current cloud is ready to migrate, we only support cloud with only NFS secondary storages
20492040
List<ImageStoreVO> imgStores = _imageStoreDao.listImageStores();
20502041
List<ImageStoreVO> nfsStores = new ArrayList<ImageStoreVO>();

0 commit comments

Comments
 (0)