From 6bf9de596e783552e6ca612bb15c2b37a35093f7 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Thu, 16 May 2013 14:13:54 -0700 Subject: [PATCH] Removed orchestration from relying on cloud-server --- .../apache/cloudstack/config/ConfigKey.java | 91 +++++++++++++++++++ .../deploy/DeploymentPlanningManager.java | 0 .../apache/cloudstack/config/ConfigRepo.java | 26 ++++++ .../cloudstack/config}/ConfigValue.java | 21 +++-- .../cloudstack/engine/config/Configs.java | 44 +++++++++ engine/orchestration/pom.xml | 5 - .../engine/vm/VirtualMachineOrchestrator.java | 32 +++---- engine/schema/pom.xml | 5 + .../cloud/vm/VirtualMachineProfileImpl.java | 0 .../cloudstack/vm/jobs}/VmWorkJobDao.java | 7 +- .../cloudstack/vm/jobs}/VmWorkJobDaoImpl.java | 6 +- .../cloudstack/vm/jobs}/VmWorkJobVO.java | 5 +- .../test/DirectAgentManagerSimpleImpl.java | 17 +--- .../configuration/ConfigurationManager.java | 2 - .../ConfigurationManagerImpl.java | 7 +- .../cloud/vm/VirtualMachineManagerImpl.java | 4 +- .../cloud/vm/VmWorkJobWakeupDispatcher.java | 2 + server/test/com/cloud/vm/VmWorkTest.java | 4 +- .../cloud/vm/VmWorkTestApiJobDispatcher.java | 1 + .../com/cloud/vm/VmWorkTestConfiguration.java | 2 + server/test/com/cloud/vm/dao/VmDaoTest.java | 5 +- .../cloud/vm/dao/VmDaoTestConfiguration.java | 5 +- .../vpc/MockConfigurationManagerImpl.java | 8 -- 23 files changed, 230 insertions(+), 69 deletions(-) create mode 100644 api/src/org/apache/cloudstack/config/ConfigKey.java rename {server => engine/components-api}/src/com/cloud/deploy/DeploymentPlanningManager.java (100%) create mode 100644 engine/components-api/src/org/apache/cloudstack/config/ConfigRepo.java rename {server/src/com/cloud/configuration => engine/components-api/src/org/apache/cloudstack/config}/ConfigValue.java (80%) create mode 100644 engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java rename {server => engine/schema}/src/com/cloud/vm/VirtualMachineProfileImpl.java (100%) rename {server/src/com/cloud/vm => engine/schema/src/org/apache/cloudstack/vm/jobs}/VmWorkJobDao.java (88%) rename {server/src/com/cloud/vm => engine/schema/src/org/apache/cloudstack/vm/jobs}/VmWorkJobDaoImpl.java (96%) rename {server/src/com/cloud/vm => engine/schema/src/org/apache/cloudstack/vm/jobs}/VmWorkJobVO.java (94%) diff --git a/api/src/org/apache/cloudstack/config/ConfigKey.java b/api/src/org/apache/cloudstack/config/ConfigKey.java new file mode 100644 index 00000000000..2a77a9b3257 --- /dev/null +++ b/api/src/org/apache/cloudstack/config/ConfigKey.java @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.config; + +/** + * ConfigKey supplants the original Config.java. It is just a class + * declaration where others can declare their config variables. + * + * TODO: This class should be moved to a framework project where the gathering + * of these configuration keys should be done by a config server. I + * don't have time yet to do this. Ask me about it if you want to work + * in this area. Right now, we'll just work with the actual names. + */ +public class ConfigKey { + + private final String _category; + + public String category() { + return _category; + } + + public Class component() { + return _componentClass; + } + + public Class type() { + return _type; + } + + public String key() { + return _name; + } + + public String defaultValue() { + return _defaultValue; + } + + public String description() { + return _description; + } + + public String range() { + return _range; + } + + public String scope() { + return _scope; + } + + @Override + public String toString() { + return _name; + } + + private final Class _componentClass; + private final Class _type; + private final String _name; + private final String _defaultValue; + private final String _description; + private final String _range; + private final String _scope; // Parameter can be at different levels (Zone/cluster/pool/account), by default every parameter is at global + + public ConfigKey(Class type, String name, String category, Class componentClass, String defaultValue, String description, String range, String scope) { + _category = category; + _componentClass = componentClass; + _type = type; + _name = name; + _defaultValue = defaultValue; + _description = description; + _range = range; + _scope = scope; + } + + public ConfigKey(Class type, String name, String category, Class componentClass, String defaultValue, String description, String range) { + this(type, name, category, componentClass, defaultValue, description, range, null); + } +} diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManager.java b/engine/components-api/src/com/cloud/deploy/DeploymentPlanningManager.java similarity index 100% rename from server/src/com/cloud/deploy/DeploymentPlanningManager.java rename to engine/components-api/src/com/cloud/deploy/DeploymentPlanningManager.java diff --git a/engine/components-api/src/org/apache/cloudstack/config/ConfigRepo.java b/engine/components-api/src/org/apache/cloudstack/config/ConfigRepo.java new file mode 100644 index 00000000000..823d7541951 --- /dev/null +++ b/engine/components-api/src/org/apache/cloudstack/config/ConfigRepo.java @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.config; + +/** + * ConfigRepo is a repository of configurations. + * + */ +public interface ConfigRepo { + ConfigValue get(ConfigKey key); + +} diff --git a/server/src/com/cloud/configuration/ConfigValue.java b/engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java similarity index 80% rename from server/src/com/cloud/configuration/ConfigValue.java rename to engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java index 967944aa8a6..12a31565bb1 100644 --- a/server/src/com/cloud/configuration/ConfigValue.java +++ b/engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java @@ -14,26 +14,31 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.configuration; +package org.apache.cloudstack.config; +import com.cloud.configuration.ConfigurationVO; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.utils.exception.CloudRuntimeException; -// This class returns the config value in a class. We can later enhance this -// class to get auto-updated by the database. +/** + * This is a match set to ConfigKey. + * + * TODO: When we create a framework project for configuration, this should be + * moved there. + */ public class ConfigValue { - Config _config; + ConfigKey _config; ConfigurationDao _dao; Number _multiplier; - protected ConfigValue(ConfigurationDao dao, Config config) { + public ConfigValue(ConfigurationDao dao, ConfigKey config) { _dao = dao; _config = config; _multiplier = 1; } - public Config getConfig() { + public ConfigKey getConfigKey() { return _config; } @@ -45,9 +50,9 @@ public class ConfigValue { @SuppressWarnings("unchecked") public T value() { ConfigurationVO vo = _dao.findByName(_config.key()); - String value = vo != null ? vo.getValue() : _config.getDefaultValue(); + String value = vo != null ? vo.getValue() : _config.defaultValue(); - Class type = _config.getType(); + Class type = _config.type(); if (type.isAssignableFrom(Boolean.class)) { return (T)Boolean.valueOf(value); } else if (type.isAssignableFrom(Integer.class)) { diff --git a/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java b/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java new file mode 100644 index 00000000000..aa5ca70d91b --- /dev/null +++ b/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.engine.config; + +import org.apache.cloudstack.config.ConfigKey; +import org.apache.cloudstack.engine.service.api.OrchestrationService; + +public interface Configs { + + public static final ConfigKey StartRetry = new ConfigKey( + Integer.class, "start.retry", "Advanced", OrchestrationService.class, "10", "Number of times to retry create and start commands", null); + public static final ConfigKey VmOpWaitInterval = new ConfigKey( + Long.class, "vm.op.wait.interval", "Advanced", OrchestrationService.class, "120", "Time (in seconds) to wait before checking if a previous operation has succeeded", + null); + public static final ConfigKey VmOpLockStateRetry = new ConfigKey( + Integer.class, "vm.op.lock.state.retry", "Advanced", OrchestrationService.class, "5", "Times to retry locking the state of a VM for operations", "-1 means try forever"); + public static final ConfigKey VmOpCleanupInterval = new ConfigKey( + Long.class, "vm.op.cleanup.interval", "Advanced", OrchestrationService.class, "86400", "Interval to run the thread that cleans up the vm operations (in seconds)", + "Seconds"); + public static final ConfigKey VmOpCleanupWait = new ConfigKey( + Long.class, "vm.op.cleanup.wait", "Advanced", OrchestrationService.class, "3600", "Time (in seconds) to wait before cleanuping up any vm work items", "Seconds"); + public static final ConfigKey VmOpCancelInterval = new ConfigKey( + Integer.class, "vm.op.cancel.interval", "Advanced", OrchestrationService.class, "3600", "Time (in seconds) to wait before cancelling a operation", "Seconds"); + + public static final ConfigKey Wait = new ConfigKey( + Integer.class, "wait", "Advanced", OrchestrationService.class, "1800", "Time in seconds to wait for control commands to return", null); + public static final ConfigKey VmDestroyForcestop = new ConfigKey( + Boolean.class, "vm.destroy.forcestop", "Advanced", OrchestrationService.class, "false", "On destroy, force-stop takes this value ", null); + +} diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml index 1ebd0b48169..6e02b6d6cc7 100755 --- a/engine/orchestration/pom.xml +++ b/engine/orchestration/pom.xml @@ -48,11 +48,6 @@ cloud-utils ${project.version} - - org.apache.cloudstack - cloud-server - ${project.version} - diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/vm/VirtualMachineOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/vm/VirtualMachineOrchestrator.java index 9cb0cb02740..5f1e3d0f65e 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/vm/VirtualMachineOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/vm/VirtualMachineOrchestrator.java @@ -29,11 +29,15 @@ import javax.naming.ConfigurationException; import org.apache.log4j.Logger; +import org.apache.cloudstack.config.ConfigRepo; +import org.apache.cloudstack.config.ConfigValue; import org.apache.cloudstack.engine.cloud.entity.VMEntityVO; import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl; +import org.apache.cloudstack.engine.config.Configs; import org.apache.cloudstack.engine.subsystem.api.storage.StorageOrchestrator; import org.apache.cloudstack.network.NetworkOrchestrator; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; @@ -43,9 +47,6 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.StartupCommand; import com.cloud.cluster.ManagementServerNode; -import com.cloud.configuration.Config; -import com.cloud.configuration.ConfigValue; -import com.cloud.configuration.ConfigurationManager; import com.cloud.dao.EntityManager; import com.cloud.deploy.DeploymentPlan; import com.cloud.domain.dao.DomainDao; @@ -70,12 +71,10 @@ import com.cloud.utils.component.ComponentContext; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.vm.NicProfile; -import com.cloud.vm.ReservationContextImpl; import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachineManager; import com.cloud.vm.VirtualMachineProfileImpl; -import com.cloud.vm.VmWorkJobDao; /** * VirtualMachineOrchestrator orchestrates virtual machine operations. @@ -86,7 +85,7 @@ public class VirtualMachineOrchestrator extends ManagerBase { @Inject EntityManager _entityMgr; @Inject - ConfigurationManager _configMgr; + ConfigRepo _configRepo; @Inject NetworkOrchestrator _networkOrchestrator; @Inject @@ -99,7 +98,7 @@ public class VirtualMachineOrchestrator extends ManagerBase { VirtualMachineManager _itMgr; protected ConfigValue _retry; - protected ConfigValue _cancelWait; + protected ConfigValue _cancelWait; protected ConfigValue _cleanupWait; protected ConfigValue _cleanupInterval; protected ConfigValue _opWaitInterval; @@ -280,16 +279,15 @@ public class VirtualMachineOrchestrator extends ManagerBase { public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); - _retry = _configMgr.getConfig(Config.StartRetry, Integer.class); + _retry = _configRepo.get(Configs.StartRetry); - - _cancelWait = _configMgr.getConfig(Config.VmOpCancelInterval, Long.class); - _cleanupWait = _configMgr.getConfig(Config.VmOpCleanupWait, Long.class); - _cleanupInterval = _configMgr.getConfig(Config.VmOpCleanupInterval, Long.class).setMultiplier(1000); - _opWaitInterval = _configMgr.getConfig(Config.VmOpWaitInterval, Long.class).setMultiplier(1000); - _lockStateRetry = _configMgr.getConfig(Config.VmOpLockStateRetry, Integer.class); - _operationTimeout = _configMgr.getConfig(Config.Wait, Integer.class).setMultiplier(2); - _forceStop = _configMgr.getConfig(Config.VmDestroyForcestop, Boolean.class); + _cancelWait = _configRepo.get(Configs.VmOpCancelInterval); + _cleanupWait = _configRepo.get(Configs.VmOpCleanupWait); + _cleanupInterval = _configRepo.get(Configs.VmOpCleanupInterval).setMultiplier(1000); + _opWaitInterval = _configRepo.get(Configs.VmOpWaitInterval).setMultiplier(1000); + _lockStateRetry = _configRepo.get(Configs.VmOpLockStateRetry); + _operationTimeout = _configRepo.get(Configs.Wait).setMultiplier(2); + _forceStop = _configRepo.get(Configs.VmDestroyForcestop); _nodeId = ManagementServerNode.getManagementServerId(); @@ -297,7 +295,7 @@ public class VirtualMachineOrchestrator extends ManagerBase { _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Vm-Operations-Cleanup")); - ReservationContextImpl.setComponents(_userDao, _domainDao, _accountDao); +// ReservationContextImpl.setComponents(_userDao, _domainDao, _accountDao); VirtualMachineProfileImpl.setComponents(_offeringDao, _templateDao, _accountDao); VirtualMachineEntityImpl2.init(_entityMgr, this, _networkOrchestrator, _storageOrchestrator); diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml index 431151ab88e..99b0149671e 100644 --- a/engine/schema/pom.xml +++ b/engine/schema/pom.xml @@ -33,6 +33,11 @@ cloud-engine-api ${project.version} + + org.apache.cloudstack + cloud-framework-jobs + ${project.version} + install diff --git a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java b/engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java similarity index 100% rename from server/src/com/cloud/vm/VirtualMachineProfileImpl.java rename to engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java diff --git a/server/src/com/cloud/vm/VmWorkJobDao.java b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobDao.java similarity index 88% rename from server/src/com/cloud/vm/VmWorkJobDao.java rename to engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobDao.java index 0db811dfd80..735a04a817a 100644 --- a/server/src/com/cloud/vm/VmWorkJobDao.java +++ b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobDao.java @@ -14,13 +14,16 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm; +package org.apache.cloudstack.vm.jobs; import java.util.Date; import java.util.List; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO.Step; + import com.cloud.utils.db.GenericDao; -import com.cloud.vm.VmWorkJobVO.Step; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.Type; public interface VmWorkJobDao extends GenericDao { VmWorkJobVO findPendingWorkJob(VirtualMachine.Type type, long instanceId); diff --git a/server/src/com/cloud/vm/VmWorkJobDaoImpl.java b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobDaoImpl.java similarity index 96% rename from server/src/com/cloud/vm/VmWorkJobDaoImpl.java rename to engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobDaoImpl.java index 53c76ed9b46..4ece4e82bc8 100644 --- a/server/src/com/cloud/vm/VmWorkJobDaoImpl.java +++ b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobDaoImpl.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm; +package org.apache.cloudstack.vm.jobs; import java.util.Date; import java.util.List; @@ -22,6 +22,7 @@ import java.util.List; import javax.annotation.PostConstruct; import org.apache.cloudstack.framework.jobs.AsyncJobConstants; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO.Step; import com.cloud.utils.DateUtil; import com.cloud.utils.db.Filter; @@ -29,7 +30,8 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; -import com.cloud.vm.VmWorkJobVO.Step; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.Type; public class VmWorkJobDaoImpl extends GenericDaoBase implements VmWorkJobDao { diff --git a/server/src/com/cloud/vm/VmWorkJobVO.java b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java similarity index 94% rename from server/src/com/cloud/vm/VmWorkJobVO.java rename to engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java index 8cea54f912f..bdf8301c7a7 100644 --- a/server/src/com/cloud/vm/VmWorkJobVO.java +++ b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm; +package org.apache.cloudstack.vm.jobs; import javax.persistence.Column; import javax.persistence.DiscriminatorValue; @@ -26,6 +26,9 @@ import javax.persistence.Table; import org.apache.cloudstack.framework.jobs.AsyncJobVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.Type; + @Entity @Table(name="vm_work_job") diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java index 575bc8e2ba2..f4a970bae58 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java @@ -32,11 +32,8 @@ import com.cloud.agent.StartupCommandProcessor; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.SetupCommand; -import com.cloud.agent.api.StartupCommand; -import com.cloud.agent.manager.AgentAttache; import com.cloud.agent.manager.Commands; import com.cloud.exception.AgentUnavailableException; -import com.cloud.exception.ConnectionException; import com.cloud.exception.OperationTimedoutException; import com.cloud.host.HostEnvironment; import com.cloud.host.HostVO; @@ -49,7 +46,7 @@ import com.cloud.utils.component.ManagerBase; public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentManager { private static final Logger logger = Logger.getLogger(DirectAgentManagerSimpleImpl.class); - private Map hostResourcesMap = new HashMap(); + private final Map hostResourcesMap = new HashMap(); @Inject HostDao hostDao; @Override @@ -192,24 +189,12 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa return false; } - @Override - public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException { - // TODO Auto-generated method stub - return null; - } - @Override public boolean agentStatusTransitTo(HostVO host, Event e, long msId) { // TODO Auto-generated method stub return false; } - @Override - public AgentAttache findAttache(long hostId) { - // TODO Auto-generated method stub - return null; - } - @Override public void disconnectWithoutInvestigation(long hostId, Event event) { // TODO Auto-generated method stub diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java index bad67ce6ccd..41f62f797e1 100755 --- a/server/src/com/cloud/configuration/ConfigurationManager.java +++ b/server/src/com/cloud/configuration/ConfigurationManager.java @@ -242,6 +242,4 @@ public interface ConfigurationManager extends ConfigurationService, Manager { * @return */ String cleanupTags(String tags); - - ConfigValue getConfig(Config config, Class clazz); } diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 702c38c8cd8..0535b1c7e2e 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -65,6 +65,9 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd; import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd; import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; +import org.apache.cloudstack.config.ConfigKey; +import org.apache.cloudstack.config.ConfigRepo; +import org.apache.cloudstack.config.ConfigValue; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; @@ -187,7 +190,7 @@ import com.cloud.vm.dao.NicDao; import edu.emory.mathcs.backport.java.util.Arrays; @Local(value = { ConfigurationManager.class, ConfigurationService.class }) -public class ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, ConfigurationService { +public class ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, ConfigurationService, ConfigRepo { public static final Logger s_logger = Logger.getLogger(ConfigurationManagerImpl.class.getName()); @Inject @@ -4485,7 +4488,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } @Override - public ConfigValue getConfig(Config config, Class clazz) { + public ConfigValue get(ConfigKey config) { return new ConfigValue(_configDao, config); } } diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 28b7d9ceb55..1781017baa4 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -44,6 +44,9 @@ import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.messagebus.TopicConstants; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO.Step; import com.cloud.agent.AgentManager; import com.cloud.agent.AgentManager.OnError; @@ -167,7 +170,6 @@ import com.cloud.utils.fsm.StateMachine2; import com.cloud.vm.VirtualMachine.Event; import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; -import com.cloud.vm.VmWorkJobVO.Step; import com.cloud.vm.dao.NicDao; import com.cloud.vm.dao.UserVmDao; import com.cloud.vm.dao.UserVmDetailsDao; diff --git a/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java b/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java index 08584ed74a4..17963f7135c 100644 --- a/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java +++ b/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java @@ -30,6 +30,8 @@ import org.apache.cloudstack.framework.jobs.AsyncJob; import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher; import org.apache.cloudstack.framework.jobs.AsyncJobJoinMapVO; import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO; import com.cloud.api.ApiSerializerHelper; import com.cloud.user.AccountVO; diff --git a/server/test/com/cloud/vm/VmWorkTest.java b/server/test/com/cloud/vm/VmWorkTest.java index 4f91aba519f..3cb78da0f6b 100644 --- a/server/test/com/cloud/vm/VmWorkTest.java +++ b/server/test/com/cloud/vm/VmWorkTest.java @@ -46,11 +46,13 @@ import com.cloud.utils.LogUtils; import com.cloud.utils.Predicate; import com.cloud.utils.component.ComponentContext; import com.cloud.utils.db.Transaction; -import com.cloud.vm.VmWorkJobVO.Step; import com.google.gson.Gson; import org.apache.cloudstack.framework.jobs.AsyncJobManager; import org.apache.cloudstack.framework.jobs.AsyncJobVO; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO.Step; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations="classpath:/VmWorkTestContext.xml") diff --git a/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java b/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java index 5166372cd0d..258f88dc424 100644 --- a/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java +++ b/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java @@ -25,6 +25,7 @@ import javax.inject.Inject; import org.apache.cloudstack.framework.jobs.AsyncJob; import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher; import org.apache.cloudstack.framework.jobs.AsyncJobManager; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO; import com.cloud.api.ApiSerializerHelper; import com.cloud.async.AsyncJobExecutionContext; diff --git a/server/test/com/cloud/vm/VmWorkTestConfiguration.java b/server/test/com/cloud/vm/VmWorkTestConfiguration.java index 9db06f8e195..b436b1607ee 100644 --- a/server/test/com/cloud/vm/VmWorkTestConfiguration.java +++ b/server/test/com/cloud/vm/VmWorkTestConfiguration.java @@ -33,6 +33,8 @@ import org.apache.cloudstack.framework.jobs.dao.SyncQueueDao; import org.apache.cloudstack.framework.jobs.dao.SyncQueueDaoImpl; import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDao; import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDaoImpl; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobDaoImpl; import com.cloud.api.ApiDispatcher; import com.cloud.cluster.ClusterManager; diff --git a/server/test/com/cloud/vm/dao/VmDaoTest.java b/server/test/com/cloud/vm/dao/VmDaoTest.java index b22c20306dc..d9819168b3d 100644 --- a/server/test/com/cloud/vm/dao/VmDaoTest.java +++ b/server/test/com/cloud/vm/dao/VmDaoTest.java @@ -29,13 +29,14 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobVO; + import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.db.Transaction; import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VmWorkJobDao; -import com.cloud.vm.VmWorkJobVO; import junit.framework.Assert; import junit.framework.TestCase; diff --git a/server/test/com/cloud/vm/dao/VmDaoTestConfiguration.java b/server/test/com/cloud/vm/dao/VmDaoTestConfiguration.java index 6b0a15a1f28..46d95016548 100644 --- a/server/test/com/cloud/vm/dao/VmDaoTestConfiguration.java +++ b/server/test/com/cloud/vm/dao/VmDaoTestConfiguration.java @@ -20,6 +20,9 @@ import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.apache.cloudstack.vm.jobs.VmWorkJobDao; +import org.apache.cloudstack.vm.jobs.VmWorkJobDaoImpl; + import com.cloud.cluster.agentlb.dao.HostTransferMapDao; import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl; import com.cloud.dc.dao.ClusterDao; @@ -30,8 +33,6 @@ import com.cloud.host.dao.HostDaoImpl; import com.cloud.host.dao.HostDetailsDao; import com.cloud.host.dao.HostTagsDao; import com.cloud.tags.dao.ResourceTagDao; -import com.cloud.vm.VmWorkJobDao; -import com.cloud.vm.VmWorkJobDaoImpl; @Configuration public class VmDaoTestConfiguration { diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java index d221f3c424f..bd6893bb7f5 100755 --- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java +++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java @@ -48,8 +48,6 @@ import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd; import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; -import com.cloud.configuration.Config; -import com.cloud.configuration.ConfigValue; import com.cloud.configuration.Configuration; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.ConfigurationService; @@ -633,10 +631,4 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu return false; } - @Override - public ConfigValue getConfig(Config config, Class clazz) { - // TODO Auto-generated method stub - return null; - } - }