mirror of https://github.com/apache/cloudstack.git
Mount disabled storage pool on host reboot (#6164)
* Mount disabled storage pool on host reboot Add a global setting so that disabled pools will be mounted again on host reboot * fix build error * Update description * add cluster-wide support Co-authored-by: Rakesh Venkatesh <rakeshv@apache.org>
This commit is contained in:
parent
2c8c476656
commit
b88cfc226e
|
|
@ -155,6 +155,15 @@ public interface StorageManager extends StorageService {
|
|||
ConfigKey<String> PreferredStoragePool = new ConfigKey<String>(String.class, "preferred.storage.pool", "Advanced", "",
|
||||
"The UUID of preferred storage pool for allocation.", true, ConfigKey.Scope.Account, null);
|
||||
|
||||
ConfigKey<Boolean> MountDisabledStoragePool = new ConfigKey<>(Boolean.class,
|
||||
"mount.disabled.storage.pool",
|
||||
"Storage",
|
||||
"false",
|
||||
"Mount all zone-wide or cluster-wide disabled storage pools after node reboot",
|
||||
true,
|
||||
ConfigKey.Scope.Cluster,
|
||||
null);
|
||||
|
||||
/**
|
||||
* Returns a comma separated list of tags for the specified storage pool
|
||||
* @param poolId
|
||||
|
|
|
|||
|
|
@ -3340,7 +3340,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
MaxDataMigrationWaitTime,
|
||||
DiskProvisioningStrictness,
|
||||
PreferredStoragePool,
|
||||
SecStorageVMAutoScaleDown
|
||||
SecStorageVMAutoScaleDown,
|
||||
MountDisabledStoragePool
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.storage.StorageManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
|
||||
|
|
@ -44,7 +45,6 @@ import com.cloud.storage.ScopeType;
|
|||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StorageManagerImpl;
|
||||
import com.cloud.storage.StoragePoolHostVO;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
|
||||
public class StoragePoolMonitor implements Listener {
|
||||
private static final Logger s_logger = Logger.getLogger(StoragePoolMonitor.class);
|
||||
|
|
@ -108,10 +108,17 @@ public class StoragePoolMonitor implements Listener {
|
|||
List<StoragePoolVO> zoneStoragePoolsByAnyHypervisor = _poolDao.findZoneWideStoragePoolsByHypervisor(host.getDataCenterId(), HypervisorType.Any);
|
||||
pools.addAll(zoneStoragePoolsByAnyHypervisor);
|
||||
|
||||
// get the zone wide disabled pools list if global setting is true.
|
||||
if (StorageManager.MountDisabledStoragePool.value()) {
|
||||
pools.addAll(_poolDao.findDisabledPoolsByScope(host.getDataCenterId(), null, null, ScopeType.ZONE));
|
||||
}
|
||||
|
||||
// get the cluster wide disabled pool list
|
||||
if (StorageManager.MountDisabledStoragePool.valueIn(host.getClusterId())) {
|
||||
pools.addAll(_poolDao.findDisabledPoolsByScope(host.getDataCenterId(), host.getPodId(), host.getClusterId(), ScopeType.CLUSTER));
|
||||
}
|
||||
|
||||
for (StoragePoolVO pool : pools) {
|
||||
if (pool.getStatus() != StoragePoolStatus.Up) {
|
||||
continue;
|
||||
}
|
||||
if (!pool.isShared()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue