From 3ef77bc85abef67d99b088301138d87b10636c7e Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Thu, 13 Jun 2013 13:48:28 -0700 Subject: [PATCH] Complete the move of the virtualmachinemanager to cloud-engine --- .../manager/allocator/HostAllocator.java | 3 +- .../src/com/cloud/alert/AlertManager.java | 0 .../com/cloud/ha/HighAvailabilityManager.java | 0 .../hypervisor/HypervisorGuruManager.java | 0 .../com/cloud/network/rules/RulesManager.java | 0 .../src/com/cloud/resource/Discoverer.java | 0 .../com/cloud/resource/ResourceManager.java | 0 .../cloud/resource/ResourceStateAdapter.java | 0 .../com/cloud/vm/ReservationContextImpl.java | 0 .../com/cloud/vm/VirtualMachineManager.java | 3 + .../cloud/vm/snapshot/VMSnapshotManager.java | 0 .../cloud/vm/VirtualMachineManagerImpl.java | 92 ++++++++++--------- .../vm/VirtualMachinePowerStateSync.java | 0 .../vm/VirtualMachinePowerStateSyncImpl.java | 3 +- .../src/com/cloud/vm/VmWorkJobDispatcher.java | 7 +- .../src/com/cloud/vm/VmWorkStart.java | 0 .../src/com/cloud/vm/VmWorkStop.java | 0 .../cloud/async/AsyncJobExecutionContext.java | 0 .../allocator/impl/RandomAllocator.java | 7 +- .../allocator/impl/FirstFitAllocator.java | 48 +++++----- .../allocator/impl/TestingAllocator.java | 5 +- .../com/cloud/async/AsyncJobManagerImpl.java | 5 +- .../com/cloud/capacity/CapacityManager.java | 5 +- .../cloud/capacity/CapacityManagerImpl.java | 7 +- .../src/com/cloud/configuration/Config.java | 3 +- .../configuration/ConfigurationManager.java | 17 ---- .../ConfigurationManagerImpl.java | 29 ------ .../cloudstack/messagebus/TopicConstants.java | 26 ------ .../com/cloud/api/StringMapTypeAdapter.java | 0 29 files changed, 100 insertions(+), 160 deletions(-) rename {server => api}/src/com/cloud/agent/manager/allocator/HostAllocator.java (96%) rename {server => engine/components-api}/src/com/cloud/alert/AlertManager.java (100%) rename {server => engine/components-api}/src/com/cloud/ha/HighAvailabilityManager.java (100%) rename {server => engine/components-api}/src/com/cloud/hypervisor/HypervisorGuruManager.java (100%) rename {server => engine/components-api}/src/com/cloud/network/rules/RulesManager.java (100%) rename {server => engine/components-api}/src/com/cloud/resource/Discoverer.java (100%) rename {server => engine/components-api}/src/com/cloud/resource/ResourceManager.java (100%) rename {server => engine/components-api}/src/com/cloud/resource/ResourceStateAdapter.java (100%) rename {server => engine/components-api}/src/com/cloud/vm/ReservationContextImpl.java (100%) rename {server => engine/components-api}/src/com/cloud/vm/snapshot/VMSnapshotManager.java (100%) rename {server => engine/orchestration}/src/com/cloud/vm/VirtualMachineManagerImpl.java (98%) rename {server => engine/orchestration}/src/com/cloud/vm/VirtualMachinePowerStateSync.java (100%) rename {server => engine/orchestration}/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java (96%) rename {server => engine/orchestration}/src/com/cloud/vm/VmWorkJobDispatcher.java (93%) rename {server => engine/orchestration}/src/com/cloud/vm/VmWorkStart.java (100%) rename {server => engine/orchestration}/src/com/cloud/vm/VmWorkStop.java (100%) rename {server => framework/jobs}/src/com/cloud/async/AsyncJobExecutionContext.java (100%) delete mode 100644 server/src/org/apache/cloudstack/messagebus/TopicConstants.java rename {server => utils}/src/com/cloud/api/StringMapTypeAdapter.java (100%) diff --git a/server/src/com/cloud/agent/manager/allocator/HostAllocator.java b/api/src/com/cloud/agent/manager/allocator/HostAllocator.java similarity index 96% rename from server/src/com/cloud/agent/manager/allocator/HostAllocator.java rename to api/src/com/cloud/agent/manager/allocator/HostAllocator.java index a75533c0122..dbfe8932be2 100755 --- a/server/src/com/cloud/agent/manager/allocator/HostAllocator.java +++ b/api/src/com/cloud/agent/manager/allocator/HostAllocator.java @@ -22,7 +22,6 @@ import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.host.Host; import com.cloud.host.Host.Type; -import com.cloud.host.HostVO; import com.cloud.offering.ServiceOffering; import com.cloud.utils.component.Adapter; import com.cloud.vm.VirtualMachine; @@ -78,7 +77,7 @@ public interface HostAllocator extends Adapter { * @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity) * @return List List of hosts that are suitable for VM allocation **/ - public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List hosts, int returnUpTo, + public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity); public static int RETURN_UPTO_ALL = -1; diff --git a/server/src/com/cloud/alert/AlertManager.java b/engine/components-api/src/com/cloud/alert/AlertManager.java similarity index 100% rename from server/src/com/cloud/alert/AlertManager.java rename to engine/components-api/src/com/cloud/alert/AlertManager.java diff --git a/server/src/com/cloud/ha/HighAvailabilityManager.java b/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java similarity index 100% rename from server/src/com/cloud/ha/HighAvailabilityManager.java rename to engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruManager.java b/engine/components-api/src/com/cloud/hypervisor/HypervisorGuruManager.java similarity index 100% rename from server/src/com/cloud/hypervisor/HypervisorGuruManager.java rename to engine/components-api/src/com/cloud/hypervisor/HypervisorGuruManager.java diff --git a/server/src/com/cloud/network/rules/RulesManager.java b/engine/components-api/src/com/cloud/network/rules/RulesManager.java similarity index 100% rename from server/src/com/cloud/network/rules/RulesManager.java rename to engine/components-api/src/com/cloud/network/rules/RulesManager.java diff --git a/server/src/com/cloud/resource/Discoverer.java b/engine/components-api/src/com/cloud/resource/Discoverer.java similarity index 100% rename from server/src/com/cloud/resource/Discoverer.java rename to engine/components-api/src/com/cloud/resource/Discoverer.java diff --git a/server/src/com/cloud/resource/ResourceManager.java b/engine/components-api/src/com/cloud/resource/ResourceManager.java similarity index 100% rename from server/src/com/cloud/resource/ResourceManager.java rename to engine/components-api/src/com/cloud/resource/ResourceManager.java diff --git a/server/src/com/cloud/resource/ResourceStateAdapter.java b/engine/components-api/src/com/cloud/resource/ResourceStateAdapter.java similarity index 100% rename from server/src/com/cloud/resource/ResourceStateAdapter.java rename to engine/components-api/src/com/cloud/resource/ResourceStateAdapter.java diff --git a/server/src/com/cloud/vm/ReservationContextImpl.java b/engine/components-api/src/com/cloud/vm/ReservationContextImpl.java similarity index 100% rename from server/src/com/cloud/vm/ReservationContextImpl.java rename to engine/components-api/src/com/cloud/vm/ReservationContextImpl.java diff --git a/engine/components-api/src/com/cloud/vm/VirtualMachineManager.java b/engine/components-api/src/com/cloud/vm/VirtualMachineManager.java index 83ec485230c..f1ace6c521b 100644 --- a/engine/components-api/src/com/cloud/vm/VirtualMachineManager.java +++ b/engine/components-api/src/com/cloud/vm/VirtualMachineManager.java @@ -65,6 +65,9 @@ import com.cloud.utils.fsm.NoTransitionException; * */ public interface VirtualMachineManager extends Manager { + public interface Topics { + public static final String VM_POWER_STATE = "vm.powerstate"; + } boolean allocate(String vmInstanceName, VMTemplateVO template, diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManager.java b/engine/components-api/src/com/cloud/vm/snapshot/VMSnapshotManager.java similarity index 100% rename from server/src/com/cloud/vm/snapshot/VMSnapshotManager.java rename to engine/components-api/src/com/cloud/vm/snapshot/VMSnapshotManager.java diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java similarity index 98% rename from server/src/com/cloud/vm/VirtualMachineManagerImpl.java rename to engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 2a8d5c38e4f..3492e6a735c 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -33,6 +33,10 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; +import org.apache.log4j.lf5.viewer.configure.ConfigurationManager; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.config.ConfigRepo; @@ -41,12 +45,12 @@ import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.config.Configs; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; +import org.apache.cloudstack.framework.jobs.AsyncJob; import org.apache.cloudstack.framework.jobs.AsyncJobConstants; import org.apache.cloudstack.framework.jobs.AsyncJobManager; import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.MessageDispatcher; import org.apache.cloudstack.framework.messagebus.MessageHandler; -import org.apache.cloudstack.messagebus.TopicConstants; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.vm.jobs.VmWorkJobDao; import org.apache.cloudstack.vm.jobs.VmWorkJobVO; @@ -80,9 +84,8 @@ import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.agent.manager.Commands; import com.cloud.agent.manager.allocator.HostAllocator; import com.cloud.alert.AlertManager; -import com.cloud.api.ApiSerializerHelper; +import com.cloud.api.StringMapTypeAdapter; import com.cloud.async.AsyncJobExecutionContext; -import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.dao.EntityManager; import com.cloud.dc.ClusterDetailsDao; @@ -97,8 +100,6 @@ import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlanner; import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.deploy.DeploymentPlanningManager; -import com.cloud.event.EventTypes; -import com.cloud.event.UsageEventUtils; import com.cloud.exception.AffinityConflictException; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.ConcurrentOperationException; @@ -132,7 +133,6 @@ import com.cloud.resource.ResourceManager; import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.Storage.ImageFormat; -import com.cloud.storage.StorageManager; import com.cloud.storage.StoragePool; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Volume; @@ -142,12 +142,12 @@ import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.StoragePoolHostDao; import com.cloud.storage.dao.VolumeDao; import com.cloud.user.Account; -import com.cloud.user.AccountManager; import com.cloud.user.User; import com.cloud.utils.DateUtil; import com.cloud.utils.Journal; import com.cloud.utils.Pair; import com.cloud.utils.Predicate; +import com.cloud.utils.StringUtils; import com.cloud.utils.Ternary; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; @@ -177,8 +177,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Inject ConfigRepo _configRepo; @Inject - protected StorageManager _storageMgr; - @Inject DataStoreManager _dataStoreMgr; @Inject protected NetworkManager _networkMgr; @@ -196,8 +194,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Inject protected NicDao _nicsDao; @Inject - protected AccountManager _accountMgr; - @Inject protected HostDao _hostDao; @Inject protected AlertManager _alertMgr; @@ -271,6 +267,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac protected ConfigValue _operationTimeout; protected ConfigValue _forceStop; protected long _nodeId; + protected Gson _gson; SearchBuilder RootVolumeSearch; @@ -479,7 +476,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac .done(); - _messageBus.subscribe(TopicConstants.VM_POWER_STATE, MessageDispatcher.getDispatcher(this)); + _messageBus.subscribe(Topics.VM_POWER_STATE, MessageDispatcher.getDispatcher(this)); + + GsonBuilder gBuilder = new GsonBuilder(); + gBuilder.setVersion(1.3); + gBuilder.registerTypeAdapter(Map.class, new StringMapTypeAdapter()); + _gson = gBuilder.create(); return true; } @@ -666,6 +668,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac return false; } + public String serialize(VmWork work) { + return _gson.toJson(work); + } + + public T deserialize(Class clazz, String work) { + return _gson.fromJson(work, clazz); + } + @Override @DB public void advanceStart(String vmUuid, Map params, DeploymentPlan planToDeploy) @@ -708,7 +718,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workInfo.setVmId(vm.getId()); workInfo.setPlan(planToDeploy); workInfo.setParams(params); - workJob.setCmdInfo(ApiSerializerHelper.toSerializedString(workInfo)); + workJob.setCmdInfo(serialize(workInfo)); _jobMgr.submitAsyncJob(workJob, VmWorkJobDispatcher.VM_WORK_QUEUE, vm.getId()); } @@ -730,7 +740,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // // _jobMgr.waitAndCheck( - new String[] { TopicConstants.VM_POWER_STATE, TopicConstants.JOB_STATE }, + new String[] {Topics.VM_POWER_STATE, AsyncJob.Topics.JOB_STATE}, 3000L, 600000L, new Predicate() { @Override @@ -976,10 +986,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VmWorkJobVO.Step prevStep = work.getStep(); _workJobDao.updateStep(work.getId(), VmWorkJobVO.Step.Release); if (prevStep == VmWorkJobVO.Step.Started || prevStep == VmWorkJobVO.Step.Starting) { - cleanup(vmGuru, vmProfile, work, Event.OperationFailed, false, caller, account); + cleanup(vmGuru, vmProfile, work, Event.OperationFailed, false); } else { //if step is not starting/started, send cleanup command with force=true - cleanup(vmGuru, vmProfile, work, Event.OperationFailed, true, caller, account); + cleanup(vmGuru, vmProfile, work, Event.OperationFailed, true); } } } @@ -1039,8 +1049,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac return true; } - protected boolean cleanup(VirtualMachineGuru guru, VirtualMachineProfile profile, VmWorkJobVO work, Event event, boolean force, User user, - Account account) { + protected boolean cleanup(VirtualMachineGuru guru, VirtualMachineProfile profile, VmWorkJobVO work, Event event, boolean force) { VirtualMachine vm = profile.getVirtualMachine(); State state = vm.getState(); s_logger.debug("Cleaning up resources for the vm " + vm + " in " + state + " state"); @@ -1142,7 +1151,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workInfo.setUserId(user.getId()); workInfo.setVmId(vm.getId()); workInfo.setForceStop(forced); - workJob.setCmdInfo(ApiSerializerHelper.toSerializedString(workInfo)); + workJob.setCmdInfo(serialize(workInfo)); _jobMgr.submitAsyncJob(workJob, VmWorkJobDispatcher.VM_WORK_QUEUE, vm.getId()); } @@ -1158,7 +1167,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(jobId); _jobMgr.waitAndCheck( - new String[] { TopicConstants.VM_POWER_STATE, TopicConstants.JOB_STATE }, + new String[] {Topics.VM_POWER_STATE, AsyncJob.Topics.JOB_STATE}, 3000L, 600000L, new Predicate() { @Override @@ -1234,7 +1243,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } if (doCleanup) { - if (cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.StopRequested, forced, user, account)) { + if (cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.StopRequested, forced)) { try { if (s_logger.isDebugEnabled()) { s_logger.debug("Updating work item to Done, id:" + work.getId()); @@ -1774,8 +1783,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } catch (AgentUnavailableException e) { s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId); } - cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true, - _accountMgr.getSystemUser(), _accountMgr.getSystemAccount()); + cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true); return null; } } catch (OperationTimedoutException e) { @@ -2858,8 +2866,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } // Check that the service offering being upgraded to has all the tags of the current service offering - List currentTags = _configMgr.csvTagsToList(currentServiceOffering.getTags()); - List newTags = _configMgr.csvTagsToList(newServiceOffering.getTags()); + List currentTags = StringUtils.csvTagsToList(currentServiceOffering.getTags()); + List newTags = StringUtils.csvTagsToList(newServiceOffering.getTags()); if (!newTags.containsAll(currentTags)) { throw new InvalidParameterValueException("Unable to upgrade virtual machine; the new service offering " + "does not have all the tags of the " @@ -2872,7 +2880,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac public boolean upgradeVmDb(long vmId, long serviceOfferingId) { VMInstanceVO vmForUpdate = _vmDao.createForUpdate(); vmForUpdate.setServiceOfferingId(serviceOfferingId); - ServiceOffering newSvcOff = _configMgr.getServiceOffering(serviceOfferingId); + ServiceOffering newSvcOff = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); vmForUpdate.setHaEnabled(newSvcOff.getOfferHA()); vmForUpdate.setLimitCpuUse(newSvcOff.getLimitCpuUse()); vmForUpdate.setServiceOfferingId(newSvcOff.getId()); @@ -2955,7 +2963,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmVO, null, null, null, null); - DataCenter dc = _configMgr.getZone(network.getDataCenterId()); + DataCenter dc = _entityMgr.findById(DataCenter.class, network.getDataCenterId()); Host host = _hostDao.findById(vm.getHostId()); DeployDestination dest = new DeployDestination(dc, null, null, host); @@ -2980,9 +2988,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.debug("Nic is plugged successfully for vm " + vm + " in network " + network + ". Vm is a part of network now"); long isDefault = (nic.isDefaultNic()) ? 1 : 0; // insert nic's Id into DB as resource_name - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), - vmVO.getDataCenterId(), vmVO.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), - null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid()); + //FIXME +// UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), +// vmVO.getDataCenterId(), vmVO.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), +// null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid()); return nic; } else { s_logger.warn("Failed to plug nic to the vm " + vm + " in network " + network); @@ -3022,7 +3031,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmVO, null, null, null, null); - DataCenter dc = _configMgr.getZone(network.getDataCenterId()); + DataCenter dc = _entityMgr.findById(DataCenter.class, network.getDataCenterId()); Host host = _hostDao.findById(vm.getHostId()); DeployDestination dest = new DeployDestination(dc, null, null, host); HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vmProfile.getVirtualMachine().getHypervisorType()); @@ -3053,9 +3062,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (result) { s_logger.debug("Nic is unplugged successfully for vm " + vm + " in network " + network ); long isDefault = (nic.isDefaultNic()) ? 1 : 0; - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), - vm.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), null, - isDefault, VirtualMachine.class.getName(), vm.getUuid()); + //FIXME +// UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), +// vm.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), null, +// isDefault, VirtualMachine.class.getName(), vm.getUuid()); } else { s_logger.warn("Failed to unplug nic for the vm " + vm + " from network " + network); return false; @@ -3086,7 +3096,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmVO, null, null, null, null); - DataCenter dc = _configMgr.getZone(network.getDataCenterId()); + DataCenter dc = _entityMgr.findById(DataCenter.class, network.getDataCenterId()); Host host = _hostDao.findById(vm.getHostId()); DeployDestination dest = new DeployDestination(dc, null, null, host); HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vmProfile.getVirtualMachine().getHypervisorType()); @@ -3418,7 +3428,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // PowerState report handling for out-of-band changes and handling of left-over transitional VM states // - @MessageHandler(topic=TopicConstants.VM_POWER_STATE) + @MessageHandler(topic = Topics.VM_POWER_STATE) private void HandlePownerStateReport(Object target, String subject, String senderAddress, Object args) { assert(args != null); Long vmId = (Long)args; @@ -3438,7 +3448,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac HandlePowerOffReportWithNoPendingJobsOnVM(vm); break; - // PowerUnknown shouldn't be reported, it is a derived + // PowerUnknown shouldn't be reported, it is a derived // VM power state from host state (host un-reachable case PowerUnknown : default : @@ -3492,7 +3502,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac case Destroyed : case Expunging : - s_logger.info("Receive power on report when VM is in destroyed or expunging state. vm: " + s_logger.info("Receive power on report when VM is in destroyed or expunging state. vm: " + vm.getId() + ", state: " + vm.getState()); break; @@ -3506,7 +3516,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac case Error : default : - s_logger.info("Receive power on report when VM is in error or unexpected state. vm: " + s_logger.info("Receive power on report when VM is in error or unexpected state. vm: " + vm.getId() + ", state: " + vm.getState()); break; } @@ -3517,7 +3527,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // TODO : // 1) handle left-over transitional VM states // 2) handle out of sync stationary states, schedule force-stop to release resources - // + // switch(vm.getState()) { case Starting : break; @@ -3546,7 +3556,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac private void scanStalledVMInTransitionState(long hostId) { // - // TODO check VM that is stuck in Starting, Stopping, Migrating states, we won't check + // TODO check VM that is stuck in Starting, Stopping, Migrating states, we won't check // VMs in expunging state (this need to be handled specially) // // checking condition diff --git a/server/src/com/cloud/vm/VirtualMachinePowerStateSync.java b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSync.java similarity index 100% rename from server/src/com/cloud/vm/VirtualMachinePowerStateSync.java rename to engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSync.java diff --git a/server/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java similarity index 96% rename from server/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java rename to engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java index 9273ed016c2..e76781c357e 100644 --- a/server/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java @@ -25,7 +25,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.PublishScope; -import org.apache.cloudstack.messagebus.TopicConstants; import com.cloud.agent.api.HostVmStateReportEntry; import com.cloud.vm.VirtualMachine.PowerState; @@ -78,7 +77,7 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat if(s_logger.isDebugEnabled()) s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); - _messageBus.publish(null, TopicConstants.VM_POWER_STATE, PublishScope.GLOBAL, entry.getKey()); + _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, entry.getKey()); } } diff --git a/server/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java similarity index 93% rename from server/src/com/cloud/vm/VmWorkJobDispatcher.java rename to engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java index 3e6dc0bc36f..e0be62f774c 100644 --- a/server/src/com/cloud/vm/VmWorkJobDispatcher.java +++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java @@ -26,7 +26,6 @@ import org.apache.cloudstack.framework.jobs.AsyncJobConstants; import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher; import org.apache.cloudstack.framework.jobs.AsyncJobManager; -import com.cloud.api.ApiSerializerHelper; import com.cloud.dao.EntityManager; import com.cloud.user.dao.AccountDao; import com.cloud.utils.component.AdapterBase; @@ -56,7 +55,11 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch String cmd = job.getCmd(); assert(cmd != null); - work = (VmWork)ApiSerializerHelper.fromSerializedString(job.getCmdInfo()); + if (cmd.equals(Start)) { + work = _vmMgr.deserialize(VmWorkStart.class, job.getCmdInfo()); + } else { + work = _vmMgr.deserialize(VmWorkStop.class, job.getCmdInfo()); + } assert(work != null); CallContext.register(work.getUserId(), work.getAccountId(), job.getRelated()); diff --git a/server/src/com/cloud/vm/VmWorkStart.java b/engine/orchestration/src/com/cloud/vm/VmWorkStart.java similarity index 100% rename from server/src/com/cloud/vm/VmWorkStart.java rename to engine/orchestration/src/com/cloud/vm/VmWorkStart.java diff --git a/server/src/com/cloud/vm/VmWorkStop.java b/engine/orchestration/src/com/cloud/vm/VmWorkStop.java similarity index 100% rename from server/src/com/cloud/vm/VmWorkStop.java rename to engine/orchestration/src/com/cloud/vm/VmWorkStop.java diff --git a/server/src/com/cloud/async/AsyncJobExecutionContext.java b/framework/jobs/src/com/cloud/async/AsyncJobExecutionContext.java similarity index 100% rename from server/src/com/cloud/async/AsyncJobExecutionContext.java rename to framework/jobs/src/com/cloud/async/AsyncJobExecutionContext.java diff --git a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java index 3b0c8f0e18b..c7a58218596 100755 --- a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java +++ b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java @@ -11,7 +11,7 @@ // 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.agent.manager.allocator.impl; @@ -19,13 +19,11 @@ package com.cloud.agent.manager.allocator.impl; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map; import javax.ejb.Local; import javax.inject.Inject; import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; import com.cloud.agent.manager.allocator.HostAllocator; import com.cloud.deploy.DeploymentPlan; @@ -40,7 +38,6 @@ import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; -@Component @Local(value=HostAllocator.class) public class RandomAllocator extends AdapterBase implements HostAllocator { private static final Logger s_logger = Logger.getLogger(RandomAllocator.class); @@ -55,7 +52,7 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { @Override public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, - ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity) { + ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity) { long dcId = plan.getDataCenterId(); Long podId = plan.getPodId(); Long clusterId = plan.getClusterId(); diff --git a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java index 29ba83772d1..bb06fd6a6a4 100755 --- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java @@ -40,7 +40,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.host.DetailVO; import com.cloud.host.Host; import com.cloud.host.Host.Type; -import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.offering.ServiceOffering; @@ -121,7 +120,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { boolean hasSvcOfferingTag = hostTagOnOffering != null ? true : false; boolean hasTemplateTag = hostTagOnTemplate != null ? true : false; - List clusterHosts = new ArrayList(); + List clusterHosts = new ArrayList(); String haVmTag = (String)vmProfile.getParameter(VirtualMachineProfile.Param.HaTag); if (haVmTag != null) { @@ -130,8 +129,8 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { if (hostTagOnOffering == null && hostTagOnTemplate == null){ clusterHosts = _resourceMgr.listAllUpAndEnabledNonHAHosts(type, clusterId, podId, dcId); } else { - List hostsMatchingOfferingTag = new ArrayList(); - List hostsMatchingTemplateTag = new ArrayList(); + List hostsMatchingOfferingTag = new ArrayList(); + List hostsMatchingTemplateTag = new ArrayList(); if (hasSvcOfferingTag){ if (s_logger.isDebugEnabled()){ s_logger.debug("Looking for hosts having tag specified on SvcOffering:" + hostTagOnOffering); @@ -170,9 +169,9 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { } // add all hosts that we are not considering to the avoid list - List allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(type, clusterId, podId, dcId, null); + List allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(type, clusterId, podId, dcId, null); allhostsInCluster.removeAll(clusterHosts); - for (HostVO host : allhostsInCluster) { + for (Host host : allhostsInCluster) { avoid.addHost(host.getId()); } @@ -181,7 +180,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { @Override public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, - Type type, ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity) { + Type type, ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity) { long dcId = plan.getDataCenterId(); Long podId = plan.getPodId(); Long clusterId = plan.getClusterId(); @@ -226,7 +225,8 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { return suitableHosts; } - protected List allocateTo(DeploymentPlan plan, ServiceOffering offering, VMTemplateVO template, ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity, Account account) { + protected List allocateTo(DeploymentPlan plan, ServiceOffering offering, VMTemplateVO template, ExcludeList avoid, List hosts, int returnUpTo, + boolean considerReservedCapacity, Account account) { if (_allocationAlgorithm.equals("random") || _allocationAlgorithm.equals("userconcentratedpod_random")) { // Shuffle this so that we don't check the hosts in the same order. Collections.shuffle(hosts); @@ -252,7 +252,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { List suitableHosts = new ArrayList(); - for (HostVO host : hosts) { + for (Host host : hosts) { if(suitableHosts.size() == returnUpTo){ break; } @@ -303,7 +303,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { return suitableHosts; } - private List reorderHostsByNumberOfVms(DeploymentPlan plan, List hosts, Account account) { + private List reorderHostsByNumberOfVms(DeploymentPlan plan, List hosts, Account account) { if(account == null){ return hosts; } @@ -317,15 +317,15 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { } //now filter the given list of Hosts by this ordered list - Map hostMap = new HashMap(); - for (HostVO host : hosts) { + Map hostMap = new HashMap(); + for (Host host : hosts) { hostMap.put(host.getId(), host); } List matchingHostIds = new ArrayList(hostMap.keySet()); hostIdsByVmCount.retainAll(matchingHostIds); - List reorderedHosts = new ArrayList(); + List reorderedHosts = new ArrayList(); for(Long id: hostIdsByVmCount){ reorderedHosts.add(hostMap.get(id)); } @@ -340,7 +340,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { return true; } - protected List prioritizeHosts(VMTemplateVO template, List hosts) { + protected List prioritizeHosts(VMTemplateVO template, List hosts) { if (template == null) { return hosts; } @@ -348,13 +348,13 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { // Determine the guest OS category of the template String templateGuestOSCategory = getTemplateGuestOSCategory(template); - List prioritizedHosts = new ArrayList(); - List noHvmHosts = new ArrayList(); + List prioritizedHosts = new ArrayList(); + List noHvmHosts = new ArrayList(); // If a template requires HVM and a host doesn't support HVM, remove it from consideration - List hostsToCheck = new ArrayList(); + List hostsToCheck = new ArrayList(); if (template.isRequiresHvm()) { - for (HostVO host : hosts) { + for (Host host : hosts) { if (hostSupportsHVM(host)) { hostsToCheck.add(host); } else { @@ -372,9 +372,9 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { } // If a host is tagged with the same guest OS category as the template, move it to a high priority list // If a host is tagged with a different guest OS category than the template, move it to a low priority list - List highPriorityHosts = new ArrayList(); - List lowPriorityHosts = new ArrayList(); - for (HostVO host : hostsToCheck) { + List highPriorityHosts = new ArrayList(); + List lowPriorityHosts = new ArrayList(); + for (Host host : hostsToCheck) { String hostGuestOSCategory = getHostGuestOSCategory(host); if (hostGuestOSCategory == null) { continue; @@ -389,7 +389,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { hostsToCheck.removeAll(lowPriorityHosts); // Prioritize the remaining hosts by HVM capability - for (HostVO host : hostsToCheck) { + for (Host host : hostsToCheck) { if (!template.isRequiresHvm() && !hostSupportsHVM(host)) { // Host and template both do not support hvm, put it as first consideration prioritizedHosts.add(0, host); @@ -406,7 +406,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { return prioritizedHosts; } - protected boolean hostSupportsHVM(HostVO host) { + protected boolean hostSupportsHVM(Host host) { if ( !_checkHvm ) { return true; } @@ -425,7 +425,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { return false; } - protected String getHostGuestOSCategory(HostVO host) { + protected String getHostGuestOSCategory(Host host) { DetailVO hostDetail = _hostDetailsDao.findDetail(host.getId(), "guest.os.category.id"); if (hostDetail != null) { String guestOSCategoryIdString = hostDetail.getValue(); diff --git a/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java index b80dddc972d..042b26e4123 100755 --- a/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java @@ -29,7 +29,6 @@ import com.cloud.agent.manager.allocator.HostAllocator; import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.host.Host; -import com.cloud.host.HostVO; import com.cloud.host.Host.Type; import com.cloud.host.dao.HostDao; import com.cloud.offering.ServiceOffering; @@ -53,7 +52,7 @@ public class TestingAllocator extends AdapterBase implements HostAllocator { @Override public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, - ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity) { + ExcludeList avoid, List hosts, int returnUpTo, boolean considerReservedCapacity) { return allocateTo(vmProfile, plan, type, avoid, returnUpTo, considerReservedCapacity); } @@ -61,7 +60,7 @@ public class TestingAllocator extends AdapterBase implements HostAllocator { public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity) { List availableHosts = new ArrayList(); - Host host = null; + Host host = null; if (type == Host.Type.Routing && _routingHost != null) { host = _hostDao.findById(_routingHost); } else if (type == Host.Type.Storage && _storageHost != null) { diff --git a/server/src/com/cloud/async/AsyncJobManagerImpl.java b/server/src/com/cloud/async/AsyncJobManagerImpl.java index d65347c02bc..fd6775e1464 100644 --- a/server/src/com/cloud/async/AsyncJobManagerImpl.java +++ b/server/src/com/cloud/async/AsyncJobManagerImpl.java @@ -58,7 +58,6 @@ import org.apache.cloudstack.framework.jobs.impl.SyncQueueVO; import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.MessageDetector; import org.apache.cloudstack.framework.messagebus.PublishScope; -import org.apache.cloudstack.messagebus.TopicConstants; import com.cloud.api.ApiSerializerHelper; import com.cloud.cluster.ClusterManager; @@ -254,7 +253,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, scheduleExecution(jobToWakeup, false); } - _messageBus.publish(null, TopicConstants.JOB_STATE, PublishScope.GLOBAL, jobId); + _messageBus.publish(null, AsyncJob.Topics.JOB_STATE, PublishScope.GLOBAL, jobId); } catch(Exception e) { s_logger.error("Unexpected exception while completing async job-" + jobId, e); txn.rollback(); @@ -511,7 +510,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, private long getJobRunNumber() { synchronized(this) { - return this._executionRunNumber++; + return _executionRunNumber++; } } diff --git a/server/src/com/cloud/capacity/CapacityManager.java b/server/src/com/cloud/capacity/CapacityManager.java index bdd9ccd155b..e8fdd949df4 100755 --- a/server/src/com/cloud/capacity/CapacityManager.java +++ b/server/src/com/cloud/capacity/CapacityManager.java @@ -18,6 +18,7 @@ package com.cloud.capacity; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.storage.VMTemplateVO; import com.cloud.utils.component.Manager; @@ -45,7 +46,7 @@ public interface CapacityManager extends Manager { /** * @param pool storage pool - * @param templateForVmCreation template that will be used for vm creation + * @param templateForVmCreation template that will be used for vm creation * @return total allocated capacity for the storage pool */ long getAllocatedPoolCapacity(StoragePoolVO pool, VMTemplateVO templateForVmCreation); @@ -55,5 +56,5 @@ public interface CapacityManager extends Manager { * @param host the host to be checked * @return true if the count of host's running VMs >= hypervisor limit */ - boolean checkIfHostReachMaxGuestLimit(HostVO host); + boolean checkIfHostReachMaxGuestLimit(Host host); } diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java index e58ae4079bc..840ac7b806b 100755 --- a/server/src/com/cloud/capacity/CapacityManagerImpl.java +++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java @@ -27,11 +27,12 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.PublishScope; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; @@ -899,7 +900,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager, } @Override - public boolean checkIfHostReachMaxGuestLimit(HostVO host) { + public boolean checkIfHostReachMaxGuestLimit(Host host) { Long vmCount = _vmDao.countRunningByHostId(host.getId()); HypervisorType hypervisorType = host.getHypervisorType(); String hypervisorVersion = host.getHypervisorVersion(); diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 5ee0fad8643..ed467932f86 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -160,7 +160,8 @@ public enum Config { HostStatsInterval("Advanced", ManagementServer.class, Integer.class, "host.stats.interval", "60000", "The interval (in milliseconds) when host stats are retrieved from agents.", null), HostRetry("Advanced", AgentManager.class, Integer.class, "host.retry", "2", "Number of times to retry hosts for creating a volume", null), IntegrationAPIPort("Advanced", ManagementServer.class, Integer.class, "integration.api.port", null, "Defaul API port", null), - InvestigateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "investigate.retry.interval", "60", "Time (in seconds) between VM pings when agent is disconnected", null), + InvestigateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "investigate.retry.interval", "60", + "Time (in seconds) between VM pings when agent is disconnected", null), MigrateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "migrate.retry.interval", "120", "Time (in seconds) between migration retries", null), PingInterval("Advanced", AgentManager.class, Integer.class, "ping.interval", "60", "Ping interval in seconds", null), PingTimeout("Advanced", AgentManager.class, Float.class, "ping.timeout", "2.5", "Multiplier to ping.interval before announcing an agent has timed out", null), diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java index 01eb67944d4..81c96bbd0bd 100755 --- a/server/src/com/cloud/configuration/ConfigurationManager.java +++ b/server/src/com/cloud/configuration/ConfigurationManager.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.configuration; -import java.util.List; import java.util.Map; import java.util.Set; @@ -154,22 +153,6 @@ public interface ConfigurationManager extends ConfigurationService, Manager { */ boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId, Account caller); - /** - * Converts a comma separated list of tags to a List - * - * @param tags - * @return List of tags - */ - List csvTagsToList(String tags); - - /** - * Converts a List of tags to a comma separated list - * - * @param tags - * @return String containing a comma separated list of tags - */ - String listToCsvTags(List tags); - void checkZoneAccess(Account caller, DataCenter zone); void checkDiskOfferingAccess(Account caller, DiskOffering dof); diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index a02327e3b35..15f9d0fa0cc 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3216,35 +3216,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } - @Override - public List csvTagsToList(String tags) { - List tagsList = new ArrayList(); - - if (tags != null) { - String[] tokens = tags.split(","); - for (int i = 0; i < tokens.length; i++) { - tagsList.add(tokens[i].trim()); - } - } - - return tagsList; - } - - @Override - public String listToCsvTags(List tagsList) { - String tags = ""; - if (tagsList.size() > 0) { - for (int i = 0; i < tagsList.size(); i++) { - tags += tagsList.get(i); - if (i != tagsList.size() - 1) { - tags += ","; - } - } - } - - return tags; - } - @Override public String cleanupTags(String tags) { if (tags != null) { diff --git a/server/src/org/apache/cloudstack/messagebus/TopicConstants.java b/server/src/org/apache/cloudstack/messagebus/TopicConstants.java deleted file mode 100644 index 6f465f4906e..00000000000 --- a/server/src/org/apache/cloudstack/messagebus/TopicConstants.java +++ /dev/null @@ -1,26 +0,0 @@ -// 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.messagebus; - -public interface TopicConstants { - // VM power state messages on message bus - public static final String VM_POWER_STATE = "vm.powerstate"; // args vmid - - // job messages on message bus - public static final String JOB_HEARTBEAT = "job.heartbeat"; // args jobid - public static final String JOB_STATE = "job.state"; // args jobid -} diff --git a/server/src/com/cloud/api/StringMapTypeAdapter.java b/utils/src/com/cloud/api/StringMapTypeAdapter.java similarity index 100% rename from server/src/com/cloud/api/StringMapTypeAdapter.java rename to utils/src/com/cloud/api/StringMapTypeAdapter.java