mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-18 03:23:45 +01:00
removed MockAPI server
This commit is contained in:
parent
def9fd1f2e
commit
ea660cd06d
@ -1,52 +0,0 @@
|
||||
<?xml version="1.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.
|
||||
-->
|
||||
<!--
|
||||
components.xml is the configuration file for the VM Ops
|
||||
insertion servers. Someone can quickly pull together an
|
||||
insertion server by selecting the correct adapters to use.
|
||||
|
||||
Here are some places to look for information.
|
||||
- To find out the general functionality that each Manager
|
||||
or Adapter provide, look at the javadoc for the interface
|
||||
that it implements. The interface is usually the
|
||||
"key" attribute in the declaration.
|
||||
- To find specific implementation of each Manager or
|
||||
Adapter, look at the javadoc for the actual class. The
|
||||
class can be found in the <class> element.
|
||||
- To find out the configuration parameters for each Manager
|
||||
or Adapter, look at the javadoc for the actual implementation
|
||||
class. It should be documented in the description of the
|
||||
class.
|
||||
- To know more about the components.xml in general, look for
|
||||
the javadoc for ComponentLocator.java.
|
||||
|
||||
If you found that the Manager or Adapter are not properly
|
||||
documented, please contact the author.
|
||||
-->
|
||||
<components.xml>
|
||||
<management-server class="com.cloud.server.MockManagementServerImpl" library="com.cloud.configuration.RegionsComponentLibrary">
|
||||
<dao name="Configuration configuration server" class="com.cloud.vpc.dao.MockConfigurationDaoImpl">
|
||||
<param name="premium">true</param>
|
||||
</dao>
|
||||
<adapters key="com.cloud.acl.SecurityChecker">
|
||||
<adapter name="DomainChecker" class="com.cloud.acl.DomainChecker"/>
|
||||
</adapters>
|
||||
</management-server>
|
||||
</components.xml>
|
||||
@ -1,639 +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.api;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.ResponseObject;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ExceptionResponse;
|
||||
import org.apache.http.ConnectionClosedException;
|
||||
import org.apache.http.HttpException;
|
||||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpServerConnection;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.entity.BasicHttpEntity;
|
||||
import org.apache.http.impl.DefaultHttpResponseFactory;
|
||||
import org.apache.http.impl.DefaultHttpServerConnection;
|
||||
import org.apache.http.impl.NoConnectionReuseStrategy;
|
||||
import org.apache.http.impl.SocketHttpServerConnection;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
import org.apache.http.params.CoreConnectionPNames;
|
||||
import org.apache.http.params.CoreProtocolPNames;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.BasicHttpContext;
|
||||
import org.apache.http.protocol.BasicHttpProcessor;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpRequestHandler;
|
||||
import org.apache.http.protocol.HttpRequestHandlerRegistry;
|
||||
import org.apache.http.protocol.HttpService;
|
||||
import org.apache.http.protocol.ResponseConnControl;
|
||||
import org.apache.http.protocol.ResponseContent;
|
||||
import org.apache.http.protocol.ResponseDate;
|
||||
import org.apache.http.protocol.ResponseServer;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.response.ApiResponseSerializer;
|
||||
import com.cloud.cluster.StackMaid;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.exception.CSExceptionErrorCode;
|
||||
|
||||
public abstract class MockApiServer implements HttpRequestHandler {
|
||||
// private static final Logger s_logger = Logger.getLogger(MockApiServer.class.getName());
|
||||
//
|
||||
// public static final short ADMIN_COMMAND = 1;
|
||||
// public static final short DOMAIN_ADMIN_COMMAND = 4;
|
||||
// public static final short RESOURCE_DOMAIN_ADMIN_COMMAND = 2;
|
||||
// public static final short USER_COMMAND = 8;
|
||||
// public static boolean encodeApiResponse = false;
|
||||
// public static String jsonContentType = "text/javascript";
|
||||
// private Properties _apiCommands = null;
|
||||
// private ApiDispatcher _dispatcher;
|
||||
// private AccountManager _accountMgr = null;
|
||||
// private Account _systemAccount = null;
|
||||
// private User _systemUser = null;
|
||||
//
|
||||
// private static int _workerCount = 0;
|
||||
//
|
||||
// private static MockApiServer s_instance = null;
|
||||
// private static List<String> s_userCommands = null;
|
||||
// private static List<String> s_resellerCommands = null; // AKA domain-admin
|
||||
// private static List<String> s_adminCommands = null;
|
||||
// private static List<String> s_resourceDomainAdminCommands = null;
|
||||
// private static List<String> s_allCommands = null;
|
||||
// private static List<String> s_pluggableServiceCommands = null;
|
||||
//
|
||||
// private static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("ApiServer"));
|
||||
//
|
||||
// static {
|
||||
// s_userCommands = new ArrayList<String>();
|
||||
// s_resellerCommands = new ArrayList<String>();
|
||||
// s_adminCommands = new ArrayList<String>();
|
||||
// s_resourceDomainAdminCommands = new ArrayList<String>();
|
||||
// s_allCommands = new ArrayList<String>();
|
||||
// s_pluggableServiceCommands = new ArrayList<String>();
|
||||
// }
|
||||
//
|
||||
// private MockApiServer() {
|
||||
// }
|
||||
//
|
||||
// public static void initApiServer(String[] apiConfig) {
|
||||
// if (s_instance == null) {
|
||||
// s_instance = new MockApiServer();
|
||||
// s_instance.init(apiConfig);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static MockApiServer getInstance() {
|
||||
// // initApiServer();
|
||||
// return s_instance;
|
||||
// }
|
||||
//
|
||||
// public Properties get_apiCommands() {
|
||||
// return _apiCommands;
|
||||
// }
|
||||
//
|
||||
// private void processConfigFiles(String[] apiConfig, boolean pluggableServicesConfig) {
|
||||
// try {
|
||||
// if (_apiCommands == null) {
|
||||
// _apiCommands = new Properties();
|
||||
// }
|
||||
// Properties preProcessedCommands = new Properties();
|
||||
// if (apiConfig != null) {
|
||||
// for (String configFile : apiConfig) {
|
||||
// File commandsFile = PropertiesUtil.findConfigFile(configFile);
|
||||
// if (commandsFile != null) {
|
||||
// try {
|
||||
// preProcessedCommands.load(new FileInputStream(commandsFile));
|
||||
// } catch (FileNotFoundException fnfex) {
|
||||
// // in case of a file within a jar in classpath, try to open stream using url
|
||||
// InputStream stream = PropertiesUtil.openStreamFromURL(configFile);
|
||||
// if (stream != null) {
|
||||
// preProcessedCommands.load(stream);
|
||||
// } else {
|
||||
// s_logger.error("Unable to find properites file", fnfex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for (Object key : preProcessedCommands.keySet()) {
|
||||
// String preProcessedCommand = preProcessedCommands.getProperty((String) key);
|
||||
// String[] commandParts = preProcessedCommand.split(";");
|
||||
// _apiCommands.put(key, commandParts[0]);
|
||||
//
|
||||
// if (pluggableServicesConfig) {
|
||||
// s_pluggableServiceCommands.add(commandParts[0]);
|
||||
// }
|
||||
//
|
||||
// if (commandParts.length > 1) {
|
||||
// try {
|
||||
// short cmdPermissions = Short.parseShort(commandParts[1]);
|
||||
// if ((cmdPermissions & ADMIN_COMMAND) != 0) {
|
||||
// s_adminCommands.add((String) key);
|
||||
// }
|
||||
// if ((cmdPermissions & RESOURCE_DOMAIN_ADMIN_COMMAND) != 0) {
|
||||
// s_resourceDomainAdminCommands.add((String) key);
|
||||
// }
|
||||
// if ((cmdPermissions & DOMAIN_ADMIN_COMMAND) != 0) {
|
||||
// s_resellerCommands.add((String) key);
|
||||
// }
|
||||
// if ((cmdPermissions & USER_COMMAND) != 0) {
|
||||
// s_userCommands.add((String) key);
|
||||
// }
|
||||
// } catch (NumberFormatException nfe) {
|
||||
// s_logger.info("Malformed command.properties permissions value, key = " + key + ", value = " + preProcessedCommand);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// s_allCommands.addAll(s_adminCommands);
|
||||
// s_allCommands.addAll(s_resourceDomainAdminCommands);
|
||||
// s_allCommands.addAll(s_userCommands);
|
||||
// s_allCommands.addAll(s_resellerCommands);
|
||||
// }
|
||||
// } catch (FileNotFoundException fnfex) {
|
||||
// s_logger.error("Unable to find properites file", fnfex);
|
||||
// } catch (IOException ioex) {
|
||||
// s_logger.error("Exception loading properties file", ioex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void init(String[] apiConfig) {
|
||||
// BaseCmd.setComponents(new ApiResponseHelper());
|
||||
// BaseListCmd.configure();
|
||||
// processConfigFiles(apiConfig, false);
|
||||
//
|
||||
// ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
// _accountMgr = locator.getManager(AccountManager.class);
|
||||
// _systemAccount = _accountMgr.getSystemAccount();
|
||||
// _systemUser = _accountMgr.getSystemUser();
|
||||
// _dispatcher = ApiDispatcher.getInstance();
|
||||
//
|
||||
// Integer apiPort = null; // api port, null by default
|
||||
// ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
|
||||
// SearchCriteria<ConfigurationVO> sc = configDao.createSearchCriteria();
|
||||
// sc.addAnd("name", SearchCriteria.Op.EQ, "integration.api.port");
|
||||
// List<ConfigurationVO> values = configDao.search(sc, null);
|
||||
// if ((values != null) && (values.size() > 0)) {
|
||||
// ConfigurationVO apiPortConfig = values.get(0);
|
||||
// if (apiPortConfig.getValue() != null) {
|
||||
// apiPort = Integer.parseInt(apiPortConfig.getValue());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key()));
|
||||
//
|
||||
// String jsonType = configDao.getValue(Config.JavaScriptDefaultContentType.key());
|
||||
// if (jsonType != null) {
|
||||
// jsonContentType = jsonType;
|
||||
// }
|
||||
//
|
||||
// if (apiPort != null) {
|
||||
// ListenerThread listenerThread = new ListenerThread(this, apiPort);
|
||||
// listenerThread.start();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
// @Override
|
||||
// public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
|
||||
// // get some information for the access log...
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// HttpServerConnection connObj = (HttpServerConnection) context.getAttribute("http.connection");
|
||||
// if (connObj instanceof SocketHttpServerConnection) {
|
||||
// InetAddress remoteAddr = ((SocketHttpServerConnection) connObj).getRemoteAddress();
|
||||
// sb.append(remoteAddr.toString() + " -- ");
|
||||
// }
|
||||
// sb.append(request.getRequestLine());
|
||||
//
|
||||
// try {
|
||||
// String uri = request.getRequestLine().getUri();
|
||||
// int requestParamsStartIndex = uri.indexOf('?');
|
||||
// if (requestParamsStartIndex >= 0) {
|
||||
// uri = uri.substring(requestParamsStartIndex + 1);
|
||||
// }
|
||||
//
|
||||
// String[] paramArray = uri.split("&");
|
||||
// if (paramArray.length < 1) {
|
||||
// s_logger.info("no parameters received for request: " + uri + ", aborting...");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Map parameterMap = new HashMap<String, String[]>();
|
||||
//
|
||||
// String responseType = BaseCmd.RESPONSE_TYPE_XML;
|
||||
// for (String paramEntry : paramArray) {
|
||||
// String[] paramValue = paramEntry.split("=");
|
||||
// if (paramValue.length != 2) {
|
||||
// s_logger.info("malformed parameter: " + paramEntry + ", skipping");
|
||||
// continue;
|
||||
// }
|
||||
// if ("response".equalsIgnoreCase(paramValue[0])) {
|
||||
// responseType = paramValue[1];
|
||||
// } else {
|
||||
// // according to the servlet spec, the parameter map should be in the form (name=String,
|
||||
// // value=String[]), so
|
||||
// // parameter values will be stored in an array
|
||||
// parameterMap.put(/* name */paramValue[0], /* value */new String[] { paramValue[1] });
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
// // always trust commands from API port, user context will always be UID_SYSTEM/ACCOUNT_ID_SYSTEM
|
||||
// UserContext.registerContext(_systemUser.getId(), _systemAccount, null, true);
|
||||
// sb.insert(0, "(userId=" + User.UID_SYSTEM + " accountId=" + Account.ACCOUNT_ID_SYSTEM + " sessionId=" + null + ") ");
|
||||
// String responseText = handleRequest(parameterMap, true, responseType, sb);
|
||||
// sb.append(" 200 " + ((responseText == null) ? 0 : responseText.length()));
|
||||
//
|
||||
// writeResponse(response, responseText, HttpStatus.SC_OK, responseType, null);
|
||||
// } catch (ServerApiException se) {
|
||||
// String responseText = getSerializedApiError(se.getErrorCode(), se.getDescription(), parameterMap, responseType, se);
|
||||
// writeResponse(response, responseText, se.getErrorCode(), responseType, se.getDescription());
|
||||
// sb.append(" " + se.getErrorCode() + " " + se.getDescription());
|
||||
// } catch (RuntimeException e) {
|
||||
// // log runtime exception like NullPointerException to help identify the source easier
|
||||
// s_logger.error("Unhandled exception, ", e);
|
||||
// throw e;
|
||||
// } catch (Exception e){
|
||||
// s_logger.info("Error: "+e.getMessage());
|
||||
// }
|
||||
// } finally {
|
||||
// UserContext.unregisterContext();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("rawtypes")
|
||||
// public String handleRequest(Map params, boolean decode, String responseType, StringBuffer auditTrailSb) throws ServerApiException {
|
||||
// String response = null;
|
||||
// String[] command = null;
|
||||
// try {
|
||||
// command = (String[]) params.get("command");
|
||||
// if (command == null) {
|
||||
// s_logger.error("invalid request, no command sent");
|
||||
// if (s_logger.isTraceEnabled()) {
|
||||
// s_logger.trace("dumping request parameters");
|
||||
// for (Object key : params.keySet()) {
|
||||
// String keyStr = (String) key;
|
||||
// String[] value = (String[]) params.get(key);
|
||||
// s_logger.trace(" key: " + keyStr + ", value: " + ((value == null) ? "'null'" : value[0]));
|
||||
// }
|
||||
// }
|
||||
// throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "Invalid request, no command sent");
|
||||
// } else {
|
||||
// Map<String, String> paramMap = new HashMap<String, String>();
|
||||
// Set keys = params.keySet();
|
||||
// Iterator keysIter = keys.iterator();
|
||||
// while (keysIter.hasNext()) {
|
||||
// String key = (String) keysIter.next();
|
||||
// if ("command".equalsIgnoreCase(key)) {
|
||||
// continue;
|
||||
// }
|
||||
// String[] value = (String[]) params.get(key);
|
||||
//
|
||||
// String decodedValue = null;
|
||||
// if (decode) {
|
||||
// try {
|
||||
// decodedValue = URLDecoder.decode(value[0], "UTF-8");
|
||||
// } catch (UnsupportedEncodingException usex) {
|
||||
// s_logger.warn(key + " could not be decoded, value = " + value[0]);
|
||||
// throw new ServerApiException(ApiErrorCode.PARAM_ERROR, key + " could not be decoded, received value " + value[0]);
|
||||
// } catch (IllegalArgumentException iae) {
|
||||
// s_logger.warn(key + " could not be decoded, value = " + value[0]);
|
||||
// throw new ServerApiException(ApiErrorCode.PARAM_ERROR, key + " could not be decoded, received value " + value[0] + " which contains illegal characters eg.%");
|
||||
// }
|
||||
// } else {
|
||||
// decodedValue = value[0];
|
||||
// }
|
||||
// paramMap.put(key, decodedValue);
|
||||
// }
|
||||
// String cmdClassName = _apiCommands.getProperty(command[0]);
|
||||
// if (cmdClassName != null) {
|
||||
// Class<?> cmdClass = Class.forName(cmdClassName);
|
||||
// BaseCmd cmdObj = (BaseCmd) cmdClass.newInstance();
|
||||
// cmdObj.setFullUrlParams(paramMap);
|
||||
// cmdObj.setResponseType(responseType);
|
||||
// // This is where the command is either serialized, or directly dispatched
|
||||
// response = queueCommand(cmdObj, paramMap);
|
||||
// } else {
|
||||
// if (!command[0].equalsIgnoreCase("login") && !command[0].equalsIgnoreCase("logout")) {
|
||||
// String errorString = "Unknown API command: " + ((command == null) ? "null" : command[0]);
|
||||
// s_logger.warn(errorString);
|
||||
// auditTrailSb.append(" " + errorString);
|
||||
// throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, errorString);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// if (ex instanceof InvalidParameterValueException) {
|
||||
// InvalidParameterValueException ref = (InvalidParameterValueException)ex;
|
||||
// ServerApiException e = new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage());
|
||||
// // copy over the IdentityProxy information as well and throw the serverapiexception.
|
||||
// ArrayList<IdentityProxy> idList = ref.getIdProxyList();
|
||||
// if (idList != null) {
|
||||
// // Iterate through entire arraylist and copy over each proxy id.
|
||||
// for (int i = 0 ; i < idList.size(); i++) {
|
||||
// IdentityProxy obj = idList.get(i);
|
||||
// e.addProxyObject(obj.getTableName(), obj.getValue(), obj.getidFieldName());
|
||||
// }
|
||||
// }
|
||||
// // Also copy over the cserror code and the function/layer in which it was thrown.
|
||||
// e.setCSErrorCode(ref.getCSErrorCode());
|
||||
// throw e;
|
||||
// } else if (ex instanceof PermissionDeniedException) {
|
||||
// PermissionDeniedException ref = (PermissionDeniedException)ex;
|
||||
// ServerApiException e = new ServerApiException(ApiErrorCode.ACCOUNT_ERROR, ex.getMessage());
|
||||
// // copy over the IdentityProxy information as well and throw the serverapiexception.
|
||||
// ArrayList<IdentityProxy> idList = ref.getIdProxyList();
|
||||
// if (idList != null) {
|
||||
// // Iterate through entire arraylist and copy over each proxy id.
|
||||
// for (int i = 0 ; i < idList.size(); i++) {
|
||||
// IdentityProxy obj = idList.get(i);
|
||||
// e.addProxyObject(obj.getTableName(), obj.getValue(), obj.getidFieldName());
|
||||
// }
|
||||
// }
|
||||
// e.setCSErrorCode(ref.getCSErrorCode());
|
||||
// throw e;
|
||||
// } else if (ex instanceof ServerApiException) {
|
||||
// throw (ServerApiException) ex;
|
||||
// } else {
|
||||
// s_logger.error("unhandled exception executing api command: " + ((command == null) ? "null" : command[0]), ex);
|
||||
// ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Internal server error, unable to execute request.");
|
||||
// e.setCSErrorCode(CSExceptionErrorCode.getCSErrCode("ServerApiException"));
|
||||
// throw e;
|
||||
// }
|
||||
// }
|
||||
// return response;
|
||||
// }
|
||||
//
|
||||
// private String queueCommand(BaseCmd cmdObj, Map<String, String> params) {
|
||||
// params.put("ctxStartEventId", String.valueOf(0L));
|
||||
// _dispatcher.dispatch(cmdObj, params);
|
||||
// SerializationContext.current().setUuidTranslation(true);
|
||||
// return ApiResponseSerializer.toSerializedString((ResponseObject) cmdObj.getResponseObject(), cmdObj.getResponseType());
|
||||
// }
|
||||
//
|
||||
// // FIXME: rather than isError, we might was to pass in the status code to give more flexibility
|
||||
// private void writeResponse(HttpResponse resp, final String responseText, final int statusCode, String responseType, String reasonPhrase) {
|
||||
// try {
|
||||
// resp.setStatusCode(statusCode);
|
||||
// resp.setReasonPhrase(reasonPhrase);
|
||||
//
|
||||
// BasicHttpEntity body = new BasicHttpEntity();
|
||||
// if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
|
||||
// // JSON response
|
||||
// body.setContentType(jsonContentType);
|
||||
// if (responseText == null) {
|
||||
// body.setContent(new ByteArrayInputStream("{ \"error\" : { \"description\" : \"Internal Server Error\" } }".getBytes("UTF-8")));
|
||||
// }
|
||||
// } else {
|
||||
// body.setContentType("text/xml");
|
||||
// if (responseText == null) {
|
||||
// body.setContent(new ByteArrayInputStream("<error>Internal Server Error</error>".getBytes("UTF-8")));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (responseText != null) {
|
||||
// body.setContent(new ByteArrayInputStream(responseText.getBytes("UTF-8")));
|
||||
// }
|
||||
// resp.setEntity(body);
|
||||
// } catch (Exception ex) {
|
||||
// s_logger.error("error!", ex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // FIXME: the following two threads are copied from
|
||||
// // http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
|
||||
// // we have to cite a license if we are using this code directly, so we need to add the appropriate citation or
|
||||
// // modify the
|
||||
// // code to be very specific to our needs
|
||||
// static class ListenerThread extends Thread {
|
||||
// private HttpService _httpService = null;
|
||||
// private ServerSocket _serverSocket = null;
|
||||
// private HttpParams _params = null;
|
||||
//
|
||||
// public ListenerThread(MockApiServer requestHandler, int port) {
|
||||
// try {
|
||||
// _serverSocket = new ServerSocket(port);
|
||||
// } catch (IOException ioex) {
|
||||
// s_logger.error("error initializing api server", ioex);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _params = new BasicHttpParams();
|
||||
// _params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
|
||||
// .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
|
||||
// .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
|
||||
//
|
||||
// // Set up the HTTP protocol processor
|
||||
// BasicHttpProcessor httpproc = new BasicHttpProcessor();
|
||||
// httpproc.addInterceptor(new ResponseDate());
|
||||
// httpproc.addInterceptor(new ResponseServer());
|
||||
// httpproc.addInterceptor(new ResponseContent());
|
||||
// httpproc.addInterceptor(new ResponseConnControl());
|
||||
//
|
||||
// // Set up request handlers
|
||||
// HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
|
||||
// reqistry.register("*", requestHandler);
|
||||
//
|
||||
// // Set up the HTTP service
|
||||
// _httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
|
||||
// _httpService.setParams(_params);
|
||||
// _httpService.setHandlerResolver(reqistry);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// s_logger.info("ApiServer listening on port " + _serverSocket.getLocalPort());
|
||||
// while (!Thread.interrupted()) {
|
||||
// try {
|
||||
// // Set up HTTP connection
|
||||
// Socket socket = _serverSocket.accept();
|
||||
// DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
|
||||
// conn.bind(socket, _params);
|
||||
//
|
||||
// // Execute a new worker task to handle the request
|
||||
// _executor.execute(new WorkerTask(_httpService, conn, _workerCount++));
|
||||
// } catch (InterruptedIOException ex) {
|
||||
// break;
|
||||
// } catch (IOException e) {
|
||||
// s_logger.error("I/O error initializing connection thread", e);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// static class WorkerTask implements Runnable {
|
||||
// private final HttpService _httpService;
|
||||
// private final HttpServerConnection _conn;
|
||||
//
|
||||
// public WorkerTask(final HttpService httpService, final HttpServerConnection conn, final int count) {
|
||||
// _httpService = httpService;
|
||||
// _conn = conn;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// HttpContext context = new BasicHttpContext(null);
|
||||
// try {
|
||||
// while (!Thread.interrupted() && _conn.isOpen()) {
|
||||
// try {
|
||||
// _httpService.handleRequest(_conn, context);
|
||||
// _conn.close();
|
||||
// } finally {
|
||||
// StackMaid.current().exitCleanup();
|
||||
// }
|
||||
// }
|
||||
// } catch (ConnectionClosedException ex) {
|
||||
// if (s_logger.isTraceEnabled()) {
|
||||
// s_logger.trace("ApiServer: Client closed connection");
|
||||
// }
|
||||
// } catch (IOException ex) {
|
||||
// if (s_logger.isTraceEnabled()) {
|
||||
// s_logger.trace("ApiServer: IOException - " + ex);
|
||||
// }
|
||||
// } catch (HttpException ex) {
|
||||
// s_logger.warn("ApiServer: Unrecoverable HTTP protocol violation" + ex);
|
||||
// } finally {
|
||||
// try {
|
||||
// _conn.shutdown();
|
||||
// } catch (IOException ignore) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public String getSerializedApiError(int errorCode, String errorText, Map<String, Object[]> apiCommandParams, String responseType, Exception ex) {
|
||||
// String responseName = null;
|
||||
// String cmdClassName = null;
|
||||
//
|
||||
// String responseText = null;
|
||||
//
|
||||
// try {
|
||||
// if (errorCode == ApiErrorCode.UNSUPPORTED_ACTION_ERROR.ordinal() || apiCommandParams == null || apiCommandParams.isEmpty()) {
|
||||
// responseName = "errorresponse";
|
||||
// } else {
|
||||
// Object cmdObj = apiCommandParams.get("command");
|
||||
// // cmd name can be null when "command" parameter is missing in the request
|
||||
// if (cmdObj != null) {
|
||||
// String cmdName = ((String[]) cmdObj)[0];
|
||||
// cmdClassName = _apiCommands.getProperty(cmdName);
|
||||
// if (cmdClassName != null) {
|
||||
// Class<?> claz = Class.forName(cmdClassName);
|
||||
// responseName = ((BaseCmd) claz.newInstance()).getCommandName();
|
||||
// } else {
|
||||
// responseName = "errorresponse";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ExceptionResponse apiResponse = new ExceptionResponse();
|
||||
// apiResponse.setErrorCode(errorCode);
|
||||
// apiResponse.setErrorText(errorText);
|
||||
// apiResponse.setResponseName(responseName);
|
||||
// // Also copy over the IdentityProxy object List into this new apiResponse, from
|
||||
// // the exception caught. When invoked from handle(), the exception here can
|
||||
// // be either ServerApiException, PermissionDeniedException or InvalidParameterValue
|
||||
// // Exception. When invoked from ApiServlet's processRequest(), this can be
|
||||
// // a standard exception like NumberFormatException. We'll leave the standard ones alone.
|
||||
//// if (ex != null) {
|
||||
//// if (ex instanceof ServerApiException || ex instanceof PermissionDeniedException
|
||||
//// || ex instanceof InvalidParameterValueException) {
|
||||
//// // Cast the exception appropriately and retrieve the IdentityProxy
|
||||
//// if (ex instanceof ServerApiException) {
|
||||
//// ServerApiException ref = (ServerApiException) ex;
|
||||
//// ArrayList<IdentityProxy> idList = ref.getIdProxyList();
|
||||
//// if (idList != null) {
|
||||
//// for (int i=0; i < idList.size(); i++) {
|
||||
//// IdentityProxy id = idList.get(i);
|
||||
//// apiResponse.addProxyObject(id.getTableName(), id.getValue(), id.getidFieldName());
|
||||
//// }
|
||||
//// }
|
||||
//// // Also copy over the cserror code and the function/layer in which it was thrown.
|
||||
//// apiResponse.setCSErrorCode(ref.getCSErrorCode());
|
||||
//// } else if (ex instanceof PermissionDeniedException) {
|
||||
//// PermissionDeniedException ref = (PermissionDeniedException) ex;
|
||||
//// ArrayList<IdentityProxy> idList = ref.getIdProxyList();
|
||||
//// if (idList != null) {
|
||||
//// for (int i=0; i < idList.size(); i++) {
|
||||
//// IdentityProxy id = idList.get(i);
|
||||
//// apiResponse.addProxyObject(id.getTableName(), id.getValue(), id.getidFieldName());
|
||||
//// }
|
||||
//// }
|
||||
//// // Also copy over the cserror code and the function/layer in which it was thrown.
|
||||
//// apiResponse.setCSErrorCode(ref.getCSErrorCode());
|
||||
//// } else if (ex instanceof InvalidParameterValueException) {
|
||||
//// InvalidParameterValueException ref = (InvalidParameterValueException) ex;
|
||||
//// ArrayList<IdentityProxy> idList = ref.getIdProxyList();
|
||||
//// if (idList != null) {
|
||||
//// for (int i=0; i < idList.size(); i++) {
|
||||
//// IdentityProxy id = idList.get(i);
|
||||
//// apiResponse.addProxyObject(id.getTableName(), id.getValue(), id.getidFieldName());
|
||||
//// }
|
||||
//// }
|
||||
//// // Also copy over the cserror code and the function/layer in which it was thrown.
|
||||
//// apiResponse.setCSErrorCode(ref.getCSErrorCode());
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
// SerializationContext.current().setUuidTranslation(true);
|
||||
// responseText = ApiResponseSerializer.toSerializedString(apiResponse, responseType);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// s_logger.error("Exception responding to http request", e);
|
||||
// }
|
||||
// return responseText;
|
||||
// }
|
||||
//
|
||||
}
|
||||
@ -1,42 +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.api;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
|
||||
public class RegionTest {
|
||||
private static final Logger s_logger = Logger.getLogger(RegionTest.class.getName());
|
||||
|
||||
public static void main(String args[]){
|
||||
System.out.println("Starting");
|
||||
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
||||
if (file != null) {
|
||||
s_logger.info("log4j configuration found at " + file.getAbsolutePath());
|
||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||
}
|
||||
final ComponentLocator _locator = ComponentLocator.getLocator(ManagementService.Name, "components-regions.xml", "log4j-cloud");
|
||||
MockApiServer.initApiServer(new String[] { "commands.properties" });
|
||||
System.out.println("Started");
|
||||
}
|
||||
}
|
||||
@ -1,230 +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.configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.alert.AlertManagerImpl;
|
||||
import com.cloud.alert.dao.AlertDaoImpl;
|
||||
import com.cloud.capacity.dao.CapacityDaoImpl;
|
||||
import com.cloud.configuration.dao.ConfigurationDaoImpl;
|
||||
import com.cloud.configuration.dao.ResourceCountDaoImpl;
|
||||
import com.cloud.configuration.dao.ResourceLimitDaoImpl;
|
||||
import com.cloud.dao.EntityManager;
|
||||
import com.cloud.dao.EntityManagerImpl;
|
||||
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDaoImpl;
|
||||
import com.cloud.dc.dao.HostPodDaoImpl;
|
||||
import com.cloud.dc.dao.VlanDaoImpl;
|
||||
import com.cloud.domain.dao.DomainDaoImpl;
|
||||
import com.cloud.host.dao.HostDaoImpl;
|
||||
import com.cloud.network.MockNetworkManagerImpl;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDaoImpl;
|
||||
import com.cloud.network.dao.IPAddressDaoImpl;
|
||||
import com.cloud.network.dao.LoadBalancerDaoImpl;
|
||||
import com.cloud.network.dao.NetworkDaoImpl;
|
||||
import com.cloud.network.dao.NetworkDomainDaoImpl;
|
||||
import com.cloud.network.dao.NetworkRuleConfigDaoImpl;
|
||||
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
|
||||
import com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl;
|
||||
import com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl;
|
||||
import com.cloud.network.dao.VpnUserDaoImpl;
|
||||
import com.cloud.network.security.MockSecurityGroupManagerImpl;
|
||||
import com.cloud.network.security.dao.SecurityGroupDaoImpl;
|
||||
import com.cloud.network.vpc.dao.VpcDaoImpl;
|
||||
import com.cloud.network.vpn.MockRemoteAccessVpnManagerImpl;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
|
||||
import com.cloud.projects.MockProjectManagerImpl;
|
||||
import com.cloud.projects.dao.ProjectAccountDaoImpl;
|
||||
import com.cloud.projects.dao.ProjectDaoImpl;
|
||||
import com.cloud.region.RegionManagerImpl;
|
||||
import com.cloud.region.dao.RegionDaoImpl;
|
||||
import com.cloud.resourcelimit.ResourceLimitManagerImpl;
|
||||
import com.cloud.service.dao.ServiceOfferingDaoImpl;
|
||||
import com.cloud.storage.MockStorageManagerImpl;
|
||||
import com.cloud.storage.dao.DiskOfferingDaoImpl;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDaoImpl;
|
||||
import com.cloud.storage.dao.GuestOSDaoImpl;
|
||||
import com.cloud.storage.dao.LaunchPermissionDaoImpl;
|
||||
import com.cloud.storage.dao.SnapshotDaoImpl;
|
||||
import com.cloud.storage.dao.StoragePoolDaoImpl;
|
||||
import com.cloud.storage.dao.UploadDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateDetailsDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateHostDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateSwiftDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateZoneDaoImpl;
|
||||
import com.cloud.storage.dao.VolumeDaoImpl;
|
||||
import com.cloud.storage.dao.VolumeHostDaoImpl;
|
||||
import com.cloud.storage.snapshot.MockSnapshotManagerImpl;
|
||||
import com.cloud.template.MockTemplateManagerImpl;
|
||||
import com.cloud.user.AccountDetailsDaoImpl;
|
||||
import com.cloud.user.AccountManagerImpl;
|
||||
import com.cloud.user.DomainManagerImpl;
|
||||
import com.cloud.user.dao.AccountDaoImpl;
|
||||
import com.cloud.user.dao.SSHKeyPairDaoImpl;
|
||||
import com.cloud.user.dao.UserAccountDaoImpl;
|
||||
import com.cloud.user.dao.UserDaoImpl;
|
||||
import com.cloud.user.dao.UserStatisticsDaoImpl;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.utils.component.ComponentLibrary;
|
||||
import com.cloud.utils.component.ComponentLibraryBase;
|
||||
import com.cloud.utils.component.ComponentLocator.ComponentInfo;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.uuididentity.dao.IdentityDaoImpl;
|
||||
import com.cloud.vm.MockUserVmManagerImpl;
|
||||
import com.cloud.vm.MockVirtualMachineManagerImpl;
|
||||
import com.cloud.vm.dao.ConsoleProxyDaoImpl;
|
||||
import com.cloud.vm.dao.DomainRouterDaoImpl;
|
||||
import com.cloud.vm.dao.InstanceGroupDaoImpl;
|
||||
import com.cloud.vm.dao.UserVmDaoImpl;
|
||||
import com.cloud.vm.dao.UserVmDetailsDaoImpl;
|
||||
import com.cloud.vm.dao.VMInstanceDaoImpl;
|
||||
import com.cloud.vpc.MockConfigurationManagerImpl;
|
||||
import com.cloud.vpc.MockResourceLimitManagerImpl;
|
||||
import com.cloud.vpc.MockSite2SiteVpnManagerImpl;
|
||||
import com.cloud.vpc.MockVpcManagerImpl;
|
||||
|
||||
|
||||
public class RegionsComponentLibrary extends ComponentLibraryBase implements ComponentLibrary {
|
||||
protected void populateDaos() {
|
||||
addDao("DomainDao", DomainDaoImpl.class);
|
||||
addDao("AccountDao", AccountDaoImpl.class);
|
||||
addDao("UserDao", UserDaoImpl.class);
|
||||
addDao("UserAccountDao", UserAccountDaoImpl.class);
|
||||
addDao("NetworkOfferingDao", NetworkOfferingDaoImpl.class);
|
||||
addDao("RegionDao", RegionDaoImpl.class);
|
||||
addDao("IdentityDao", IdentityDaoImpl.class);
|
||||
addDao("AccountVlanMapDao", AccountVlanMapDaoImpl.class);
|
||||
addDao("CapacityDao", CapacityDaoImpl.class);
|
||||
addDao("ClusterDao", ClusterDaoImpl.class);
|
||||
addDao("ServiceOfferingDao", ServiceOfferingDaoImpl.class);
|
||||
addDao("DiskOfferingDao", DiskOfferingDaoImpl.class);
|
||||
addDao("DomainRouterDao", DomainRouterDaoImpl.class);
|
||||
addDao("GuestOSDao", GuestOSDaoImpl.class);
|
||||
addDao("GuestOSCategoryDao", GuestOSCategoryDaoImpl.class);
|
||||
addDao("HostDao", HostDaoImpl.class);
|
||||
addDao("IPAddressDao", IPAddressDaoImpl.class);
|
||||
addDao("LoadBalancerDao", LoadBalancerDaoImpl.class);
|
||||
addDao("NetworkRuleConfigDao", NetworkRuleConfigDaoImpl.class);
|
||||
addDao("HostPodDao", HostPodDaoImpl.class);
|
||||
addDao("SnapshotDao", SnapshotDaoImpl.class);
|
||||
addDao("StoragePoolDao", StoragePoolDaoImpl.class);
|
||||
addDao("ConfigurationDao", ConfigurationDaoImpl.class);
|
||||
addDao("DataCenterDao", DataCenterDaoImpl.class);
|
||||
addDao("VMTemplateZoneDao", VMTemplateZoneDaoImpl.class);
|
||||
addDao("VMTemplateDetailsDao", VMTemplateDetailsDaoImpl.class);
|
||||
addDao("VMTemplateDao", VMTemplateDaoImpl.class);
|
||||
addDao("VMTemplateHostDao", VMTemplateHostDaoImpl.class);
|
||||
addDao("VMTemplateSwiftDao", VMTemplateSwiftDaoImpl.class);
|
||||
addDao("UploadDao", UploadDaoImpl.class);
|
||||
addDao("UserDao", UserDaoImpl.class);
|
||||
addDao("UserStatisticsDao", UserStatisticsDaoImpl.class);
|
||||
addDao("UserVmDao", UserVmDaoImpl.class);
|
||||
addDao("VlanDao", VlanDaoImpl.class);
|
||||
addDao("VolumeDao", VolumeDaoImpl.class);
|
||||
addDao("Site2SiteVpnGatewayDao", Site2SiteVpnGatewayDaoImpl.class);
|
||||
addDao("Site2SiteCustomerGatewayDao", Site2SiteCustomerGatewayDaoImpl.class);
|
||||
addDao("VolumeHostDao", VolumeHostDaoImpl.class);
|
||||
addDao("SecurityGroupDao", SecurityGroupDaoImpl.class);
|
||||
addDao("NetworkConfigurationDao", NetworkDaoImpl.class);
|
||||
addDao("ConsoleProxyDao", ConsoleProxyDaoImpl.class);
|
||||
addDao("FirewallRulesCidrsDao", FirewallRulesCidrsDaoImpl.class);
|
||||
addDao("VMInstanceDao", VMInstanceDaoImpl.class);
|
||||
addDao("AccountDetailsDao", AccountDetailsDaoImpl.class);
|
||||
addDao("NetworkDomainDao", NetworkDomainDaoImpl.class);
|
||||
addDao("SSHKeyPairDao", SSHKeyPairDaoImpl.class);
|
||||
addDao("UserVmDetailsDao", UserVmDetailsDaoImpl.class);
|
||||
addDao("ResourceCountDao", ResourceCountDaoImpl.class);
|
||||
addDao("InstanceGroupDao", InstanceGroupDaoImpl.class);
|
||||
addDao("RemoteAccessVpnDao", RemoteAccessVpnDaoImpl.class);
|
||||
addDao("VpnUserDao", VpnUserDaoImpl.class);
|
||||
addDao("ProjectDao", ProjectDaoImpl.class);
|
||||
addDao("ProjectAccountDao", ProjectAccountDaoImpl.class);
|
||||
addDao("LaunchPermissionDao", LaunchPermissionDaoImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
|
||||
if (_daos.size() == 0) {
|
||||
populateDaos();
|
||||
}
|
||||
return _daos;
|
||||
}
|
||||
|
||||
protected void populateManagers() {
|
||||
addManager("configuration manager", MockConfigurationManagerImpl.class);
|
||||
addManager("account manager", AccountManagerImpl.class);
|
||||
addManager("domain manager", DomainManagerImpl.class);
|
||||
addManager("Region Manager", RegionManagerImpl.class);
|
||||
addManager("ResourceLimit Manager", MockResourceLimitManagerImpl.class);
|
||||
addManager("Network Manager", MockNetworkManagerImpl.class);
|
||||
addManager("UserVm Manager", MockUserVmManagerImpl.class);
|
||||
addManager("Vm Manager", MockVirtualMachineManagerImpl.class);
|
||||
addManager("Project Manager", MockProjectManagerImpl.class);
|
||||
addManager("Vpc Manager", MockVpcManagerImpl.class);
|
||||
addManager("Site2SiteVpn Manager", MockSite2SiteVpnManagerImpl.class);
|
||||
addManager("SecurityGroup Manager", MockSecurityGroupManagerImpl.class);
|
||||
addManager("Snapshot Manager", MockSnapshotManagerImpl.class);
|
||||
addManager("Template Manager", MockTemplateManagerImpl.class);
|
||||
addManager("Storage Manager", MockStorageManagerImpl.class);
|
||||
addManager("RemoteAccessVpn Manager", MockRemoteAccessVpnManagerImpl.class);
|
||||
addManager("Entity Manager", EntityManagerImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, ComponentInfo<Manager>> getManagers() {
|
||||
if (_managers.size() == 0) {
|
||||
populateManagers();
|
||||
}
|
||||
return _managers;
|
||||
}
|
||||
|
||||
protected void populateAdapters() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
|
||||
if (_adapters.size() == 0) {
|
||||
populateAdapters();
|
||||
}
|
||||
return _adapters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<Class<?>, Class<?>> getFactories() {
|
||||
HashMap<Class<?>, Class<?>> factories = new HashMap<Class<?>, Class<?>>();
|
||||
factories.put(EntityManager.class, EntityManagerImpl.class);
|
||||
return factories;
|
||||
}
|
||||
|
||||
protected void populateServices() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
|
||||
if (_pluggableServices.size() == 0) {
|
||||
populateServices();
|
||||
}
|
||||
return _pluggableServices;
|
||||
}
|
||||
}
|
||||
@ -1,198 +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.network.security;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.AuthorizeSecurityGroupEgressCmd;
|
||||
import com.cloud.api.commands.AuthorizeSecurityGroupIngressCmd;
|
||||
import com.cloud.api.commands.CreateSecurityGroupCmd;
|
||||
import com.cloud.api.commands.DeleteSecurityGroupCmd;
|
||||
import com.cloud.api.commands.ListSecurityGroupsCmd;
|
||||
import com.cloud.api.commands.RevokeSecurityGroupEgressCmd;
|
||||
import com.cloud.api.commands.RevokeSecurityGroupIngressCmd;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.fsm.StateListener;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Event;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
|
||||
@Local(value = { SecurityGroupManager.class, SecurityGroupService.class })
|
||||
public class MockSecurityGroupManagerImpl implements SecurityGroupManager, SecurityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
|
||||
@Override
|
||||
public boolean preStateTransitionEvent(State oldState, Event event,
|
||||
State newState, VirtualMachine vo, boolean status, Object opaque) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean postStateTransitionEvent(State oldState, Event event,
|
||||
State newState, VirtualMachine vo, boolean status, Object opaque) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityGroup createSecurityGroup(CreateSecurityGroupCmd command)
|
||||
throws PermissionDeniedException, InvalidParameterValueException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean revokeSecurityGroupIngress(RevokeSecurityGroupIngressCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean revokeSecurityGroupEgress(RevokeSecurityGroupEgressCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSecurityGroup(DeleteSecurityGroupCmd cmd)
|
||||
throws ResourceInUseException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SecurityGroupRules> searchForSecurityGroupRules(
|
||||
ListSecurityGroupsCmd cmd) throws PermissionDeniedException,
|
||||
InvalidParameterValueException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SecurityRule> authorizeSecurityGroupIngress(
|
||||
AuthorizeSecurityGroupIngressCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SecurityRule> authorizeSecurityGroupEgress(
|
||||
AuthorizeSecurityGroupEgressCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityGroupVO createSecurityGroup(String name, String description,
|
||||
Long domainId, Long accountId, String accountName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityGroupVO createDefaultSecurityGroup(Long accountId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addInstanceToGroups(Long userVmId, List<Long> groups) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeInstanceFromGroups(long userVmId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fullSync(long agentId,
|
||||
HashMap<String, Pair<Long, Long>> newGroupStates) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecurityGroupsNamesForVm(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecurityGroupVO> getSecurityGroupsForVm(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVmSecurityGroupEnabled(Long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityGroup getDefaultSecurityGroup(long accountId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityGroup getSecurityGroup(String name, long accountId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVmMappedToDefaultSecurityGroup(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,129 +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.network.vpn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.ListRemoteAccessVpnsCmd;
|
||||
import com.cloud.api.commands.ListVpnUsersCmd;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
@Local(value = RemoteAccessVpnService.class)
|
||||
public class MockRemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manager {
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId,
|
||||
String ipRange, boolean openFirewall, long networkId)
|
||||
throws NetworkRuleConflictException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyRemoteAccessVpn(long vpnServerAddressId)
|
||||
throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteAccessVpn startRemoteAccessVpn(long vpnServerAddressId,
|
||||
boolean openFirewall) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VpnUser addVpnUser(long vpnOwnerId, String userName, String password) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeVpnUser(long vpnOwnerId, String userName) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VpnUser> listVpnUsers(long vpnOwnerId, String userName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyVpnUsers(long vpnOwnerId, String userName) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends RemoteAccessVpn> searchForRemoteAccessVpns(
|
||||
ListRemoteAccessVpnsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VpnUser> searchForVpnUsers(ListVpnUsersCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends RemoteAccessVpn> listRemoteAccessVpns(long networkId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteAccessVpn getRemoteAccessVpn(long vpnId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,483 +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.server;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.alert.Alert;
|
||||
import com.cloud.api.commands.CreateSSHKeyPairCmd;
|
||||
import com.cloud.api.commands.DeleteSSHKeyPairCmd;
|
||||
import com.cloud.api.commands.DestroySystemVmCmd;
|
||||
import com.cloud.api.commands.ExtractVolumeCmd;
|
||||
import com.cloud.api.commands.GetVMPasswordCmd;
|
||||
import com.cloud.api.commands.ListAlertsCmd;
|
||||
import com.cloud.api.commands.ListAsyncJobsCmd;
|
||||
import com.cloud.api.commands.ListCapabilitiesCmd;
|
||||
import com.cloud.api.commands.ListCapacityCmd;
|
||||
import com.cloud.api.commands.ListCfgsByCmd;
|
||||
import com.cloud.api.commands.ListClustersCmd;
|
||||
import com.cloud.api.commands.ListDiskOfferingsCmd;
|
||||
import com.cloud.api.commands.ListEventsCmd;
|
||||
import com.cloud.api.commands.ListGuestOsCategoriesCmd;
|
||||
import com.cloud.api.commands.ListGuestOsCmd;
|
||||
import com.cloud.api.commands.ListHostsCmd;
|
||||
import com.cloud.api.commands.ListIsosCmd;
|
||||
import com.cloud.api.commands.ListPodsByCmd;
|
||||
import com.cloud.api.commands.ListPublicIpAddressesCmd;
|
||||
import com.cloud.api.commands.ListRoutersCmd;
|
||||
import com.cloud.api.commands.ListSSHKeyPairsCmd;
|
||||
import com.cloud.api.commands.ListServiceOfferingsCmd;
|
||||
import com.cloud.api.commands.ListStoragePoolsCmd;
|
||||
import com.cloud.api.commands.ListSystemVMsCmd;
|
||||
import com.cloud.api.commands.ListTemplatesCmd;
|
||||
import com.cloud.api.commands.ListVMGroupsCmd;
|
||||
import com.cloud.api.commands.ListVlanIpRangesCmd;
|
||||
import com.cloud.api.commands.ListZonesByCmd;
|
||||
import com.cloud.api.commands.RebootSystemVmCmd;
|
||||
import com.cloud.api.commands.RegisterSSHKeyPairCmd;
|
||||
import com.cloud.api.commands.StopSystemVmCmd;
|
||||
import com.cloud.api.commands.UpdateHostPasswordCmd;
|
||||
import com.cloud.api.commands.UpdateIsoCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateVMGroupCmd;
|
||||
import com.cloud.api.commands.UpgradeSystemVMCmd;
|
||||
import com.cloud.api.commands.UploadCustomCertificateCmd;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.configuration.Configuration;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.event.Event;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.HypervisorCapabilities;
|
||||
import com.cloud.info.ConsoleProxyInfo;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.GuestOsCategory;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.SSHKeyPair;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
public class MockManagementServerImpl implements ManagementServer {
|
||||
|
||||
@Override
|
||||
public List<? extends DataCenter> listDataCenters(ListZonesByCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Configuration> searchForConfigurations(ListCfgsByCmd c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends ServiceOffering> searchForServiceOfferings(
|
||||
ListServiceOfferingsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Cluster> searchForClusters(ListClustersCmd c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Cluster> searchForClusters(long zoneId,
|
||||
Long startIndex, Long pageSizeVal, String hypervisorType) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Pod> searchForPods(ListPodsByCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Host> searchForServers(ListHostsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate updateTemplate(UpdateIsoCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Event> searchForEvents(ListEventsCmd c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VirtualRouter> searchForRouters(ListRoutersCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends IpAddress> searchForIPAddresses(
|
||||
ListPublicIpAddressesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends GuestOS> listGuestOSByCriteria(ListGuestOsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends GuestOsCategory> listGuestOSCategoriesByCriteria(
|
||||
ListGuestOsCategoriesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine stopSystemVM(StopSystemVmCmd cmd)
|
||||
throws ResourceUnavailableException, ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine startSystemVM(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine rebootSystemVM(RebootSystemVmCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine destroySystemVM(DestroySystemVmCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine upgradeSystemVM(UpgradeSystemVMCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Alert> searchForAlerts(ListAlertsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Capacity> listCapacities(ListCapacityCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Pair<Long, Long>> listIsos(ListIsosCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Pair<Long, Long>> listTemplates(ListTemplatesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends DiskOffering> searchForDiskOfferings(
|
||||
ListDiskOfferingsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends StoragePool> searchForStoragePools(
|
||||
ListStoragePoolsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VirtualMachine> searchForSystemVm(ListSystemVMsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getCloudIdentifierResponse(long userId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateHostPassword(UpdateHostPasswordCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InstanceGroup updateVmGroup(UpdateVMGroupCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends InstanceGroup> searchForVmGroups(ListVMGroupsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listCapabilities(ListCapabilitiesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long extractVolume(ExtractVolumeCmd cmd) throws URISyntaxException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHypervisors(Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadCertificate(UploadCustomCertificateCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Vlan> searchForVlans(ListVlanIpRangesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends AsyncJob> searchForAsyncJobs(ListAsyncJobsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateRandomPassword() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long saveStartedEvent(Long userId, Long accountId, String type,
|
||||
String description, long startEventId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long saveCompletedEvent(Long userId, Long accountId, String level,
|
||||
String type, String description, long startEventId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SSHKeyPair registerSSHKeyPair(RegisterSSHKeyPairCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSSHKeyPair(DeleteSSHKeyPairCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVMPassword(GetVMPasswordCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.cloud.vm.VirtualMachine.Type findSystemVMTypeById(long instanceId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<List<? extends Host>, List<? extends Host>> listHostsForMigrationOfVM(
|
||||
Long vmId, Long startIndex, Long pageSize) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] listEventTypes() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends HypervisorCapabilities> listHypervisorCapabilities(
|
||||
Long id, HypervisorType hypervisorType, String keyword,
|
||||
Long startIndex, Long pageSizeVal) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HypervisorCapabilities updateHypervisorCapabilities(Long id,
|
||||
Long maxGuestsLimit, Boolean securityGroupEnabled) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Capacity> listTopConsumedResources(ListCapacityCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getApiConfig() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getHostBy(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventVO> getEvents(long userId, long accountId, Long domainId,
|
||||
String type, String level, Date startDate, Date endDate) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsoleProxyInfo getConsoleProxyForVm(long dataCenterId,
|
||||
long userVmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConsoleAccessUrlRoot(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuestOSVO getGuestOs(Long guestOsId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<String, Integer> getVncPort(VirtualMachine vm) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMemoryOrCpuCapacityByHost(Long hostId, short capacityType) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends StoragePoolVO> searchForStoragePools(Criteria c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHashKey() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,679 +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.storage;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||
import com.cloud.agent.api.CleanupSnapshotBackupCommand;
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.CreateStoragePoolCommand;
|
||||
import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
|
||||
import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
|
||||
import com.cloud.agent.api.DeleteStoragePoolCommand;
|
||||
import com.cloud.agent.api.ManageSnapshotCommand;
|
||||
import com.cloud.agent.api.ModifyStoragePoolAnswer;
|
||||
import com.cloud.agent.api.ModifyStoragePoolCommand;
|
||||
import com.cloud.agent.api.UpgradeSnapshotCommand;
|
||||
import com.cloud.agent.api.storage.CopyVolumeAnswer;
|
||||
import com.cloud.agent.api.storage.CopyVolumeCommand;
|
||||
import com.cloud.agent.api.storage.CreateAnswer;
|
||||
import com.cloud.agent.api.storage.CreateCommand;
|
||||
import com.cloud.agent.api.storage.DeleteTemplateCommand;
|
||||
import com.cloud.agent.api.storage.DeleteVolumeCommand;
|
||||
import com.cloud.agent.api.storage.DestroyCommand;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.commands.CancelPrimaryStorageMaintenanceCmd;
|
||||
import com.cloud.api.commands.CreateStoragePoolCmd;
|
||||
import com.cloud.api.commands.CreateVolumeCmd;
|
||||
import com.cloud.api.commands.DeletePoolCmd;
|
||||
import com.cloud.api.commands.ListVolumesCmd;
|
||||
import com.cloud.api.commands.UpdateStoragePoolCmd;
|
||||
import com.cloud.api.commands.UploadVolumeCmd;
|
||||
import com.cloud.async.AsyncJobManager;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.capacity.CapacityState;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.cluster.CheckPointManager;
|
||||
import com.cloud.cluster.ClusterManagerListener;
|
||||
import com.cloud.cluster.ManagementServerHostVO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.consoleproxy.ConsoleProxyManager;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.UsageEventVO;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.event.dao.UsageEventDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InsufficientStorageCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.HypervisorGuruManager;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||
import com.cloud.server.StatsCollector;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.Volume.Event;
|
||||
import com.cloud.storage.Volume.Type;
|
||||
import com.cloud.storage.allocator.StoragePoolAllocator;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
import com.cloud.storage.dao.SnapshotDao;
|
||||
import com.cloud.storage.dao.SnapshotPolicyDao;
|
||||
import com.cloud.storage.dao.StoragePoolDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.storage.dao.StoragePoolWorkDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||
import com.cloud.storage.dao.VMTemplatePoolDao;
|
||||
import com.cloud.storage.dao.VMTemplateSwiftDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.dao.VolumeHostDao;
|
||||
import com.cloud.storage.download.DownloadMonitor;
|
||||
import com.cloud.storage.listener.StoragePoolMonitor;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.snapshot.SnapshotManager;
|
||||
import com.cloud.storage.snapshot.SnapshotScheduler;
|
||||
import com.cloud.tags.ResourceTagVO;
|
||||
import com.cloud.tags.dao.ResourceTagDao;
|
||||
import com.cloud.template.TemplateManager;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.EnumUtils;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.UriUtils;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericSearchBuilder;
|
||||
import com.cloud.utils.db.GlobalLock;
|
||||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.JoinBuilder.JoinType;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.exception.ExecutionException;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.SecondaryStorageVmVO;
|
||||
import com.cloud.vm.UserVmManager;
|
||||
import com.cloud.vm.UserVmVO;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.VirtualMachineProfileImpl;
|
||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
@Local(value = { StorageManager.class, StorageService.class })
|
||||
public class MockStorageManagerImpl implements StorageManager, Manager, ClusterManagerListener {
|
||||
|
||||
@Override
|
||||
public StoragePool createPool(CreateStoragePoolCmd cmd)
|
||||
throws ResourceInUseException, IllegalArgumentException,
|
||||
UnknownHostException, ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Volume allocVolume(CreateVolumeCmd cmd)
|
||||
throws ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Volume createVolume(CreateVolumeCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteVolume(long volumeId)
|
||||
throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePool(DeletePoolCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoragePool preparePrimaryStorageForMaintenance(Long primaryStorageId)
|
||||
throws ResourceUnavailableException, InsufficientCapacityException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoragePool cancelPrimaryStorageForMaintenance(
|
||||
CancelPrimaryStorageMaintenanceCmd cmd)
|
||||
throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoragePool updateStoragePool(UpdateStoragePoolCmd cmd)
|
||||
throws IllegalArgumentException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoragePool getStoragePool(long id) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Volume migrateVolume(Long volumeId, Long storagePoolId)
|
||||
throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Volume> searchForVolumes(ListVolumesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Volume uploadVolume(UploadVolumeCmd cmd)
|
||||
throws ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onManagementNodeJoined(List<ManagementServerHostVO> nodeList,
|
||||
long selfNodeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList,
|
||||
long selfNodeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onManagementNodeIsolated() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canVmRestartOnAnotherServer(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<String, String> getAbsoluteIsoPath(long templateId,
|
||||
long dataCenterId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecondaryStorageURL(long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStoragePoolTags(long poolId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getSecondaryStorageHost(long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateHostVO findVmTemplateHost(long templateId, StoragePool pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolumeVO moveVolume(VolumeVO volume, long destPoolDcId,
|
||||
Long destPoolPodId, Long destPoolClusterId,
|
||||
HypervisorType dataDiskHyperType)
|
||||
throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm,
|
||||
VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
|
||||
Long clusterId, ServiceOfferingVO offering,
|
||||
DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size,
|
||||
HypervisorType hyperType) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroyVolume(VolumeVO volume)
|
||||
throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCapacityEntry(StoragePoolVO storagePool) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean volumeOnSharedStoragePool(VolumeVO volume) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer sendToPool(long poolId, Command cmd)
|
||||
throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer sendToPool(StoragePool pool, Command cmd)
|
||||
throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer[] sendToPool(long poolId, Commands cmd)
|
||||
throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer[] sendToPool(StoragePool pool, Commands cmds)
|
||||
throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Long, Answer[]> sendToPool(StoragePool pool,
|
||||
long[] hostIdsToTryFirst, List<Long> hostIdsToAvoid, Commands cmds)
|
||||
throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Long, Answer> sendToPool(StoragePool pool,
|
||||
long[] hostIdsToTryFirst, List<Long> hostIdsToAvoid, Command cmd)
|
||||
throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean volumeInactive(VolumeVO volume) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVmNameOnVolume(VolumeVO volume) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocalStorageActiveOnHost(Host host) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupStorage(boolean recurring) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryStorageNameLabel(VolumeVO volume) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> DiskProfile allocateRawVolume(Type type,
|
||||
String name, DiskOfferingVO offering, Long size, T vm, Account owner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends VMInstanceVO> DiskProfile allocateTemplatedVolume(
|
||||
Type type, String name, DiskOfferingVO offering,
|
||||
VMTemplateVO template, T vm, Account owner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCapacityEntry(StoragePoolVO storagePool,
|
||||
short capacityType, long allocated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
DeployDestination dest) throws StorageUnavailableException,
|
||||
InsufficientStorageCapacityException, ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release(VirtualMachineProfile<? extends VMInstanceVO> profile) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupVolumes(long vmId) throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareForMigration(
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
DeployDestination dest) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer sendToPool(StoragePool pool, long[] hostIdsToTryFirst,
|
||||
Command cmd) throws StorageUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CapacityVO getSecondaryStorageUsedStats(Long hostId, Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId,
|
||||
Long podId, Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createStoragePool(long hostId, StoragePoolVO pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delPoolFromHost(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getSecondaryStorageHost(long zoneId, long tmpltId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> getSecondaryStorageHosts(long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> ListByDataCenterHypervisor(long datacenterId,
|
||||
HypervisorType type) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMInstanceVO> listByStoragePool(long storagePoolId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoragePoolVO findLocalStorageOnHost(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateHostVO getTemplateHostRef(long zoneId, long tmpltId,
|
||||
boolean readyOnly) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean StorageMigration(
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
StoragePool destPool) throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stateTransitTo(Volume vol, Event event)
|
||||
throws NoTransitionException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Host updateSecondaryStorage(long secStorageId, String newUrl) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getUpHostsInPool(long poolId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupSecondaryStorage(boolean recurring) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolumeVO copyVolumeFromSecToPrimary(VolumeVO volume,
|
||||
VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc,
|
||||
HostPodVO pod, Long clusterId, ServiceOfferingVO offering,
|
||||
DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size,
|
||||
HypervisorType hyperType) throws NoTransitionException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSupportedImageFormatForCluster(Long clusterId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HypervisorType getHypervisorTypeFromFormat(ImageFormat format) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storagePoolHasEnoughSpace(List<Volume> volume,
|
||||
StoragePool pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,236 +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.storage.snapshot;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.CreateSnapshotPolicyCmd;
|
||||
import com.cloud.api.commands.DeleteSnapshotPoliciesCmd;
|
||||
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
|
||||
import com.cloud.api.commands.ListSnapshotPoliciesCmd;
|
||||
import com.cloud.api.commands.ListSnapshotsCmd;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.SnapshotPolicyVO;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.db.Filter;
|
||||
|
||||
@Local(value = { SnapshotManager.class, SnapshotService.class })
|
||||
public class MockSnapshotManagerImpl implements SnapshotManager, SnapshotService, Manager {
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Snapshot> listSnapshots(ListSnapshotsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSnapshot(long snapshotId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnapshotPolicy createPolicy(CreateSnapshotPolicyCmd cmd,
|
||||
Account policyOwner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SnapshotSchedule> findRecurringSnapshotSchedule(
|
||||
ListRecurringSnapshotScheduleCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SnapshotPolicy> listPoliciesforVolume(
|
||||
ListSnapshotPoliciesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snapshot allocSnapshot(Long volumeId, Long policyId)
|
||||
throws ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snapshot createSnapshot(Long volumeId, Long policyId,
|
||||
Long snapshotId, Account snapshotOwner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean backupSnapshotToSecondaryStorage(SnapshotVO snapshot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postCreateSnapshot(Long volumeId, Long snapshotId,
|
||||
Long policyId, boolean backedUp) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroySnapshot(long userId, long snapshotId, long policyId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePolicy(long userId, Long policyId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotPolicyVO> listPoliciesforVolume(long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotVO> listSnapsforVolume(long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePoliciesForVolume(Long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSnapshotDirsForAccount(long accountId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnapshotPolicyVO getPolicyForVolume(long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroySnapshotBackUp(long snapshotId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnapshotVO createSnapshotOnPrimary(VolumeVO volume, Long polocyId,
|
||||
Long snapshotId) throws ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotPolicyVO> listPoliciesforSnapshot(long snapshotId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotVO> listSnapsforPolicy(long policyId, Filter filter) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadSnapshotsFromSwift(SnapshotVO ss) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getSecondaryStorageHost(SnapshotVO snapshot) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecondaryStorageURL(SnapshotVO snapshot) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSnapshotsForVolume(String secondaryStoragePoolUrl,
|
||||
Long dcId, Long accountId, Long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSnapshotsDirForVolume(String secondaryStoragePoolUrl,
|
||||
Long dcId, Long accountId, Long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOperateOnVolume(VolumeVO volume) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,211 +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.template;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.CopyTemplateCmd;
|
||||
import com.cloud.api.commands.DeleteIsoCmd;
|
||||
import com.cloud.api.commands.DeleteTemplateCmd;
|
||||
import com.cloud.api.commands.ExtractIsoCmd;
|
||||
import com.cloud.api.commands.ExtractTemplateCmd;
|
||||
import com.cloud.api.commands.ListTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.RegisterIsoCmd;
|
||||
import com.cloud.api.commands.RegisterTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
|
||||
@Local(value={TemplateManager.class, TemplateService.class})
|
||||
public class MockTemplateManagerImpl implements TemplateManager, Manager, TemplateService {
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate registerTemplate(RegisterTemplateCmd cmd)
|
||||
throws URISyntaxException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate registerIso(RegisterIsoCmd cmd)
|
||||
throws IllegalArgumentException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate copyTemplate(CopyTemplateCmd cmd)
|
||||
throws StorageUnavailableException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate prepareTemplate(long templateId, long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean detachIso(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachIso(long isoId, long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteTemplate(DeleteTemplateCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteIso(DeleteIsoCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long extract(ExtractIsoCmd cmd) throws InternalErrorException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long extract(ExtractTemplateCmd cmd) throws InternalErrorException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate getTemplate(long templateId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listTemplatePermissions(
|
||||
ListTemplateOrIsoPermissionsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTemplateOrIsoPermissions(
|
||||
UpdateTemplateOrIsoPermissionsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateStoragePoolVO prepareTemplateForCreate(
|
||||
VMTemplateVO template, StoragePool pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetTemplateDownloadStateOnPool(
|
||||
long templateStoragePoolRefId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copy(long userId, VMTemplateVO template, HostVO srcSecHost,
|
||||
DataCenterVO srcZone, DataCenterVO dstZone)
|
||||
throws StorageUnavailableException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(long userId, long templateId, Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateStoragePoolVO> getUnusedTemplatesInPool(
|
||||
StoragePoolVO pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evictTemplateFromStoragePool(
|
||||
VMTemplateStoragePoolVO templatePoolVO) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean templateIsDeleteable(VMTemplateHostVO templateHostRef) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateHostVO prepareISOForCreate(VMTemplateVO template,
|
||||
StoragePool pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -40,7 +39,6 @@ import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
|
||||
@ -197,7 +195,7 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
|
||||
@Override
|
||||
public Pair<List<UserVmJoinVO>, Integer> searchForUserVMs(Criteria c, Account caller, Long domainId, boolean isRecursive, List<Long> permittedAccounts, boolean listAll, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags) {
|
||||
// TODO Auto-generated method stub
|
||||
return new ArrayList<UserVmVO>();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user