mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'master' into api_limit
This commit is contained in:
commit
97cb16944f
@ -17,9 +17,9 @@
|
||||
package com.cloud.exception;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class CloudAuthenticationException extends RuntimeCloudException {
|
||||
public class CloudAuthenticationException extends CloudRuntimeException {
|
||||
private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
|
||||
|
||||
public CloudAuthenticationException(String message) {
|
||||
|
||||
@ -1,57 +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.exception;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class CloudExecutionException extends RuntimeCloudException {
|
||||
private final static long serialVersionUID = SerialVersionUID.CloudExecutionException;
|
||||
|
||||
private final ErrorCode code;
|
||||
private final HashMap<String, Object> details;
|
||||
|
||||
public CloudExecutionException(ErrorCode code, String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.code = code;
|
||||
details = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
public ErrorCode getErrorCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return new StringBuilder("Error Code=").append(code).append("; Error Message=").append(super.toString()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buff = new StringBuilder();
|
||||
buff.append("Error Code=").append(code);
|
||||
buff.append("; Error Message=").append(super.toString());
|
||||
if (details.size() > 0) {
|
||||
buff.append("; Error Details=").append(details.toString());
|
||||
}
|
||||
return buff.toString();
|
||||
}
|
||||
}
|
||||
@ -1,52 +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.exception;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ErrorCode {
|
||||
String code;
|
||||
private static HashSet<ErrorCode> s_codes = new HashSet<ErrorCode>();
|
||||
|
||||
public ErrorCode(String code) {
|
||||
this.code = code;
|
||||
assert !s_codes.contains(this) : "There is already an error code registered for this code: " + code;
|
||||
s_codes.add(this);
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return code.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (!(that instanceof ErrorCode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.code.equals(((ErrorCode)that).code);
|
||||
}
|
||||
|
||||
public final static ErrorCode UnableToReachResource = new ErrorCode("resource.unavailable");
|
||||
}
|
||||
@ -50,6 +50,10 @@ public class UserContext {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public User getCallerUser() {
|
||||
return _accountMgr.getActiveUser(userId);
|
||||
}
|
||||
|
||||
public void setCallerUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ServerApiException extends RuntimeCloudException {
|
||||
public class ServerApiException extends CloudRuntimeException {
|
||||
private int _errorCode;
|
||||
private String _description;
|
||||
|
||||
|
||||
@ -16,11 +16,8 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.discovery;
|
||||
|
||||
import com.cloud.user.AccountService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
@ -42,16 +39,13 @@ public class ListApisCmd extends BaseCmd {
|
||||
@PlugService
|
||||
ApiDiscoveryService _apiDiscoveryService;
|
||||
|
||||
@Inject
|
||||
private AccountService _accountService;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="API name")
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public void execute() throws ServerApiException {
|
||||
if (_apiDiscoveryService != null) {
|
||||
User user = _accountService.getActiveUser(UserContext.current().getCallerUserId());
|
||||
User user = UserContext.current().getCallerUser();
|
||||
ListResponse<ApiDiscoveryResponse> response = (ListResponse<ApiDiscoveryResponse>) _apiDiscoveryService.listApis(user, name);
|
||||
if (response == null) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis");
|
||||
|
||||
@ -17,17 +17,13 @@
|
||||
package org.apache.cloudstack.discovery;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.ReflectUtil;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.acl.APIChecker;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
@ -54,16 +50,14 @@ import java.util.Set;
|
||||
public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
|
||||
private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class);
|
||||
|
||||
@Inject(adapter = APIChecker.class)
|
||||
protected Adapters<APIChecker> _apiAccessCheckers;
|
||||
|
||||
private static Map<String, ApiDiscoveryResponse> _apiNameDiscoveryResponseMap = null;
|
||||
protected static Adapters<APIChecker> s_apiAccessCheckers = null;
|
||||
private static Map<String, ApiDiscoveryResponse> s_apiNameDiscoveryResponseMap = null;
|
||||
|
||||
protected ApiDiscoveryServiceImpl() {
|
||||
super();
|
||||
if (_apiNameDiscoveryResponseMap == null) {
|
||||
if (s_apiNameDiscoveryResponseMap == null) {
|
||||
long startTime = System.nanoTime();
|
||||
_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
|
||||
s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
|
||||
cacheResponseMap();
|
||||
long endTime = System.nanoTime();
|
||||
s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");
|
||||
@ -142,11 +136,11 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
|
||||
}
|
||||
}
|
||||
response.setObjectName("api");
|
||||
_apiNameDiscoveryResponseMap.put(apiName, response);
|
||||
s_apiNameDiscoveryResponseMap.put(apiName, response);
|
||||
}
|
||||
|
||||
for (String apiName : _apiNameDiscoveryResponseMap.keySet()) {
|
||||
ApiDiscoveryResponse response = _apiNameDiscoveryResponseMap.get(apiName);
|
||||
for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) {
|
||||
ApiDiscoveryResponse response = s_apiNameDiscoveryResponseMap.get(apiName);
|
||||
Set<ApiParameterResponse> processedParams = new HashSet<ApiParameterResponse>();
|
||||
for (ApiParameterResponse param : response.getParams()) {
|
||||
if (responseApiNameListMap.containsKey(param.getRelated())) {
|
||||
@ -166,7 +160,7 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
|
||||
} else {
|
||||
response.setRelated(null);
|
||||
}
|
||||
_apiNameDiscoveryResponseMap.put(apiName, response);
|
||||
s_apiNameDiscoveryResponseMap.put(apiName, response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,34 +169,39 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
|
||||
ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>();
|
||||
List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>();
|
||||
|
||||
if (s_apiAccessCheckers == null) {
|
||||
ComponentLocator locator = ComponentLocator.getCurrentLocator();
|
||||
s_apiAccessCheckers = locator.getAdapters(APIChecker.class);
|
||||
}
|
||||
|
||||
if (user == null)
|
||||
return null;
|
||||
|
||||
if (name != null) {
|
||||
if (!_apiNameDiscoveryResponseMap.containsKey(name))
|
||||
if (!s_apiNameDiscoveryResponseMap.containsKey(name))
|
||||
return null;
|
||||
|
||||
for (APIChecker apiChecker : _apiAccessCheckers) {
|
||||
for (APIChecker apiChecker : s_apiAccessCheckers) {
|
||||
try {
|
||||
apiChecker.checkAccess(user, name);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
responseList.add(_apiNameDiscoveryResponseMap.get(name));
|
||||
responseList.add(s_apiNameDiscoveryResponseMap.get(name));
|
||||
|
||||
} else {
|
||||
for (String apiName : _apiNameDiscoveryResponseMap.keySet()) {
|
||||
for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) {
|
||||
boolean isAllowed = true;
|
||||
for (APIChecker apiChecker : _apiAccessCheckers) {
|
||||
for (APIChecker apiChecker : s_apiAccessCheckers) {
|
||||
try {
|
||||
apiChecker.checkAccess(user, name);
|
||||
apiChecker.checkAccess(user, apiName);
|
||||
} catch (Exception ex) {
|
||||
isAllowed = false;
|
||||
}
|
||||
}
|
||||
if (isAllowed)
|
||||
responseList.add(_apiNameDiscoveryResponseMap.get(apiName));
|
||||
responseList.add(s_apiNameDiscoveryResponseMap.get(apiName));
|
||||
}
|
||||
}
|
||||
response.setResponses(responseList);
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
package com.cloud.simulator;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
/**
|
||||
* wrap exceptions that you know there's no point in dealing with.
|
||||
*/
|
||||
public class SimulatorRuntimeException extends RuntimeCloudException {
|
||||
public class SimulatorRuntimeException extends CloudRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
|
||||
|
||||
|
||||
4
pom.xml
4
pom.xml
@ -244,10 +244,6 @@
|
||||
<exclude>dist/console-proxy/js/jquery.js</exclude>
|
||||
<exclude>scripts/vm/systemvm/id_rsa.cloud</exclude>
|
||||
<exclude>tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf</exclude>
|
||||
<exclude>tools/devcloud/devcloud.cfg</exclude>
|
||||
<exclude>tools/devcloud/devcloud-advanced.cfg</exclude>
|
||||
<exclude>tools/devcloud-kvm/devcloud-kvm.cfg</exclude>
|
||||
<exclude>tools/devcloud-kvm/devcloud-kvm-advanced.cfg</exclude>
|
||||
<exclude>ui/lib/flot/jquery.colorhelpers.js</exclude>
|
||||
<exclude>ui/lib/flot/jquery.flot.crosshair.js</exclude>
|
||||
<exclude>ui/lib/flot/jquery.flot.fillbetween.js</exclude>
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
package com.cloud.async;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class AsyncCommandQueued extends RuntimeCloudException {
|
||||
public class AsyncCommandQueued extends CloudRuntimeException {
|
||||
private static final long serialVersionUID = SerialVersionUID.AsyncCommandQueued;
|
||||
|
||||
private SyncQueueVO _queue = null;
|
||||
|
||||
@ -1469,31 +1469,15 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
offeringId = _offering.getId();
|
||||
}
|
||||
|
||||
PublicIp sourceNatIp = null;
|
||||
if (publicNetwork) {
|
||||
sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
|
||||
}
|
||||
|
||||
// 3) deploy virtual router(s)
|
||||
int count = routerCount - routers.size();
|
||||
DeploymentPlan plan = planAndRouters.first();
|
||||
for (int i = 0; i < count; i++) {
|
||||
PublicIp sourceNatIp = null;
|
||||
if (publicNetwork) {
|
||||
int failCount = 0;
|
||||
// Generate different MAC for VR
|
||||
while (sourceNatIp == null) {
|
||||
sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
|
||||
NicVO nic = _nicDao.findByMacAddress(sourceNatIp.getMacAddress());
|
||||
// We got duplicate MAC here, so regenerate the mac
|
||||
if (nic != null) {
|
||||
s_logger.debug("Failed to find a different mac for redundant router. Try again. The current mac is " + sourceNatIp.getMacAddress());
|
||||
sourceNatIp = null;
|
||||
failCount ++;
|
||||
}
|
||||
//Prevent infinite loop
|
||||
if (failCount > 3) {
|
||||
s_logger.error("Failed to find a different mac for redundant router! Abort operation!");
|
||||
throw new InsufficientAddressCapacityException("Failed to find a different mac for redundant router", null, offeringId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner, isRedundant, plan, guestNetwork,
|
||||
new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
|
||||
//don't start the router as we are holding the network lock that needs to be released at the end of router allocation
|
||||
@ -1715,6 +1699,13 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
}
|
||||
NetworkOfferingVO publicOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemPublicNetwork).get(0);
|
||||
List<NetworkVO> publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false);
|
||||
String publicIp = defaultNic.getIp4Address();
|
||||
// We want to use the identical MAC address for RvR on public interface if possible
|
||||
NicVO peerNic = _nicDao.findByIp4AddressAndNetworkId(publicIp, publicNetworks.get(0).getId());
|
||||
if (peerNic != null) {
|
||||
s_logger.info("Use same MAC as previous RvR, the MAC is " + peerNic.getMacAddress());
|
||||
defaultNic.setMacAddress(peerNic.getMacAddress());
|
||||
}
|
||||
networks.add(new Pair<NetworkVO, NicProfile>(publicNetworks.get(0), defaultNic));
|
||||
}
|
||||
|
||||
|
||||
@ -549,7 +549,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
||||
|
||||
String username = System.getProperty("user.name");
|
||||
Boolean devel = Boolean.valueOf(_configDao.getValue("developer"));
|
||||
if (!username.equalsIgnoreCase("cloud") || !devel) {
|
||||
if (!username.equalsIgnoreCase("cloud") && !devel) {
|
||||
s_logger.warn("Systemvm keypairs could not be set. Management server should be run as cloud user, or in development mode.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -58,6 +58,4 @@ public interface NicDao extends GenericDao<NicVO, Long> {
|
||||
NicVO findByNetworkIdInstanceIdAndBroadcastUri(long networkId, long instanceId, String broadcastUri);
|
||||
|
||||
NicVO findByIp4AddressAndNetworkIdAndInstanceId(long networkId, long instanceId, String ip4Address);
|
||||
|
||||
NicVO findByMacAddress(String macAddress);
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
||||
AllFieldsSearch.and("address", AllFieldsSearch.entity().getIp4Address(), Op.EQ);
|
||||
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultNic(), Op.EQ);
|
||||
AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
|
||||
AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
||||
IpSearch = createSearchBuilder(String.class);
|
||||
@ -200,11 +199,4 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
||||
sc.setParameters("address", ip4Address);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicVO findByMacAddress(String macAddress) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("macAddress", macAddress);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,22 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
{
|
||||
"zones": [
|
||||
{
|
||||
|
||||
@ -1,3 +1,23 @@
|
||||
# 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.
|
||||
#
|
||||
# This is a stock devcloud config converted from the file
|
||||
# tools/devcloud/devcloud.cfg.
|
||||
|
||||
{
|
||||
"zones": [
|
||||
{
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
# 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.
|
||||
#
|
||||
# This configuration is meant for running advanced networking, with management server on the laptop.
|
||||
# It requires that the user run a DNS resolver within devcloud via 'apt-get install dnsmasq'
|
||||
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
# 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.
|
||||
#
|
||||
# This config is designed to run as an advanced network, with management server in devcloud
|
||||
# It also requires an 'apt-get install dnsmasq' to run a resolver in devcloud for internal dns
|
||||
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
{
|
||||
"zones": [
|
||||
{
|
||||
|
||||
@ -16,24 +16,62 @@
|
||||
// under the License.
|
||||
package com.cloud.utils.exception;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.cloud.utils.AnnotationHelper;
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
|
||||
/**
|
||||
* wrap exceptions that you know there's no point in dealing with.
|
||||
*/
|
||||
public class CloudRuntimeException extends RuntimeCloudException {
|
||||
public class CloudRuntimeException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
|
||||
|
||||
|
||||
// This holds a list of uuids and their names. Add uuid:fieldname pairs
|
||||
protected ArrayList<String> idList = new ArrayList<String>();
|
||||
|
||||
protected int csErrorCode;
|
||||
|
||||
|
||||
public CloudRuntimeException(String message) {
|
||||
super(message);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
|
||||
public CloudRuntimeException(String message, Throwable th) {
|
||||
super(message, th);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
protected CloudRuntimeException() {
|
||||
|
||||
public CloudRuntimeException() {
|
||||
super();
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public void addProxyObject(String uuid) {
|
||||
idList.add(uuid);
|
||||
return;
|
||||
}
|
||||
|
||||
public void addProxyObject(Object voObj, Long id, String idFieldName) {
|
||||
// Get the VO object's table name.
|
||||
String tablename = AnnotationHelper.getTableName(voObj);
|
||||
if (tablename != null) {
|
||||
addProxyObject(tablename, id, idFieldName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public ArrayList<String> getIdProxyList() {
|
||||
return idList;
|
||||
}
|
||||
|
||||
public void setCSErrorCode(int cserrcode) {
|
||||
this.csErrorCode = cserrcode;
|
||||
}
|
||||
|
||||
public int getCSErrorCode() {
|
||||
return this.csErrorCode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,10 +18,10 @@ package com.cloud.utils.exception;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
|
||||
public class HypervisorVersionChangedException extends RuntimeCloudException {
|
||||
public class HypervisorVersionChangedException extends CloudRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
|
||||
|
||||
|
||||
public HypervisorVersionChangedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@ -1,75 +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
|
||||
// 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.utils.exception;
|
||||
|
||||
import com.cloud.utils.AnnotationHelper;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* by the API response serializer. Any exceptions that are thrown by
|
||||
* class, which extends Exception instead of RuntimeException like this
|
||||
* class does.
|
||||
*/
|
||||
|
||||
public class RuntimeCloudException extends RuntimeException {
|
||||
|
||||
// This holds a list of uuids and their names. Add uuid:fieldname pairs
|
||||
protected ArrayList<String> idList = new ArrayList<String>();
|
||||
|
||||
protected int csErrorCode;
|
||||
|
||||
public void addProxyObject(String uuid) {
|
||||
idList.add(uuid);
|
||||
return;
|
||||
}
|
||||
|
||||
public RuntimeCloudException(String message) {
|
||||
super(message);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public RuntimeCloudException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public void addProxyObject(Object voObj, Long id, String idFieldName) {
|
||||
// Get the VO object's table name.
|
||||
String tablename = AnnotationHelper.getTableName(voObj);
|
||||
if (tablename != null) {
|
||||
addProxyObject(tablename, id, idFieldName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public RuntimeCloudException() {
|
||||
super();
|
||||
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
|
||||
}
|
||||
|
||||
public ArrayList<String> getIdProxyList() {
|
||||
return idList;
|
||||
}
|
||||
|
||||
public void setCSErrorCode(int cserrcode) {
|
||||
this.csErrorCode = cserrcode;
|
||||
}
|
||||
|
||||
public int getCSErrorCode() {
|
||||
return this.csErrorCode;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user