Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,8 @@ static Boolean getFullCloneConfiguration(Long storeId) {
*/
List<String> getStoragePoolTagList(long poolId);

Answer sendToPool(long poolId, Command cmd) throws StorageUnavailableException;

Answer sendToPool(StoragePool pool, Command cmd) throws StorageUnavailableException;

Answer[] sendToPool(long poolId, Commands cmd) throws StorageUnavailableException;

Answer[] sendToPool(StoragePool pool, Commands cmds) throws StorageUnavailableException;

Expand All @@ -304,9 +301,8 @@ static Boolean getFullCloneConfiguration(Long storeId) {

/**
* Cleans up storage pools by removing unused templates.
* @param recurring - true if this cleanup is part of a recurring garbage collection thread
*/
void cleanupStorage(boolean recurring);
void cleanupStorage();

void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated);

Expand Down Expand Up @@ -340,7 +336,7 @@ static Boolean getFullCloneConfiguration(Long storeId) {

List<Long> getUpHostsInPool(long poolId);

void cleanupSecondaryStorage(boolean recurring);
void cleanupSecondaryStorage();

HypervisorType getHypervisorTypeFromFormat(ImageFormat format);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfi
}

// Clean up all storage pools
storageMgr.cleanupStorage(false);
storageMgr.cleanupStorage();
// Determine what allocator to use
StoragePoolAllocator allocator;
if (dskCh.useLocalStorage()) {
Expand Down
18 changes: 4 additions & 14 deletions server/src/main/java/com/cloud/storage/StorageManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,7 @@
}

@Override
public void cleanupStorage(boolean recurring) {
public void cleanupStorage() {

Check failure on line 1948 in server/src/main/java/com/cloud/storage/StorageManagerImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 125 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=apache_cloudstack&issues=AaGxuaLJPRsJFWsxMDCL&open=AaGxuaLJPRsJFWsxMDCL&pullRequest=14561
GlobalLock scanLock = GlobalLock.getInternLock("storagemgr.cleanup");

try {
Expand Down Expand Up @@ -1986,7 +1986,7 @@
}

cleanupSnapshotsFromStoreRefInDestroyingState();
cleanupSecondaryStorage(recurring);
cleanupSecondaryStorage();

List<VolumeVO> vols = volumeDao.listVolumesToBeDestroyed(new Date(System.currentTimeMillis() - ((long)StorageCleanupDelay.value() << 10)));
List<Long> rootVolumeVmIds = vols.stream()
Expand Down Expand Up @@ -2268,7 +2268,7 @@

@Override
@DB
public void cleanupSecondaryStorage(boolean recurring) {
public void cleanupSecondaryStorage() {

Check failure on line 2271 in server/src/main/java/com/cloud/storage/StorageManagerImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 38 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=apache_cloudstack&issues=AaGxuaLJPRsJFWsxMDCM&open=AaGxuaLJPRsJFWsxMDCM&pullRequest=14561
// NOTE that object_store refactor will immediately delete the object from secondary storage when deleteTemplate etc api is issued.
// so here we don't need to issue DeleteCommand to resource anymore, only need to remove db entry.
try {
Expand Down Expand Up @@ -2943,7 +2943,7 @@
try {
logger.trace("Storage Garbage Collection Thread is running.");

cleanupStorage(true);
cleanupStorage();

} catch (Exception e) {
logger.error("Caught the following Exception", e);
Expand Down Expand Up @@ -3701,16 +3701,6 @@
return true;
}

@Override
public Answer sendToPool(long poolId, Command cmd) throws StorageUnavailableException {
return null;
}

@Override
public Answer[] sendToPool(long poolId, Commands cmd) throws StorageUnavailableException {
return null;
}

@Override
public String getName() {
return null;
Expand Down
Loading