mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Keep removing
This commit is contained in:
parent
56e5fbdee2
commit
f922c6fc03
@ -53,10 +53,7 @@ import com.cloud.utils.ProcessUtil;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.LegacyComponentLocator;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.MacAddress;
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
public class AgentShell implements IAgentShell {
|
||||
@ -146,6 +143,7 @@ public class AgentShell implements IAgentShell {
|
||||
return _guid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCmdLineProperties() {
|
||||
return _cmdLineProperties;
|
||||
}
|
||||
@ -378,8 +376,6 @@ public class AgentShell implements IAgentShell {
|
||||
|
||||
public void init(String[] args) throws ConfigurationException {
|
||||
|
||||
final LegacyComponentLocator locator = LegacyComponentLocator.getLocator("agent");
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
_version = c.getPackage().getImplementationVersion();
|
||||
if (_version == null) {
|
||||
@ -396,12 +392,9 @@ public class AgentShell implements IAgentShell {
|
||||
s_logger.debug("Found property: " + property);
|
||||
}
|
||||
|
||||
_storage = locator.getManager(StorageComponent.class);
|
||||
if (_storage == null) {
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
// merge with properties from command line to let resource access
|
||||
// command line parameters
|
||||
@ -410,22 +403,9 @@ public class AgentShell implements IAgentShell {
|
||||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
|
||||
final Enumeration en = adapters.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
_backoff = (BackoffAlgorithm) en.nextElement();
|
||||
break;
|
||||
}
|
||||
if (en.hasMoreElements()) {
|
||||
s_logger.info("More than one backoff algorithm specified. Using the first one ");
|
||||
}
|
||||
|
||||
if (_backoff == null) {
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff",
|
||||
new HashMap<String, Object>());
|
||||
}
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
private void launchAgent() throws ConfigurationException {
|
||||
@ -469,6 +449,7 @@ public class AgentShell implements IAgentShell {
|
||||
openPortWithIptables(port);
|
||||
|
||||
_consoleProxyMain = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
|
||||
@ -23,7 +23,6 @@ import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -41,19 +40,15 @@ import com.cloud.agent.dao.impl.PropertiesStorage;
|
||||
import com.cloud.agent.transport.Request;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.ProcessUtil;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.LegacyComponentLocator;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.MacAddress;
|
||||
import com.cloud.utils.nio.HandlerFactory;
|
||||
import com.cloud.utils.nio.Link;
|
||||
import com.cloud.utils.nio.NioServer;
|
||||
import com.cloud.utils.nio.Task;
|
||||
import com.cloud.utils.nio.Task.Type;
|
||||
|
||||
/**
|
||||
* Implementation of agent shell to run the agents on System Center Virtual Machine manager
|
||||
@ -81,7 +76,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
||||
private int _nextAgentId = 1;
|
||||
private volatile boolean _exit = false;
|
||||
private int _pingRetries;
|
||||
private Thread _consoleProxyMain = null;
|
||||
private final Thread _consoleProxyMain = null;
|
||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||
|
||||
public VmmAgentShell() {
|
||||
@ -317,8 +312,6 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
||||
|
||||
private void init(String[] args) throws ConfigurationException{
|
||||
|
||||
final LegacyComponentLocator locator = LegacyComponentLocator.getLocator("agent");
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
_version = c.getPackage().getImplementationVersion();
|
||||
if (_version == null) {
|
||||
@ -328,34 +321,19 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
|
||||
|
||||
parseCommand(args);
|
||||
|
||||
_storage = locator.getManager(StorageComponent.class);
|
||||
if (_storage == null) {
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
// merge with properties from command line to let resource access command line parameters
|
||||
for(Map.Entry<String, Object> cmdLineProp : getCmdLineProperties().entrySet()) {
|
||||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
|
||||
final Enumeration en = adapters.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
_backoff = (BackoffAlgorithm)en.nextElement();
|
||||
break;
|
||||
}
|
||||
if (en.hasMoreElements()) {
|
||||
s_logger.info("More than one backoff algorithm specified. Using the first one ");
|
||||
}
|
||||
|
||||
if (_backoff == null) {
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
}
|
||||
|
||||
private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException {
|
||||
String[] names = resourceClassNames.split("\\|");
|
||||
|
||||
@ -1,76 +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 com.cloud.agent.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.utils.component.ComponentLibraryBase;
|
||||
import com.cloud.utils.component.LegacyComponentLocator.ComponentInfo;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public class AgentComponentLibraryBase extends ComponentLibraryBase {
|
||||
@Override
|
||||
public Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ComponentInfo<Manager>> getManagers() {
|
||||
if (_managers.size() == 0) {
|
||||
populateManagers();
|
||||
}
|
||||
return _managers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
|
||||
if (_adapters.size() == 0) {
|
||||
populateAdapters();
|
||||
}
|
||||
return _adapters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Class<?>, Class<?>> getFactories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void populateManagers() {
|
||||
// addManager("StackMaidManager", StackMaidManagerImpl.class);
|
||||
}
|
||||
|
||||
protected void populateAdapters() {
|
||||
|
||||
}
|
||||
|
||||
protected void populateServices() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
|
||||
if (_pluggableServices.size() == 0) {
|
||||
populateServices();
|
||||
}
|
||||
return _pluggableServices;
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,12 +19,11 @@ package com.cloud.agent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentShell;
|
||||
import com.cloud.utils.testcase.Log4jEnabledTestCase;
|
||||
|
||||
public class TestAgentShell extends Log4jEnabledTestCase {
|
||||
public class TestAgentShell extends TestCase {
|
||||
protected final static Logger s_logger = Logger.getLogger(TestAgentShell.class);
|
||||
|
||||
public void testWget() {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.apache.cloudstack.storage.datastore;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||
import org.apache.cloudstack.storage.db.ObjectInDataStoreDao;
|
||||
import org.apache.cloudstack.storage.db.ObjectInDataStoreVO;
|
||||
|
||||
@ -25,9 +25,7 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@ -44,15 +42,14 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
@ -167,7 +164,13 @@ import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.kvm.resource.KVMHABase.NfsStoragePool;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ClockDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ConsoleDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.CpuTuneDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef;
|
||||
@ -182,16 +185,10 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ClockDef;
|
||||
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.IsolationType;
|
||||
import com.cloud.network.Networks.RouterPrivateIpStrategy;
|
||||
@ -199,6 +196,7 @@ import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.PhysicalNetworkSetupInfo;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.ServerResourceBase;
|
||||
import com.cloud.storage.JavaStorageLayer;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
@ -212,7 +210,6 @@ import com.cloud.storage.template.TemplateLocation;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.utils.script.OutputInterpreter;
|
||||
@ -246,7 +243,7 @@ import com.cloud.vm.VirtualMachineName;
|
||||
**/
|
||||
@Local(value = { ServerResource.class })
|
||||
public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
ServerResource {
|
||||
ServerResource {
|
||||
private static final Logger s_logger = Logger
|
||||
.getLogger(LibvirtComputingResource.class);
|
||||
|
||||
@ -329,8 +326,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
private boolean _can_bridge_firewall;
|
||||
protected String _localStoragePath;
|
||||
protected String _localStorageUUID;
|
||||
private Map <String, String> _pifs = new HashMap<String, String>();
|
||||
private Map<String, Map<String, String>> hostNetInfo = new HashMap<String, Map<String, String>>();
|
||||
private final Map <String, String> _pifs = new HashMap<String, String>();
|
||||
private final Map<String, Map<String, String>> hostNetInfo = new HashMap<String, Map<String, String>>();
|
||||
private final Map<String, vmStats> _vmStats = new ConcurrentHashMap<String, vmStats>();
|
||||
|
||||
protected boolean _disconnected = true;
|
||||
@ -444,16 +441,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
Class<?> clazz = Class
|
||||
.forName("com.cloud.storage.JavaStorageLayer");
|
||||
_storage = (StorageLayer) ComponentLocator.inject(clazz);
|
||||
_storage = new JavaStorageLayer();
|
||||
_storage.configure("StorageLayer", params);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new ConfigurationException("Unable to find class "
|
||||
+ "com.cloud.storage.JavaStorageLayer");
|
||||
}
|
||||
|
||||
|
||||
String domrScriptsDir = (String) params.get("domr.scripts.dir");
|
||||
if (domrScriptsDir == null) {
|
||||
@ -750,8 +739,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
bridges.put("private", _privBridgeName);
|
||||
bridges.put("guest", _guestBridgeName);
|
||||
|
||||
params.put("libvirt.host.bridges", (Object) bridges);
|
||||
params.put("libvirt.host.pifs", (Object) _pifs);
|
||||
params.put("libvirt.host.bridges", bridges);
|
||||
params.put("libvirt.host.pifs", _pifs);
|
||||
|
||||
// Load the vif driver
|
||||
String vifDriverName = (String) params.get("libvirt.vif.driver");
|
||||
@ -760,7 +749,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver";
|
||||
}
|
||||
|
||||
params.put("libvirt.computing.resource", (Object) this);
|
||||
params.put("libvirt.computing.resource", this);
|
||||
|
||||
try {
|
||||
Class<?> clazz = Class.forName(vifDriverName);
|
||||
|
||||
@ -84,6 +84,10 @@ public class ApiDispatcher {
|
||||
|
||||
private static ApiDispatcher s_instance;
|
||||
|
||||
public static ApiDispatcher getInstance() {
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
protected ApiDispatcher() {
|
||||
super();
|
||||
Map<String, String> configs = _configDao.getConfiguration();
|
||||
|
||||
@ -19,19 +19,20 @@ package com.cloud.api.commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.network.NetworkUsageManager;
|
||||
import com.cloud.server.ManagementService;
|
||||
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
|
||||
|
||||
|
||||
@APICommand(name = "listTrafficMonitors", description="List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class)
|
||||
@ -39,6 +40,7 @@ public class ListTrafficMonitorsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
|
||||
private static final String s_name = "listtrafficmonitorsresponse";
|
||||
|
||||
@Inject NetworkUsageManager networkUsageMgr;
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -66,8 +68,6 @@ public class ListTrafficMonitorsCmd extends BaseListCmd {
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
NetworkUsageManager networkUsageMgr = locator.getManager(NetworkUsageManager.class);
|
||||
List<? extends Host> trafficMonitors = networkUsageMgr.listTrafficMonitors(this);
|
||||
|
||||
ListResponse<TrafficMonitorResponse> listResponse = new ListResponse<TrafficMonitorResponse>();
|
||||
|
||||
@ -42,10 +42,13 @@ import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -53,9 +56,6 @@ import com.cloud.agent.api.DeleteTemplateFromS3Command;
|
||||
import com.cloud.agent.api.DownloadTemplateFromS3ToSecondaryStorageCommand;
|
||||
import com.cloud.agent.api.UploadTemplateToS3FromSecondaryStorageCommand;
|
||||
import com.cloud.agent.api.to.S3TO;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
@ -77,7 +77,6 @@ import com.cloud.storage.dao.VMTemplateS3Dao;
|
||||
import com.cloud.storage.dao.VMTemplateZoneDao;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.utils.S3Utils.ClientOptions;
|
||||
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@ -38,8 +38,7 @@ public class UsageServer {
|
||||
}
|
||||
|
||||
public void start() {
|
||||
final ComponentLocator _locator = ComponentLocator.getLocator(UsageServer.Name, "usage-components.xml", "log4j-cloud_usage");
|
||||
UsageManager mgr = _locator.getManager(UsageManager.class);
|
||||
UsageManager mgr = new UsageManager();
|
||||
if (mgr != null) {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("UsageServer ready...");
|
||||
|
||||
@ -26,7 +26,7 @@ import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
/**
|
||||
@ -76,7 +76,7 @@ public class TransactionTest {
|
||||
* that the same db connection is reused rather than acquiring a new one each time in typical transaction model.
|
||||
*/
|
||||
public void testUserManagedConnection() {
|
||||
DbTestDao testDao = ComponentLocator.inject(DbTestDao.class);
|
||||
DbTestDao testDao = ComponentContext.inject(DbTestDao.class);
|
||||
Transaction txn = Transaction.open("SingleConnectionThread");
|
||||
Connection conn = null;
|
||||
try {
|
||||
@ -115,7 +115,7 @@ public class TransactionTest {
|
||||
* This test is simulating ClusterHeartBeat process, where the same transaction and db connection is reused.
|
||||
*/
|
||||
public void testTransactionReuse() {
|
||||
DbTestDao testDao = ComponentLocator.inject(DbTestDao.class);
|
||||
DbTestDao testDao = ComponentContext.inject(DbTestDao.class);
|
||||
// acquire a db connection and keep it
|
||||
Connection conn = null;
|
||||
try {
|
||||
|
||||
@ -20,7 +20,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@ -50,7 +50,7 @@ public class CglibThrowableRendererTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testException() {
|
||||
Test test = ComponentLocator.inject(Test.class);
|
||||
Test test = ComponentContext.inject(Test.class);
|
||||
try {
|
||||
test.exception();
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user