mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
Merge branch 'master' into resizevolume
Conflicts: test/integration/smoke/test_volumes.py
This commit is contained in:
commit
c541f15dcd
@ -31,7 +31,7 @@ import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
|
||||
//@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
|
||||
public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreatePrivateNetworkCmd.class.getName());
|
||||
|
||||
@ -153,6 +153,7 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
|
||||
|
||||
if (result != null) {
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
|
||||
}
|
||||
@ -190,8 +191,4 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "networks";
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
|
||||
//@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
|
||||
public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
|
||||
import com.cloud.storage.snapshot.SnapshotSchedule;
|
||||
|
||||
@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
|
||||
//@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
|
||||
public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
|
||||
private static final String s_name = "listrecurringsnapshotscheduleresponse";
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
package com.cloud.exception;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class CloudAuthenticationException extends RuntimeCloudException {
|
||||
public class CloudAuthenticationException extends CloudRuntimeException {
|
||||
private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
|
||||
|
||||
public CloudAuthenticationException(String message) {
|
||||
|
||||
@ -16,10 +16,8 @@
|
||||
// under the License.
|
||||
package com.cloud.exception;
|
||||
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import java.util.ArrayList;
|
||||
import com.cloud.utils.exception.CSExceptionErrorCode;
|
||||
import com.cloud.utils.AnnotationHelper;
|
||||
|
||||
/**
|
||||
* by the API response serializer. Any exceptions that are thrown by
|
||||
|
||||
@ -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 RedundantRouter = new Capability("RedundantRouter");
|
||||
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 AutoScaleCounters = new Capability("AutoScaleCounters");
|
||||
public static final Capability InlineMode = new Capability("InlineMode");
|
||||
|
||||
@ -41,7 +41,7 @@ public interface NetworkService {
|
||||
|
||||
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;
|
||||
|
||||
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
||||
@ -60,6 +60,8 @@ public interface NetworkService {
|
||||
|
||||
Network getNetwork(long networkId);
|
||||
|
||||
Network getNetwork(String networkUuid);
|
||||
|
||||
IpAddress getIp(long id);
|
||||
|
||||
NetworkProfile convertNetworkToNetworkProfile(long networkId);
|
||||
|
||||
@ -105,8 +105,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
||||
|
||||
boolean getElasticIp();
|
||||
|
||||
boolean getAssociatePublicIP();
|
||||
|
||||
boolean getElasticLb();
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
||||
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
||||
@ -193,6 +194,8 @@ public interface AccountService {
|
||||
|
||||
UserAccount getUserByApiKey(String apiKey);
|
||||
|
||||
RoleType getRoleType(Account account);
|
||||
|
||||
void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
|
||||
|
||||
void checkAccess(Account account, AccessType accessType, boolean sameOwner, ControlledEntity... entities) throws PermissionDeniedException;
|
||||
|
||||
@ -30,6 +30,8 @@ public interface DomainService {
|
||||
|
||||
Domain getDomain(long id);
|
||||
|
||||
Domain getDomain(String uuid);
|
||||
|
||||
/**
|
||||
* Return whether a domain is a child domain of a given domain.
|
||||
*
|
||||
|
||||
@ -50,6 +50,10 @@ public class UserContext {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public User getCallerUser() {
|
||||
return _accountMgr.getActiveUser(userId);
|
||||
}
|
||||
|
||||
public void setCallerUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@ -16,17 +16,15 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.acl;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
* APIAccessChecker checks the ownership and access control to API requests
|
||||
*/
|
||||
public interface APIAccessChecker extends Adapter {
|
||||
// Interface for checking access to an API for an user
|
||||
boolean canAccessAPI(User user, String apiCommandName) throws PermissionDeniedException;
|
||||
// APIChecker checks the ownership and access control to API requests
|
||||
public interface APIChecker extends Adapter {
|
||||
// Interface for checking access for a role using apiname
|
||||
// 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;
|
||||
}
|
||||
43
api/src/com/cloud/exception/ErrorCode.java → api/src/org/apache/cloudstack/acl/RoleType.java
Executable file → Normal file
43
api/src/com/cloud/exception/ErrorCode.java → api/src/org/apache/cloudstack/acl/RoleType.java
Executable file → Normal file
@ -14,39 +14,24 @@
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.exception;
|
||||
package org.apache.cloudstack.acl;
|
||||
|
||||
import java.util.HashSet;
|
||||
// Enum for default roles in CloudStack
|
||||
public enum RoleType {
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ErrorCode {
|
||||
String code;
|
||||
private static HashSet<ErrorCode> s_codes = new HashSet<ErrorCode>();
|
||||
Admin(1),
|
||||
ResourceAdmin(2),
|
||||
DomainAdmin(4),
|
||||
User(8),
|
||||
Unknown(0);
|
||||
|
||||
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);
|
||||
private int mask;
|
||||
|
||||
private RoleType(int mask) {
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
public int getValue() {
|
||||
return mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return code.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (!(that instanceof ErrorCode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.code.equals(((ErrorCode)that).code);
|
||||
}
|
||||
|
||||
public final static ErrorCode UnableToReachResource = new ErrorCode("resource.unavailable");
|
||||
}
|
||||
@ -158,6 +158,7 @@ public class ApiConstants {
|
||||
public static final String RECEIVED_BYTES = "receivedbytes";
|
||||
public static final String REQUIRES_HVM = "requireshvm";
|
||||
public static final String RESOURCE_TYPE = "resourcetype";
|
||||
public static final String RESPONSE = "response";
|
||||
public static final String QUERY_FILTER = "queryfilter";
|
||||
public static final String SCHEDULE = "schedule";
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
@ -25,6 +25,8 @@ public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
|
||||
@Parameter(name = "id", type = CommandType.LONG)
|
||||
private Long id;
|
||||
|
||||
private String uuid;
|
||||
|
||||
public abstract void create() throws ResourceAllocationException;
|
||||
|
||||
public Long getEntityId() {
|
||||
@ -35,14 +37,19 @@ public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public abstract String getEntityTable();
|
||||
public String getEntityUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getResponse(long jobId, long objectId, String objectEntityTable) {
|
||||
public void setEntityUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getResponse(long jobId, String objectUuid) {
|
||||
CreateCmdResponse response = new CreateCmdResponse();
|
||||
AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId);
|
||||
response.setJobId(job.getUuid());
|
||||
response.setId(objectId);
|
||||
response.setIdEntityTable(objectEntityTable);
|
||||
response.setId(objectUuid);
|
||||
response.setResponseName(getCommandName());
|
||||
return _responseGenerator.toSerializedString(response, getResponseType());
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -64,7 +63,6 @@ import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountService;
|
||||
import com.cloud.user.DomainService;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.vm.BareMetalVmService;
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import org.apache.cloudstack.api.ResponseObject;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@ -46,6 +45,7 @@ public abstract class BaseResponse implements ResponseObject {
|
||||
this.objectName = objectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return null;
|
||||
}
|
||||
@ -56,18 +56,22 @@ public abstract class BaseResponse implements ResponseObject {
|
||||
@SerializedName(ApiConstants.JOB_STATUS) @Param(description="the current status of the latest async job acting on this object")
|
||||
private Integer jobStatus;
|
||||
|
||||
@Override
|
||||
public String getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJobId(String jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getJobStatus() {
|
||||
return jobStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJobStatus(Integer jobStatus) {
|
||||
this.jobStatus = jobStatus;
|
||||
}
|
||||
|
||||
@ -314,13 +314,6 @@ public interface ResponseGenerator {
|
||||
|
||||
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
|
||||
|
||||
/**
|
||||
* @param tableName TODO
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
Long getIdentiyId(String tableName, String token);
|
||||
|
||||
/**
|
||||
* @param resourceTag
|
||||
* @param keyValueOnly TODO
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ServerApiException extends RuntimeCloudException {
|
||||
public class ServerApiException extends CloudRuntimeException {
|
||||
private int _errorCode;
|
||||
private String _description;
|
||||
|
||||
|
||||
@ -81,6 +81,7 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd {
|
||||
|
||||
if (ctr != null) {
|
||||
this.setEntityId(ctr.getId());
|
||||
this.setEntityUuid(ctr.getUuid());
|
||||
CounterResponse response = _responseGenerator.createCounterResponse(ctr);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
@ -113,8 +114,5 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "counter";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -59,10 +59,6 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
|
||||
@Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
|
||||
private List<String> enabledServices;
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "physical_network_service_providers";
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
@ -116,6 +112,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
|
||||
PhysicalNetworkServiceProvider result = _networkService.addProviderToPhysicalNetwork(getPhysicalNetworkId(), getProviderName(), getDestinationPhysicalNetworkId(), getEnabledServices());
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
|
||||
}
|
||||
|
||||
@ -79,10 +79,6 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
|
||||
return tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "physical_network";
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
@ -164,6 +160,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
|
||||
PhysicalNetwork result = _networkService.createPhysicalNetwork(getZoneId(),getVlan(),getNetworkSpeed(), getIsolationMethods(),getBroadcastDomainRange(),getDomainId(), getTags(), getNetworkName());
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
|
||||
}
|
||||
|
||||
@ -53,10 +53,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
|
||||
this.nspId = nspId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "virtual_router_providers";
|
||||
}
|
||||
|
||||
|
||||
public Long getNspId() {
|
||||
return nspId;
|
||||
@ -94,6 +91,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
|
||||
VirtualRouterProvider result = _service.addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
|
||||
}
|
||||
|
||||
@ -66,10 +66,6 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "physical_network_traffic_types";
|
||||
}
|
||||
|
||||
public Long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
@ -136,6 +132,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
||||
PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getSimulatorLabel(), getVlan());
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
|
||||
}
|
||||
|
||||
@ -123,6 +123,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
||||
|
||||
if (result != null) {
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway");
|
||||
}
|
||||
@ -156,10 +157,6 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
|
||||
return "creating private gateway";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "vpc_gateways";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@ -70,6 +70,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
||||
VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices());
|
||||
if (vpcOff != null) {
|
||||
this.setEntityId(vpcOff.getId());
|
||||
this.setEntityUuid(vpcOff.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering");
|
||||
}
|
||||
@ -87,10 +88,6 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "vpc_offerings";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
|
||||
@ -87,9 +87,6 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "user_ip_address";
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
if (accountName != null) {
|
||||
@ -216,10 +213,11 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException{
|
||||
try {
|
||||
IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
|
||||
IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), false, getZoneId());
|
||||
|
||||
if (ip != null) {
|
||||
this.setEntityId(ip.getId());
|
||||
this.setEntityUuid(ip.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to allocate ip address");
|
||||
}
|
||||
|
||||
@ -62,10 +62,6 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
|
||||
private Long conditionDomainId;
|
||||
private Long conditionAccountId;
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "autoscale_policies";
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
@ -159,6 +155,7 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
|
||||
AutoScalePolicy result = _autoScaleService.createAutoScalePolicy(this);
|
||||
if (result != null) {
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create AutoScale Policy");
|
||||
}
|
||||
|
||||
@ -72,10 +72,6 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "autoscale_vmgroups";
|
||||
}
|
||||
|
||||
public int getMinMembers() {
|
||||
return minMembers;
|
||||
@ -161,6 +157,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
|
||||
AutoScaleVmGroup result = _autoScaleService.createAutoScaleVmGroup(this);
|
||||
if (result != null) {
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
|
||||
}
|
||||
|
||||
@ -86,10 +86,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
|
||||
private Long domainId;
|
||||
private Long accountId;
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "autoscale_vmprofiles";
|
||||
}
|
||||
|
||||
|
||||
public Long getDomainId() {
|
||||
if (domainId == null) {
|
||||
@ -232,6 +229,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
|
||||
AutoScaleVmProfile result = _autoScaleService.createAutoScaleVmProfile(this);
|
||||
if (result != null) {
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile");
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
|
||||
|
||||
if (condition != null) {
|
||||
this.setEntityId(condition.getId());
|
||||
this.setEntityUuid(condition.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create condition.");
|
||||
}
|
||||
@ -146,8 +147,5 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "conditions";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -80,9 +80,6 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "firewall_rules";
|
||||
}
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return ipAddressId;
|
||||
@ -242,6 +239,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
||||
try {
|
||||
FirewallRule result = _firewallService.createFirewallRule(this);
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException ex) {
|
||||
s_logger.info("Network rule conflict: " + ex.getMessage());
|
||||
s_logger.trace("Network Rule Conflict: ", ex);
|
||||
|
||||
@ -94,9 +94,6 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "firewall_rules";
|
||||
}
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return ipAddressId;
|
||||
@ -301,6 +298,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
|
||||
try {
|
||||
PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, getOpenFirewall());
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException ex) {
|
||||
s_logger.info("Network rule conflict: " , ex);
|
||||
s_logger.trace("Network Rule Conflict: ", ex);
|
||||
|
||||
@ -91,9 +91,7 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
|
||||
return paramList;
|
||||
}
|
||||
|
||||
public String getEntityTable() {
|
||||
return "firewall_rules";
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -141,6 +139,7 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
|
||||
try {
|
||||
StickinessPolicy result = _lbService.createLBStickinessPolicy(this);
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||
|
||||
@ -120,9 +120,6 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
||||
return privatePort;
|
||||
}
|
||||
|
||||
public String getEntityTable() {
|
||||
return "firewall_rules";
|
||||
}
|
||||
|
||||
public Long getSourceIpAddressId() {
|
||||
if (publicIpId != null) {
|
||||
@ -283,6 +280,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
||||
try {
|
||||
LoadBalancer result = _lbService.createLoadBalancerRule(this, getOpenFirewall());
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException e) {
|
||||
s_logger.warn("Exception: ", e);
|
||||
throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||
|
||||
@ -75,9 +75,6 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "firewall_rules";
|
||||
}
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return ipAddressId;
|
||||
@ -151,6 +148,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
|
||||
try {
|
||||
StaticNatRule rule = _rulesService.createStaticNatRule(this, getOpenFirewall());
|
||||
this.setEntityId(rule.getId());
|
||||
this.setEntityUuid(rule.getUuid());
|
||||
} catch (NetworkRuleConflictException e) {
|
||||
s_logger.info("Unable to create Static Nat Rule due to ", e);
|
||||
throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||
|
||||
@ -86,10 +86,6 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "firewall_rules";
|
||||
}
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return null;
|
||||
}
|
||||
@ -262,6 +258,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
try {
|
||||
FirewallRule result = _networkACLService.createNetworkACL(this);
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException ex) {
|
||||
s_logger.info("Network rule conflict: " + ex.getMessage());
|
||||
s_logger.trace("Network Rule Conflict: ", ex);
|
||||
|
||||
@ -56,9 +56,6 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "projects";
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
if (accountName != null) {
|
||||
@ -127,6 +124,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
|
||||
Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId());
|
||||
if (project != null) {
|
||||
this.setEntityId(project.getId());
|
||||
this.setEntityUuid(project.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
|
||||
}
|
||||
|
||||
@ -65,9 +65,6 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "snapshots";
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
@ -153,6 +150,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
||||
Snapshot snapshot = _snapshotService.allocSnapshot(getVolumeId(), getPolicyId());
|
||||
if (snapshot != null) {
|
||||
this.setEntityId(snapshot.getId());
|
||||
this.setEntityUuid(snapshot.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot");
|
||||
}
|
||||
|
||||
@ -102,9 +102,6 @@ import com.cloud.user.UserContext;
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "vm_template";
|
||||
}
|
||||
|
||||
public Integer getBits() {
|
||||
return bits;
|
||||
@ -240,13 +237,15 @@ import com.cloud.user.UserContext;
|
||||
public void create() throws ResourceAllocationException {
|
||||
if (isBareMetal()) {
|
||||
_bareMetalVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
|
||||
/*Baremetal creates template record after taking image proceeded, use vmId as entity id here*/
|
||||
/*Baremetal creates template record after taking image proceeded, use vmId as entity id and uuid here*/
|
||||
this.setEntityId(vmId);
|
||||
this.setEntityUuid(vmId.toString());
|
||||
} else {
|
||||
VirtualMachineTemplate template = null;
|
||||
template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
|
||||
if (template != null) {
|
||||
this.setEntityId(template.getId());
|
||||
this.setEntityUuid(template.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
|
||||
"Failed to create a template");
|
||||
|
||||
@ -147,10 +147,9 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
private List<String> securityGroupNameList;
|
||||
|
||||
@ACL(checkKeyAccess=true)
|
||||
@Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class,IpAddress.class},
|
||||
@Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class, IpAddress.class},
|
||||
description = "ip to network mapping. Can't be specified with networkIds parameter." +
|
||||
" Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=204 - requests to" +
|
||||
" use ip 10.10.10.11 in network id=204")
|
||||
" Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
|
||||
private Map ipToNetworkList;
|
||||
|
||||
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the ip address for default vm's network")
|
||||
@ -171,9 +170,6 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "vm_instance";
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
if (accountName == null) {
|
||||
@ -287,7 +283,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
Iterator iter = ipsCollection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
HashMap<String, String> ips = (HashMap<String, String>) iter.next();
|
||||
Long networkId = Long.valueOf(_responseGenerator.getIdentiyId("networks", ips.get("networkid")));
|
||||
Long networkId;
|
||||
Network network = _networkService.getNetwork(ips.get("networkid"));
|
||||
if (network != null) {
|
||||
networkId = network.getId();
|
||||
} else {
|
||||
try {
|
||||
networkId = Long.parseLong(ips.get("networkid"));
|
||||
} catch(NumberFormatException e) {
|
||||
throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid"));
|
||||
}
|
||||
}
|
||||
String requestedIp = (String) ips.get("ip");
|
||||
ipToNetworkMap.put(networkId, requestedIp);
|
||||
}
|
||||
@ -446,6 +452,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
||||
|
||||
if (vm != null) {
|
||||
setEntityId(vm.getId());
|
||||
setEntityUuid(vm.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
|
||||
}
|
||||
|
||||
@ -76,9 +76,6 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "volumes";
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
@ -154,6 +151,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
||||
Volume volume = _storageService.allocVolume(this);
|
||||
if (volume != null) {
|
||||
this.setEntityId(volume.getId());
|
||||
this.setEntityUuid(volume.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
|
||||
Volume vol = _entityMgr.findById(Volume.class, id);
|
||||
response.setId(vol.getUuid());
|
||||
response.setName(vol.getName());
|
||||
DataCenter zone = _entityMgr.findById(DataCenter.class, id);
|
||||
DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
|
||||
response.setZoneId(zone.getUuid());
|
||||
response.setZoneName(zone.getName());
|
||||
response.setMode(mode);
|
||||
|
||||
@ -67,6 +67,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{
|
||||
try {
|
||||
StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getCidr());
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException ex) {
|
||||
s_logger.info("Network rule conflict: " + ex.getMessage());
|
||||
s_logger.trace("Network rule conflict: ", ex);
|
||||
@ -74,10 +75,6 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "static_routes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
|
||||
@ -124,6 +124,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
|
||||
getCidr(), getNetworkDomain());
|
||||
if (vpc != null) {
|
||||
this.setEntityId(vpc.getId());
|
||||
this.setEntityUuid(vpc.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC");
|
||||
}
|
||||
@ -157,11 +158,6 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "vpc";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
|
||||
@ -103,9 +103,6 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public String getEntityTable() {
|
||||
return "vpn_users";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
@ -150,5 +147,6 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
|
||||
}
|
||||
setEntityId(vpnUser.getId());
|
||||
setEntityUuid(vpnUser.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,10 +62,6 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "user_ip_address";
|
||||
}
|
||||
|
||||
public Long getPublicIpId() {
|
||||
return publicIpId;
|
||||
}
|
||||
@ -146,6 +142,11 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
|
||||
RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall(), getNetworkId());
|
||||
if (vpn != null) {
|
||||
this.setEntityId(vpn.getServerAddressId());
|
||||
// find uuid for server ip address
|
||||
IpAddress ipAddr = _entityMgr.findById(IpAddress.class, vpn.getServerAddressId());
|
||||
if (ipAddr != null) {
|
||||
this.setEntityUuid(ipAddr.getUuid());
|
||||
}
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
|
||||
}
|
||||
|
||||
@ -51,9 +51,6 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_vpn_connection";
|
||||
}
|
||||
|
||||
public Long getVpnGatewayId() {
|
||||
return vpnGatewayId;
|
||||
@ -95,6 +92,7 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
|
||||
Site2SiteVpnConnection conn = _s2sVpnService.createVpnConnection(this);
|
||||
if (conn != null) {
|
||||
this.setEntityId(conn.getId());
|
||||
this.setEntityUuid(conn.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection");
|
||||
}
|
||||
|
||||
@ -78,9 +78,6 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_customer_gateway";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
@ -47,10 +47,6 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_vpn_gateway";
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
@ -44,9 +44,6 @@ public class DeleteVpnConnectionCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_vpn_connection";
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
||||
@ -43,9 +43,6 @@ public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_customer_gateway";
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
||||
@ -43,9 +43,6 @@ public class DeleteVpnGatewayCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_vpn_gateway";
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
||||
@ -53,9 +53,6 @@ public class ResetVpnConnectionCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_vpn_connection";
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
|
||||
@ -78,11 +78,7 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getEntityTable() {
|
||||
return "s2s_customer_gateway";
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@ -16,24 +16,16 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class CreateCmdResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID)
|
||||
private IdentityProxy id = new IdentityProxy();
|
||||
private String id;
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
}
|
||||
|
||||
public void setIdEntityTable(String entityTable) {
|
||||
this.id.setTableName(entityTable);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@ -29,7 +28,7 @@ public class S3Response extends BaseResponse {
|
||||
|
||||
@SerializedName(ID)
|
||||
@Param(description = "The ID of the S3 configuration")
|
||||
private IdentityProxy id = new IdentityProxy("s3");
|
||||
private String id;
|
||||
|
||||
@SerializedName(S3_ACCESS_KEY)
|
||||
@Param(description = "The S3 access key")
|
||||
@ -135,11 +134,11 @@ public class S3Response extends BaseResponse {
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.id.getValue().toString();
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setObjectId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setObjectId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAccessKey() {
|
||||
|
||||
@ -16,8 +16,9 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
from cloudutils.syscfg import sysConfigFactory
|
||||
from cloudutils.utilities import initLoging
|
||||
from cloudutils.utilities import initLoging, UnknownSystemException
|
||||
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
|
||||
from cloudutils.globalEnv import globalEnv
|
||||
from cloudutils.serviceConfigServer import cloudManagementConfig
|
||||
@ -35,7 +36,12 @@ if __name__ == '__main__':
|
||||
glbEnv.mode = "Server"
|
||||
|
||||
print "Starting to configure CloudStack Management Server:"
|
||||
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
|
||||
try:
|
||||
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
|
||||
except UnknownSystemException:
|
||||
print >>sys.stderr, ("Error: CloudStack failed to detect your "
|
||||
"operating system. Exiting.")
|
||||
sys.exit(1)
|
||||
try:
|
||||
syscfg.registerService(cloudManagementConfig)
|
||||
syscfg.config()
|
||||
|
||||
@ -1,23 +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.
|
||||
|
||||
# bitmap of permissions at the end of each classname, 1 = ADMIN, 2 =
|
||||
# RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
# Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
# CloudStack API Discovery service command
|
||||
listApis=15
|
||||
@ -1,25 +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.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
#### Cisco Nexus 1000v Virtual Supervisor Module (VSM) commands
|
||||
deleteCiscoNexusVSM=1
|
||||
enableCiscoNexusVSM=1
|
||||
disableCiscoNexusVSM=1
|
||||
listCiscoNexusVSMs=1
|
||||
@ -1,28 +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.
|
||||
|
||||
#### usage commands
|
||||
generateUsageRecords=com.cloud.api.commands.GenerateUsageRecordsCmd;1
|
||||
listUsageRecords=com.cloud.api.commands.GetUsageRecordsCmd;1
|
||||
listUsageTypes=com.cloud.api.commands.ListUsageTypesCmd;1
|
||||
|
||||
#### traffic monitor commands
|
||||
addTrafficMonitor=com.cloud.api.commands.AddTrafficMonitorCmd;1
|
||||
deleteTrafficMonitor=com.cloud.api.commands.DeleteTrafficMonitorCmd;1
|
||||
listTrafficMonitors=com.cloud.api.commands.ListTrafficMonitorsCmd;1
|
||||
|
||||
|
||||
@ -425,3 +425,87 @@ resetVpnConnection=15
|
||||
listVpnCustomerGateways=15
|
||||
listVpnGateways=15
|
||||
listVpnConnections=15
|
||||
|
||||
#### router commands
|
||||
createVirtualRouterElement=7
|
||||
configureVirtualRouterElement=7
|
||||
listVirtualRouterElements=7
|
||||
|
||||
#### usage commands
|
||||
generateUsageRecords=1
|
||||
listUsageRecords=1
|
||||
listUsageTypes=1
|
||||
|
||||
#### traffic monitor commands
|
||||
addTrafficMonitor=1
|
||||
deleteTrafficMonitor=1
|
||||
listTrafficMonitors=1
|
||||
|
||||
#### Cisco Nexus 1000v Virtual Supervisor Module (VSM) commands
|
||||
deleteCiscoNexusVSM=1
|
||||
enableCiscoNexusVSM=1
|
||||
disableCiscoNexusVSM=1
|
||||
listCiscoNexusVSMs=1
|
||||
|
||||
#### f5 big ip load balancer commands
|
||||
|
||||
#Deprecated commands
|
||||
addExternalLoadBalancer=1
|
||||
deleteExternalLoadBalancer=1
|
||||
listExternalLoadBalancers=1
|
||||
|
||||
addF5LoadBalancer=1
|
||||
configureF5LoadBalancer=1
|
||||
deleteF5LoadBalancer=1
|
||||
listF5LoadBalancers=1
|
||||
listF5LoadBalancerNetworks=1
|
||||
|
||||
#### juniper srx firewall commands
|
||||
addExternalFirewall=1
|
||||
deleteExternalFirewall=1
|
||||
listExternalFirewalls=1
|
||||
|
||||
addSrxFirewall=1
|
||||
deleteSrxFirewall=1
|
||||
configureSrxFirewall=1
|
||||
listSrxFirewalls=1
|
||||
listSrxFirewallNetworks=1
|
||||
|
||||
####Netapp integration commands
|
||||
createVolumeOnFiler=15
|
||||
destroyVolumeOnFiler=15
|
||||
listVolumesOnFiler=15
|
||||
createLunOnFiler=15
|
||||
destroyLunOnFiler=15
|
||||
listLunsOnFiler=15
|
||||
associateLun=15
|
||||
dissociateLun=15
|
||||
createPool=15
|
||||
deletePool=15
|
||||
modifyPool=15
|
||||
listPools=15
|
||||
|
||||
#### netscaler load balancer commands
|
||||
addNetscalerLoadBalancer=1
|
||||
deleteNetscalerLoadBalancer=1
|
||||
configureNetscalerLoadBalancer=1
|
||||
listNetscalerLoadBalancers=1
|
||||
listNetscalerLoadBalancerNetworks=1
|
||||
|
||||
#### nicira nvp commands
|
||||
|
||||
addNiciraNvpDevice=1
|
||||
deleteNiciraNvpDevice=1
|
||||
listNiciraNvpDevices=1
|
||||
listNiciraNvpDeviceNetworks=1
|
||||
|
||||
# Not implemented (yet)
|
||||
#configureNiciraNvpDevice=1
|
||||
|
||||
#### host simulator commands
|
||||
|
||||
configureSimulator=1
|
||||
|
||||
#### api discovery commands
|
||||
|
||||
listApis=15
|
||||
|
||||
@ -53,12 +53,9 @@ under the License.
|
||||
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
|
||||
<param name="premium">true</param>
|
||||
</dao>
|
||||
<adapters key="org.apache.cloudstack.acl.APIAccessChecker">
|
||||
<adapters key="org.apache.cloudstack.acl.APIChecker">
|
||||
<adapter name="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker"/>
|
||||
</adapters>
|
||||
<adapters key="org.apache.cloudstack.discovery.ApiDiscoveryService">
|
||||
<adapter name="ApiDiscoveryService" class="org.apache.cloudstack.discovery.ApiDiscoveryServiceImpl"/>
|
||||
</adapters>
|
||||
<adapters key="com.cloud.agent.manager.allocator.HostAllocator">
|
||||
<adapter name="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.FirstFitRoutingAllocator"/>
|
||||
<!--adapter name="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.RecreateHostAllocator"/-->
|
||||
|
||||
@ -1,32 +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.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
#### f5 big ip load balancer commands
|
||||
|
||||
#Deprecated commands
|
||||
addExternalLoadBalancer=1
|
||||
deleteExternalLoadBalancer=1
|
||||
listExternalLoadBalancers=1
|
||||
|
||||
addF5LoadBalancer=1
|
||||
configureF5LoadBalancer=1
|
||||
deleteF5LoadBalancer=1
|
||||
listF5LoadBalancers=1
|
||||
listF5LoadBalancerNetworks=1
|
||||
@ -1,30 +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.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
#### juniper srx firewall commands
|
||||
addExternalFirewall=1
|
||||
deleteExternalFirewall=1
|
||||
listExternalFirewalls=1
|
||||
|
||||
addSrxFirewall=1
|
||||
deleteSrxFirewall=1
|
||||
configureSrxFirewall=1
|
||||
listSrxFirewalls=1
|
||||
listSrxFirewallNetworks=1
|
||||
@ -1,33 +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.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
####Netapp integration commands
|
||||
createVolumeOnFiler=15
|
||||
destroyVolumeOnFiler=15
|
||||
listVolumesOnFiler=15
|
||||
createLunOnFiler=15
|
||||
destroyLunOnFiler=15
|
||||
listLunsOnFiler=15
|
||||
associateLun=15
|
||||
dissociateLun=15
|
||||
createPool=15
|
||||
deletePool=15
|
||||
modifyPool=15
|
||||
listPools=15
|
||||
@ -1,26 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
#### netscaler load balancer commands
|
||||
addNetscalerLoadBalancer=1
|
||||
deleteNetscalerLoadBalancer=1
|
||||
configureNetscalerLoadBalancer=1
|
||||
listNetscalerLoadBalancers=1
|
||||
listNetscalerLoadBalancerNetworks=1
|
||||
@ -1,29 +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.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
#### nicira nvp commands
|
||||
|
||||
addNiciraNvpDevice=1
|
||||
deleteNiciraNvpDevice=1
|
||||
listNiciraNvpDevices=1
|
||||
listNiciraNvpDeviceNetworks=1
|
||||
|
||||
# Not implemented (yet)
|
||||
#configureNiciraNvpDevice=1
|
||||
@ -1,19 +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.
|
||||
|
||||
|
||||
configureSimulator=1
|
||||
@ -1,24 +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.
|
||||
|
||||
### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
|
||||
### Please standardize naming conventions to camel-case (even for acronyms).
|
||||
|
||||
#### router commands
|
||||
createVirtualRouterElement=7
|
||||
configureVirtualRouterElement=7
|
||||
listVirtualRouterElements=7
|
||||
@ -29,7 +29,7 @@
|
||||
<orderedlist>
|
||||
<listitem><para>Log in to the &PRODUCT; UI as a user or admin.</para></listitem>
|
||||
<listitem><para>Click Instances, then click the name of a running VM.</para></listitem>
|
||||
<listitem><para>Click the View Console button <inlinegraphic format="PNG" fileref="images/icon.png"/>.</para></listitem>
|
||||
<listitem><para>Click the View Console button <inlinegraphic format="PNG" fileref="images/view-console-button.png"/>.</para></listitem>
|
||||
</orderedlist>
|
||||
<para>To access a VM directly over the network:</para>
|
||||
<orderedlist>
|
||||
|
||||
284
docs/en-US/autoscale.xml
Normal file
284
docs/en-US/autoscale.xml
Normal file
@ -0,0 +1,284 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
<section id="autoscale">
|
||||
<title>Configuring AutoScale</title>
|
||||
<para>AutoScaling allows you to scale your back-end services or application VMs up or down
|
||||
seamlessly and automatically according to the conditions you define. With AutoScaling enabled,
|
||||
you can ensure that the number of VMs you are using seamlessly scale up when demand increases,
|
||||
and automatically decreases when demand subsides. Thus it helps you save compute costs by
|
||||
terminating underused VMs automatically and launching new VMs when you need them, without the
|
||||
need for manual intervention.</para>
|
||||
<para>NetScaler AutoScaling is designed to seamlessly launch or terminate VMs based on
|
||||
user-defined conditions. Conditions for triggering a scaleup or scaledown action can vary from a
|
||||
simple use case like monitoring the CPU usage of a server to a complex use case of monitoring a
|
||||
combination of server's responsiveness and its CPU usage. For example, you can configure
|
||||
AutoScaling to launch an additional VM whenever CPU usage exceeds 80 percent for 15 minutes, or
|
||||
to remove a VM whenever CPU usage is less than 20 percent for 30 minutes.</para>
|
||||
<para>&PRODUCT; uses the NetScaler load balancer to monitor all aspects of a system's health and
|
||||
work in unison with &PRODUCT; to initiate scale-up or scale-down actions. The supported
|
||||
NetScaler version is 10.0.</para>
|
||||
<formalpara>
|
||||
<title>Prerequisites</title>
|
||||
<para>Before you configure an AutoScale rule, consider the following:</para>
|
||||
</formalpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Ensure that the necessary template is prepared before configuring AutoScale. When a VM
|
||||
is deployed by using a template and when it comes up, the application should be up and
|
||||
running.</para>
|
||||
<note>
|
||||
<para>If the application is not running, the NetScaler device considers the VM as
|
||||
ineffective and continues provisioning the VMs unconditionally until the resource limit is
|
||||
exhausted.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Deploy the templates you prepared. Ensure that the applications come up on the first
|
||||
boot and is ready to take the traffic. Observe the time requires to deploy the template.
|
||||
Consider this time when you specify the quiet time while configuring AutoScale.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>The AutoScale feature supports the SNMP counters that can be used to define conditions
|
||||
for taking scale up or scale down actions. To monitor the SNMP-based counter, ensure that
|
||||
the SNMP agent is installed in the template used for creating the AutoScale VMs, and the
|
||||
SNMP operations work with the configured SNMP community and port by using standard SNMP
|
||||
managers. For example, see <xref linkend="configure-snmp-rhel"/> to configure SNMP on a RHEL
|
||||
machine.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Ensure that the endpointe.url parameter present in the Global Settings is set to the
|
||||
Management Server API URL. For example, http://10.102.102.22:8080/client/api. In a
|
||||
multi-node Management Server deployment, use the virtual IP address configured in the load
|
||||
balancer for the management server’s cluster. Additionally, ensure that the NetScaler device
|
||||
has access to this IP address to provide AutoScale support.</para>
|
||||
<para>If you update the endpointe.url, disable the AutoScale functionality of the load
|
||||
balancer rules in the system, then enable them back to reflect the changes. For more
|
||||
information see <xref linkend="update-autoscale"/></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If the API Key and Secret Key are regenerated for an AutoScale user, ensure that the
|
||||
AutoScale functionality of the load balancers that the user participates in are disabled and
|
||||
then enabled to reflect the configuration changes in the NetScaler.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In an advanced Zone, ensure that at least one VM should be present before configuring a
|
||||
load balancer rule with AutoScale. Having one VM in the network ensures that the network is
|
||||
in implemented state for configuring AutoScale.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<formalpara>
|
||||
<title>Configuration</title>
|
||||
<para>Specify the following:</para>
|
||||
</formalpara>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/autoscale-config.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>autoscaleateconfig.png: Configuring AutoScale</phrase>
|
||||
</textobject>
|
||||
</mediaobject>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Template</emphasis>: A template consists of a base OS image and
|
||||
application. A template is used to provision the new instance of an application on a scaleup
|
||||
action. When a VM is deployed from a template, the VM can start taking the traffic from the
|
||||
load balancer without any admin intervention. For example, if the VM is deployed for a Web
|
||||
service, it should have the Web server running, the database connected, and so on.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Compute offering</emphasis>: A predefined set of virtual hardware
|
||||
attributes, including CPU speed, number of CPUs, and RAM size, that the user can select when
|
||||
creating a new virtual machine instance. Choose one of the compute offerings to be used
|
||||
while provisioning a VM instance as part of scaleup action.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Min Instance</emphasis>: The minimum number of active VM instances
|
||||
that is assigned to a load balancing rule. The active VM instances are the application
|
||||
instances that are up and serving the traffic, and are being load balanced. This parameter
|
||||
ensures that a load balancing rule has at least the configured number of active VM instances
|
||||
are available to serve the traffic.</para>
|
||||
<note>
|
||||
<para>If an application, such as SAP, running on a VM instance is down for some reason, the
|
||||
VM is then not counted as part of Min Instance parameter, and the AutoScale feature
|
||||
initiates a scaleup action if the number of active VM instances is below the configured
|
||||
value. Similarly, when an application instance comes up from its earlier down state, this
|
||||
application instance is counted as part of the active instance count and the AutoScale
|
||||
process initiates a scaledown action when the active instance count breaches the Max
|
||||
instance value.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Max Instance</emphasis>: Maximum number of active VM instances
|
||||
that <emphasis role="bold">should be assigned to </emphasis>a load balancing rule. This
|
||||
parameter defines the upper limit of active VM instances that can be assigned to a load
|
||||
balancing rule.</para>
|
||||
<para>Specifying a large value for the maximum instance parameter might result in provisioning
|
||||
large number of VM instances, which in turn leads to a single load balancing rule exhausting
|
||||
the VM instances limit specified at the account or domain level.</para>
|
||||
<note>
|
||||
<para>If an application, such as SAP, running on a VM instance is down for some reason, the
|
||||
VM is not counted as part of Max Instance parameter. So there may be scenarios where the
|
||||
number of VMs provisioned for a scaleup action might be more than the configured Max
|
||||
Instance value. Once the application instances in the VMs are up from an earlier down
|
||||
state, the AutoScale feature starts aligning to the configured Max Instance value.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>Specify the following scale-up and scale-down policies:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Duration</emphasis>: The duration, in seconds, for which the
|
||||
conditions you specify must be true to trigger a scaleup action. The conditions defined
|
||||
should hold true for the entire duration you specify for an AutoScale action to be invoked.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Counter</emphasis>: The performance counters expose the state of
|
||||
the monitored instances. By default, &PRODUCT; offers four performance counters: Three SNMP
|
||||
counters and one NetScaler counter. The SNMP counters are Linux User CPU, Linux System CPU,
|
||||
and Linux CPU Idle. The NetScaler counter is ResponseTime. The root administrator can add
|
||||
additional counters into &PRODUCT; by using the &PRODUCT; API. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Operator</emphasis>: The following five relational operators are
|
||||
supported in AutoScale feature: Greater than, Less than, Less than or equal to, Greater than
|
||||
or equal to, and Equal to.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Threshold</emphasis>: Threshold value to be used for the counter.
|
||||
Once the counter defined above breaches the threshold value, the AutoScale feature initiates
|
||||
a scaleup or scaledown action.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Add</emphasis>: Click Add to add the condition.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>Additionally, if you want to configure the advanced settings, click Show advanced settings,
|
||||
and specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Polling interval</emphasis>: Frequency in which the conditions,
|
||||
combination of counter, operator and threshold, are to be evaluated before taking a scale up
|
||||
or down action. The default polling interval is 30 seconds.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Quiet Time</emphasis>: This is the cool down period after an
|
||||
AutoScale action is initiated. The time includes the time taken to complete provisioning a
|
||||
VM instance from its template and the time taken by an application to be ready to serve
|
||||
traffic. This quiet time allows the fleet to come up to a stable state before any action can
|
||||
take place. The default is 300 seconds.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Destroy VM Grace Period</emphasis>: The duration in seconds, after
|
||||
a scaledown action is initiated, to wait before the VM is destroyed as part of scaledown
|
||||
action. This is to ensure graceful close of any pending sessions or transactions being
|
||||
served by the VM marked for destroy. The default is 120 seconds.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Security Groups</emphasis>: Security groups provide a way to
|
||||
isolate traffic to the VM instances. A security group is a group of VMs that filter their
|
||||
incoming and outgoing traffic according to a set of rules, called ingress and egress rules.
|
||||
These rules filter network traffic according to the IP address that is attempting to
|
||||
communicate with the VM.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Disk Offerings</emphasis>: A predefined set of disk size for
|
||||
primary data storage. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">SNMP Community</emphasis>: The SNMP community string to be used by
|
||||
the NetScaler device to query the configured counter value from the provisioned VM
|
||||
instances. Default is public.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">SNMP Port</emphasis>: The port number on which the SNMP agent that
|
||||
run on the provisioned VMs is listening. Default port is 161. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">User</emphasis>: This is the user that the NetScaler device use to
|
||||
invoke scaleup and scaledown API calls to the cloud. If no option is specified, the user who
|
||||
configures AutoScaling is applied. Specify another user name to override.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Apply</emphasis>: Click Apply to create the AutoScale
|
||||
configuration.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<formalpara>
|
||||
<title>Disabling and Enabling an AutoScale Configuration</title>
|
||||
<para>If you want to perform any maintenance operation on the AutoScale VM instances, disable
|
||||
the AutoScale configuration. When the AutoScale configuration is disabled, no scaleup or
|
||||
scaledown action is performed. You can use this downtime for the maintenance activities. To
|
||||
disable the AutoScale configuration, click the Disable AutoScale<inlinemediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/enable-disable-autoscale.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>EnableDisable.png: button to enable or disable AutoScale.</phrase>
|
||||
</textobject>
|
||||
</inlinemediaobject>button.</para>
|
||||
</formalpara>
|
||||
<para>The button toggles between enable and disable, depending on whether AutoScale is currently
|
||||
enabled or not. After the maintenance operations are done, you can enable the AutoScale
|
||||
configuration back. To enable, open the AutoScale configuration page again, then click the
|
||||
Enable AutoScale<inlinemediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/enable-disable-autoscale.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>EnableDisable.png: button to enable or disable AutoScale.</phrase>
|
||||
</textobject>
|
||||
</inlinemediaobject>button.</para>
|
||||
<formalpara id="update-autoscale">
|
||||
<title>Updating an AutoScale Configuration</title>
|
||||
<para>You can update the various parameters and add or delete the conditions in a scaleup or
|
||||
scaledown rule. Before you update an AutoScale configuration, ensure that you disable the
|
||||
AutoScale load balancer rule by clicking the Disable AutoScale button.</para>
|
||||
</formalpara>
|
||||
<para>After you modify the required AutoScale parameters, click Apply. To apply the new AutoScale
|
||||
policies, open the AutoScale configuration page again, then click the Enable AutoScale
|
||||
button.</para>
|
||||
<formalpara>
|
||||
<title>Runtime Considerations</title>
|
||||
<para/>
|
||||
</formalpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>An administrator should not assign a VM to a load balancing rule which is configured for
|
||||
AutoScale.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Before a VM provisioning is completed if NetScaler is shutdown or restarted, the
|
||||
provisioned VM cannot be a part of the load balancing rule though the intent was to assign
|
||||
it to a load balancing rule. To workaround, rename the AutoScale provisioned VMs based on
|
||||
the rule name or ID so at any point of time the VMs can be reconciled to its load balancing
|
||||
rule.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Making API calls outside the context of AutoScale, such as destroyVM, on an autoscaled
|
||||
VM leaves the load balancing configuration in an inconsistent state. Though VM is destroyed
|
||||
from the load balancer rule, NetScaler continues to show the VM as a service assigned to a
|
||||
rule.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
46
docs/en-US/building-marvin.xml
Normal file
46
docs/en-US/building-marvin.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<section id="building-marvin">
|
||||
<title>Building and Installing Marvin</title>
|
||||
<para>Marvin is built with Maven and is dependent on APIdoc. To build it do the following in the root tree of &PRODUCT;:</para>
|
||||
<programlisting>mvn -P developer -l :cloud-apidoc</programlisting>
|
||||
<programlisting>mvn -P developer -l :cloud-marvin</programlisting>
|
||||
<para>If successfull the build will have created the cloudstackAPI Python package under tools/marvin/marvin/cloudstackAPI as well as a gziped Marvin package under tools/marvin dist. To install the Python Marvin module do the following in tools/marvin:</para>
|
||||
<programlisting>sudo python ./setup.py install</programlisting>
|
||||
<para>The dependencies will be downloaded the Python module installed and you should be able to use Marvin in Python. Check that you can import the module before starting to use it.</para>
|
||||
<programlisting>$ python
|
||||
Python 2.7.3 (default, Nov 17 2012, 19:54:34)
|
||||
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import marvin
|
||||
>>> from marvin.cloudstackAPI import *
|
||||
>>> </programlisting>
|
||||
|
||||
<para>You could also install it using <emphasis>pip</emphasis> or <emphasis>easy_install</emphasis> using the local distribution package in tools/marvin/dist :</para>
|
||||
<programlisting>pip install tools/marvin/dist/Marvin-0.1.0.tar.gz</programlisting>
|
||||
<para>Or:</para>
|
||||
<programlisting>easy_install tools/marvin/dist/Marvin-0.1.0.tar.gz</programlisting>
|
||||
|
||||
</section>
|
||||
86
docs/en-US/configure-snmp-rhel.xml
Normal file
86
docs/en-US/configure-snmp-rhel.xml
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<!-- 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.
|
||||
-->
|
||||
<section id="configure-snmp-rhel">
|
||||
<title>Configuring SNMP Community String on a RHEL Server</title>
|
||||
<para>The SNMP Community string is similar to a user id or password that provides access to a
|
||||
network device, such as router. This string is sent along with all SNMP requests. If the
|
||||
community string is correct, the device responds with the requested information. If the
|
||||
community string is incorrect, the device discards the request and does not respond.</para>
|
||||
<para>The NetScaler device uses SNMP to communicate with the VMs. You must install SNMP and
|
||||
configure SNMP Community string for a secure communication between the NetScaler device and the
|
||||
RHEL machine.</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Ensure that you installed SNMP on RedHat. If not, run the following command:</para>
|
||||
<screen>yum install net-snmp-utils</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Edit the /etc/snmp/snmpd.conf file to allow the SNMP polling from the NetScaler
|
||||
device.</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Map the community name into a security name (local and mynetwork, depending on where
|
||||
the request is coming from):</para>
|
||||
<note>
|
||||
<para>Use a strong password instead of public when you edit the following table.</para>
|
||||
</note>
|
||||
<screen># sec.name source community
|
||||
com2sec local localhost public
|
||||
com2sec mynetwork 0.0.0.0 public</screen>
|
||||
<note>
|
||||
<para>Setting to 0.0.0.0 allows all IPs to poll the NetScaler server.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Map the security names into group names: </para>
|
||||
<screen># group.name sec.model sec.name
|
||||
group MyRWGroup v1 local
|
||||
group MyRWGroup v2c local
|
||||
group MyROGroup v1 mynetwork
|
||||
group MyROGroup v2c mynetwork</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Create a view to allow the groups to have the permission to:</para>
|
||||
<screen>incl/excl subtree mask view all included .1 </screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Grant access with different write permissions to the two groups to the view you
|
||||
created.</para>
|
||||
<screen># context sec.model sec.level prefix read write notif
|
||||
access MyROGroup "" any noauth exact all none none
|
||||
access MyRWGroup "" any noauth exact all all all </screen>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Unblock SNMP in iptables.</para>
|
||||
<screen>iptables -A INPUT -p udp --dport 161 -j ACCEPT</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Start the SNMP service:</para>
|
||||
<screen>service snmpd start</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Ensure that the SNMP service is started automatically during the system startup:</para>
|
||||
<screen>chkconfig snmpd on</screen>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
@ -3,26 +3,31 @@
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
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.
|
||||
-->
|
||||
|
||||
<section id="external-firewalls-and-load-balancers">
|
||||
<title>External Firewalls and Load Balancers</title>
|
||||
<para>&PRODUCT; is capable of replacing its Virtual Router with an external Juniper SRX device and an optional external NetScaler or F5 load balancer for gateway and load balancing services. In this case, the VMs use the SRX as their gateway.</para>
|
||||
<title>External Firewalls and Load Balancers</title>
|
||||
<para>&PRODUCT; is capable of replacing its Virtual Router with an external Juniper SRX device and
|
||||
an optional external NetScaler or F5 load balancer for gateway and load balancing services. In
|
||||
this case, the VMs use the SRX as their gateway.</para>
|
||||
<xi:include href="using-netscaler-load-balancers.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="configure-snmp-rhel.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="initial-setup-of-external-firewalls-loadbalancers.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="ongoing-configuration-of-external-firewalls-loadbalancer.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="autoscale.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
</section>
|
||||
|
||||
BIN
docs/en-US/images/view-console-button.png
Normal file
BIN
docs/en-US/images/view-console-button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
@ -29,4 +29,5 @@
|
||||
<para>Marvin's complete documenation is on the wiki at <ulink url="https://cwiki.apache.org/CLOUDSTACK/testing-with-python.html">https://cwiki.apache.org/CLOUDSTACK/testing-with-python.html</ulink></para>
|
||||
<para>The source code is located at <emphasis>tools/marvin</emphasis></para>
|
||||
</note>
|
||||
<xi:include href="building-marvin.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</section>
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<!-- 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.
|
||||
-->
|
||||
<section id="ongoing-configuration-of-external-firewalls-loadbalancer">
|
||||
<title>Ongoing Configuration of External Firewalls and Load Balancers</title>
|
||||
<para>Additional user actions (e.g. setting a port forward) will cause further programming of the
|
||||
firewall and load balancer. A user may request additional public IP addresses and forward
|
||||
traffic received at these IPs to specific VMs. This is accomplished by enabling static NAT for a
|
||||
public IP address, assigning the IP to a VM, and specifying a set of protocols and port ranges
|
||||
to open. When a static NAT rule is created, &PRODUCT; programs the zone's external firewall with
|
||||
the following objects:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>A static NAT rule that maps the public IP address to the private IP address of a
|
||||
VM.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A security policy that allows traffic within the set of protocols and port ranges that
|
||||
are specified.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A firewall filter counter that measures the number of bytes of incoming traffic to the
|
||||
public IP.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The number of incoming and outgoing bytes through source NAT, static NAT, and load balancing
|
||||
rules is measured and saved on each external element. This data is collected on a regular basis
|
||||
and stored in the &PRODUCT; database.</para>
|
||||
</section>
|
||||
@ -26,4 +26,5 @@
|
||||
<title>System Service Offerings</title>
|
||||
<para>System service offerings provide a choice of CPU speed, number of CPUs, tags, and RAM size, just as other service offerings do. But rather than being used for virtual machine instances and exposed to users, system service offerings are used to change the default properties of virtual routers, console proxies, and other system VMs. System service offerings are visible only to the &PRODUCT; root administrator. &PRODUCT; provides default system service offerings. The &PRODUCT; root administrator can create additional custom system service offerings.</para>
|
||||
<para>When &PRODUCT; creates a virtual router for a guest network, it uses default settings which are defined in the system service offering associated with the network offering. You can upgrade the capabilities of the virtual router by applying a new network offering that contains a different system service offering. All virtual routers in that network will begin using the settings from the new service offering.</para>
|
||||
<xi:include href="creating-system-service-offerings.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</section>
|
||||
|
||||
@ -16,93 +16,56 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.acl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.acl.APIAccessChecker;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.AccountService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
||||
/*
|
||||
* This is the default API access checker that grab's the user's account
|
||||
* based on the account type, access is granted referring to commands in all *.properties files.
|
||||
*/
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Local(value=APIAccessChecker.class)
|
||||
public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIAccessChecker {
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
// This is the default API access checker that grab's the user's account
|
||||
// based on the account type, access is granted
|
||||
@Local(value = APIChecker.class)
|
||||
public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
|
||||
|
||||
protected static final Logger s_logger = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class);
|
||||
public static final short ADMIN_COMMAND = 1;
|
||||
public static final short DOMAIN_ADMIN_COMMAND = 4;
|
||||
public static final short RESOURCE_DOMAIN_ADMIN_COMMAND = 2;
|
||||
public static final short USER_COMMAND = 8;
|
||||
private static List<String> s_userCommands = null;
|
||||
private static List<String> s_resellerCommands = null; // AKA domain-admin
|
||||
private static List<String> s_adminCommands = null;
|
||||
private static List<String> s_resourceDomainAdminCommands = null;
|
||||
private static List<String> s_allCommands = null;
|
||||
|
||||
protected @Inject AccountManager _accountMgr;
|
||||
private static Map<RoleType, Set<String>> s_roleBasedApisMap =
|
||||
new HashMap<RoleType, Set<String>>();
|
||||
|
||||
private static AccountService s_accountService;
|
||||
|
||||
protected StaticRoleBasedAPIAccessChecker() {
|
||||
super();
|
||||
s_allCommands = new ArrayList<String>();
|
||||
s_userCommands = new ArrayList<String>();
|
||||
s_resellerCommands = new ArrayList<String>();
|
||||
s_adminCommands = new ArrayList<String>();
|
||||
s_resourceDomainAdminCommands = new ArrayList<String>();
|
||||
for (RoleType roleType : RoleType.values())
|
||||
s_roleBasedApisMap.put(roleType, new HashSet<String>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccessAPI(User user, String apiCommandName)
|
||||
throws PermissionDeniedException{
|
||||
|
||||
boolean commandExists = s_allCommands.contains(apiCommandName);
|
||||
|
||||
if(commandExists && user != null){
|
||||
Long accountId = user.getAccountId();
|
||||
Account userAccount = _accountMgr.getAccount(accountId);
|
||||
short accountType = userAccount.getType();
|
||||
return isCommandAvailableForAccount(accountType, apiCommandName);
|
||||
public boolean checkAccess(User user, String commandName)
|
||||
throws PermissionDeniedException {
|
||||
Account account = s_accountService.getAccount(user.getAccountId());
|
||||
if (account == null) {
|
||||
throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
|
||||
}
|
||||
|
||||
return commandExists;
|
||||
}
|
||||
|
||||
private static boolean isCommandAvailableForAccount(short accountType, String commandName) {
|
||||
boolean isCommandAvailable = false;
|
||||
switch (accountType) {
|
||||
case Account.ACCOUNT_TYPE_ADMIN:
|
||||
isCommandAvailable = s_adminCommands.contains(commandName);
|
||||
break;
|
||||
case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
|
||||
isCommandAvailable = s_resellerCommands.contains(commandName);
|
||||
break;
|
||||
case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
|
||||
isCommandAvailable = s_resourceDomainAdminCommands.contains(commandName);
|
||||
break;
|
||||
case Account.ACCOUNT_TYPE_NORMAL:
|
||||
isCommandAvailable = s_userCommands.contains(commandName);
|
||||
break;
|
||||
RoleType roleType = s_accountService.getRoleType(account);
|
||||
boolean isAllowed = s_roleBasedApisMap.get(roleType).contains(commandName);
|
||||
if (!isAllowed) {
|
||||
throw new PermissionDeniedException("The API does not exist or is blacklisted. Role type=" + roleType.toString() + " is not allowed to request the api: " + commandName);
|
||||
}
|
||||
return isCommandAvailable;
|
||||
return isAllowed;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -111,72 +74,27 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
|
||||
|
||||
// Read command properties files to build the static map per role.
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
|
||||
List<PluggableService> services = locator.getAllPluggableServices();
|
||||
services.add((PluggableService) ComponentLocator.getComponent(ManagementServer.Name));
|
||||
s_accountService = locator.getManager(AccountService.class);
|
||||
|
||||
List<String> configFiles = new ArrayList<String>();
|
||||
for (PluggableService service : services) {
|
||||
configFiles.addAll(Arrays.asList(service.getPropertiesFiles()));
|
||||
}
|
||||
processMapping(PropertiesUtil.processConfigFile(new String[]
|
||||
{"commands.properties"}));
|
||||
|
||||
processConfigFiles(configFiles);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void processConfigFiles(List<String> configFiles) {
|
||||
Properties preProcessedCommands = new Properties();
|
||||
|
||||
for (String configFile : configFiles) {
|
||||
File commandsFile = PropertiesUtil.findConfigFile(configFile);
|
||||
if (commandsFile != null) {
|
||||
try {
|
||||
preProcessedCommands.load(new FileInputStream(commandsFile));
|
||||
} catch (FileNotFoundException fnfex) {
|
||||
// in case of a file within a jar in classpath, try to open stream using url
|
||||
InputStream stream = PropertiesUtil.openStreamFromURL(configFile);
|
||||
if (stream != null) {
|
||||
try {
|
||||
preProcessedCommands.load(stream);
|
||||
} catch (IOException e) {
|
||||
s_logger.error("IO Exception, unable to find properties file:", fnfex);
|
||||
}
|
||||
} else {
|
||||
s_logger.error("Unable to find properites file", fnfex);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
s_logger.error("IO Exception loading properties file", ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Object key : preProcessedCommands.keySet()) {
|
||||
String preProcessedCommand = preProcessedCommands.getProperty((String) key);
|
||||
int splitIndex = preProcessedCommand.lastIndexOf(";");
|
||||
// Backward compatible to old style, apiname=pkg;mask
|
||||
String mask = preProcessedCommand.substring(splitIndex+1);
|
||||
|
||||
private void processMapping(Map<String, String> configMap) {
|
||||
for (Map.Entry<String, String> entry : configMap.entrySet()) {
|
||||
String apiName = entry.getKey();
|
||||
String roleMask = entry.getValue();
|
||||
try {
|
||||
short cmdPermissions = Short.parseShort(mask);
|
||||
if ((cmdPermissions & ADMIN_COMMAND) != 0) {
|
||||
s_adminCommands.add((String) key);
|
||||
short cmdPermissions = Short.parseShort(roleMask);
|
||||
for (RoleType roleType : RoleType.values()) {
|
||||
if ((cmdPermissions & roleType.getValue()) != 0)
|
||||
s_roleBasedApisMap.get(roleType).add(apiName);
|
||||
}
|
||||
if ((cmdPermissions & RESOURCE_DOMAIN_ADMIN_COMMAND) != 0) {
|
||||
s_resourceDomainAdminCommands.add((String) key);
|
||||
}
|
||||
if ((cmdPermissions & DOMAIN_ADMIN_COMMAND) != 0) {
|
||||
s_resellerCommands.add((String) key);
|
||||
}
|
||||
if ((cmdPermissions & USER_COMMAND) != 0) {
|
||||
s_userCommands.add((String) key);
|
||||
}
|
||||
s_allCommands.addAll(s_adminCommands);
|
||||
s_allCommands.addAll(s_resourceDomainAdminCommands);
|
||||
s_allCommands.addAll(s_userCommands);
|
||||
s_allCommands.addAll(s_resellerCommands);
|
||||
} catch (NumberFormatException nfe) {
|
||||
s_logger.info("Malformed command.properties permissions value, key = " + key + ", value = " + preProcessedCommand);
|
||||
s_logger.info("Malformed key=value pair for entry: " + entry.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,9 +16,12 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.discovery;
|
||||
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.PlugService;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
@ -27,8 +30,8 @@ import org.apache.cloudstack.api.response.ApiDiscoveryResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by Api Discovery plugin", since = "4.1.0")
|
||||
public class ListApisCmd extends BaseListCmd {
|
||||
@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by the Api Discovery plugin", since = "4.1.0")
|
||||
public class ListApisCmd extends BaseCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName());
|
||||
private static final String s_name = "listapisresponse";
|
||||
@ -36,12 +39,16 @@ public class ListApisCmd extends BaseListCmd {
|
||||
@PlugService
|
||||
ApiDiscoveryService _apiDiscoveryService;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="API name")
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public void execute() throws ServerApiException {
|
||||
if (_apiDiscoveryService != null) {
|
||||
ListResponse<ApiDiscoveryResponse> response = (ListResponse<ApiDiscoveryResponse>) _apiDiscoveryService.listApis();
|
||||
User user = UserContext.current().getCallerUser();
|
||||
ListResponse<ApiDiscoveryResponse> response = (ListResponse<ApiDiscoveryResponse>) _apiDiscoveryService.listApis(user, name);
|
||||
if (response == null) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find and process any apis");
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis");
|
||||
}
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
@ -52,4 +59,10 @@ public class ListApisCmd extends BaseListCmd {
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
// no owner is needed for list command
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,18 +16,15 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@EntityReference(value = Account.class)
|
||||
public class ApiDiscoveryResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the api command")
|
||||
private String name;
|
||||
@ -41,11 +38,18 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.IS_ASYNC) @Param(description="true if api is asynchronous")
|
||||
private Boolean isAsync;
|
||||
|
||||
@SerializedName("related") @Param(description="comma separated related apis")
|
||||
private String related;
|
||||
|
||||
@SerializedName(ApiConstants.PARAMS) @Param(description="the list params the api accepts", responseObject = ApiParameterResponse.class)
|
||||
private Set<ApiParameterResponse> params;
|
||||
|
||||
@SerializedName(ApiConstants.RESPONSE) @Param(description="api response fields", responseObject = ApiResponseResponse.class)
|
||||
private Set<ApiResponseResponse> apiResponse;
|
||||
|
||||
public ApiDiscoveryResponse(){
|
||||
params = new HashSet<ApiParameterResponse>();
|
||||
apiResponse = new HashSet<ApiResponseResponse>();
|
||||
isAsync = false;
|
||||
}
|
||||
|
||||
@ -65,6 +69,18 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
||||
this.isAsync = isAsync;
|
||||
}
|
||||
|
||||
public String getRelated() {
|
||||
return related;
|
||||
}
|
||||
|
||||
public void setRelated(String related) {
|
||||
this.related = related;
|
||||
}
|
||||
|
||||
public Set<ApiParameterResponse> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Set<ApiParameterResponse> params) {
|
||||
this.params = params;
|
||||
}
|
||||
@ -72,4 +88,8 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
||||
public void addParam(ApiParameterResponse param) {
|
||||
this.params.add(param);
|
||||
}
|
||||
|
||||
public void addApiResponse(ApiResponseResponse apiResponse) {
|
||||
this.apiResponse.add(apiResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@ public class ApiParameterResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.SINCE) @Param(description="version of CloudStack the api was introduced in")
|
||||
private String since;
|
||||
|
||||
@SerializedName("related") @Param(description="comma separated related apis to get the parameter")
|
||||
private String related;
|
||||
|
||||
public ApiParameterResponse(){
|
||||
}
|
||||
|
||||
@ -67,4 +70,12 @@ public class ApiParameterResponse extends BaseResponse {
|
||||
this.since = since;
|
||||
}
|
||||
|
||||
public String getRelated() {
|
||||
return related;
|
||||
}
|
||||
|
||||
public void setRelated(String related) {
|
||||
this.related = related;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
// 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.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class ApiResponseResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the api response field")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION) @Param(description="description of the api response field")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.TYPE) @Param(description="response field type")
|
||||
private String type;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@ -16,14 +16,11 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.discovery;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ApiDiscoveryService extends Adapter, PluggableService {
|
||||
ListResponse<? extends BaseResponse> listApis();
|
||||
Map<String, Class<?>> getApiNameCmdClassMapping();
|
||||
public interface ApiDiscoveryService extends PluggableService {
|
||||
ListResponse<? extends BaseResponse> listApis(User user, String apiName);
|
||||
}
|
||||
@ -16,64 +16,63 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.discovery;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.ReflectUtil;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.acl.APIChecker;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.command.user.discovery.ListApisCmd;
|
||||
import org.apache.cloudstack.api.response.ApiDiscoveryResponse;
|
||||
import org.apache.cloudstack.api.response.ApiParameterResponse;
|
||||
import org.apache.cloudstack.api.response.ApiResponseResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Local(value = ApiDiscoveryService.class)
|
||||
public class ApiDiscoveryServiceImpl extends AdapterBase implements ApiDiscoveryService {
|
||||
|
||||
public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
|
||||
private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class);
|
||||
private Map<String, Class<?>> _apiNameCmdClassMap;
|
||||
private ListResponse<ApiDiscoveryResponse> _discoveryResponse;
|
||||
|
||||
protected static Adapters<APIChecker> s_apiAccessCheckers = null;
|
||||
private static Map<String, ApiDiscoveryResponse> s_apiNameDiscoveryResponseMap = null;
|
||||
|
||||
protected ApiDiscoveryServiceImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
private void generateApiNameCmdClassMapping() {
|
||||
_apiNameCmdClassMap = new HashMap<String, Class<?>>();
|
||||
Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class, new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
|
||||
|
||||
for(Class<?> cmdClass: cmdClasses) {
|
||||
String apiName = cmdClass.getAnnotation(APICommand.class).name();
|
||||
if (_apiNameCmdClassMap.containsKey(apiName)) {
|
||||
s_logger.error("API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName);
|
||||
continue;
|
||||
}
|
||||
_apiNameCmdClassMap.put(apiName, cmdClass);
|
||||
if (s_apiNameDiscoveryResponseMap == null) {
|
||||
long startTime = System.nanoTime();
|
||||
s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
|
||||
cacheResponseMap();
|
||||
long endTime = System.nanoTime();
|
||||
s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");
|
||||
}
|
||||
}
|
||||
|
||||
private void precacheListApiResponse() {
|
||||
private void cacheResponseMap() {
|
||||
Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class,
|
||||
new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
|
||||
|
||||
if(_apiNameCmdClassMap == null)
|
||||
return;
|
||||
//TODO: Fix and use PluggableService to get the classes
|
||||
|
||||
_discoveryResponse = new ListResponse<ApiDiscoveryResponse>();
|
||||
Map<String, List<String>> responseApiNameListMap = new HashMap<String, List<String>>();
|
||||
|
||||
List<ApiDiscoveryResponse> apiDiscoveryResponses = new ArrayList<ApiDiscoveryResponse>();
|
||||
|
||||
for(String key: _apiNameCmdClassMap.keySet()) {
|
||||
Class<?> cmdClass = _apiNameCmdClassMap.get(key);
|
||||
for (Class<?> cmdClass : cmdClasses) {
|
||||
APICommand apiCmdAnnotation = cmdClass.getAnnotation(APICommand.class);
|
||||
if (apiCmdAnnotation == null)
|
||||
apiCmdAnnotation = cmdClass.getSuperclass().getAnnotation(APICommand.class);
|
||||
@ -82,20 +81,43 @@ public class ApiDiscoveryServiceImpl extends AdapterBase implements ApiDiscovery
|
||||
|| apiCmdAnnotation.name().isEmpty())
|
||||
continue;
|
||||
|
||||
String apiName = apiCmdAnnotation.name();
|
||||
String responseName = apiCmdAnnotation.responseObject().getName();
|
||||
if (!responseName.contains("SuccessResponse")) {
|
||||
if (!responseApiNameListMap.containsKey(responseName))
|
||||
responseApiNameListMap.put(responseName, new ArrayList<String>());
|
||||
responseApiNameListMap.get(responseName).add(apiName);
|
||||
}
|
||||
ApiDiscoveryResponse response = new ApiDiscoveryResponse();
|
||||
response.setName(apiCmdAnnotation.name());
|
||||
response.setName(apiName);
|
||||
response.setDescription(apiCmdAnnotation.description());
|
||||
response.setSince(apiCmdAnnotation.since());
|
||||
if (!apiCmdAnnotation.since().isEmpty())
|
||||
response.setSince(apiCmdAnnotation.since());
|
||||
response.setRelated(responseName);
|
||||
|
||||
Field[] responseFields = apiCmdAnnotation.responseObject().getDeclaredFields();
|
||||
for (Field responseField : responseFields) {
|
||||
SerializedName serializedName = responseField.getAnnotation(SerializedName.class);
|
||||
if (serializedName != null) {
|
||||
ApiResponseResponse responseResponse = new ApiResponseResponse();
|
||||
responseResponse.setName(serializedName.value());
|
||||
Param param = responseField.getAnnotation(Param.class);
|
||||
if (param != null)
|
||||
responseResponse.setDescription(param.description());
|
||||
responseResponse.setType(responseField.getType().getSimpleName().toLowerCase());
|
||||
response.addApiResponse(responseResponse);
|
||||
}
|
||||
}
|
||||
|
||||
Field[] fields = ReflectUtil.getAllFieldsForClass(cmdClass,
|
||||
new Class<?>[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
|
||||
new Class<?>[]{BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
|
||||
|
||||
boolean isAsync = ReflectUtil.isCmdClassAsync(cmdClass,
|
||||
new Class<?>[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
|
||||
new Class<?>[]{BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
|
||||
|
||||
response.setAsync(isAsync);
|
||||
|
||||
for(Field field: fields) {
|
||||
for (Field field : fields) {
|
||||
Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
|
||||
if (parameterAnnotation != null
|
||||
&& parameterAnnotation.expose()
|
||||
@ -104,41 +126,92 @@ public class ApiDiscoveryServiceImpl extends AdapterBase implements ApiDiscovery
|
||||
ApiParameterResponse paramResponse = new ApiParameterResponse();
|
||||
paramResponse.setName(parameterAnnotation.name());
|
||||
paramResponse.setDescription(parameterAnnotation.description());
|
||||
paramResponse.setType(parameterAnnotation.type().toString());
|
||||
paramResponse.setType(parameterAnnotation.type().toString().toLowerCase());
|
||||
paramResponse.setLength(parameterAnnotation.length());
|
||||
paramResponse.setRequired(parameterAnnotation.required());
|
||||
paramResponse.setSince(parameterAnnotation.since());
|
||||
if (!parameterAnnotation.since().isEmpty())
|
||||
paramResponse.setSince(parameterAnnotation.since());
|
||||
paramResponse.setRelated(parameterAnnotation.entityType()[0].getName());
|
||||
response.addParam(paramResponse);
|
||||
}
|
||||
}
|
||||
response.setObjectName("apis");
|
||||
apiDiscoveryResponses.add(response);
|
||||
response.setObjectName("api");
|
||||
s_apiNameDiscoveryResponseMap.put(apiName, response);
|
||||
}
|
||||
|
||||
for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) {
|
||||
ApiDiscoveryResponse response = s_apiNameDiscoveryResponseMap.get(apiName);
|
||||
Set<ApiParameterResponse> processedParams = new HashSet<ApiParameterResponse>();
|
||||
for (ApiParameterResponse param : response.getParams()) {
|
||||
if (responseApiNameListMap.containsKey(param.getRelated())) {
|
||||
List<String> relatedApis = responseApiNameListMap.get(param.getRelated());
|
||||
param.setRelated(StringUtils.join(relatedApis, ","));
|
||||
} else {
|
||||
param.setRelated(null);
|
||||
}
|
||||
processedParams.add(param);
|
||||
}
|
||||
response.setParams(processedParams);
|
||||
|
||||
if (responseApiNameListMap.containsKey(response.getRelated())) {
|
||||
List<String> relatedApis = responseApiNameListMap.get(response.getRelated());
|
||||
relatedApis.remove(apiName);
|
||||
response.setRelated(StringUtils.join(relatedApis, ","));
|
||||
} else {
|
||||
response.setRelated(null);
|
||||
}
|
||||
s_apiNameDiscoveryResponseMap.put(apiName, response);
|
||||
}
|
||||
_discoveryResponse.setResponses(apiDiscoveryResponses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
public ListResponse<? extends BaseResponse> listApis(User user, String name) {
|
||||
ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>();
|
||||
List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>();
|
||||
|
||||
generateApiNameCmdClassMapping();
|
||||
precacheListApiResponse();
|
||||
if (s_apiAccessCheckers == null) {
|
||||
ComponentLocator locator = ComponentLocator.getCurrentLocator();
|
||||
s_apiAccessCheckers = locator.getAdapters(APIChecker.class);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if (user == null)
|
||||
return null;
|
||||
|
||||
public Map<String, Class<?>> getApiNameCmdClassMapping() {
|
||||
return _apiNameCmdClassMap;
|
||||
if (name != null) {
|
||||
if (!s_apiNameDiscoveryResponseMap.containsKey(name))
|
||||
return null;
|
||||
|
||||
for (APIChecker apiChecker : s_apiAccessCheckers) {
|
||||
try {
|
||||
apiChecker.checkAccess(user, name);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
responseList.add(s_apiNameDiscoveryResponseMap.get(name));
|
||||
|
||||
} else {
|
||||
for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) {
|
||||
boolean isAllowed = true;
|
||||
for (APIChecker apiChecker : s_apiAccessCheckers) {
|
||||
try {
|
||||
apiChecker.checkAccess(user, apiName);
|
||||
} catch (Exception ex) {
|
||||
isAllowed = false;
|
||||
}
|
||||
}
|
||||
if (isAllowed)
|
||||
responseList.add(s_apiNameDiscoveryResponseMap.get(apiName));
|
||||
}
|
||||
}
|
||||
response.setResponses(responseList);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListResponse<? extends BaseResponse> listApis() {
|
||||
return _discoveryResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "api-discovery_commands.properties" };
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(ListApisCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,6 +91,8 @@ public class KVMGuestOsMapper {
|
||||
s_mapper.put("Fedora 10", "Fedora 10");
|
||||
s_mapper.put("Fedora 9", "Fedora 9");
|
||||
s_mapper.put("Fedora 8", "Fedora 8");
|
||||
s_mapper.put("Ubuntu 12.04 (32-bit)", "Ubuntu 12.04");
|
||||
s_mapper.put("Ubuntu 12.04 (64-bit)", "Ubuntu 12.04");
|
||||
s_mapper.put("Ubuntu 10.04 (32-bit)", "Ubuntu 10.04");
|
||||
s_mapper.put("Ubuntu 10.04 (64-bit)", "Ubuntu 10.04");
|
||||
s_mapper.put("Ubuntu 10.10 (32-bit)", "Ubuntu 10.10");
|
||||
|
||||
@ -2978,9 +2978,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
|
||||
NicTO[] nics = vmSpec.getNics();
|
||||
for (NicTO nic : nics) {
|
||||
if (nic.getIsolationUri() != null
|
||||
&& nic.getIsolationUri().getScheme()
|
||||
.equalsIgnoreCase(IsolationType.Ec2.toString())) {
|
||||
if (nic.isSecurityGroupEnabled() || ( nic.getIsolationUri() != null
|
||||
&& nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) {
|
||||
if (vmSpec.getType() != VirtualMachine.Type.User) {
|
||||
default_network_rules_for_systemvm(conn, vmName);
|
||||
break;
|
||||
|
||||
@ -17,16 +17,17 @@
|
||||
package com.cloud.server;
|
||||
|
||||
|
||||
import com.cloud.api.commands.ConfigureSimulator;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ManagementServerSimulatorImpl extends ManagementServerExtImpl {
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
String[] apis = super.getPropertiesFiles();
|
||||
String[] newapis = new String[apis.length + 1];
|
||||
for (int i = 0; i < apis.length; i++) {
|
||||
newapis[i] = apis[i];
|
||||
}
|
||||
|
||||
newapis[apis.length] = "commands-simulator.properties";
|
||||
return newapis;
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = super.getCommands();
|
||||
cmdList.add(ConfigureSimulator.class);
|
||||
return cmdList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
package com.cloud.simulator;
|
||||
|
||||
import com.cloud.utils.SerialVersionUID;
|
||||
import com.cloud.utils.exception.RuntimeCloudException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
/**
|
||||
* wrap exceptions that you know there's no point in dealing with.
|
||||
*/
|
||||
public class SimulatorRuntimeException extends RuntimeCloudException {
|
||||
public class SimulatorRuntimeException extends CloudRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.Class;
|
||||
import java.lang.String;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
@ -24,6 +26,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
|
||||
@ -237,7 +240,12 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "cisconexusvsm_commands.properties" };
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(ListCiscoNexusVSMsCmd.class);
|
||||
cmdList.add(EnableCiscoNexusVSMCmd.class);
|
||||
cmdList.add(DisableCiscoNexusVSMCmd.class);
|
||||
cmdList.add(DeleteCiscoNexusVSMCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1328,7 +1328,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
NicTO[] nics = vmSpec.getNics();
|
||||
boolean secGrpEnabled = false;
|
||||
for (NicTO nic : nics) {
|
||||
if (nic.getIsolationUri() != null && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
|
||||
if (nic.isSecurityGroupEnabled() || (nic.getIsolationUri() != null
|
||||
&& nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) {
|
||||
secGrpEnabled = true;
|
||||
break;
|
||||
}
|
||||
@ -1346,7 +1347,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
//For user vm, program the rules for each nic if the isolation uri scheme is ec2
|
||||
NicTO[] nics = vmSpec.getNics();
|
||||
for (NicTO nic : nics) {
|
||||
if (nic.getIsolationUri() != null && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
|
||||
if ( nic.isSecurityGroupEnabled() || nic.getIsolationUri() != null
|
||||
&& nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
|
||||
result = callHostPlugin(conn, "vmops", "default_network_rules", "vmName", vmName, "vmIP", nic.getIp(), "vmMAC", nic.getMac(), "vmID", Long.toString(vmSpec.getId()));
|
||||
|
||||
if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) {
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
// under the License.
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.Class;
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -24,6 +26,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -119,7 +122,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
ConfigurationDao _configDao;
|
||||
|
||||
private boolean canHandle(Network config) {
|
||||
if ((config.getGuestType() != Network.GuestType.Isolated && config.getGuestType() != Network.GuestType.Shared) || config.getTrafficType() != TrafficType.Guest) {
|
||||
if (config.getGuestType() != Network.GuestType.Isolated || config.getTrafficType() != TrafficType.Guest) {
|
||||
s_logger.trace("Not handling network with Type " + config.getGuestType() + " and traffic type " + config.getTrafficType());
|
||||
return false;
|
||||
}
|
||||
@ -260,8 +263,17 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "f5bigip_commands.properties" };
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(AddExternalLoadBalancerCmd.class);
|
||||
cmdList.add(AddF5LoadBalancerCmd.class);
|
||||
cmdList.add(ConfigureF5LoadBalancerCmd.class);
|
||||
cmdList.add(DeleteExternalLoadBalancerCmd.class);
|
||||
cmdList.add(DeleteF5LoadBalancerCmd.class);
|
||||
cmdList.add(ListExternalLoadBalancersCmd.class);
|
||||
cmdList.add(ListF5LoadBalancerNetworksCmd.class);
|
||||
cmdList.add(ListF5LoadBalancersCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -24,6 +25,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -128,8 +130,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
|
||||
private boolean canHandle(Network network, Service service) {
|
||||
DataCenter zone = _configMgr.getZone(network.getDataCenterId());
|
||||
if ((zone.getNetworkType() == NetworkType.Advanced && !(network.getGuestType() == Network.GuestType.Isolated || network.getGuestType() == Network.GuestType.Shared ))
|
||||
|| (zone.getNetworkType() == NetworkType.Basic && network.getGuestType() != Network.GuestType.Shared)) {
|
||||
if ((zone.getNetworkType() == NetworkType.Advanced && network.getGuestType() != Network.GuestType.Isolated) || (zone.getNetworkType() == NetworkType.Basic && network.getGuestType() != Network.GuestType.Shared)) {
|
||||
s_logger.trace("Element " + getProvider().getName() + "is not handling network type = " + network.getGuestType());
|
||||
return false;
|
||||
}
|
||||
@ -402,8 +403,17 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "junipersrx_commands.properties"};
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(AddExternalFirewallCmd.class);
|
||||
cmdList.add(AddSrxFirewallCmd.class);
|
||||
cmdList.add(ConfigureSrxFirewallCmd.class);
|
||||
cmdList.add(DeleteExternalFirewallCmd.class);
|
||||
cmdList.add(DeleteSrxFirewallCmd.class);
|
||||
cmdList.add(ListExternalFirewallsCmd.class);
|
||||
cmdList.add(ListSrxFirewallNetworksCmd.class);
|
||||
cmdList.add(ListSrxFirewallsCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -38,15 +38,10 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.lang.Class;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* User: tomoe
|
||||
* Date: 8/8/12
|
||||
* Time: 1:38 PM
|
||||
*/
|
||||
|
||||
@Local(value = NetworkElement.class)
|
||||
public class MidokuraMidonetElement extends AdapterBase implements ConnectivityProvider, PluggableService {
|
||||
private static final Logger s_logger = Logger.getLogger(MidokuraMidonetElement.class);
|
||||
@ -126,7 +121,7 @@ public class MidokuraMidonetElement extends AdapterBase implements ConnectivityP
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertiesFile() {
|
||||
public List<Class<?>> getCommands() {
|
||||
// TODO: implement this.
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.Class;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -26,6 +27,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -152,8 +154,7 @@ StaticNatServiceProvider {
|
||||
|
||||
private boolean canHandle(Network config, Service service) {
|
||||
DataCenter zone = _dcDao.findById(config.getDataCenterId());
|
||||
boolean handleInAdvanceZone = (zone.getNetworkType() == NetworkType.Advanced &&
|
||||
(config.getGuestType() == Network.GuestType.Isolated || config.getGuestType() == Network.GuestType.Shared) && config.getTrafficType() == TrafficType.Guest);
|
||||
boolean handleInAdvanceZone = (zone.getNetworkType() == NetworkType.Advanced && config.getGuestType() == Network.GuestType.Isolated && config.getTrafficType() == TrafficType.Guest);
|
||||
boolean handleInBasicZone = (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() == Network.GuestType.Shared && config.getTrafficType() == TrafficType.Guest);
|
||||
|
||||
if (!(handleInAdvanceZone || handleInBasicZone)) {
|
||||
@ -464,8 +465,14 @@ StaticNatServiceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "netscalerloadbalancer_commands.properties" };
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(AddNetscalerLoadBalancerCmd.class);
|
||||
cmdList.add(ConfigureNetscalerLoadBalancerCmd.class);
|
||||
cmdList.add(DeleteNetscalerLoadBalancerCmd.class);
|
||||
cmdList.add(ListNetscalerLoadBalancerNetworksCmd.class);
|
||||
cmdList.add(ListNetscalerLoadBalancersCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -27,6 +27,7 @@ import java.util.UUID;
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -540,8 +541,13 @@ public class NiciraNvpElement extends AdapterBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "nicira-nvp_commands.properties" };
|
||||
public List<Class<?>> getCommands() {
|
||||
List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(AddNiciraNvpDeviceCmd.class);
|
||||
cmdList.add(DeleteNiciraNvpDeviceCmd.class);
|
||||
cmdList.add(ListNiciraNvpDeviceNetworksCmd.class);
|
||||
cmdList.add(ListNiciraNvpDevicesCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
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