mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-9333: Exclude clusters for OVF operations
This commit is contained in:
parent
419f8fba63
commit
4aae051558
@ -53,6 +53,16 @@ public interface CapacityManager {
|
||||
"0.85",
|
||||
"Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.",
|
||||
true, ConfigKey.Scope.Zone);
|
||||
static final ConfigKey<Boolean> StorageOperationsExcludeCluster =
|
||||
new ConfigKey<Boolean>(
|
||||
Boolean.class,
|
||||
"cluster.storage.operations.exclude",
|
||||
"Advanced",
|
||||
"false",
|
||||
"Exclude cluster from storage operations",
|
||||
true,
|
||||
ConfigKey.Scope.Cluster,
|
||||
null);
|
||||
|
||||
public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId);
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||
import org.apache.cloudstack.storage.LocalHostEndpoint;
|
||||
import org.apache.cloudstack.storage.RemoteHostEndPoint;
|
||||
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
@ -64,9 +65,13 @@ public class DefaultEndPointSelector implements EndPointSelector {
|
||||
private static final Logger s_logger = Logger.getLogger(DefaultEndPointSelector.class);
|
||||
@Inject
|
||||
HostDao hostDao;
|
||||
private final String findOneHostOnPrimaryStorage =
|
||||
"select h.id from host h, storage_pool_host_ref s where h.status = 'Up' and h.type = 'Routing' and h.resource_state = 'Enabled' and"
|
||||
+ " h.id = s.host_id and s.pool_id = ? ";
|
||||
private final String findOneHostOnPrimaryStorage = "select t.id from "
|
||||
+ "(select h.id, cd.value "
|
||||
+ "from host h join storage_pool_host_ref s on h.id = s.host_id "
|
||||
+ "join cluster c on c.id=h.cluster_id "
|
||||
+ "left join cluster_details cd on c.id=cd.cluster_id and cd.name='" + CapacityManager.StorageOperationsExcludeCluster.key() + "' "
|
||||
+ "where h.status = 'Up' and h.type = 'Routing' and h.resource_state = 'Enabled' and s.pool_id = ? ";
|
||||
|
||||
private String findOneHypervisorHostInScope = "select h.id from host h where h.status = 'Up' and h.hypervisor_type is not null ";
|
||||
|
||||
protected boolean moveBetweenPrimaryImage(DataStore srcStore, DataStore destStore) {
|
||||
@ -115,6 +120,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
|
||||
sbuilder.append(scope.getScopeId());
|
||||
}
|
||||
// TODO: order by rand() is slow if there are lot of hosts
|
||||
sbuilder.append(") t where t.value<>'true' or t.value is null"); //Added for exclude cluster's subquery
|
||||
sbuilder.append(" ORDER by rand() limit 1");
|
||||
String sql = sbuilder.toString();
|
||||
HostVO host = null;
|
||||
|
||||
@ -1082,6 +1082,6 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {CpuOverprovisioningFactor, MemOverprovisioningFactor, StorageCapacityDisableThreshold, StorageOverprovisioningFactor,
|
||||
StorageAllocatedCapacityDisableThreshold};
|
||||
StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster};
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,3 +410,6 @@ VIEW `user_vm_view` AS
|
||||
AND (`custom_speed`.`name` = 'CpuSpeed'))))
|
||||
LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`)
|
||||
AND (`custom_ram_size`.`name` = 'memory'))));
|
||||
|
||||
-- Add cluster.storage.operations.exclude property
|
||||
INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `description`, `default_value`, `updated`, `scope`, `is_dynamic`) VALUES ('Advanced', 'DEFAULT', 'CapacityManager', 'cluster.storage.operations.exclude', 'Exclude cluster from storage operations', 'false', now(), 'Cluster', '1');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user