diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 9766505a8d4..17229d79d00 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -186,7 +186,6 @@ public enum Config { ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null), ManagementNetwork("Advanced", ManagementServer.class, String.class, "management.network.cidr", null, "The cidr of management server network", null), EventPurgeDelay("Advanced", ManagementServer.class, Integer.class, "event.purge.delay", "15", "Events older than specified number days will be purged. Set this value to 0 to never delete events", null), - UseLocalStorage("Advanced", ManagementServer.class, Boolean.class, "use.local.storage", "false", "Should we use the local storage if it's available?", null), SecStorageVmMTUSize("Advanced", AgentManager.class, Integer.class, "secstorage.vm.mtu.size", String.valueOf(SecondaryStorageVmManager.DEFAULT_SS_VM_MTUSIZE), "MTU size (in Byte) of storage network in secondary storage vms", null), MaxTemplateAndIsoSize("Advanced", ManagementServer.class, Long.class, "max.template.iso.size", "50", "The maximum size for a downloaded template or ISO (in GB).", null), SecStorageAllowedInternalDownloadSites("Advanced", ManagementServer.class, String.class, "secstorage.allowed.internal.sites", null, "Comma separated list of cidrs internal to the datacenter that can host template download servers, please note 0.0.0.0 is not a valid site", null), diff --git a/server/src/com/cloud/storage/allocator/UseLocalForRootAllocator.java b/server/src/com/cloud/storage/allocator/UseLocalForRootAllocator.java index fd245c980d1..fdc89e75f4a 100644 --- a/server/src/com/cloud/storage/allocator/UseLocalForRootAllocator.java +++ b/server/src/com/cloud/storage/allocator/UseLocalForRootAllocator.java @@ -20,23 +20,29 @@ import javax.naming.ConfigurationException; import com.cloud.configuration.Config; import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.dao.DataCenterDao; import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.host.Host; import com.cloud.storage.StoragePool; import com.cloud.storage.Volume.Type; import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.Inject; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; @Local(value=StoragePoolAllocator.class) public class UseLocalForRootAllocator extends LocalStoragePoolAllocator implements StoragePoolAllocator { - boolean _useLocalStorage; + @Inject + DataCenterDao _dcDao; + @Override public List allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) { - if (!_useLocalStorage) { + DataCenterVO dc = _dcDao.findById(plan.getDataCenterId()); + if (!dc.isLocalStorageEnabled()) { return null; } @@ -51,13 +57,6 @@ public class UseLocalForRootAllocator extends LocalStoragePoolAllocator implemen @Override public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); - - ComponentLocator locator = ComponentLocator.getCurrentLocator(); - ConfigurationDao configDao = locator.getDao(ConfigurationDao.class); - Map dbParams = configDao.getConfiguration(params); - - _useLocalStorage = Boolean.parseBoolean(dbParams.get(Config.UseLocalStorage.toString())); - return true; } diff --git a/server/src/com/cloud/test/DatabaseConfig.java b/server/src/com/cloud/test/DatabaseConfig.java index 487e2c53991..bc0ac05de83 100755 --- a/server/src/com/cloud/test/DatabaseConfig.java +++ b/server/src/com/cloud/test/DatabaseConfig.java @@ -201,8 +201,7 @@ public class DatabaseConfig { s_configurationDescriptions.put("expunge.interval", "the interval to wait before running the expunge thread"); s_configurationDescriptions.put("network.throttling.rate", "default data transfer rate in megabits per second allowed per user"); s_configurationDescriptions.put("multicast.throttling.rate", "default multicast rate in megabits per second allowed"); - s_configurationDescriptions.put("use.local.storage", "Indicates whether to use local storage pools or shared storage pools for user VMs"); - s_configurationDescriptions.put("use.local.storage", "Indicates whether to use local storage pools or shared storage pools for system VMs."); + s_configurationDescriptions.put("system.vm.use.local.storage", "Indicates whether to use local storage pools or shared storage pools for system VMs."); s_configurationDescriptions.put("snapshot.poll.interval", "The time interval in seconds when the management server polls for snapshots to be scheduled."); s_configurationDescriptions.put("snapshot.max.hourly", "Maximum hourly snapshots for a volume"); s_configurationDescriptions.put("snapshot.max.daily", "Maximum daily snapshots for a volume"); @@ -275,7 +274,6 @@ public class DatabaseConfig { s_configurationComponents.put("storage.overwrite.provisioning", "UserVmManager"); s_configurationComponents.put("init", "none"); s_configurationComponents.put("system.vm.use.local.storage", "ManagementServer"); - s_configurationComponents.put("use.local.storage", "ManagementServer"); s_configurationComponents.put("snapshot.poll.interval", "SnapshotManager"); s_configurationComponents.put("snapshot.max.hourly", "SnapshotManager"); s_configurationComponents.put("snapshot.max.daily", "SnapshotManager"); @@ -328,7 +326,6 @@ public class DatabaseConfig { s_defaultConfigurationValues.put("migrate.retry.interval", "120"); s_defaultConfigurationValues.put("account.cleanup.interval", "86400"); s_defaultConfigurationValues.put("system.vm.use.local.storage", "false"); - s_defaultConfigurationValues.put("use.local.storage", "false"); s_defaultConfigurationValues.put("init", "false"); } diff --git a/setup/db/db/schema-304to305.sql b/setup/db/db/schema-304to305.sql index 8b63b3f0a31..1f51465489b 100755 --- a/setup/db/db/schema-304to305.sql +++ b/setup/db/db/schema-304to305.sql @@ -353,6 +353,7 @@ CREATE TABLE `cloud`.`s2s_vpn_connection` ( ALTER TABLE `cloud`.`data_center` ADD COLUMN `is_local_storage_enabled` tinyint NOT NULL DEFAULT 0 COMMENT 'Is local storage offering enabled for this data center; 1: enabled, 0: not'; UPDATE `cloud`.`data_center` SET `is_local_storage_enabled` = IF ((SELECT `value` FROM `cloud`.`configuration` WHERE `name`='use.local.storage')='true', 1, 0) WHERE `removed` IS NULL; +DELETE FROM `cloud`.`configuration` where name='use.local.storage'; ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `max_data_volumes_limit` int unsigned DEFAULT 6 COMMENT 'Max. data volumes per VM supported by hypervisor';