mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
All merge conflicts resolved
This commit is contained in:
commit
10d9c019a9
38
api/src/com/cloud/exception/ErrorCode.java → api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
Executable file → Normal file
38
api/src/com/cloud/exception/ErrorCode.java → api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
Executable file → Normal file
@ -14,39 +14,27 @@
|
|||||||
// KIND, either express or implied. See the License for the
|
// KIND, either express or implied. See the License for the
|
||||||
// specific language governing permissions and limitations
|
// specific language governing permissions and limitations
|
||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.exception;
|
package com.cloud.agent.api.storage;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import com.cloud.agent.api.Answer;
|
||||||
|
|
||||||
/**
|
public class ResizeVolumeAnswer extends Answer {
|
||||||
*/
|
private long newSize;
|
||||||
public class ErrorCode {
|
|
||||||
String code;
|
protected ResizeVolumeAnswer() {
|
||||||
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() {
|
public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) {
|
||||||
return code;
|
super(cmd, result, details);
|
||||||
|
this.newSize = newSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) {
|
||||||
public int hashCode() {
|
super(cmd, result, details);
|
||||||
return code.hashCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public long getNewSize() {
|
||||||
public boolean equals(Object that) {
|
return newSize;
|
||||||
if (!(that instanceof ErrorCode)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.code.equals(((ErrorCode)that).code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static ErrorCode UnableToReachResource = new ErrorCode("resource.unavailable");
|
|
||||||
}
|
}
|
||||||
86
api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
Normal file
86
api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package com.cloud.agent.api.storage;
|
||||||
|
|
||||||
|
import com.cloud.agent.api.Command;
|
||||||
|
import com.cloud.agent.api.to.StorageFilerTO;
|
||||||
|
import com.cloud.storage.StoragePool;
|
||||||
|
|
||||||
|
public class ResizeVolumeCommand extends Command {
|
||||||
|
private String path;
|
||||||
|
private StorageFilerTO pool;
|
||||||
|
private String vmInstance;
|
||||||
|
private Long newSize;
|
||||||
|
private Long currentSize;
|
||||||
|
private boolean shrinkOk;
|
||||||
|
|
||||||
|
protected ResizeVolumeCommand() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResizeVolumeCommand(String path,
|
||||||
|
StorageFilerTO pool,
|
||||||
|
Long currentSize,
|
||||||
|
Long newSize,
|
||||||
|
boolean shrinkOk,
|
||||||
|
String vmInstance)
|
||||||
|
{
|
||||||
|
this.path = path;
|
||||||
|
this.pool = pool;
|
||||||
|
this.vmInstance = vmInstance;
|
||||||
|
this.currentSize = currentSize;
|
||||||
|
this.newSize = newSize;
|
||||||
|
this.shrinkOk = shrinkOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPoolUuid() {
|
||||||
|
return pool.getUuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageFilerTO getPool() {
|
||||||
|
return pool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNewSize() {
|
||||||
|
return newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCurrentSize() {
|
||||||
|
return currentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getShrinkOk() {
|
||||||
|
return shrinkOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInstanceName() {
|
||||||
|
return vmInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean executeInSequence() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -145,17 +145,17 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
|
|||||||
} catch (InsufficientCapacityException ex){
|
} catch (InsufficientCapacityException ex){
|
||||||
s_logger.info(ex);
|
s_logger.info(ex);
|
||||||
s_logger.trace(ex);
|
s_logger.trace(ex);
|
||||||
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
|
||||||
} catch (ConcurrentOperationException ex) {
|
} catch (ConcurrentOperationException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
this.setEntityId(result.getId());
|
this.setEntityId(result.getId());
|
||||||
this.setEntityUuid(result.getUuid());
|
this.setEntityUuid(result.getUuid());
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy console proxy");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,6 +108,7 @@ public class EventTypes {
|
|||||||
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
|
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
|
||||||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||||
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
|
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
|
||||||
|
public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
|
||||||
|
|
||||||
// Domains
|
// Domains
|
||||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
package com.cloud.exception;
|
package com.cloud.exception;
|
||||||
|
|
||||||
import com.cloud.utils.SerialVersionUID;
|
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;
|
private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
|
||||||
|
|
||||||
public CloudAuthenticationException(String message) {
|
public CloudAuthenticationException(String message) {
|
||||||
|
|||||||
@ -54,7 +54,6 @@ public class CloudException extends Exception {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<String> getIdProxyList() {
|
public ArrayList<String> getIdProxyList() {
|
||||||
return idList;
|
return idList;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -170,7 +170,6 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
|
|||||||
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
|
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
|
||||||
public static final Capability RedundantRouter = new Capability("RedundantRouter");
|
public static final Capability RedundantRouter = new Capability("RedundantRouter");
|
||||||
public static final Capability ElasticIp = new Capability("ElasticIp");
|
public static final Capability ElasticIp = new Capability("ElasticIp");
|
||||||
public static final Capability AssociatePublicIP = new Capability("AssociatePublicIP");
|
|
||||||
public static final Capability ElasticLb = new Capability("ElasticLb");
|
public static final Capability ElasticLb = new Capability("ElasticLb");
|
||||||
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
|
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
|
||||||
public static final Capability InlineMode = new Capability("InlineMode");
|
public static final Capability InlineMode = new Capability("InlineMode");
|
||||||
|
|||||||
252
api/src/com/cloud/network/NetworkModel.java
Normal file
252
api/src/com/cloud/network/NetworkModel.java
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.cloud.dc.Vlan;
|
||||||
|
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
|
import com.cloud.network.Network.Capability;
|
||||||
|
import com.cloud.network.Network.Provider;
|
||||||
|
import com.cloud.network.Network.Service;
|
||||||
|
import com.cloud.network.Networks.TrafficType;
|
||||||
|
import com.cloud.network.element.NetworkElement;
|
||||||
|
import com.cloud.network.element.UserDataServiceProvider;
|
||||||
|
import com.cloud.offering.NetworkOffering;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.vm.Nic;
|
||||||
|
import com.cloud.vm.NicProfile;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NetworkModel presents a read-only view into the Network data such as L2 networks,
|
||||||
|
* Nics, PublicIps, NetworkOfferings, traffic labels, physical networks and the like
|
||||||
|
* The idea is that only the orchestration core should be able to modify the data, while other
|
||||||
|
* participants in the orchestration can use this interface to query the data.
|
||||||
|
*/
|
||||||
|
public interface NetworkModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists IP addresses that belong to VirtualNetwork VLANs
|
||||||
|
*
|
||||||
|
* @param accountId
|
||||||
|
* - account that the IP address should belong to
|
||||||
|
* @param associatedNetworkId
|
||||||
|
* TODO
|
||||||
|
* @param sourceNat
|
||||||
|
* - (optional) true if the IP address should be a source NAT address
|
||||||
|
* @return - list of IP addresses
|
||||||
|
*/
|
||||||
|
List<? extends IpAddress> listPublicIpsAssignedToGuestNtwk(long accountId, long associatedNetworkId, Boolean sourceNat);
|
||||||
|
|
||||||
|
List<? extends NetworkOffering> getSystemAccountNetworkOfferings(String... offeringNames);
|
||||||
|
|
||||||
|
List<? extends Nic> getNics(long vmId);
|
||||||
|
|
||||||
|
String getNextAvailableMacAddressInNetwork(long networkConfigurationId) throws InsufficientAddressCapacityException;
|
||||||
|
|
||||||
|
PublicIpAddress getPublicIpAddress(long ipAddressId);
|
||||||
|
|
||||||
|
List<? extends Vlan> listPodVlans(long podId);
|
||||||
|
|
||||||
|
List<? extends Network> listNetworksUsedByVm(long vmId, boolean isSystem);
|
||||||
|
|
||||||
|
Nic getNicInNetwork(long vmId, long networkId);
|
||||||
|
|
||||||
|
List<? extends Nic> getNicsForTraffic(long vmId, TrafficType type);
|
||||||
|
|
||||||
|
Network getDefaultNetworkForVm(long vmId);
|
||||||
|
|
||||||
|
Nic getDefaultNic(long vmId);
|
||||||
|
|
||||||
|
UserDataServiceProvider getUserDataUpdateProvider(Network network);
|
||||||
|
|
||||||
|
boolean networkIsConfiguredForExternalNetworking(long zoneId, long networkId);
|
||||||
|
|
||||||
|
Map<Capability, String> getNetworkServiceCapabilities(long networkId, Service service);
|
||||||
|
|
||||||
|
boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services);
|
||||||
|
|
||||||
|
Network getNetworkWithSecurityGroupEnabled(Long zoneId);
|
||||||
|
|
||||||
|
String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId);
|
||||||
|
|
||||||
|
List<? extends Network> listNetworksForAccount(long accountId, long zoneId, Network.GuestType type);
|
||||||
|
|
||||||
|
List<? extends Network> listAllNetworksInAllZonesByType(Network.GuestType type);
|
||||||
|
|
||||||
|
String getGlobalGuestDomainSuffix();
|
||||||
|
|
||||||
|
String getStartIpAddress(long networkId);
|
||||||
|
|
||||||
|
String getIpInNetwork(long vmId, long networkId);
|
||||||
|
|
||||||
|
String getIpInNetworkIncludingRemoved(long vmId, long networkId);
|
||||||
|
|
||||||
|
Long getPodIdForVlan(long vlanDbId);
|
||||||
|
|
||||||
|
List<Long> listNetworkOfferingsForUpgrade(long networkId);
|
||||||
|
|
||||||
|
boolean isSecurityGroupSupportedInNetwork(Network network);
|
||||||
|
|
||||||
|
boolean isProviderSupportServiceInNetwork(long networkId, Service service, Provider provider);
|
||||||
|
|
||||||
|
boolean isProviderEnabledInPhysicalNetwork(long physicalNetowrkId, String providerName);
|
||||||
|
|
||||||
|
String getNetworkTag(HypervisorType hType, Network network);
|
||||||
|
|
||||||
|
List<Service> getElementServices(Provider provider);
|
||||||
|
|
||||||
|
boolean canElementEnableIndividualServices(Provider provider);
|
||||||
|
|
||||||
|
boolean areServicesSupportedInNetwork(long networkId, Service... services);
|
||||||
|
|
||||||
|
boolean isNetworkSystem(Network network);
|
||||||
|
|
||||||
|
Map<Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service);
|
||||||
|
|
||||||
|
Long getPhysicalNetworkId(Network network);
|
||||||
|
|
||||||
|
boolean getAllowSubdomainAccessGlobal();
|
||||||
|
|
||||||
|
boolean isProviderForNetwork(Provider provider, long networkId);
|
||||||
|
|
||||||
|
boolean isProviderForNetworkOffering(Provider provider, long networkOfferingId);
|
||||||
|
|
||||||
|
void canProviderSupportServices(Map<Provider, Set<Service>> providersMap);
|
||||||
|
|
||||||
|
List<PhysicalNetworkSetupInfo> getPhysicalNetworkInfo(long dcId, HypervisorType hypervisorType);
|
||||||
|
|
||||||
|
boolean canAddDefaultSecurityGroup();
|
||||||
|
|
||||||
|
List<Service> listNetworkOfferingServices(long networkOfferingId);
|
||||||
|
|
||||||
|
boolean areServicesEnabledInZone(long zoneId, NetworkOffering offering, List<Service> services);
|
||||||
|
|
||||||
|
Map<PublicIpAddress, Set<Service>> getIpToServices(List<? extends PublicIpAddress> publicIps, boolean rulesRevoked,
|
||||||
|
boolean includingFirewall);
|
||||||
|
|
||||||
|
Map<Provider, ArrayList<PublicIpAddress>> getProviderToIpList(Network network, Map<PublicIpAddress, Set<Service>> ipToServices);
|
||||||
|
|
||||||
|
boolean checkIpForService(IpAddress ip, Service service, Long networkId);
|
||||||
|
|
||||||
|
void checkCapabilityForProvider(Set<Provider> providers, Service service, Capability cap, String capValue);
|
||||||
|
|
||||||
|
Provider getDefaultUniqueProviderForService(String serviceName);
|
||||||
|
|
||||||
|
void checkNetworkPermissions(Account owner, Network network);
|
||||||
|
|
||||||
|
String getDefaultManagementTrafficLabel(long zoneId, HypervisorType hypervisorType);
|
||||||
|
|
||||||
|
String getDefaultStorageTrafficLabel(long zoneId, HypervisorType hypervisorType);
|
||||||
|
|
||||||
|
String getDefaultPublicTrafficLabel(long dcId, HypervisorType vmware);
|
||||||
|
|
||||||
|
String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param providerName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
NetworkElement getElementImplementingProvider(String providerName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param accountId
|
||||||
|
* @param zoneId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getAccountNetworkDomain(long accountId, long zoneId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getDefaultNetworkDomain();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ntwkOffId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Provider> getNtwkOffDistinctProviders(long ntwkOffId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param accountId
|
||||||
|
* @param dcId
|
||||||
|
* @param sourceNat
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<? extends IpAddress> listPublicIpsAssignedToAccount(long accountId, long dcId, Boolean sourceNat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId
|
||||||
|
* @param trafficType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param guestNic
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isPrivateGateway(Nic guestNic);
|
||||||
|
|
||||||
|
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
|
||||||
|
|
||||||
|
Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
||||||
|
|
||||||
|
Long getDedicatedNetworkDomain(long networkId);
|
||||||
|
|
||||||
|
Map<Service, Set<Provider>> getNetworkOfferingServiceProvidersMap(long networkOfferingId);
|
||||||
|
|
||||||
|
List<? extends Provider> listSupportedNetworkServiceProviders(String serviceName);
|
||||||
|
|
||||||
|
List<? extends Network> listNetworksByVpc(long vpcId);
|
||||||
|
|
||||||
|
boolean canUseForDeploy(Network network);
|
||||||
|
|
||||||
|
Network getExclusiveGuestNetwork(long zoneId);
|
||||||
|
|
||||||
|
long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType);
|
||||||
|
|
||||||
|
Integer getNetworkRate(long networkId, Long vmId);
|
||||||
|
|
||||||
|
boolean isVmPartOfNetwork(long vmId, long ntwkId);
|
||||||
|
|
||||||
|
PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
||||||
|
|
||||||
|
Network getNetwork(long networkId);
|
||||||
|
|
||||||
|
IpAddress getIp(long sourceIpAddressId);
|
||||||
|
|
||||||
|
boolean isNetworkAvailableInDomain(long networkId, long domainId);
|
||||||
|
|
||||||
|
NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri);
|
||||||
|
|
||||||
|
Set<Long> getAvailableIps(Network network, String requestedIp);
|
||||||
|
|
||||||
|
String getDomainNetworkDomain(long domainId, long zoneId);
|
||||||
|
|
||||||
|
PublicIpAddress getSourceNatIpAddressForGuestNetwork(Account owner, Network guestNetwork);
|
||||||
|
|
||||||
|
boolean isNetworkInlineMode(Network network);
|
||||||
|
|
||||||
|
}
|
||||||
@ -17,8 +17,6 @@
|
|||||||
package com.cloud.network;
|
package com.cloud.network;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||||
@ -29,19 +27,22 @@ import com.cloud.exception.InsufficientAddressCapacityException;
|
|||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.network.Network.Capability;
|
|
||||||
import com.cloud.network.Network.Provider;
|
|
||||||
import com.cloud.network.Network.Service;
|
import com.cloud.network.Network.Service;
|
||||||
import com.cloud.network.Networks.TrafficType;
|
import com.cloud.network.Networks.TrafficType;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NetworkService interface is the "public" api to entities that make requests to the orchestration engine
|
||||||
|
* Such entities are usually the admin and end-user API.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface NetworkService {
|
public interface NetworkService {
|
||||||
|
|
||||||
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
|
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
|
||||||
|
|
||||||
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
|
IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException,
|
||||||
InsufficientAddressCapacityException, ConcurrentOperationException;
|
InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||||
|
|
||||||
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
||||||
@ -64,24 +65,12 @@ public interface NetworkService {
|
|||||||
|
|
||||||
IpAddress getIp(long id);
|
IpAddress getIp(long id);
|
||||||
|
|
||||||
NetworkProfile convertNetworkToNetworkProfile(long networkId);
|
|
||||||
|
|
||||||
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
|
|
||||||
|
|
||||||
boolean isNetworkAvailableInDomain(long networkId, long domainId);
|
|
||||||
|
|
||||||
Long getDedicatedNetworkDomain(long networkId);
|
|
||||||
|
|
||||||
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
|
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
|
||||||
String domainSuffix, Long networkOfferingId, Boolean changeCidr);
|
String domainSuffix, Long networkOfferingId, Boolean changeCidr);
|
||||||
|
|
||||||
Integer getNetworkRate(long networkId, Long vmId);
|
|
||||||
|
|
||||||
Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
|
||||||
|
|
||||||
Map<Service, Set<Provider>> getNetworkOfferingServiceProvidersMap(long networkOfferingId);
|
|
||||||
|
|
||||||
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
|
|
||||||
List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name);
|
List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name);
|
||||||
|
|
||||||
Pair<List<? extends PhysicalNetwork>, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword,
|
Pair<List<? extends PhysicalNetwork>, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword,
|
||||||
@ -94,8 +83,6 @@ public interface NetworkService {
|
|||||||
|
|
||||||
List<? extends Service> listNetworkServices(String providerName);
|
List<? extends Service> listNetworkServices(String providerName);
|
||||||
|
|
||||||
List<? extends Provider> listSupportedNetworkServiceProviders(String serviceName);
|
|
||||||
|
|
||||||
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName,
|
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName,
|
||||||
Long destinationPhysicalNetworkId, List<String> enabledServices);
|
Long destinationPhysicalNetworkId, List<String> enabledServices);
|
||||||
|
|
||||||
@ -127,17 +114,14 @@ public interface NetworkService {
|
|||||||
|
|
||||||
Pair<List<? extends PhysicalNetworkTrafficType>, Integer> listTrafficTypes(Long physicalNetworkId);
|
Pair<List<? extends PhysicalNetworkTrafficType>, Integer> listTrafficTypes(Long physicalNetworkId);
|
||||||
|
|
||||||
PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
|
||||||
|
|
||||||
Network getExclusiveGuestNetwork(long zoneId);
|
Network getExclusiveGuestNetwork(long zoneId);
|
||||||
|
|
||||||
List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd);
|
List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd);
|
||||||
|
|
||||||
List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner);
|
List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner);
|
||||||
|
|
||||||
List<? extends Network> listNetworksByVpc(long vpcId);
|
|
||||||
|
|
||||||
boolean isVmPartOfNetwork(long vmId, long ntwkId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param networkId
|
* @param networkId
|
||||||
@ -170,9 +154,5 @@ public interface NetworkService {
|
|||||||
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
|
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
|
||||||
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId)
|
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId)
|
||||||
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
|
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
|
||||||
/**
|
|
||||||
* @param network
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean canUseForDeploy(Network network);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,9 @@ import com.cloud.network.Network;
|
|||||||
import com.cloud.network.Network.Provider;
|
import com.cloud.network.Network.Provider;
|
||||||
import com.cloud.network.Network.Service;
|
import com.cloud.network.Network.Service;
|
||||||
import com.cloud.network.PublicIpAddress;
|
import com.cloud.network.PublicIpAddress;
|
||||||
|
import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
public interface IpDeployer {
|
public interface IpDeployer extends Adapter{
|
||||||
/**
|
/**
|
||||||
* Apply ip addresses to this network
|
* Apply ip addresses to this network
|
||||||
* @param network
|
* @param network
|
||||||
|
|||||||
@ -22,8 +22,9 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||||||
import com.cloud.network.Network;
|
import com.cloud.network.Network;
|
||||||
import com.cloud.network.RemoteAccessVpn;
|
import com.cloud.network.RemoteAccessVpn;
|
||||||
import com.cloud.network.VpnUser;
|
import com.cloud.network.VpnUser;
|
||||||
|
import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
public interface RemoteAccessVPNServiceProvider extends NetworkElement, IpDeployingRequester {
|
public interface RemoteAccessVPNServiceProvider extends Adapter {
|
||||||
String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users) throws ResourceUnavailableException;
|
String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users) throws ResourceUnavailableException;
|
||||||
|
|
||||||
boolean startVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
|
boolean startVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
|
||||||
|
|||||||
@ -17,10 +17,10 @@
|
|||||||
package com.cloud.network.element;
|
package com.cloud.network.element;
|
||||||
|
|
||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.network.Network;
|
|
||||||
import com.cloud.network.Site2SiteVpnConnection;
|
import com.cloud.network.Site2SiteVpnConnection;
|
||||||
|
import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
public interface Site2SiteVpnServiceProvider extends NetworkElement {
|
public interface Site2SiteVpnServiceProvider extends Adapter {
|
||||||
boolean startSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException;
|
boolean startSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException;
|
||||||
|
|
||||||
boolean stopSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException;
|
boolean stopSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException;
|
||||||
|
|||||||
@ -105,8 +105,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||||||
|
|
||||||
boolean getElasticIp();
|
boolean getElasticIp();
|
||||||
|
|
||||||
boolean getAssociatePublicIP();
|
|
||||||
|
|
||||||
boolean getElasticLb();
|
boolean getElasticLb();
|
||||||
|
|
||||||
boolean getSpecifyIpRanges();
|
boolean getSpecifyIpRanges();
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import java.util.Set;
|
|||||||
import com.cloud.alert.Alert;
|
import com.cloud.alert.Alert;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
|
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
|
||||||
@ -140,6 +141,14 @@ public interface ManagementService {
|
|||||||
*/
|
*/
|
||||||
Pair<List<? extends Pod>, Integer> searchForPods(ListPodsByCmd cmd);
|
Pair<List<? extends Pod>, Integer> searchForPods(ListPodsByCmd cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId",
|
||||||
|
* "podId"
|
||||||
|
*
|
||||||
|
* @param cmd
|
||||||
|
* @return List of Hosts
|
||||||
|
*/
|
||||||
|
Pair<List<? extends Host>, Integer> searchForServers(ListHostsCmd cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new template
|
* Creates a new template
|
||||||
@ -384,7 +393,7 @@ public interface ManagementService {
|
|||||||
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with
|
* @return Pair<List<? extends Host>, List<? extends Host>> List of all Hosts in VM's cluster and list of Hosts with
|
||||||
* enough capacity
|
* enough capacity
|
||||||
*/
|
*/
|
||||||
Pair<List<? extends Host>, List<? extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
|
Pair<Pair<List<? extends Host>, Integer>, List<? extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
|
||||||
|
|
||||||
String[] listEventTypes();
|
String[] listEventTypes();
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaint
|
|||||||
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
||||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||||
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
||||||
|
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
@ -70,6 +71,15 @@ public interface StorageService{
|
|||||||
Volume createVolume(CreateVolumeCmd cmd);
|
Volume createVolume(CreateVolumeCmd cmd);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resizes the volume based on the given criteria
|
||||||
|
*
|
||||||
|
* @param cmd
|
||||||
|
* the API command wrapping the criteria
|
||||||
|
* @return the volume object
|
||||||
|
*/
|
||||||
|
Volume resizeVolume(ResizeVolumeCmd cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the storage pool
|
* Delete the storage pool
|
||||||
*
|
*
|
||||||
|
|||||||
@ -36,6 +36,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||||||
Ready("The volume is ready to be used."),
|
Ready("The volume is ready to be used."),
|
||||||
Migrating("The volume is migrating to other storage pool"),
|
Migrating("The volume is migrating to other storage pool"),
|
||||||
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
|
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
|
||||||
|
Resizing("The volume is being resized"),
|
||||||
Expunging("The volume is being expunging"),
|
Expunging("The volume is being expunging"),
|
||||||
Destroy("The volume is destroyed, and can't be recovered."),
|
Destroy("The volume is destroyed, and can't be recovered."),
|
||||||
Destroying("The volume is destroying, and can't be recovered."),
|
Destroying("The volume is destroying, and can't be recovered."),
|
||||||
@ -64,6 +65,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||||||
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
|
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
|
||||||
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
|
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
|
||||||
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
|
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
|
||||||
|
s_fsm.addTransition(Ready, Event.ResizeRequested, Resizing);
|
||||||
|
s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready);
|
||||||
|
s_fsm.addTransition(Resizing, Event.OperationFailed, Ready);
|
||||||
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
|
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
|
||||||
s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
|
s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
|
||||||
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
|
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
|
||||||
@ -93,7 +97,8 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||||||
MigrationRequested,
|
MigrationRequested,
|
||||||
SnapshotRequested,
|
SnapshotRequested,
|
||||||
DestroyRequested,
|
DestroyRequested,
|
||||||
ExpungingRequested;
|
ExpungingRequested,
|
||||||
|
ResizeRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.user;
|
package com.cloud.user;
|
||||||
|
|
||||||
|
|
||||||
public class UserContext {
|
public class UserContext {
|
||||||
|
|
||||||
private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>();
|
private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>();
|
||||||
@ -43,6 +44,10 @@ public class UserContext {
|
|||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getCallerUser() {
|
||||||
|
return _accountMgr.getActiveUser(userId);
|
||||||
|
}
|
||||||
|
|
||||||
public void setCallerUserId(long userId) {
|
public void setCallerUserId(long userId) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,11 +17,14 @@
|
|||||||
package org.apache.cloudstack.acl;
|
package org.apache.cloudstack.acl;
|
||||||
|
|
||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
import org.apache.cloudstack.acl.RoleType;
|
import com.cloud.user.User;
|
||||||
import com.cloud.utils.component.Adapter;
|
import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
// APIChecker checks the ownership and access control to API requests
|
// APIChecker checks the ownership and access control to API requests
|
||||||
public interface APIChecker extends Adapter {
|
public interface APIChecker extends Adapter {
|
||||||
// Interface for checking access for a role using apiname
|
// Interface for checking access for a role using apiname
|
||||||
boolean checkAccess(RoleType roleType, String apiCommandName) throws PermissionDeniedException;
|
// If true, apiChecker has checked the operation
|
||||||
|
// If false, apiChecker is unable to handle the operation or not implemented
|
||||||
|
// On exception, checkAccess failed don't allow
|
||||||
|
boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -387,6 +387,7 @@ public class ApiConstants {
|
|||||||
public static final String ESP_LIFETIME = "esplifetime";
|
public static final String ESP_LIFETIME = "esplifetime";
|
||||||
public static final String DPD = "dpd";
|
public static final String DPD = "dpd";
|
||||||
public static final String FOR_VPC = "forvpc";
|
public static final String FOR_VPC = "forvpc";
|
||||||
|
public static final String SHRINK_OK = "shrinkok";
|
||||||
public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
|
public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
|
||||||
public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
|
public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
|
||||||
public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
|
public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
|
||||||
|
|||||||
59
api/src/org/apache/cloudstack/api/ApiErrorCode.java
Normal file
59
api/src/org/apache/cloudstack/api/ApiErrorCode.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing,
|
||||||
|
// software distributed under the License is distributed on an
|
||||||
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
// KIND, either express or implied. See the License for the
|
||||||
|
// specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
package org.apache.cloudstack.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum class for various API error code used in CloudStack
|
||||||
|
* @author minc
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum ApiErrorCode {
|
||||||
|
|
||||||
|
MALFORMED_PARAMETER_ERROR(430),
|
||||||
|
PARAM_ERROR(431),
|
||||||
|
UNSUPPORTED_ACTION_ERROR(432),
|
||||||
|
API_LIMIT_EXCEED(429),
|
||||||
|
|
||||||
|
INTERNAL_ERROR(530),
|
||||||
|
ACCOUNT_ERROR(531),
|
||||||
|
ACCOUNT_RESOURCE_LIMIT_ERROR(532),
|
||||||
|
INSUFFICIENT_CAPACITY_ERROR(533),
|
||||||
|
RESOURCE_UNAVAILABLE_ERROR(534),
|
||||||
|
RESOURCE_ALLOCATION_ERROR(534),
|
||||||
|
RESOURCE_IN_USE_ERROR(536),
|
||||||
|
NETWORK_RULE_CONFLICT_ERROR(537);
|
||||||
|
|
||||||
|
private int httpCode;
|
||||||
|
|
||||||
|
private ApiErrorCode(int httpStatusCode){
|
||||||
|
httpCode = httpStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHttpCode() {
|
||||||
|
return httpCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttpCode(int httpCode) {
|
||||||
|
this.httpCode = httpCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
return String.valueOf(this.httpCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -83,23 +83,6 @@ public abstract class BaseCmd {
|
|||||||
BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
|
BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Extract these out into a separate file
|
|
||||||
// Client error codes
|
|
||||||
public static final int MALFORMED_PARAMETER_ERROR = 430;
|
|
||||||
public static final int PARAM_ERROR = 431;
|
|
||||||
public static final int UNSUPPORTED_ACTION_ERROR = 432;
|
|
||||||
public static final int PAGE_LIMIT_EXCEED = 433;
|
|
||||||
|
|
||||||
// Server error codes
|
|
||||||
public static final int INTERNAL_ERROR = 530;
|
|
||||||
public static final int ACCOUNT_ERROR = 531;
|
|
||||||
public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532;
|
|
||||||
public static final int INSUFFICIENT_CAPACITY_ERROR = 533;
|
|
||||||
public static final int RESOURCE_UNAVAILABLE_ERROR = 534;
|
|
||||||
public static final int RESOURCE_ALLOCATION_ERROR = 534;
|
|
||||||
public static final int RESOURCE_IN_USE_ERROR = 536;
|
|
||||||
public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
|
|
||||||
|
|
||||||
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
|
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
|
||||||
@ -200,7 +183,7 @@ public abstract class BaseCmd {
|
|||||||
int arrayStartIndex = key.indexOf('[');
|
int arrayStartIndex = key.indexOf('[');
|
||||||
int arrayStartLastIndex = key.lastIndexOf('[');
|
int arrayStartLastIndex = key.lastIndexOf('[');
|
||||||
if (arrayStartIndex != arrayStartLastIndex) {
|
if (arrayStartIndex != arrayStartLastIndex) {
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +192,7 @@ public abstract class BaseCmd {
|
|||||||
int arrayEndLastIndex = key.lastIndexOf(']');
|
int arrayEndLastIndex = key.lastIndexOf(']');
|
||||||
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
|
||||||
// malformed parameter
|
// malformed parameter
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +200,7 @@ public abstract class BaseCmd {
|
|||||||
int fieldIndex = key.indexOf('.');
|
int fieldIndex = key.indexOf('.');
|
||||||
String fieldName = null;
|
String fieldName = null;
|
||||||
if (fieldIndex < arrayEndIndex) {
|
if (fieldIndex < arrayEndIndex) {
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
} else {
|
} else {
|
||||||
fieldName = key.substring(fieldIndex + 1);
|
fieldName = key.substring(fieldIndex + 1);
|
||||||
@ -242,7 +225,7 @@ public abstract class BaseCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!parsedIndex) {
|
if (!parsedIndex) {
|
||||||
throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
|
||||||
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
Executable file → Normal file
0
api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
Executable file → Normal file
2
api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
Executable file → Normal file
2
api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
Executable file → Normal file
@ -119,7 +119,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template/iso permissions");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,28 +15,51 @@
|
|||||||
// specific language governing permissions and limitations
|
// specific language governing permissions and limitations
|
||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.api;
|
package org.apache.cloudstack.api;
|
||||||
import com.cloud.utils.exception.RuntimeCloudException;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.cloud.exception.CloudException;
|
||||||
|
import com.cloud.utils.exception.CSExceptionErrorCode;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ServerApiException extends RuntimeCloudException {
|
public class ServerApiException extends CloudRuntimeException {
|
||||||
private int _errorCode;
|
private ApiErrorCode _errorCode;
|
||||||
private String _description;
|
private String _description;
|
||||||
|
|
||||||
public ServerApiException() {
|
public ServerApiException() {
|
||||||
_errorCode = 0;
|
_errorCode = ApiErrorCode.INTERNAL_ERROR;
|
||||||
_description = null;
|
_description = null;
|
||||||
|
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerApiException(int errorCode, String description) {
|
public ServerApiException(ApiErrorCode errorCode, String description) {
|
||||||
_errorCode = errorCode;
|
_errorCode = errorCode;
|
||||||
_description = description;
|
_description = description;
|
||||||
|
setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getErrorCode() {
|
// wrap a specific CloudRuntimeException to a ServerApiException
|
||||||
|
public ServerApiException(ApiErrorCode errorCode, String description, Throwable cause){
|
||||||
|
super(description, cause);
|
||||||
|
_errorCode = errorCode;
|
||||||
|
_description = description;
|
||||||
|
if (cause instanceof CloudRuntimeException || cause instanceof CloudException ) {
|
||||||
|
CloudRuntimeException rt = (CloudRuntimeException) cause;
|
||||||
|
ArrayList<String> idList = rt.getIdProxyList();
|
||||||
|
if (idList != null) {
|
||||||
|
for (int i = 0; i < idList.size(); i++) {
|
||||||
|
addProxyObject(idList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setCSErrorCode(rt.getCSErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiErrorCode getErrorCode() {
|
||||||
return _errorCode;
|
return _errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorCode(int errorCode) {
|
public void setErrorCode(ApiErrorCode errorCode) {
|
||||||
_errorCode = errorCode;
|
_errorCode = errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -151,7 +151,7 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user account");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.account;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -95,7 +96,7 @@ public class EnableAccountCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable account");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class LockAccountCmd extends BaseCmd {
|
|||||||
// response.setResponseName(getCommandName());
|
// response.setResponseName(getCommandName());
|
||||||
// this.setResponseObject(response);
|
// this.setResponseObject(response);
|
||||||
// } else {
|
// } else {
|
||||||
// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock account");
|
// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock account");
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.Map;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -125,7 +126,7 @@ public class UpdateAccountCmd extends BaseCmd{
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package org.apache.cloudstack.api.command.admin.autoscale;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -86,7 +87,7 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package org.apache.cloudstack.api.command.admin.autoscale;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -56,7 +57,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
|
|||||||
result = _autoScaleService.deleteCounter(getId());
|
result = _autoScaleService.deleteCounter(getId());
|
||||||
} catch (ResourceInUseException ex) {
|
} catch (ResourceInUseException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -64,7 +65,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
s_logger.warn("Failed to delete counter with Id: " + getId());
|
s_logger.warn("Failed to delete counter with Id: " + getId());
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete counter.");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@ public class AddClusterCmd extends BaseCmd {
|
|||||||
clusterResponses.add(clusterResponse);
|
clusterResponses.add(clusterResponse);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add cluster");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add cluster");
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setResponses(clusterResponses);
|
response.setResponses(clusterResponses);
|
||||||
@ -165,10 +165,10 @@ public class AddClusterCmd extends BaseCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (DiscoveryException ex) {
|
} catch (DiscoveryException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
} catch (ResourceInUseException ex) {
|
} catch (ResourceInUseException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
ServerApiException e = new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
for (String proxyObj : ex.getIdProxyList()) {
|
for (String proxyObj : ex.getIdProxyList()) {
|
||||||
e.addProxyObject(proxyObj);
|
e.addProxyObject(proxyObj);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.cluster;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -70,7 +71,7 @@ public class DeleteClusterCmd extends BaseCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete cluster");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete cluster");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.cluster;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -112,7 +113,7 @@ public class UpdateClusterCmd extends BaseCmd {
|
|||||||
clusterResponse.setResponseName(getCommandName());
|
clusterResponse.setResponseName(getCommandName());
|
||||||
this.setResponseObject(clusterResponse);
|
this.setResponseObject(clusterResponse);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update cluster");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update cluster");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.config;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -76,7 +77,7 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.config;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -86,7 +87,7 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class CreateDomainCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create domain");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create domain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete domain");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete domain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public class UpdateDomainCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update domain");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update domain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.List;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -148,7 +149,7 @@ public class AddHostCmd extends BaseCmd {
|
|||||||
hostResponses.add(hostResponse);
|
hostResponses.add(hostResponse);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add host");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add host");
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setResponses(hostResponses);
|
response.setResponses(hostResponses);
|
||||||
@ -157,7 +158,7 @@ public class AddHostCmd extends BaseCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (DiscoveryException ex) {
|
} catch (DiscoveryException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,11 +84,11 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||||||
this.setResponseObject(hostResponse);
|
this.setResponseObject(hostResponse);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add secondary storage");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||||
}
|
}
|
||||||
} catch (DiscoveryException ex) {
|
} catch (DiscoveryException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -104,7 +105,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel host maintenance");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel host maintenance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.HostResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -84,7 +85,7 @@ public class DeleteHostCmd extends BaseCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete host");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete host");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,17 +168,16 @@ public class ListHostsCmd extends BaseListCmd {
|
|||||||
if (getVirtualMachineId() == null) {
|
if (getVirtualMachineId() == null) {
|
||||||
response = _queryService.searchForServers(this);
|
response = _queryService.searchForServers(this);
|
||||||
} else {
|
} else {
|
||||||
List<? extends Host> result = new ArrayList<Host>();
|
Pair<List<? extends Host>,Integer> result;
|
||||||
List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
|
List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
|
||||||
|
|
||||||
Pair<List<? extends Host>, List<? extends Host>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(),
|
Pair<Pair<List<? extends Host>,Integer>, List<? extends Host>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
|
||||||
this.getStartIndex(), this.getPageSizeVal());
|
|
||||||
result = hostsForMigration.first();
|
result = hostsForMigration.first();
|
||||||
hostsWithCapacity = hostsForMigration.second();
|
hostsWithCapacity = hostsForMigration.second();
|
||||||
|
|
||||||
response = new ListResponse<HostResponse>();
|
response = new ListResponse<HostResponse>();
|
||||||
List<HostResponse> hostResponses = new ArrayList<HostResponse>();
|
List<HostResponse> hostResponses = new ArrayList<HostResponse>();
|
||||||
for (Host host : result) {
|
for (Host host : result.first()) {
|
||||||
HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
|
HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
|
||||||
Boolean suitableForMigration = false;
|
Boolean suitableForMigration = false;
|
||||||
if (hostsWithCapacity.contains(host)) {
|
if (hostsWithCapacity.contains(host)) {
|
||||||
@ -189,7 +188,7 @@ public class ListHostsCmd extends BaseListCmd {
|
|||||||
hostResponses.add(hostResponse);
|
hostResponses.add(hostResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setResponses(hostResponses);
|
response.setResponses(hostResponses, result.second());
|
||||||
}
|
}
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -104,7 +105,7 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName("host");
|
response.setResponseName("host");
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare host for maintenance");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare host for maintenance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -103,11 +104,11 @@ public class ReconnectHostCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reconnect host");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host");
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -108,7 +109,7 @@ public class UpdateHostCmd extends BaseCmd {
|
|||||||
this.setResponseObject(hostResponse);
|
this.setResponseObject(hostResponse);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.debug("Failed to update host:" + getId(), e);
|
s_logger.debug("Failed to update host:" + getId(), e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
@ -72,9 +73,9 @@ public class AddNetworkDeviceCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (InvalidParameterValueException ipve) {
|
} catch (InvalidParameterValueException ipve) {
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
|
||||||
} catch (CloudRuntimeException cre) {
|
} catch (CloudRuntimeException cre) {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -103,7 +104,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider to physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
|
|||||||
setEntityId(result.getId());
|
setEntityId(result.getId());
|
||||||
setEntityUuid(result.getUuid());
|
setEntityUuid(result.getUuid());
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -225,7 +225,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -151,7 +152,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +163,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
|
|||||||
setEntityId(result.getId());
|
setEntityId(result.getId());
|
||||||
setEntityUuid(result.getUuid());
|
setEntityUuid(result.getUuid());
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network entity");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -110,7 +111,7 @@ public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.warn("Create storage network IP range failed", e);
|
s_logger.warn("Create storage network IP range failed", e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
@ -64,12 +65,12 @@ public class DeleteNetworkDeviceCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network device:" + getId());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network device:" + getId());
|
||||||
}
|
}
|
||||||
} catch (InvalidParameterValueException ipve) {
|
} catch (InvalidParameterValueException ipve) {
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
|
||||||
} catch (CloudRuntimeException cre) {
|
} catch (CloudRuntimeException cre) {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -70,7 +71,7 @@ public class DeleteNetworkOfferingCmd extends BaseCmd{
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -76,14 +77,14 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network service provider");
|
||||||
}
|
}
|
||||||
} catch (ResourceUnavailableException ex) {
|
} catch (ResourceUnavailableException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||||
} catch (ConcurrentOperationException ex) {
|
} catch (ConcurrentOperationException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.warn("Failed to delete storage network ip range " + getId(), e);
|
s_logger.warn("Failed to delete storage network ip range " + getId(), e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.BaseListCmd;
|
import org.apache.cloudstack.api.BaseListCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -83,9 +84,9 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
|
|||||||
listResponse.setResponseName(getCommandName());
|
listResponse.setResponseName(getCommandName());
|
||||||
this.setResponseObject(listResponse);
|
this.setResponseObject(listResponse);
|
||||||
} catch (InvalidParameterValueException ipve) {
|
} catch (InvalidParameterValueException ipve) {
|
||||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
|
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
|
||||||
} catch (CloudRuntimeException cre) {
|
} catch (CloudRuntimeException cre) {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.BaseListCmd;
|
import org.apache.cloudstack.api.BaseListCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -100,7 +101,7 @@ public class ListPhysicalNetworksCmd extends BaseListCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to search for physical networks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
|
s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -88,7 +89,7 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service provider");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
|||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.warn("Update storage network IP range failed", e);
|
s_logger.warn("Update storage network IP range failed", e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -115,7 +116,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create disk offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create disk offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -162,7 +163,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create service offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DiskOfferingResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -70,7 +71,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete disk offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete disk offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.admin.offering;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -91,7 +92,7 @@ public class UpdateDiskOfferingCmd extends BaseCmd{
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update disk offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service offering");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service offering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,7 @@ public class CreatePodCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.pod;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -70,7 +71,7 @@ public class DeletePodCmd extends BaseCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete pod");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete pod");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public class UpdatePodCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update pod");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public class UploadCustomCertificateCmd extends BaseAsyncCmd {
|
|||||||
response.setObjectName("customcertificate");
|
response.setObjectName("customcertificate");
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload custom certificate");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload custom certificate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import javax.inject.Inject;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -123,7 +124,7 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd {
|
|||||||
routerResponse.setResponseName(getCommandName());
|
routerResponse.setResponseName(getCommandName());
|
||||||
this.setResponseObject(routerResponse);
|
this.setResponseObject(routerResponse);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the virtual router provider");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
|
|||||||
setEntityId(result.getId());
|
setEntityId(result.getId());
|
||||||
setEntityUuid(result.getUuid());
|
setEntityUuid(result.getUuid());
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.router;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -104,7 +105,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy router");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ public class RebootRouterCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName("router");
|
response.setResponseName("router");
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot router");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,7 +102,7 @@ public class StartRouterCmd extends BaseAsyncCmd {
|
|||||||
routerResponse.setResponseName(getCommandName());
|
routerResponse.setResponseName(getCommandName());
|
||||||
this.setResponseObject(routerResponse);
|
this.setResponseObject(routerResponse);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to start router");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.router;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -109,7 +110,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop router");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,7 @@ public class UpgradeRouterCmd extends BaseCmd {
|
|||||||
routerResponse.setResponseName(getCommandName());
|
routerResponse.setResponseName(getCommandName());
|
||||||
this.setResponseObject(routerResponse);
|
this.setResponseObject(routerResponse);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade router");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import static org.apache.cloudstack.api.BaseCmd.CommandType.STRING;
|
|||||||
import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN;
|
import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN;
|
||||||
import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM;
|
import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -93,12 +94,12 @@ public final class AddS3Cmd extends BaseCmd {
|
|||||||
result = _resourceService.discoverS3(this);
|
result = _resourceService.discoverS3(this);
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3.");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (DiscoveryException e) {
|
} catch (DiscoveryException e) {
|
||||||
|
|
||||||
throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.storage;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -107,7 +108,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel primary storage maintenance");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel primary storage maintenance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,17 +122,17 @@ public class CreateStoragePoolCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add storage pool");
|
||||||
}
|
}
|
||||||
} catch (ResourceUnavailableException ex1) {
|
} catch (ResourceUnavailableException ex1) {
|
||||||
s_logger.warn("Exception: ", ex1);
|
s_logger.warn("Exception: ", ex1);
|
||||||
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage());
|
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage());
|
||||||
}catch (ResourceInUseException ex2) {
|
}catch (ResourceInUseException ex2) {
|
||||||
s_logger.warn("Exception: ", ex2);
|
s_logger.warn("Exception: ", ex2);
|
||||||
throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex2.getMessage());
|
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex2.getMessage());
|
||||||
} catch (UnknownHostException ex3) {
|
} catch (UnknownHostException ex3) {
|
||||||
s_logger.warn("Exception: ", ex3);
|
s_logger.warn("Exception: ", ex3);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex3.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex3.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,9 +78,9 @@ public class DeletePoolCmd extends BaseCmd {
|
|||||||
} else {
|
} else {
|
||||||
StoragePool pool = _storageService.getStoragePool(id);
|
StoragePool pool = _storageService.getStoragePool(id);
|
||||||
if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) {
|
if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete storage pool");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete storage pool");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.storage;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -105,7 +106,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName("storagepool");
|
response.setResponseName("storagepool");
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public class UpdateStoragePoolCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update storage pool");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,12 +92,12 @@ public class AddSwiftCmd extends BaseCmd {
|
|||||||
swiftResponse.setObjectName("swift");
|
swiftResponse.setObjectName("swift");
|
||||||
this.setResponseObject(swiftResponse);
|
this.setResponseObject(swiftResponse);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift");
|
||||||
}
|
}
|
||||||
} catch (DiscoveryException ex) {
|
} catch (DiscoveryException ex) {
|
||||||
String errMsg = "Failed to add Swift due to " + ex.toString();
|
String errMsg = "Failed to add Swift due to " + ex.toString();
|
||||||
s_logger.warn(errMsg, ex);
|
s_logger.warn(errMsg, ex);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg);
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.systemvm;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -116,20 +117,20 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm");
|
||||||
}
|
}
|
||||||
} catch (ResourceUnavailableException ex) {
|
} catch (ResourceUnavailableException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||||
} catch (ConcurrentOperationException e) {
|
} catch (ConcurrentOperationException e) {
|
||||||
s_logger.warn("Exception: ", e);
|
s_logger.warn("Exception: ", e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
} catch (ManagementServerException e) {
|
} catch (ManagementServerException e) {
|
||||||
s_logger.warn("Exception: ", e);
|
s_logger.warn("Exception: ", e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
} catch (VirtualMachineMigrationException e) {
|
} catch (VirtualMachineMigrationException e) {
|
||||||
s_logger.warn("Exception: ", e);
|
s_logger.warn("Exception: ", e);
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.systemvm;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -105,7 +106,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.systemvm;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -109,7 +110,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to start system vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -112,7 +112,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to stop system vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -123,7 +124,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
|||||||
setEntityId(result.getId());
|
setEntityId(result.getId());
|
||||||
setEntityUuid(result.getUuid());
|
setEntityUuid(result.getUuid());
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.TrafficTypeResponse;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -73,7 +74,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
|
|||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic type");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.usage;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -95,7 +96,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
}else {
|
}else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update traffic type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.user;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
@ -137,7 +138,7 @@ public class CreateUserCmd extends BaseCmd {
|
|||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user