mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
Initial checkin for VPC feature:
1) Added API frameworks for the feature. New commands: * CreateVPCCmd * ListVPCsCmd * DeleteVPCCmd * UpdateVPCCmd * CreateVPCOfferingCmd * UpdateVPCOfferingCmd * DeleteVPCOfferingCmd * ListVPCOfferingsCmd 2) New db tables: * `cloud`.`vpc` * `cloud`.`vpc_offerings` * `cloud`.`vpc_offering_service_map` and corresponding VO/Dao objects. Added vpc_id field to `cloud.`networks` table - not null when network belongs to VPC 3) New Manager and Service interfaces- VpcManager/VpcService 4) Automatically create new VpcOffering (if doesn't exist) on system start 5) New Action events: * VPC.CREATE * VPC.UPDATE * VPC.DELETE * VPC.OFFERING.CREATE * VPC.OFFERING.UPDATE * VPC.OFFERING.DELETE Conflicts: api/src/com/cloud/api/ApiConstants.java client/tomcatconf/commands.properties.in server/src/com/cloud/api/ApiDBUtils.java server/src/com/cloud/network/NetworkManagerImpl.java setup/db/create-schema.sql
This commit is contained in:
parent
f3e598a033
commit
60b52f90dd
@ -357,6 +357,8 @@ public class ApiConstants {
|
||||
public static final String VSM_CONFIG_STATE = "vsmconfigstate";
|
||||
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
|
||||
public static final String ADD_VSM_FLAG = "addvsmflag";
|
||||
public static final String VPC_OFF_ID = "vpcofferingid";
|
||||
public static final String NETWORK = "network";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
||||
@ -44,6 +44,7 @@ import com.cloud.network.firewall.FirewallService;
|
||||
import com.cloud.network.lb.LoadBalancingRulesService;
|
||||
import com.cloud.network.rules.RulesService;
|
||||
import com.cloud.network.security.SecurityGroupService;
|
||||
import com.cloud.network.vpc.VpcService;
|
||||
import com.cloud.network.vpn.RemoteAccessVpnService;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.ProjectService;
|
||||
@ -128,6 +129,7 @@ public abstract class BaseCmd {
|
||||
public static ResourceLimitService _resourceLimitService;
|
||||
public static IdentityService _identityService;
|
||||
public static StorageNetworkService _storageNetworkService;
|
||||
public static VpcService _vpcService;
|
||||
|
||||
static void setComponents(ResponseGenerator generator) {
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
@ -155,6 +157,7 @@ public abstract class BaseCmd {
|
||||
_resourceLimitService = locator.getManager(ResourceLimitService.class);
|
||||
_identityService = locator.getManager(IdentityService.class);
|
||||
_storageNetworkService = locator.getManager(StorageNetworkService.class);
|
||||
_vpcService = locator.getManager(VpcService.class);
|
||||
}
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
||||
|
||||
@ -74,6 +74,8 @@ import com.cloud.api.response.UserVmResponse;
|
||||
import com.cloud.api.response.VirtualRouterProviderResponse;
|
||||
import com.cloud.api.response.VlanIpRangeResponse;
|
||||
import com.cloud.api.response.VolumeResponse;
|
||||
import com.cloud.api.response.VpcOfferingResponse;
|
||||
import com.cloud.api.response.VpcResponse;
|
||||
import com.cloud.api.response.VpnUsersResponse;
|
||||
import com.cloud.api.response.ZoneResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
@ -107,6 +109,8 @@ import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityGroupRules;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
@ -280,4 +284,16 @@ public interface ResponseGenerator {
|
||||
* @return
|
||||
*/
|
||||
Long getIdentiyId(String tableName, String token);
|
||||
|
||||
/**
|
||||
* @param offering
|
||||
* @return
|
||||
*/
|
||||
VpcOfferingResponse createVpcOfferingResponse(VpcOffering offering);
|
||||
|
||||
/**
|
||||
* @param vpc
|
||||
* @return
|
||||
*/
|
||||
VpcResponse createVpcResponse(Vpc vpc);
|
||||
}
|
||||
|
||||
155
api/src/com/cloud/api/commands/CreateVPCCmd.java
Normal file
155
api/src/com/cloud/api/commands/CreateVPCCmd.java
Normal file
@ -0,0 +1,155 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCreateCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VpcResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class CreateVPCCmd extends BaseAsyncCreateCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(CreateVPCCmd.class.getName());
|
||||
private static final String s_name = "createvpcresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the VPC. " +
|
||||
"Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
@IdentityMapper(entityTableName="domain")
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the VPC. " +
|
||||
"If used with the account parameter returns the VPC associated with the account for the specified domain.")
|
||||
private Long domainId;
|
||||
|
||||
@IdentityMapper(entityTableName="data_center")
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the availability zone")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the VPC")
|
||||
private String vpcName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of " +
|
||||
"the VPC")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.CIDR, type=CommandType.STRING, required=true, description="the cidr of the VPC. All VPC " +
|
||||
"guest networks' cidrs should be within this CIDR")
|
||||
private String cidr;
|
||||
|
||||
|
||||
@IdentityMapper(entityTableName="vpc_offerings")
|
||||
@Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.LONG, required=true, description="the ID of the VPC offering")
|
||||
private Long vpcOffering;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getVpcName() {
|
||||
return vpcName;
|
||||
}
|
||||
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public Long getVpcOffering() {
|
||||
return vpcOffering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
Vpc vpc = _vpcService.createVpc(getZoneId(), getVpcOffering(), getEntityOwnerId(), getVpcName(), getDisplayText(), getCidr());
|
||||
if (vpc != null) {
|
||||
this.setEntityId(vpc.getId());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
//TODO - prepare vpc here (call start() method, it should start the VR, associate source nat ip address, etc)
|
||||
Vpc vpc = _vpcService.getVpc(this.getEntityId());
|
||||
if (vpc != null) {
|
||||
VpcResponse response = _responseGenerator.createVpcResponse(vpc);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "vpc";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VPC_CREATE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "creating VPC. Id: " + getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = finalyzeAccountId(accountName, domainId, null, true);
|
||||
if (accountId == null) {
|
||||
return UserContext.current().getCaller().getId();
|
||||
}
|
||||
|
||||
return accountId;
|
||||
}
|
||||
}
|
||||
116
api/src/com/cloud/api/commands/CreateVPCOfferingCmd.java
Normal file
116
api/src/com/cloud/api/commands/CreateVPCOfferingCmd.java
Normal file
@ -0,0 +1,116 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCreateCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VpcOfferingResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(CreateVPCOfferingCmd.class.getName());
|
||||
private static final String _name = "createvpcofferingresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the vpc offering")
|
||||
private String vpcOfferingName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of " +
|
||||
"the vpc offering")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, required=true, collectionType=CommandType.STRING,
|
||||
description="services supported by the vpc offering")
|
||||
private List<String> supportedServices;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getVpcOfferingName() {
|
||||
return vpcOfferingName;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public List<String> getSupportedServices() {
|
||||
return supportedServices;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices());
|
||||
if (vpcOff != null) {
|
||||
this.setEntityId(vpcOff.getId());
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
VpcOffering vpc = _vpcService.getVpcOffering(this.getEntityId());
|
||||
if (vpc != null) {
|
||||
VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(vpc);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC offering");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTable() {
|
||||
return "vpc_offerings";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VPC_OFFERING_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "creating VPC offering. Id: " + getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
}
|
||||
93
api/src/com/cloud/api/commands/DeleteVPCCmd.java
Normal file
93
api/src/com/cloud/api/commands/DeleteVPCCmd.java
Normal file
@ -0,0 +1,93 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class DeleteVPCCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteVPCCmd.class.getName());
|
||||
private static final String s_name = "deletevpcresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vpc")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the VPC")
|
||||
private Long id;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VPC_DELETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Deleting VPC id=" + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
boolean result = _vpcService.deleteVpc(getId());
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Vpc vpc = _entityMgr.findById(Vpc.class, getId());
|
||||
if (vpc != null) {
|
||||
return vpc.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
}
|
||||
89
api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
Normal file
89
api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
Normal file
@ -0,0 +1,89 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteVPCOfferingCmd.class.getName());
|
||||
private static final String s_name = "deletevpcofferingresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vpc_offerings")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the VPC offering")
|
||||
private Long id;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
boolean result = _vpcService.deleteVpcOffering(getId());
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC offering");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType(){
|
||||
return EventTypes.EVENT_VPC_OFFERING_DELETE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Deleting VPC offering id=" + getId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
113
api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
Normal file
113
api/src/com/cloud/api/commands/ListVPCOfferingsCmd.java
Normal file
@ -0,0 +1,113 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseListCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.VpcOfferingResponse;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class ListVPCOfferingsCmd extends BaseListCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(ListVPCOfferingsCmd.class.getName());
|
||||
private static final String _name = "listvpcofferingsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@IdentityMapper(entityTableName="vpc_offerings")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC offerings by id")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list VPC offerings by name")
|
||||
private String vpcOffName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list VPC offerings by display text")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if need to list only default " +
|
||||
"VPC offerings. Default value is false")
|
||||
private Boolean isDefault;
|
||||
|
||||
@Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
|
||||
description="list VPC offerings supporting certain services")
|
||||
private List<String> supportedServices;
|
||||
|
||||
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list VPC offerings by state")
|
||||
private String state;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getVpcOffName() {
|
||||
return vpcOffName;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public Boolean getIsDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public List<String> getSupportedServices() {
|
||||
return supportedServices;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
List<? extends VpcOffering> offerings = _vpcService.listVpcOfferings(getId(), getVpcOffName(), getDisplayText(),
|
||||
getSupportedServices(), isDefault, this.getKeyword(), getState(), this.getStartIndex(), this.getPageSizeVal());
|
||||
ListResponse<VpcOfferingResponse> response = new ListResponse<VpcOfferingResponse>();
|
||||
List<VpcOfferingResponse> offeringResponses = new ArrayList<VpcOfferingResponse>();
|
||||
for (VpcOffering offering : offerings) {
|
||||
VpcOfferingResponse offeringResponse = _responseGenerator.createVpcOfferingResponse(offering);
|
||||
offeringResponses.add(offeringResponse);
|
||||
}
|
||||
|
||||
response.setResponses(offeringResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
}
|
||||
148
api/src/com/cloud/api/commands/ListVPCsCmd.java
Normal file
148
api/src/com/cloud/api/commands/ListVPCsCmd.java
Normal file
@ -0,0 +1,148 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseListAccountResourcesCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
import com.cloud.api.response.VpcResponse;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class ListVPCsCmd extends BaseListAccountResourcesCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(ListVPCsCmd.class.getName());
|
||||
private static final String s_name = "listvpcsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@IdentityMapper(entityTableName="vpc")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list VPC by id")
|
||||
private Long id;
|
||||
|
||||
@IdentityMapper(entityTableName="data_center")
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list by zone")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list by name of the VPC")
|
||||
private String vpcName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="List by display text of " +
|
||||
"the VPC")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.CIDR, type=CommandType.STRING, description="list by cidr of the VPC. All VPC " +
|
||||
"guest networks' cidrs should be within this CIDR")
|
||||
private String cidr;
|
||||
|
||||
@IdentityMapper(entityTableName="vpc_offerings")
|
||||
@Parameter(name=ApiConstants.VPC_OFF_ID, type=CommandType.LONG, description="list by ID of the VPC offering")
|
||||
private Long VpcOffId;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list by account associated with the VPC. " +
|
||||
"Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
@IdentityMapper(entityTableName="domain")
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="list by domain ID associated with the VPC. " +
|
||||
"If used with the account parameter returns the VPC associated with the account for the specified domain.")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
|
||||
description="list VPC supporting certain services")
|
||||
private List<String> supportedServices;
|
||||
|
||||
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list VPCs by state")
|
||||
private String state;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getVpcName() {
|
||||
return vpcName;
|
||||
}
|
||||
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public Long getVpcOffId() {
|
||||
return VpcOffId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<String> getSupportedServices() {
|
||||
return supportedServices;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
List<? extends Vpc> vpcs = _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(),
|
||||
getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(),
|
||||
this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getZoneId(), this.isRecursive(), this.listAll());
|
||||
ListResponse<VpcResponse> response = new ListResponse<VpcResponse>();
|
||||
List<VpcResponse> offeringResponses = new ArrayList<VpcResponse>();
|
||||
for (Vpc vpc : vpcs) {
|
||||
VpcResponse offeringResponse = _responseGenerator.createVpcResponse(vpc);
|
||||
offeringResponses.add(offeringResponse);
|
||||
}
|
||||
|
||||
response.setResponses(offeringResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
}
|
||||
106
api/src/com/cloud/api/commands/UpdateVPCCmd.java
Normal file
106
api/src/com/cloud/api/commands/UpdateVPCCmd.java
Normal file
@ -0,0 +1,106 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VpcResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class UpdateVPCCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateVPCCmd.class.getName());
|
||||
private static final String _name = "updatevpcresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vpc")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC")
|
||||
private String vpcName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the VPC")
|
||||
private String displayText;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getVpcName() {
|
||||
return vpcName;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Vpc vpc = _entityMgr.findById(Vpc.class, getId());
|
||||
if (vpc != null) {
|
||||
return vpc.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText());
|
||||
if (result != null) {
|
||||
VpcResponse response = _responseGenerator.createVpcResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VPC_UPDATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Updating VPC id=" + getId();
|
||||
}
|
||||
}
|
||||
107
api/src/com/cloud/api/commands/UpdateVPCOfferingCmd.java
Normal file
107
api/src/com/cloud/api/commands/UpdateVPCOfferingCmd.java
Normal file
@ -0,0 +1,107 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.VpcOfferingResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateVPCOfferingCmd.class.getName());
|
||||
private static final String _name = "updatevpcofferingresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vpc_offerings")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC offering")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC offering")
|
||||
private String vpcOffName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the VPC offering")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the VPC offering")
|
||||
private String state;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getVpcOfferingName() {
|
||||
return vpcOffName;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
VpcOffering result = _vpcService.updateVpcOffering(getId(), getVpcOfferingName(), getDisplayText(), getState());
|
||||
if (result != null) {
|
||||
VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC offering");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VPC_OFFERING_UPDATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Updating VPC offering id=" + getId();
|
||||
}
|
||||
}
|
||||
77
api/src/com/cloud/api/response/VpcOfferingResponse.java
Normal file
77
api/src/com/cloud/api/response/VpcOfferingResponse.java
Normal file
@ -0,0 +1,77 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.response;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class VpcOfferingResponse extends BaseResponse{
|
||||
@SerializedName("id") @Param(description="the id of the vpc offering")
|
||||
private final IdentityProxy id = new IdentityProxy("vpc_offerings");
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the vpc offering")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_TEXT) @Param(description="an alternate display text of the vpc offering.")
|
||||
private String displayText;
|
||||
|
||||
@SerializedName(ApiConstants.CREATED) @Param(description="the date this vpc offering was created")
|
||||
private Date created;
|
||||
|
||||
@SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if vpc offering is default, false otherwise")
|
||||
private Boolean isDefault;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="state of the vpc offering. Can be Disabled/Enabled")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.SERVICE) @Param(description="the list of supported services", responseObject = ServiceResponse.class)
|
||||
private List<ServiceResponse> services;
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDisplayText(String displayText) {
|
||||
this.displayText = displayText;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public void setIsDefault(Boolean isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
public void setServices(List<ServiceResponse> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
143
api/src/com/cloud/api/response/VpcResponse.java
Normal file
143
api/src/com/cloud/api/response/VpcResponse.java
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.response;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class VpcResponse extends BaseResponse implements ControlledEntityResponse{
|
||||
@SerializedName("id") @Param(description="the id of the VPC")
|
||||
private final IdentityProxy id = new IdentityProxy("vpc");
|
||||
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the VPC")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.DISPLAY_TEXT) @Param(description="an alternate display text of the VPC.")
|
||||
private String displayText;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="state of the VPC. Can be Disabled/Enabled")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id of the vpc")
|
||||
private IdentityProxy zoneId = new IdentityProxy("data_center");
|
||||
|
||||
@SerializedName(ApiConstants.SERVICE) @Param(description="the list of supported services", responseObject = ServiceResponse.class)
|
||||
private List<ServiceResponse> services;
|
||||
|
||||
@SerializedName(ApiConstants.CIDR) @Param(description="the cidr the VPC")
|
||||
private String cidr;
|
||||
|
||||
@SerializedName(ApiConstants.VPC_OFF_ID) @Param(description="vpc offering id the VPC is created from")
|
||||
private IdentityProxy vpcOfferingId = new IdentityProxy("vpc_offerings");
|
||||
|
||||
@SerializedName(ApiConstants.CREATED) @Param(description="the date this VPC was created")
|
||||
private Date created;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the VPC")
|
||||
private String accountName;
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the VPC")
|
||||
private IdentityProxy projectId = new IdentityProxy("projects");
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the VPC")
|
||||
private String projectName;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the VPC owner")
|
||||
private IdentityProxy domainId = new IdentityProxy("domain");
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the owner")
|
||||
private String domain;
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK) @Param(description="the list of networks belongign to the VPC", responseObject = NetworkResponse.class)
|
||||
private List<NetworkResponse> networks;
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDisplayText(String displayText) {
|
||||
this.displayText = displayText;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public void setServices(List<ServiceResponse> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectId(Long projectId) {
|
||||
this.projectId.setValue(projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDomainId(Long domainId) {
|
||||
this.domainId.setValue(domainId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDomainName(String domainName) {
|
||||
this.domain = domainName;
|
||||
}
|
||||
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId.setValue(zoneId);
|
||||
}
|
||||
|
||||
public void setCidr(String cidr) {
|
||||
this.cidr = cidr;
|
||||
}
|
||||
|
||||
public void setVpcOfferingId(Long vpcOfferingId) {
|
||||
this.vpcOfferingId.setValue(vpcOfferingId);
|
||||
}
|
||||
|
||||
public List<NetworkResponse> getNetworks() {
|
||||
return networks;
|
||||
}
|
||||
|
||||
public void setNetworks(List<NetworkResponse> networks) {
|
||||
this.networks = networks;
|
||||
}
|
||||
}
|
||||
@ -259,4 +259,14 @@ public class EventTypes {
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_ADD = "PHYSICAL.FIREWALL.ADD";
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE = "PHYSICAL.FIREWALL.DELETE";
|
||||
public static final String EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE = "PHYSICAL.FIREWALL.CONFIGURE";
|
||||
|
||||
// VPC
|
||||
public static final String EVENT_VPC_CREATE = "VPC.CREATE";
|
||||
public static final String EVENT_VPC_UPDATE = "VPC.UPDATE";
|
||||
public static final String EVENT_VPC_DELETE = "VPC.DELETE";
|
||||
|
||||
|
||||
public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE";
|
||||
public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE";
|
||||
public static final String EVENT_VPC_OFFERING_DELETE = "VPC.OFFERING.DELETE";
|
||||
}
|
||||
|
||||
@ -283,4 +283,9 @@ public interface Network extends ControlledEntity {
|
||||
boolean isRestartRequired();
|
||||
|
||||
boolean getSpecifyIpRanges();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
long getVpcId();
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ public class NetworkProfile implements Network {
|
||||
private ACLType aclType;
|
||||
private boolean restartRequired;
|
||||
private boolean specifyIpRanges;
|
||||
private Long vpcId;
|
||||
|
||||
public NetworkProfile(Network network) {
|
||||
this.id = network.getId();
|
||||
@ -71,6 +72,7 @@ public class NetworkProfile implements Network {
|
||||
this.aclType = network.getAclType();
|
||||
this.restartRequired = network.isRestartRequired();
|
||||
this.specifyIpRanges = network.getSpecifyIpRanges();
|
||||
this.vpcId = network.getVpcId();
|
||||
}
|
||||
|
||||
public String getDns1() {
|
||||
@ -210,4 +212,9 @@ public class NetworkProfile implements Network {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -134,4 +134,6 @@ public interface NetworkService {
|
||||
|
||||
List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner);
|
||||
|
||||
List<? extends Network> listNetworksByVpc(long vpcId);
|
||||
|
||||
}
|
||||
|
||||
@ -30,7 +30,8 @@ public interface VirtualNetworkApplianceService {
|
||||
* the command specifying router's id
|
||||
* @return DomainRouter object
|
||||
*/
|
||||
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Reboots domain router
|
||||
@ -39,7 +40,8 @@ public interface VirtualNetworkApplianceService {
|
||||
* the command specifying router's id
|
||||
* @return router if successful
|
||||
*/
|
||||
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
VirtualRouter upgradeRouter(UpgradeRouterCmd cmd);
|
||||
|
||||
|
||||
51
api/src/com/cloud/network/vpc/Vpc.java
Normal file
51
api/src/com/cloud/network/vpc/Vpc.java
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.acl.ControlledEntity;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface Vpc extends ControlledEntity{
|
||||
public enum State {
|
||||
Enabled,
|
||||
Disabled
|
||||
}
|
||||
|
||||
public static final String _supportedProviders = Network.Provider.VirtualRouter.getName();
|
||||
|
||||
boolean readyToUse();
|
||||
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getName();
|
||||
|
||||
long getZoneId();
|
||||
|
||||
String getCidr();
|
||||
|
||||
State getState();
|
||||
|
||||
long getVpcOfferingId();
|
||||
|
||||
String getDisplayText();
|
||||
|
||||
}
|
||||
41
api/src/com/cloud/network/vpc/VpcOffering.java
Normal file
41
api/src/com/cloud/network/vpc/VpcOffering.java
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface VpcOffering {
|
||||
public enum State {
|
||||
Disabled,
|
||||
Enabled
|
||||
}
|
||||
|
||||
public static final String defaultVPCOfferingName = "Default VPC offering";
|
||||
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getName();
|
||||
|
||||
String getUniqueName();
|
||||
|
||||
String getDisplayText();
|
||||
|
||||
State getState();
|
||||
|
||||
boolean isDefault();
|
||||
|
||||
}
|
||||
105
api/src/com/cloud/network/vpc/VpcService.java
Normal file
105
api/src/com/cloud/network/vpc/VpcService.java
Normal file
@ -0,0 +1,105 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface VpcService {
|
||||
|
||||
public VpcOffering getVpcOffering(long vpcOfferingId);
|
||||
|
||||
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices);
|
||||
|
||||
public Vpc getVpc(long vpcId);
|
||||
|
||||
public Vpc createVpc(long zoneId, String name, String cidr, long ownerId);
|
||||
|
||||
public List<Network> getVpcNetworks(long vpcId);
|
||||
|
||||
Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId);
|
||||
|
||||
List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr,
|
||||
Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
|
||||
|
||||
/**
|
||||
* @param offId
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteVpcOffering(long offId);
|
||||
|
||||
/**
|
||||
* @param vpcOffId
|
||||
* @param vpcOfferingName
|
||||
* @param displayText
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
|
||||
|
||||
/**
|
||||
* @param zoneId
|
||||
* @param vpcOffId
|
||||
* @param vpcOwnerId
|
||||
* @param vpcName
|
||||
* @param displayText
|
||||
* @param cidr
|
||||
* @return
|
||||
*/
|
||||
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr);
|
||||
|
||||
/**
|
||||
* @param vpcId
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteVpc(long vpcId);
|
||||
|
||||
/**
|
||||
* @param vpcId
|
||||
* @param vpcName
|
||||
* @param displayText
|
||||
* @return
|
||||
*/
|
||||
public Vpc updateVpc(long vpcId, String vpcName, String displayText);
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param vpcName
|
||||
* @param displayText
|
||||
* @param supportedServicesStr
|
||||
* @param cidr
|
||||
* @param state TODO
|
||||
* @param accountName
|
||||
* @param domainId
|
||||
* @param keyword
|
||||
* @param startIndex
|
||||
* @param pageSizeVal
|
||||
* @param zoneId TODO
|
||||
* @param isRecursive TODO
|
||||
* @param listAll TODO
|
||||
* @param vpc
|
||||
* @return
|
||||
*/
|
||||
public List<? extends Vpc> listVpcs(Long id, String vpcName, String displayText,
|
||||
List<String> supportedServicesStr, String cidr, Long vpcOffId, String state, String accountName, Long domainId,
|
||||
String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll);
|
||||
|
||||
}
|
||||
@ -47,7 +47,8 @@ public interface StorageService{
|
||||
* @throws ResourceUnavailableException
|
||||
* TODO
|
||||
*/
|
||||
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException;
|
||||
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException,
|
||||
UnknownHostException, ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Creates the database object for a volume based on the given criteria
|
||||
@ -92,7 +93,8 @@ public interface StorageService{
|
||||
* @throws InsufficientCapacityException
|
||||
* TODO
|
||||
*/
|
||||
public StoragePool preparePrimaryStorageForMaintenance(Long primaryStorageId) throws ResourceUnavailableException, InsufficientCapacityException;
|
||||
public StoragePool preparePrimaryStorageForMaintenance(Long primaryStorageId) throws ResourceUnavailableException,
|
||||
InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Complete maintenance for primary storage
|
||||
@ -103,7 +105,8 @@ public interface StorageService{
|
||||
* @throws ResourceUnavailableException
|
||||
* TODO
|
||||
*/
|
||||
public StoragePool cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd) throws ResourceUnavailableException;
|
||||
public StoragePool cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
public StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException;
|
||||
|
||||
|
||||
@ -332,3 +332,22 @@ updateStorageNetworkIpRange=com.cloud.api.commands.UpdateStorageNetworkIpRangeCm
|
||||
addNetworkDevice=com.cloud.api.commands.AddNetworkDeviceCmd;1
|
||||
listNetworkDevice=com.cloud.api.commands.ListNetworkDeviceCmd;1
|
||||
deleteNetworkDevice=com.cloud.api.commands.DeleteNetworkDeviceCmd;1
|
||||
|
||||
### Network Devices commands
|
||||
addNetworkDevice=com.cloud.api.commands.AddNetworkDeviceCmd;1
|
||||
listNetworkDevice=com.cloud.api.commands.ListNetworkDeviceCmd;1
|
||||
deleteNetworkDevice=com.cloud.api.commands.DeleteNetworkDeviceCmd;1
|
||||
|
||||
|
||||
### VPC commands
|
||||
createVPC=com.cloud.api.commands.CreateVPCCmd;15
|
||||
listVPCs=com.cloud.api.commands.ListVPCsCmd;15
|
||||
deleteVPC=com.cloud.api.commands.DeleteVPCCmd;15
|
||||
updateVPC=com.cloud.api.commands.UpdateVPCCmd;15
|
||||
|
||||
|
||||
#### VPC offering commands
|
||||
createVPCOffering=com.cloud.api.commands.CreateVPCOfferingCmd;1
|
||||
updateVPCOffering=com.cloud.api.commands.UpdateVPCOfferingCmd;1
|
||||
deleteVPCOffering=com.cloud.api.commands.DeleteVPCOfferingCmd;1
|
||||
listVPCOfferings=com.cloud.api.commands.ListVPCOfferingsCmd;15
|
||||
|
||||
@ -49,6 +49,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
@ -68,6 +69,7 @@ import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityGroupManager;
|
||||
import com.cloud.network.security.SecurityGroupVO;
|
||||
import com.cloud.network.security.dao.SecurityGroupDao;
|
||||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.offerings.NetworkOfferingVO;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||
@ -84,6 +86,7 @@ import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSCategoryVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.StorageStats;
|
||||
@ -91,9 +94,8 @@ import com.cloud.storage.UploadVO;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateSwiftVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VolumeHostVO;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Volume.Type;
|
||||
import com.cloud.storage.VolumeHostVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDao;
|
||||
@ -188,6 +190,7 @@ public class ApiDBUtils {
|
||||
private static AccountDetailsDao _accountDetailsDao;
|
||||
private static NetworkDomainDao _networkDomainDao;
|
||||
private static HighAvailabilityManager _haMgr;
|
||||
private static VpcManager _vpcMgr;
|
||||
|
||||
static {
|
||||
_ms = (ManagementServer) ComponentLocator.getComponent(ManagementServer.Name);
|
||||
@ -241,6 +244,7 @@ public class ApiDBUtils {
|
||||
_accountDetailsDao = locator.getDao(AccountDetailsDao.class);
|
||||
_networkDomainDao = locator.getDao(NetworkDomainDao.class);
|
||||
_haMgr = locator.getManager(HighAvailabilityManager.class);
|
||||
_vpcMgr = locator.getManager(VpcManager.class);
|
||||
|
||||
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
|
||||
_statsCollector = StatsCollector.getInstance();
|
||||
@ -748,4 +752,12 @@ public class ApiDBUtils {
|
||||
public static String getHaTag() {
|
||||
return _haMgr.getHaTag();
|
||||
}
|
||||
|
||||
public static Map<Service, Set<Provider>> listVpcOffServices(long vpcOffId) {
|
||||
return _vpcMgr.getVpcOffSvcProvidersMap(vpcOffId);
|
||||
}
|
||||
|
||||
public static List<? extends Network> listVpcNetworks(long vpcId) {
|
||||
return _networkMgr.listNetworksByVpc(vpcId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,6 +91,8 @@ import com.cloud.api.response.UserVmResponse;
|
||||
import com.cloud.api.response.VirtualRouterProviderResponse;
|
||||
import com.cloud.api.response.VlanIpRangeResponse;
|
||||
import com.cloud.api.response.VolumeResponse;
|
||||
import com.cloud.api.response.VpcOfferingResponse;
|
||||
import com.cloud.api.response.VpcResponse;
|
||||
import com.cloud.api.response.VpnUsersResponse;
|
||||
import com.cloud.api.response.ZoneResponse;
|
||||
import com.cloud.async.AsyncJob;
|
||||
@ -143,6 +145,8 @@ import com.cloud.network.security.SecurityGroupRules;
|
||||
import com.cloud.network.security.SecurityGroupVO;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.network.security.SecurityRule.SecurityRuleType;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
@ -3399,4 +3403,87 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
return ApiDispatcher.getIdentiyId(tableName, token);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VpcOfferingResponse createVpcOfferingResponse(VpcOffering offering) {
|
||||
VpcOfferingResponse response = new VpcOfferingResponse();
|
||||
response.setId(offering.getId());
|
||||
response.setName(offering.getName());
|
||||
response.setDisplayText(offering.getDisplayText());
|
||||
response.setIsDefault(offering.isDefault());
|
||||
response.setState(offering.getState().name());
|
||||
|
||||
Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(offering.getId());
|
||||
List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>();
|
||||
for (Service service : serviceProviderMap.keySet()) {
|
||||
ServiceResponse svcRsp = new ServiceResponse();
|
||||
// skip gateway service
|
||||
if (service == Service.Gateway) {
|
||||
continue;
|
||||
}
|
||||
svcRsp.setName(service.getName());
|
||||
List<ProviderResponse> providers = new ArrayList<ProviderResponse>();
|
||||
for (Provider provider : serviceProviderMap.get(service)) {
|
||||
if (provider != null) {
|
||||
ProviderResponse providerRsp = new ProviderResponse();
|
||||
providerRsp.setName(provider.getName());
|
||||
providers.add(providerRsp);
|
||||
}
|
||||
}
|
||||
svcRsp.setProviders(providers);
|
||||
|
||||
serviceResponses.add(svcRsp);
|
||||
}
|
||||
response.setServices(serviceResponses);
|
||||
response.setObjectName("vpcoffering");
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VpcResponse createVpcResponse(Vpc vpc) {
|
||||
VpcResponse response = new VpcResponse();
|
||||
response.setId(vpc.getId());
|
||||
response.setName(vpc.getName());
|
||||
response.setDisplayText(vpc.getDisplayText());
|
||||
response.setState(vpc.getState().name());
|
||||
response.setVpcOfferingId(vpc.getVpcOfferingId());
|
||||
response.setCidr(vpc.getCidr());
|
||||
response.setZoneId(vpc.getZoneId());
|
||||
|
||||
Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(vpc.getVpcOfferingId());
|
||||
List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>();
|
||||
for (Service service : serviceProviderMap.keySet()) {
|
||||
ServiceResponse svcRsp = new ServiceResponse();
|
||||
// skip gateway service
|
||||
if (service == Service.Gateway) {
|
||||
continue;
|
||||
}
|
||||
svcRsp.setName(service.getName());
|
||||
List<ProviderResponse> providers = new ArrayList<ProviderResponse>();
|
||||
for (Provider provider : serviceProviderMap.get(service)) {
|
||||
if (provider != null) {
|
||||
ProviderResponse providerRsp = new ProviderResponse();
|
||||
providerRsp.setName(provider.getName());
|
||||
providers.add(providerRsp);
|
||||
}
|
||||
}
|
||||
svcRsp.setProviders(providers);
|
||||
|
||||
serviceResponses.add(svcRsp);
|
||||
}
|
||||
|
||||
List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
|
||||
List<? extends Network> networks = ApiDBUtils.listVpcNetworks(vpc.getId());
|
||||
for (Network network : networks) {
|
||||
NetworkResponse ntwkRsp = createNetworkResponse(network);
|
||||
networkResponses.add(ntwkRsp);
|
||||
}
|
||||
|
||||
response.setNetworks(networkResponses);
|
||||
response.setServices(serviceResponses);
|
||||
response.setObjectName("vpcoffering");
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -499,7 +499,8 @@ public class ApiServer implements HttpRequestHandler {
|
||||
asyncCmd.setStartEventId(startEventId);
|
||||
|
||||
// save the scheduled event
|
||||
Long eventId = EventUtils.saveScheduledEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId, asyncCmd.getEntityOwnerId(), asyncCmd.getEventType(), asyncCmd.getEventDescription(),
|
||||
Long eventId = EventUtils.saveScheduledEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId,
|
||||
asyncCmd.getEntityOwnerId(), asyncCmd.getEventType(), asyncCmd.getEventDescription(),
|
||||
startEventId);
|
||||
if (startEventId == 0) {
|
||||
// There was no create event before, set current event id as start eventId
|
||||
|
||||
@ -164,11 +164,12 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
/**
|
||||
* Creates a new network offering
|
||||
*
|
||||
* @param name
|
||||
* @param displayText
|
||||
* @param trafficType
|
||||
* @param tags
|
||||
* @param specifyVlan
|
||||
* ;
|
||||
* @param networkRate
|
||||
* TODO
|
||||
* @param serviceProviderMap
|
||||
@ -180,19 +181,18 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
* @param systemOnly
|
||||
* TODO
|
||||
* @param serviceOfferingId
|
||||
* @param conserveMode
|
||||
* ;
|
||||
* @param specifyIpRanges
|
||||
* TODO
|
||||
* @param id
|
||||
* @param specifyVlan
|
||||
* ;
|
||||
* @param conserveMode
|
||||
* ;
|
||||
*
|
||||
* @return network offering object
|
||||
*/
|
||||
|
||||
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate,
|
||||
Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode,
|
||||
Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges);
|
||||
NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap,
|
||||
boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap,
|
||||
boolean specifyIpRanges);
|
||||
|
||||
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, String vlanId, Account vlanOwner) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
|
||||
|
||||
@ -226,4 +226,10 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
||||
|
||||
AllocationState findClusterAllocationState(ClusterVO cluster);
|
||||
|
||||
/**
|
||||
* @param tags
|
||||
* @return
|
||||
*/
|
||||
String cleanupTags(String tags);
|
||||
|
||||
}
|
||||
|
||||
@ -138,8 +138,8 @@ import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.swift.SwiftManager;
|
||||
import com.cloud.test.IPRangeConfig;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
@ -2531,7 +2531,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
return tags;
|
||||
}
|
||||
|
||||
private String cleanupTags(String tags) {
|
||||
@Override
|
||||
public String cleanupTags(String tags) {
|
||||
if (tags != null) {
|
||||
String[] tokens = tags.split(",");
|
||||
StringBuilder t = new StringBuilder();
|
||||
@ -2863,7 +2864,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_OFFERING_CREATE, eventDescription = "creating network offering")
|
||||
public NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd) {
|
||||
Long userId = UserContext.current().getCallerUserId();
|
||||
String name = cmd.getNetworkOfferingName();
|
||||
String displayText = cmd.getDisplayText();
|
||||
String tags = cmd.getTags();
|
||||
@ -2970,7 +2970,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
Set<Provider> providers = new HashSet<Provider>();
|
||||
// in Acton, don't allow to specify more than 1 provider per service
|
||||
if (svcPrv.get(serviceStr) != null && svcPrv.get(serviceStr).size() > 1) {
|
||||
throw new InvalidParameterValueException("In the current release only one provider can be specified for the service");
|
||||
throw new InvalidParameterValueException("In the current release only one provider can be " +
|
||||
"specified for the service");
|
||||
}
|
||||
for (String prvNameStr : svcPrv.get(serviceStr)) {
|
||||
// check if provider is supported
|
||||
@ -3001,7 +3002,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
}
|
||||
serviceProviderMap.put(service, providers);
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Service " + serviceStr + " is not enabled for the network offering, can't add a provider to it");
|
||||
throw new InvalidParameterValueException("Service " + serviceStr + " is not enabled for the network " +
|
||||
"offering, can't add a provider to it");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3035,8 +3037,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
serviceCapabilityMap.put(Service.SourceNat, sourceNatServiceCapabilityMap);
|
||||
serviceCapabilityMap.put(Service.StaticNat, staticNatServiceCapabilityMap);
|
||||
|
||||
// if Firewall service is missing, and Juniper is a provider for any other service or VR is StaticNat/PF provider, add Firewall
|
||||
// service/provider combination
|
||||
// if Firewall service is missing, add Firewall service/provider combination
|
||||
if (firewallProvider != null) {
|
||||
s_logger.debug("Adding Firewall service with provider " + firewallProvider.getName());
|
||||
Set<Provider> firewallProviderSet = new HashSet<Provider>();
|
||||
@ -3044,8 +3045,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
serviceProviderMap.put(Service.Firewall, firewallProviderSet);
|
||||
}
|
||||
|
||||
return createNetworkOffering(userId, name, displayText, trafficType, tags, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType,
|
||||
false, serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges);
|
||||
return createNetworkOffering(name, displayText, trafficType, tags, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType, false,
|
||||
serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges);
|
||||
}
|
||||
|
||||
void validateLoadBalancerServiceCapabilities(Map<Capability, String> lbServiceCapabilityMap) {
|
||||
@ -3125,9 +3126,9 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability,
|
||||
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly,
|
||||
Long serviceOfferingId, boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges) {
|
||||
public NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate,
|
||||
Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
|
||||
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges) {
|
||||
|
||||
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
|
||||
int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
|
||||
@ -3189,13 +3190,15 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
if ((sourceNatServiceCapabilityMap != null) && (!sourceNatServiceCapabilityMap.isEmpty())) {
|
||||
String sourceNatType = sourceNatServiceCapabilityMap.get(Capability.SupportedSourceNatTypes);
|
||||
if (sourceNatType != null) {
|
||||
_networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat, Capability.SupportedSourceNatTypes, sourceNatType);
|
||||
_networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat,
|
||||
Capability.SupportedSourceNatTypes, sourceNatType);
|
||||
sharedSourceNat = sourceNatType.contains("perzone");
|
||||
}
|
||||
|
||||
String param = sourceNatServiceCapabilityMap.get(Capability.RedundantRouter);
|
||||
if (param != null) {
|
||||
_networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat, Capability.RedundantRouter, param);
|
||||
_networkMgr.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat,
|
||||
Capability.RedundantRouter, param);
|
||||
redundantRouter = param.contains("true");
|
||||
}
|
||||
}
|
||||
@ -3209,7 +3212,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
}
|
||||
}
|
||||
|
||||
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
|
||||
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan,
|
||||
networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
|
||||
sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges);
|
||||
|
||||
if (serviceOfferingId != null) {
|
||||
|
||||
@ -45,6 +45,7 @@ import com.cloud.dao.EntityManagerImpl;
|
||||
import com.cloud.dc.ClusterDetailsDaoImpl;
|
||||
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterVSMMapDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterIpAddressDaoImpl;
|
||||
import com.cloud.dc.dao.DcDetailsDaoImpl;
|
||||
@ -70,11 +71,9 @@ import com.cloud.maint.dao.AgentUpgradeDaoImpl;
|
||||
import com.cloud.network.ExternalLoadBalancerUsageManagerImpl;
|
||||
import com.cloud.network.NetworkManagerImpl;
|
||||
import com.cloud.network.StorageNetworkManagerImpl;
|
||||
import com.cloud.network.dao.CiscoNexusVSMDeviceDaoImpl;
|
||||
import com.cloud.network.dao.ExternalFirewallDeviceDaoImpl;
|
||||
import com.cloud.network.dao.ExternalLoadBalancerDeviceDaoImpl;
|
||||
import com.cloud.network.dao.CiscoNexusVSMDeviceDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterVSMMapDaoImpl;
|
||||
import com.cloud.network.dao.PortProfileDaoImpl;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDaoImpl;
|
||||
import com.cloud.network.dao.FirewallRulesDaoImpl;
|
||||
import com.cloud.network.dao.IPAddressDaoImpl;
|
||||
@ -92,16 +91,17 @@ import com.cloud.network.dao.NetworkServiceMapDaoImpl;
|
||||
import com.cloud.network.dao.PhysicalNetworkDaoImpl;
|
||||
import com.cloud.network.dao.PhysicalNetworkServiceProviderDaoImpl;
|
||||
import com.cloud.network.dao.PhysicalNetworkTrafficTypeDaoImpl;
|
||||
import com.cloud.network.dao.PortProfileDaoImpl;
|
||||
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
|
||||
import com.cloud.network.dao.VirtualRouterProviderDaoImpl;
|
||||
import com.cloud.network.dao.VpnUserDaoImpl;
|
||||
import com.cloud.network.element.CiscoNexusVSMElement;
|
||||
import com.cloud.network.element.CiscoNexusVSMElementService;
|
||||
import com.cloud.network.element.F5ExternalLoadBalancerElement;
|
||||
import com.cloud.network.element.F5ExternalLoadBalancerElementService;
|
||||
import com.cloud.network.element.JuniperSRXExternalFirewallElement;
|
||||
import com.cloud.network.element.JuniperSRXFirewallElementService;
|
||||
import com.cloud.network.element.NetscalerElement;
|
||||
import com.cloud.network.element.CiscoNexusVSMElement;
|
||||
import com.cloud.network.element.CiscoNexusVSMElementService;
|
||||
import com.cloud.network.element.NetscalerLoadBalancerElementService;
|
||||
import com.cloud.network.element.VirtualRouterElement;
|
||||
import com.cloud.network.element.VirtualRouterElementService;
|
||||
@ -122,6 +122,10 @@ import com.cloud.network.security.dao.SecurityGroupRulesDaoImpl;
|
||||
import com.cloud.network.security.dao.SecurityGroupVMMapDaoImpl;
|
||||
import com.cloud.network.security.dao.SecurityGroupWorkDaoImpl;
|
||||
import com.cloud.network.security.dao.VmRulesetLogDaoImpl;
|
||||
import com.cloud.network.vpc.VpcManagerImpl;
|
||||
import com.cloud.network.vpc.Dao.VpcDaoImpl;
|
||||
import com.cloud.network.vpc.Dao.VpcOfferingDaoImpl;
|
||||
import com.cloud.network.vpc.Dao.VpcOfferingServiceMapDaoImpl;
|
||||
import com.cloud.network.vpn.RemoteAccessVpnManagerImpl;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
|
||||
import com.cloud.offerings.dao.NetworkOfferingServiceMapDaoImpl;
|
||||
@ -329,6 +333,9 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
|
||||
addDao("NetworkServiceMapDao", NetworkServiceMapDaoImpl.class);
|
||||
addDao("StorageNetworkIpAddressDao", StorageNetworkIpAddressDaoImpl.class);
|
||||
addDao("StorageNetworkIpRangeDao", StorageNetworkIpRangeDaoImpl.class);
|
||||
addDao("VpcDao", VpcDaoImpl.class);
|
||||
addDao("VpcOfferingDao", VpcOfferingDaoImpl.class);
|
||||
addDao("VpcOfferingServiceMapDao", VpcOfferingServiceMapDaoImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -385,6 +392,7 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
|
||||
addManager("StorageNetworkManager", StorageNetworkManagerImpl.class);
|
||||
addManager("ExternalLoadBalancerUsageManager", ExternalLoadBalancerUsageManagerImpl.class);
|
||||
addManager("HA Manager", HighAvailabilityManagerImpl.class);
|
||||
addManager("VPC Manager", VpcManagerImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -28,6 +28,7 @@ import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.cloud.api.Identity;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
/**
|
||||
|
||||
@ -1251,29 +1251,29 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
NetworkOfferingVO offering = null;
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest,
|
||||
null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest, null,
|
||||
true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional,
|
||||
null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional, null,
|
||||
defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled",
|
||||
TrafficType.Guest, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false);
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest,
|
||||
null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null,
|
||||
true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, true);
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, true,
|
||||
Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
@ -1301,8 +1301,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
serviceCapabilityMap.put(Service.StaticNat, eip);
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedEIPandELBNetworkOffering, "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null,
|
||||
true, Availability.Optional, null, netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true);
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering, "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true,
|
||||
Availability.Optional, null, netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
offering.setDedicatedLB(false);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
@ -6574,4 +6574,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
return networkList.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Network> listNetworksByVpc(long vpcId) {
|
||||
return _networksDao.listByVpc(vpcId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +76,9 @@ public class NetworkVO implements Network, Identity {
|
||||
@Column(name="network_offering_id")
|
||||
long networkOfferingId;
|
||||
|
||||
@Column(name="vpc_id")
|
||||
long vpcId;
|
||||
|
||||
@Column(name="physical_network_id")
|
||||
Long physicalNetworkId;
|
||||
|
||||
@ -473,4 +476,9 @@ public class NetworkVO implements Network, Identity {
|
||||
public boolean getSpecifyIpRanges() {
|
||||
return specifyIpRanges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,8 +70,6 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
|
||||
|
||||
void addDomainToNetwork(long networkId, long domainId, Boolean subdomainAccess);
|
||||
|
||||
Long getNetworkCountByOfferingId(long offeringId);
|
||||
|
||||
List<NetworkVO> listByPhysicalNetwork(long physicalNetworkId);
|
||||
|
||||
List<NetworkVO> listSecurityGroupEnabledNetworks();
|
||||
@ -96,4 +94,8 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
|
||||
|
||||
List<NetworkVO> listSourceNATEnabledNetworks(long accountId, long dataCenterId, GuestType type);
|
||||
|
||||
int getNetworkCountByVpcId(long vpcId);
|
||||
|
||||
List<NetworkVO> listByVpc(long vpcId);
|
||||
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
final SearchBuilder<NetworkVO> AccountNetworkSearch;
|
||||
final SearchBuilder<NetworkVO> ZoneBroadcastUriSearch;
|
||||
final SearchBuilder<NetworkVO> ZoneSecurityGroupSearch;
|
||||
final GenericSearchBuilder<NetworkVO, Long> CountByOfferingId;
|
||||
final GenericSearchBuilder<NetworkVO, Integer> CountBy;
|
||||
final SearchBuilder<NetworkVO> PhysicalNetworkSearch;
|
||||
final SearchBuilder<NetworkVO> SecurityGroupSearch;
|
||||
final GenericSearchBuilder<NetworkVO, Long> NetworksRegularUserCanCreateSearch;
|
||||
@ -88,6 +88,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
AllFieldsSearch.and("related", AllFieldsSearch.entity().getRelated(), Op.EQ);
|
||||
AllFieldsSearch.and("guestType", AllFieldsSearch.entity().getGuestType(), Op.EQ);
|
||||
AllFieldsSearch.and("physicalNetwork", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
||||
AccountSearch = createSearchBuilder();
|
||||
@ -126,11 +127,12 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
ZoneSecurityGroupSearch.join("services", join1, ZoneSecurityGroupSearch.entity().getId(), join1.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
|
||||
ZoneSecurityGroupSearch.done();
|
||||
|
||||
CountByOfferingId = createSearchBuilder(Long.class);
|
||||
CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId());
|
||||
CountByOfferingId.and("offeringId", CountByOfferingId.entity().getNetworkOfferingId(), Op.EQ);
|
||||
CountByOfferingId.and("removed", CountByOfferingId.entity().getRemoved(), Op.NULL);
|
||||
CountByOfferingId.done();
|
||||
CountBy = createSearchBuilder(Integer.class);
|
||||
CountBy.select(null, Func.COUNT, CountBy.entity().getId());
|
||||
CountBy.and("offeringId", CountBy.entity().getNetworkOfferingId(), Op.EQ);
|
||||
CountBy.and("vpcId", CountBy.entity().getVpcId(), Op.EQ);
|
||||
CountBy.and("removed", CountBy.entity().getRemoved(), Op.NULL);
|
||||
CountBy.done();
|
||||
|
||||
PhysicalNetworkSearch = createSearchBuilder();
|
||||
PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
@ -364,14 +366,16 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
_domainsDao.persist(domain);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long getNetworkCountByOfferingId(long offeringId) {
|
||||
SearchCriteria<Long> sc = CountByOfferingId.create();
|
||||
sc.setParameters("offeringId", offeringId);
|
||||
List<Long> results = customSearch(sc, null);
|
||||
public int getNetworkCountByVpcId(long vpcId) {
|
||||
SearchCriteria<Integer> sc = CountBy.create();
|
||||
sc.setParameters("vpcId", vpcId);
|
||||
List<Integer> results = customSearch(sc, null);
|
||||
return results.get(0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<NetworkVO> listSecurityGroupEnabledNetworks() {
|
||||
SearchCriteria<NetworkVO> sc = SecurityGroupSearch.create();
|
||||
@ -459,4 +463,12 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkVO> listByVpc(long vpcId) {
|
||||
SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("vpcId", vpcId);
|
||||
|
||||
return listBy(sc, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ import com.cloud.network.PublicIpAddress;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.VirtualNetworkApplianceService;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
import com.cloud.user.Account;
|
||||
@ -33,7 +32,6 @@ import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
/**
|
||||
@ -58,35 +56,41 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
|
||||
* @param routers TODO
|
||||
*
|
||||
*/
|
||||
boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
|
||||
List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean getRouterStatistics(long vmId, Map<String, long[]> netStats, Map<String, long[]> diskStats);
|
||||
List<DomainRouterVO> deployVirtualRouter(Network guestNetwork, DeployDestination dest, Account owner,
|
||||
Map<VirtualMachineProfile.Param, Object> params, boolean isRedundant) throws InsufficientCapacityException,
|
||||
ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
List<DomainRouterVO> getRouters(long accountId, long zoneId);
|
||||
boolean startRemoteAccessVpn(Network network, RemoteAccessVpn vpn, List<? extends VirtualRouter> routers)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
List<DomainRouterVO> deployVirtualRouter(Network guestNetwork, DeployDestination dest, Account owner, Map<VirtualMachineProfile.Param, Object> params, boolean isRedundant) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException;
|
||||
boolean deleteRemoteAccessVpn(Network network, RemoteAccessVpn vpn, List<? extends VirtualRouter> routers)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
boolean startRemoteAccessVpn(Network network, RemoteAccessVpn vpn, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
boolean associateIP (Network network, final List<? extends PublicIpAddress> ipAddress,
|
||||
List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean deleteRemoteAccessVpn(Network network, RemoteAccessVpn vpn, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean associateIP (Network network, final List<? extends PublicIpAddress> ipAddress, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyFirewallRules(Network network, final List<? extends FirewallRule> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
boolean applyFirewallRules(Network network, final List<? extends FirewallRule> rules,
|
||||
List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
List<VirtualRouter> getRoutersForNetwork(long networkId);
|
||||
|
||||
String[] applyVpnUsers(Network network, List<? extends VpnUser> users, List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
String[] applyVpnUsers(Network network, List<? extends VpnUser> users, List<DomainRouterVO> routers)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
VirtualRouter stop(VirtualRouter router, boolean forced, User callingUser, Account callingAccount) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
VirtualRouter stop(VirtualRouter router, boolean forced, User callingUser, Account callingAccount)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
String getDnsBasicZoneUpdate();
|
||||
|
||||
boolean applyStaticNats(Network network, final List<? extends StaticNat> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
boolean applyStaticNats(Network network, final List<? extends StaticNat> rules, List<? extends VirtualRouter> routers)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest,
|
||||
List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
|
||||
long getDefaultVirtualRouterServiceOfferingId();
|
||||
boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest,
|
||||
List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
}
|
||||
|
||||
@ -95,7 +95,6 @@ import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
@ -132,7 +131,6 @@ import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.network.VpnUserVO;
|
||||
import com.cloud.network.addr.PublicIp;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDao;
|
||||
import com.cloud.network.dao.FirewallRulesDao;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.LoadBalancerDao;
|
||||
@ -163,13 +161,11 @@ import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Volume.Type;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
@ -214,13 +210,13 @@ import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
/**
|
||||
* VirtualNetworkApplianceManagerImpl manages the different types of virtual network appliances available in the Cloud Stack.
|
||||
*/
|
||||
@Local(value = { VirtualNetworkApplianceManager.class, VirtualNetworkApplianceService.class })
|
||||
public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplianceManager, VirtualNetworkApplianceService, VirtualMachineGuru<DomainRouterVO>, Listener {
|
||||
public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplianceManager, VirtualNetworkApplianceService,
|
||||
VirtualMachineGuru<DomainRouterVO>, Listener {
|
||||
private static final Logger s_logger = Logger.getLogger(VirtualNetworkApplianceManagerImpl.class);
|
||||
|
||||
String _name;
|
||||
@ -245,24 +241,16 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
@Inject
|
||||
UserStatisticsDao _userStatsDao = null;
|
||||
@Inject
|
||||
VolumeDao _volsDao = null;
|
||||
@Inject
|
||||
HostDao _hostDao = null;
|
||||
@Inject
|
||||
EventDao _eventDao = null;
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
@Inject
|
||||
HostPodDao _podDao = null;
|
||||
@Inject
|
||||
VMTemplateHostDao _vmTemplateHostDao = null;
|
||||
@Inject
|
||||
UserStatsLogDao _userStatsLogDao = null;
|
||||
@Inject
|
||||
AgentManager _agentMgr;
|
||||
@Inject
|
||||
StorageManager _storageMgr;
|
||||
@Inject
|
||||
AlertManager _alertMgr;
|
||||
@Inject
|
||||
AccountManager _accountMgr;
|
||||
@ -273,8 +261,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
@Inject
|
||||
UserVmDao _userVmDao;
|
||||
@Inject
|
||||
FirewallRulesDao _firewallRulesDao;
|
||||
@Inject
|
||||
UserStatisticsDao _statsDao = null;
|
||||
@Inject
|
||||
NetworkOfferingDao _networkOfferingDao = null;
|
||||
@ -299,14 +285,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
@Inject
|
||||
RemoteAccessVpnDao _vpnDao;
|
||||
@Inject
|
||||
VMInstanceDao _instanceDao;
|
||||
@Inject
|
||||
NicDao _nicDao;
|
||||
@Inject
|
||||
VolumeDao _volumeDao = null;
|
||||
@Inject
|
||||
FirewallRulesCidrsDao _firewallCidrsDao;
|
||||
@Inject
|
||||
UserVmDetailsDao _vmDetailsDao;
|
||||
@Inject
|
||||
ClusterDao _clusterDao;
|
||||
@ -344,11 +326,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
|
||||
Account _systemAcct;
|
||||
|
||||
@Override
|
||||
public List<DomainRouterVO> getRouters(long accountId, long dataCenterId) {
|
||||
return _routerDao.findBy(accountId, dataCenterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendSshKeysToHost(Long hostId, String pubKey, String prvKey) {
|
||||
ModifySshKeysCommand cmd = new ModifySshKeysCommand(pubKey, prvKey);
|
||||
@ -542,26 +519,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getRouterStatistics(final long vmId, final Map<String, long[]> netStats, final Map<String, long[]> diskStats) {
|
||||
final DomainRouterVO router = _routerDao.findById(vmId);
|
||||
|
||||
if (router == null || router.getState() != State.Running || router.getHostId() == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* final GetVmStatsCommand cmd = new GetVmStatsCommand(router, router.getInstanceName()); final Answer answer =
|
||||
* _agentMgr.easySend(router.getHostId(), cmd); if (answer == null) { return false; }
|
||||
*
|
||||
* final GetVmStatsAnswer stats = (GetVmStatsAnswer)answer;
|
||||
*
|
||||
* netStats.putAll(stats.getNetworkStats()); diskStats.putAll(stats.getDiskStats());
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override @ActionEvent(eventType = EventTypes.EVENT_ROUTER_REBOOT, eventDescription = "rebooting router Vm", async = true)
|
||||
public VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
@ -909,9 +866,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
} finally {
|
||||
scanLock.releaseRef();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1110,9 +1065,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAdmin(short accountType) {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN));
|
||||
}
|
||||
|
||||
private final int DEFAULT_PRIORITY = 100;
|
||||
private final int DEFAULT_DELTA = 2;
|
||||
|
||||
@ -1477,7 +1430,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DomainRouterVO> deployVirtualRouter(Network guestNetwork, DeployDestination dest, Account owner, Map<Param, Object> params, boolean isRedundant) throws InsufficientCapacityException,
|
||||
public List<DomainRouterVO> deployVirtualRouter(Network guestNetwork, DeployDestination dest, Account owner,
|
||||
Map<Param, Object> params, boolean isRedundant) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
if (_networkMgr.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType() == Network.GuestType.Shared) {
|
||||
owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
|
||||
@ -1489,7 +1443,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
}
|
||||
}
|
||||
|
||||
assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup || guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: "
|
||||
assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup ||
|
||||
guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: "
|
||||
+ guestNetwork;
|
||||
assert guestNetwork.getTrafficType() == TrafficType.Guest;
|
||||
|
||||
@ -2942,14 +2897,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDefaultVirtualRouterServiceOfferingId() {
|
||||
if (_offering != null) {
|
||||
return _offering.getId();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String getRouterControlIp(long routerId) {
|
||||
String routerControlIpAddress = null;
|
||||
List<NicVO> nics = _nicDao.listByVmId(routerId);
|
||||
|
||||
29
server/src/com/cloud/network/vpc/Dao/VpcDao.java
Normal file
29
server/src/com/cloud/network/vpc/Dao/VpcDao.java
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc.Dao;
|
||||
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface VpcDao extends GenericDao<VpcVO, Long>{
|
||||
|
||||
/**
|
||||
* @param offId
|
||||
* @return
|
||||
*/
|
||||
int getVpcCountByOfferingId(long offId);
|
||||
|
||||
}
|
||||
56
server/src/com/cloud/network/vpc/Dao/VpcDaoImpl.java
Normal file
56
server/src/com/cloud/network/vpc/Dao/VpcDaoImpl.java
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc.Dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.GenericSearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Func;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
|
||||
@Local(value = VpcDao.class)
|
||||
@DB(txn = false)
|
||||
public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{
|
||||
final GenericSearchBuilder<VpcVO, Integer> CountByOfferingId;
|
||||
|
||||
|
||||
protected VpcDaoImpl() {
|
||||
super();
|
||||
|
||||
CountByOfferingId = createSearchBuilder(Integer.class);
|
||||
CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId());
|
||||
CountByOfferingId.and("offeringId", CountByOfferingId.entity().getVpcOfferingId(), Op.EQ);
|
||||
CountByOfferingId.and("removed", CountByOfferingId.entity().getRemoved(), Op.NULL);
|
||||
CountByOfferingId.done();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getVpcCountByOfferingId(long offId) {
|
||||
SearchCriteria<Integer> sc = CountByOfferingId.create();
|
||||
sc.setParameters("offeringId", offId);
|
||||
List<Integer> results = customSearch(sc, null);
|
||||
return results.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
30
server/src/com/cloud/network/vpc/Dao/VpcOfferingDao.java
Normal file
30
server/src/com/cloud/network/vpc/Dao/VpcOfferingDao.java
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc.Dao;
|
||||
|
||||
import com.cloud.network.vpc.VpcOfferingVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface VpcOfferingDao extends GenericDao<VpcOfferingVO, Long>{
|
||||
/**
|
||||
* Returns the VPC offering that matches the unique name.
|
||||
*
|
||||
* @param uniqueName
|
||||
* name
|
||||
* @return VpcOfferingVO
|
||||
*/
|
||||
VpcOfferingVO findByUniqueName(String uniqueName);
|
||||
}
|
||||
68
server/src/com/cloud/network/vpc/Dao/VpcOfferingDaoImpl.java
Normal file
68
server/src/com/cloud/network/vpc/Dao/VpcOfferingDaoImpl.java
Normal file
@ -0,0 +1,68 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc.Dao;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.network.vpc.VpcOfferingVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
@Local(value = VpcOfferingDao.class)
|
||||
@DB(txn = false)
|
||||
public class VpcOfferingDaoImpl extends GenericDaoBase<VpcOfferingVO, Long> implements VpcOfferingDao{
|
||||
final SearchBuilder<VpcOfferingVO> AllFieldsSearch;
|
||||
|
||||
|
||||
protected VpcOfferingDaoImpl() {
|
||||
super();
|
||||
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
|
||||
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
|
||||
AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.EQ);
|
||||
AllFieldsSearch.and("uName", AllFieldsSearch.entity().getUniqueName(), Op.EQ);
|
||||
AllFieldsSearch.and("displayText", AllFieldsSearch.entity().getDisplayText(), Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public boolean remove(Long vpcOffId) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
VpcOfferingVO offering = findById(vpcOffId);
|
||||
offering.setUniqueName(null);
|
||||
update(vpcOffId, offering);
|
||||
boolean result = super.remove(vpcOffId);
|
||||
txn.commit();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VpcOfferingVO findByUniqueName(String uniqueName) {
|
||||
SearchCriteria<VpcOfferingVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("uName", uniqueName);
|
||||
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc.Dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.vpc.VpcOfferingServiceMapVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface VpcOfferingServiceMapDao extends GenericDao<VpcOfferingServiceMapVO, Long>{
|
||||
|
||||
List<VpcOfferingServiceMapVO> listByVpcOffId(long vpcOffId);
|
||||
|
||||
/**
|
||||
* @param networkOfferingId
|
||||
* @param services
|
||||
* @return
|
||||
*/
|
||||
boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service[] services);
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc.Dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.vpc.VpcOfferingServiceMapVO;
|
||||
import com.cloud.offerings.NetworkOfferingServiceMapVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
@Local(value = VpcOfferingServiceMapDao.class)
|
||||
@DB(txn = false)
|
||||
public class VpcOfferingServiceMapDaoImpl extends GenericDaoBase<VpcOfferingServiceMapVO, Long> implements VpcOfferingServiceMapDao{
|
||||
final SearchBuilder<VpcOfferingServiceMapVO> AllFieldsSearch;
|
||||
final SearchBuilder<VpcOfferingServiceMapVO> MultipleServicesSearch;
|
||||
|
||||
|
||||
protected VpcOfferingServiceMapDaoImpl() {
|
||||
super();
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("vpcOffId", AllFieldsSearch.entity().getVpcOfferingId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
||||
|
||||
MultipleServicesSearch = createSearchBuilder();
|
||||
MultipleServicesSearch.and("vpcOffId", MultipleServicesSearch.entity().getVpcOfferingId(), SearchCriteria.Op.EQ);
|
||||
MultipleServicesSearch.and("service", MultipleServicesSearch.entity().getService(), SearchCriteria.Op.IN);
|
||||
MultipleServicesSearch.and("provider", MultipleServicesSearch.entity().getProvider(), SearchCriteria.Op.EQ);
|
||||
MultipleServicesSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VpcOfferingServiceMapVO> listByVpcOffId(long vpcOffId) {
|
||||
SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("vpcOffId", vpcOffId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
|
||||
SearchCriteria<VpcOfferingServiceMapVO> sc = MultipleServicesSearch.create();
|
||||
sc.setParameters("vpcOffId", networkOfferingId);
|
||||
|
||||
if (services != null) {
|
||||
String[] servicesStr = new String[services.length];
|
||||
|
||||
int i = 0;
|
||||
for (Service service : services) {
|
||||
servicesStr[i] = service.getName();
|
||||
i++;
|
||||
}
|
||||
|
||||
sc.setParameters("service", (Object[])servicesStr);
|
||||
}
|
||||
|
||||
List<VpcOfferingServiceMapVO> offeringServices = listBy(sc);
|
||||
|
||||
if (services != null) {
|
||||
if (offeringServices.size() == services.length) {
|
||||
return true;
|
||||
}
|
||||
} else if (!offeringServices.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
61
server/src/com/cloud/network/vpc/VpcManager.java
Normal file
61
server/src/com/cloud/network/vpc/VpcManager.java
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.vpc.VpcOffering.State;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
public interface VpcManager extends VpcService{
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param displayText
|
||||
* @param svcProviderMap
|
||||
* @param isDefault
|
||||
* @param state TODO
|
||||
* @return
|
||||
*/
|
||||
VpcOffering createVpcOffering(String name, String displayText, Map<Service, Set<Provider>> svcProviderMap,
|
||||
boolean isDefault, State state);
|
||||
|
||||
/**
|
||||
* @param vpcOffId
|
||||
* @param services
|
||||
* @return
|
||||
*/
|
||||
boolean areServicesSupportedByVpcOffering(long vpcOffId, Service[] services);
|
||||
|
||||
/**
|
||||
* @param zoneId
|
||||
* @param vpcOffId
|
||||
* @param vpcOwner
|
||||
* @param vpcName
|
||||
* @param displayText
|
||||
* @param cidr
|
||||
* @return
|
||||
*/
|
||||
Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpcName, String displayText, String cidr);
|
||||
|
||||
List<Service> getSupportedServices();
|
||||
|
||||
}
|
||||
608
server/src/com/cloud/network/vpc/VpcManagerImpl.java
Normal file
608
server/src/com/cloud/network/vpc/VpcManagerImpl.java
Normal file
@ -0,0 +1,608 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.UnsupportedServiceException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.vpc.VpcOffering.State;
|
||||
import com.cloud.network.vpc.Dao.VpcDao;
|
||||
import com.cloud.network.vpc.Dao.VpcOfferingDao;
|
||||
import com.cloud.network.vpc.Dao.VpcOfferingServiceMapDao;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
|
||||
@Local(value = { VpcManager.class, VpcService.class })
|
||||
public class VpcManagerImpl implements VpcManager, Manager{
|
||||
private static final Logger s_logger = Logger.getLogger(VpcManagerImpl.class);
|
||||
@Inject
|
||||
VpcOfferingDao _vpcOffDao;
|
||||
@Inject
|
||||
VpcOfferingServiceMapDao _vpcOffSvcMapDao;
|
||||
@Inject
|
||||
VpcDao _vpcDao;
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
@Inject
|
||||
ConfigurationManager _configMgr;
|
||||
@Inject
|
||||
AccountManager _accountMgr;
|
||||
@Inject
|
||||
NetworkDao _ntwkDao;
|
||||
|
||||
String _name;
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_name = name;
|
||||
|
||||
//configure default vpc offering
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
if (_vpcOffDao.findByUniqueName(VpcOffering.defaultVPCOfferingName) == null) {
|
||||
s_logger.debug("Creating default VPC offering " + VpcOffering.defaultVPCOfferingName);
|
||||
|
||||
Map<Service, Set<Provider>> svcProviderMap = new HashMap<Service, Set<Provider>>();
|
||||
Set<Provider> provider = new HashSet<Provider>();
|
||||
provider.add(Provider.VirtualRouter);
|
||||
for (Service svc : getSupportedServices()) {
|
||||
svcProviderMap.put(svc, provider);
|
||||
}
|
||||
createVpcOffering(VpcOffering.defaultVPCOfferingName, VpcOffering.defaultVPCOfferingName, svcProviderMap,
|
||||
true, State.Enabled);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vpc createVpc(long zoneId, String name, String cidr, long ownerId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Network> getVpcNetworks(long vpcId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VpcOffering getVpcOffering(long vpcOffId) {
|
||||
return _vpcOffDao.findById(vpcOffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_CREATE, eventDescription = "creating vpc offering")
|
||||
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices) {
|
||||
Map<Network.Service, Set<Network.Provider>> svcProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
|
||||
Set<Network.Provider> defaultProviders = new HashSet<Network.Provider>();
|
||||
defaultProviders.add(Provider.VirtualRouter);
|
||||
|
||||
boolean sourceNatSvc = false;
|
||||
boolean firewallSvs = false;
|
||||
// populate the services first
|
||||
for (String serviceName : supportedServices) {
|
||||
// validate if the service is supported
|
||||
Service service = Network.Service.getService(serviceName);
|
||||
if (service == null || service == Service.Gateway) {
|
||||
throw new InvalidParameterValueException("Invalid service " + serviceName);
|
||||
}
|
||||
|
||||
//don't allow security group service for vpc
|
||||
if (service == Service.SecurityGroup) {
|
||||
throw new UnsupportedServiceException("Service " + Service.SecurityGroup.getName() + " is not supported by VPC");
|
||||
}
|
||||
svcProviderMap.put(service, defaultProviders);
|
||||
}
|
||||
|
||||
if (!sourceNatSvc) {
|
||||
s_logger.debug("Automatically adding source nat service to the list of VPC services");
|
||||
svcProviderMap.put(Service.SourceNat, defaultProviders);
|
||||
}
|
||||
|
||||
if (!firewallSvs) {
|
||||
s_logger.debug("Automatically adding firewall service to the list of VPC services");
|
||||
svcProviderMap.put(Service.Firewall, defaultProviders);
|
||||
}
|
||||
|
||||
svcProviderMap.put(Service.Gateway, defaultProviders);
|
||||
|
||||
return createVpcOffering(name, displayText, svcProviderMap, false, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public VpcOffering createVpcOffering(String name, String displayText, Map<Network.Service,
|
||||
Set<Network.Provider>> svcProviderMap, boolean isDefault, State state) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
// create vpc offering object
|
||||
VpcOfferingVO offering = new VpcOfferingVO(name, displayText, isDefault);
|
||||
|
||||
if (state != null) {
|
||||
offering.setState(state);
|
||||
}
|
||||
s_logger.debug("Adding vpc offering " + offering);
|
||||
offering = _vpcOffDao.persist(offering);
|
||||
// populate services and providers
|
||||
if (svcProviderMap != null) {
|
||||
for (Network.Service service : svcProviderMap.keySet()) {
|
||||
Set<Provider> providers = svcProviderMap.get(service);
|
||||
if (providers != null && !providers.isEmpty()) {
|
||||
for (Network.Provider provider : providers) {
|
||||
VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(), service, provider);
|
||||
_vpcOffSvcMapDao.persist(offService);
|
||||
s_logger.trace("Added service for the vpc offering: " + offService + " with provider " + provider.getName());
|
||||
}
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Provider is missing for the VPC offering service " + service.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
txn.commit();
|
||||
|
||||
UserContext.current().setEventDetails(" Id: " + offering.getId() + " Name: " + name);
|
||||
return offering;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Vpc getVpc(long vpcId) {
|
||||
return _vpcDao.findById(vpcId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId) {
|
||||
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Service, Set<Provider>>();
|
||||
List<VpcOfferingServiceMapVO> map = _vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
|
||||
|
||||
for (VpcOfferingServiceMapVO instance : map) {
|
||||
String service = instance.getService();
|
||||
Set<Provider> providers;
|
||||
providers = serviceProviderMap.get(service);
|
||||
if (providers == null) {
|
||||
providers = new HashSet<Provider>();
|
||||
}
|
||||
providers.add(Provider.getProvider(instance.getProvider()));
|
||||
serviceProviderMap.put(Service.getService(service), providers);
|
||||
}
|
||||
|
||||
return serviceProviderMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr,
|
||||
Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal) {
|
||||
Filter searchFilter = new Filter(VpcOfferingVO.class, "created", false, startIndex, pageSizeVal);
|
||||
SearchCriteria<VpcOfferingVO> sc = _vpcOffDao.createSearchCriteria();
|
||||
|
||||
if (keyword != null) {
|
||||
SearchCriteria<VpcOfferingVO> ssc = _vpcOffDao.createSearchCriteria();
|
||||
ssc.addOr("displayText", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
|
||||
}
|
||||
|
||||
if (displayText != null) {
|
||||
sc.addAnd("displayText", SearchCriteria.Op.LIKE, "%" + displayText + "%");
|
||||
}
|
||||
|
||||
if (isDefault != null) {
|
||||
sc.addAnd("isDefault", SearchCriteria.Op.EQ, isDefault);
|
||||
}
|
||||
|
||||
if (state != null) {
|
||||
sc.addAnd("state", SearchCriteria.Op.EQ, state);
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
}
|
||||
|
||||
|
||||
List<VpcOfferingVO> offerings = _vpcOffDao.search(sc, searchFilter);
|
||||
|
||||
// filter by supported services
|
||||
boolean listBySupportedServices = (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !offerings.isEmpty());
|
||||
|
||||
if (listBySupportedServices) {
|
||||
List<VpcOfferingVO> supportedOfferings = new ArrayList<VpcOfferingVO>();
|
||||
Service[] supportedServices = null;
|
||||
|
||||
if (listBySupportedServices) {
|
||||
supportedServices = new Service[supportedServicesStr.size()];
|
||||
int i = 0;
|
||||
for (String supportedServiceStr : supportedServicesStr) {
|
||||
Service service = Service.getService(supportedServiceStr);
|
||||
if (service == null) {
|
||||
throw new InvalidParameterValueException("Invalid service specified " + supportedServiceStr);
|
||||
} else {
|
||||
supportedServices[i] = service;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
for (VpcOfferingVO offering : offerings) {
|
||||
if (areServicesSupportedByVpcOffering(offering.getId(), supportedServices)) {
|
||||
supportedOfferings.add(offering);
|
||||
}
|
||||
}
|
||||
|
||||
return supportedOfferings;
|
||||
} else {
|
||||
return offerings;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areServicesSupportedByVpcOffering(long vpcOffId, Service... services) {
|
||||
return (_vpcOffSvcMapDao.areServicesSupportedByNetworkOffering(vpcOffId, services));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_DELETE, eventDescription = "deleting vpc offering")
|
||||
public boolean deleteVpcOffering(long offId) {
|
||||
UserContext.current().setEventDetails(" Id: " + offId);
|
||||
|
||||
// Verify vpc offering id
|
||||
VpcOfferingVO offering = _vpcOffDao.findById(offId);
|
||||
if (offering == null) {
|
||||
throw new InvalidParameterValueException("unable to find vpc offering " + offId);
|
||||
}
|
||||
|
||||
// Don't allow to delete default vpc offerings
|
||||
if (offering.isDefault() == true) {
|
||||
throw new InvalidParameterValueException("Default network offering can't be deleted");
|
||||
}
|
||||
|
||||
// don't allow to delete vpc offering if it's in use by existing vpcs (the offering can be disabled though)
|
||||
int vpcCount = _vpcDao.getVpcCountByOfferingId(offId);
|
||||
if (vpcCount > 0) {
|
||||
throw new InvalidParameterValueException("Can't delete vpc offering " + offId + " as its used by " + vpcCount + " vpcs. " +
|
||||
"To make the network offering unavaiable, disable it");
|
||||
}
|
||||
|
||||
if (_vpcOffDao.remove(offId)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_UPDATE, eventDescription = "updating vpc offering")
|
||||
public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state) {
|
||||
UserContext.current().setEventDetails(" Id: " + vpcOffId);
|
||||
|
||||
// Verify input parameters
|
||||
VpcOfferingVO offeringToUpdate = _vpcOffDao.findById(vpcOffId);
|
||||
if (offeringToUpdate == null) {
|
||||
throw new InvalidParameterValueException("Unable to find vpc offering " + vpcOffId);
|
||||
}
|
||||
|
||||
VpcOfferingVO offering = _vpcOffDao.createForUpdate(vpcOffId);
|
||||
|
||||
if (vpcOfferingName != null) {
|
||||
offering.setName(vpcOfferingName);
|
||||
}
|
||||
|
||||
if (displayText != null) {
|
||||
offering.setDisplayText(displayText);
|
||||
}
|
||||
|
||||
|
||||
if (state != null) {
|
||||
boolean validState = false;
|
||||
for (VpcOffering.State st : VpcOffering.State.values()) {
|
||||
if (st.name().equalsIgnoreCase(state)) {
|
||||
validState = true;
|
||||
offering.setState(st);
|
||||
}
|
||||
}
|
||||
if (!validState) {
|
||||
throw new InvalidParameterValueException("Incorrect state value: " + state);
|
||||
}
|
||||
}
|
||||
|
||||
if (_vpcOffDao.update(vpcOffId, offering)) {
|
||||
s_logger.debug("Updated VPC offeirng id=" + vpcOffId);
|
||||
return _vpcOffDao.findById(vpcOffId);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VPC_CREATE, eventDescription = "creating vpc")
|
||||
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Account owner = _accountMgr.getAccount(vpcOwnerId);
|
||||
|
||||
//Verify that caller can perform actions in behalf of vpc owner
|
||||
_accountMgr.checkAccess(caller, null, true, owner);
|
||||
|
||||
// Validate vpc offering
|
||||
VpcOfferingVO vpcOff = _vpcOffDao.findById(vpcOffId);
|
||||
if (vpcOff == null) {
|
||||
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find vpc offering by specified id");
|
||||
ex.addProxyObject("vpc_offerings", vpcOffId, "vpcOfferingId");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
//Validate zone
|
||||
DataCenter zone = _configMgr.getZone(zoneId);
|
||||
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
|
||||
// See DataCenterVO.java
|
||||
PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");
|
||||
ex.addProxyObject("data_center", zone.getId(), "zoneId");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
//validate cidr
|
||||
return createVpc(zoneId, vpcOffId, owner, vpcName, displayText, cidr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpcName, String displayText, String cidr) {
|
||||
if (!NetUtils.isValidCIDR(cidr)) {
|
||||
throw new InvalidParameterValueException("Invalid CIDR specified " + cidr);
|
||||
}
|
||||
|
||||
VpcVO vpc = new VpcVO (zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(), vpcOffId, cidr);
|
||||
vpc = _vpcDao.persist(vpc);
|
||||
|
||||
if (vpc != null) {
|
||||
s_logger.debug("Created VPC " + vpc);
|
||||
} else {
|
||||
s_logger.debug("Failed to create VPC");
|
||||
}
|
||||
return vpc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VPC_DELETE, eventDescription = "deleting VPC")
|
||||
public boolean deleteVpc(long vpcId) {
|
||||
UserContext.current().setEventDetails(" Id: " + vpcId);
|
||||
|
||||
// Verify vpc id
|
||||
VpcVO vpc = _vpcDao.findById(vpcId);
|
||||
if (vpc == null) {
|
||||
throw new InvalidParameterValueException("unable to find VPC id=" + vpcId);
|
||||
}
|
||||
|
||||
// don't allow to delete vpc if it's in use by existing networks
|
||||
int networksCount = _ntwkDao.getNetworkCountByVpcId(vpcId);
|
||||
if (networksCount > 0) {
|
||||
throw new InvalidParameterValueException("Can't delete VPC " + vpcId + " as its used by " + networksCount + " networks");
|
||||
}
|
||||
|
||||
if (_vpcDao.remove(vpcId)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_VPC_UPDATE, eventDescription = "updating vpc")
|
||||
public Vpc updateVpc(long vpcId, String vpcName, String displayText) {
|
||||
UserContext.current().setEventDetails(" Id: " + vpcId);
|
||||
|
||||
// Verify input parameters
|
||||
VpcVO vpcToUpdate = _vpcDao.findById(vpcId);
|
||||
if (vpcToUpdate == null) {
|
||||
throw new InvalidParameterValueException("Unable to find vpc offering " + vpcId);
|
||||
}
|
||||
|
||||
VpcVO vpc = _vpcDao.createForUpdate(vpcId);
|
||||
|
||||
if (vpcName != null) {
|
||||
vpc.setName(vpcName);
|
||||
}
|
||||
|
||||
if (displayText != null) {
|
||||
vpc.setDisplayText(displayText);
|
||||
}
|
||||
|
||||
if (_vpcDao.update(vpcId, vpc)) {
|
||||
s_logger.debug("Updated VPC id=" + vpcId);
|
||||
return _vpcDao.findById(vpcId);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends Vpc> listVpcs(Long id, String vpcName, String displayText, List<String> supportedServicesStr,
|
||||
String cidr, Long vpcOffId, String state, String accountName, Long domainId, String keyword,
|
||||
Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<Long> permittedAccounts = new ArrayList<Long>();
|
||||
|
||||
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean,
|
||||
ListProjectResourcesCriteria>(domainId, isRecursive, null);
|
||||
_accountMgr.buildACLSearchParameters(caller, id, accountName, null, permittedAccounts, domainIdRecursiveListProject,
|
||||
listAll, false);
|
||||
domainId = domainIdRecursiveListProject.first();
|
||||
isRecursive = domainIdRecursiveListProject.second();
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
|
||||
Filter searchFilter = new Filter(VpcVO.class, "created", false, startIndex, pageSizeVal);
|
||||
|
||||
SearchBuilder<VpcVO> sb = _vpcDao.createSearchBuilder();
|
||||
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
|
||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
sb.and("displayText", sb.entity().getDisplayText(), SearchCriteria.Op.LIKE);
|
||||
sb.and("vpcOfferingId", sb.entity().getVpcOfferingId(), SearchCriteria.Op.EQ);
|
||||
sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
|
||||
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
|
||||
|
||||
|
||||
// now set the SC criteria...
|
||||
SearchCriteria<VpcVO> sc = sb.create();
|
||||
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
|
||||
if (keyword != null) {
|
||||
SearchCriteria<VpcVO> ssc = _vpcDao.createSearchCriteria();
|
||||
ssc.addOr("displayText", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
}
|
||||
|
||||
if (vpcName != null) {
|
||||
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + vpcName + "%");
|
||||
}
|
||||
|
||||
if (displayText != null) {
|
||||
sc.addAnd("displayText", SearchCriteria.Op.LIKE, "%" + displayText + "%");
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
}
|
||||
|
||||
if (vpcOffId != null) {
|
||||
sc.addAnd("vpcOfferingId", SearchCriteria.Op.EQ, vpcOffId);
|
||||
}
|
||||
|
||||
if (zoneId != null) {
|
||||
sc.addAnd("zoneId", SearchCriteria.Op.EQ, zoneId);
|
||||
}
|
||||
|
||||
if (state != null) {
|
||||
sc.addAnd("state", SearchCriteria.Op.EQ, state);
|
||||
}
|
||||
|
||||
List<VpcVO> vpcs = _vpcDao.search(sc, searchFilter);
|
||||
|
||||
// filter by supported services
|
||||
boolean listBySupportedServices = (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !vpcs.isEmpty());
|
||||
|
||||
if (listBySupportedServices) {
|
||||
List<VpcVO> supportedVpcs = new ArrayList<VpcVO>();
|
||||
Service[] supportedServices = null;
|
||||
|
||||
if (listBySupportedServices) {
|
||||
supportedServices = new Service[supportedServicesStr.size()];
|
||||
int i = 0;
|
||||
for (String supportedServiceStr : supportedServicesStr) {
|
||||
Service service = Service.getService(supportedServiceStr);
|
||||
if (service == null) {
|
||||
throw new InvalidParameterValueException("Invalid service specified " + supportedServiceStr);
|
||||
} else {
|
||||
supportedServices[i] = service;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
for (VpcVO vpc : vpcs) {
|
||||
if (areServicesSupportedByVpcOffering(vpc.getVpcOfferingId(), supportedServices)) {
|
||||
supportedVpcs.add(vpc);
|
||||
}
|
||||
}
|
||||
|
||||
return supportedVpcs;
|
||||
} else {
|
||||
return vpcs;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Service> getSupportedServices() {
|
||||
List<Service> services = new ArrayList<Service>();
|
||||
services.add(Network.Service.Dhcp);
|
||||
services.add(Network.Service.Dns);
|
||||
services.add(Network.Service.UserData);
|
||||
services.add(Network.Service.Firewall);
|
||||
services.add(Network.Service.PortForwarding);
|
||||
services.add(Network.Service.Lb);
|
||||
services.add(Network.Service.SourceNat);
|
||||
services.add(Network.Service.StaticNat);
|
||||
services.add(Network.Service.Gateway);
|
||||
services.add(Network.Service.Vpn);
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="vpc_offering_service_map")
|
||||
public class VpcOfferingServiceMapVO {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
long id;
|
||||
|
||||
@Column(name="vpc_offering_id")
|
||||
long vpcOfferingId;
|
||||
|
||||
@Column(name="service")
|
||||
String service;
|
||||
|
||||
@Column(name="provider")
|
||||
String provider;
|
||||
|
||||
@Column(name=GenericDao.CREATED_COLUMN)
|
||||
Date created;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVpcOfferingId() {
|
||||
return vpcOfferingId;
|
||||
}
|
||||
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public VpcOfferingServiceMapVO() {
|
||||
}
|
||||
|
||||
public VpcOfferingServiceMapVO(long vpcOfferingId, Service service, Provider provider) {
|
||||
this.vpcOfferingId = vpcOfferingId;
|
||||
this.service = service.getName();
|
||||
if (provider != null) {
|
||||
this.provider = provider.getName();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder("[VPC Offering Service[");
|
||||
return buf.append(vpcOfferingId).append("-").append(service).append("-").append(provider).append("]").toString();
|
||||
}
|
||||
}
|
||||
143
server/src/com/cloud/network/vpc/VpcOfferingVO.java
Normal file
143
server/src/com/cloud/network/vpc/VpcOfferingVO.java
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="vpc_offerings")
|
||||
public class VpcOfferingVO implements VpcOffering{
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
long id;
|
||||
|
||||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "name")
|
||||
String name;
|
||||
|
||||
@Column(name = "unique_name")
|
||||
String uniqueName;
|
||||
|
||||
@Column(name = "display_text")
|
||||
String displayText;
|
||||
|
||||
@Column(name = "state")
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
State state = State.Disabled;
|
||||
|
||||
@Column(name = "default")
|
||||
boolean isDefault = false;
|
||||
|
||||
@Column(name = GenericDao.REMOVED_COLUMN)
|
||||
Date removed;
|
||||
|
||||
@Column(name = GenericDao.CREATED_COLUMN)
|
||||
Date created;
|
||||
|
||||
public VpcOfferingVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public VpcOfferingVO(String name, String displayText) {
|
||||
this.name = name;
|
||||
this.displayText = displayText;
|
||||
this.uniqueName = name;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
}
|
||||
|
||||
public VpcOfferingVO(String name, String displayText, boolean isDefault) {
|
||||
this(name, displayText);
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueName() {
|
||||
return uniqueName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public void setUniqueName(String uniqueName) {
|
||||
this.uniqueName = uniqueName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder("[VPC Offering [");
|
||||
return buf.append(id).append("-").append(name).append("]").toString();
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public void setDisplayText(String displayText) {
|
||||
this.displayText = displayText;
|
||||
}
|
||||
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
164
server/src/com/cloud/network/vpc/VpcVO.java
Normal file
164
server/src/com/cloud/network/vpc/VpcVO.java
Normal file
@ -0,0 +1,164 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by 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.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.api.Identity;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="vpc")
|
||||
public class VpcVO implements Vpc, Identity {
|
||||
@Id
|
||||
@Column(name="id")
|
||||
long id;
|
||||
|
||||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "display_text")
|
||||
String displayText;
|
||||
|
||||
@Column(name="zone_id")
|
||||
long zoneId;
|
||||
|
||||
@Column(name="cidr")
|
||||
private String cidr = null;
|
||||
|
||||
@Column(name="domain_id")
|
||||
Long domainId = null;
|
||||
|
||||
@Column(name="account_id")
|
||||
Long accountId = null;
|
||||
|
||||
@Column(name="state")
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
State state;
|
||||
|
||||
@Column(name="vpc_offering_id")
|
||||
long vpcOfferingId;
|
||||
|
||||
@Column(name=GenericDao.REMOVED_COLUMN)
|
||||
Date removed;
|
||||
|
||||
@Column(name=GenericDao.CREATED_COLUMN)
|
||||
Date created;
|
||||
|
||||
public VpcVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public VpcVO(long zoneId, String name, String displayText, long accountId, long domainId, long vpcOffId, String cidr) {
|
||||
this.zoneId = zoneId;
|
||||
this.name = name;
|
||||
this.displayText = displayText;
|
||||
this.accountId = accountId;
|
||||
this.domainId = domainId;
|
||||
this.cidr = cidr;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Enabled;
|
||||
this.vpcOfferingId = vpcOffId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readyToUse() {
|
||||
return state == State.Enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVpcOfferingId() {
|
||||
return vpcOfferingId;
|
||||
}
|
||||
|
||||
public Date getRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDisplayText(String displayText) {
|
||||
this.displayText = displayText;
|
||||
}
|
||||
|
||||
}
|
||||
@ -26,10 +26,15 @@ import com.cloud.utils.db.GenericDao;
|
||||
*/
|
||||
public interface NetworkOfferingServiceMapDao extends GenericDao<NetworkOfferingServiceMapVO, Long> {
|
||||
boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services);
|
||||
|
||||
List<NetworkOfferingServiceMapVO> listByNetworkOfferingId(long networkOfferingId);
|
||||
|
||||
void deleteByOfferingId(long networkOfferingId);
|
||||
|
||||
List<String> listProvidersForServiceForNetworkOffering(long networkOfferingId, Service service);
|
||||
|
||||
boolean isProviderForNetworkOffering(long networkOfferingId, Provider provider);
|
||||
|
||||
List<String> listServicesForNetworkOffering(long networkOfferingId);
|
||||
}
|
||||
|
||||
|
||||
@ -17,12 +17,9 @@ import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.exception.UnsupportedServiceException;
|
||||
import com.cloud.network.NetworkServiceMapVO;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.offerings.NetworkOfferingServiceMapVO;
|
||||
import com.cloud.offerings.NetworkOfferingVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.GenericSearchBuilder;
|
||||
|
||||
@ -152,7 +152,6 @@ import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.VolumeHostVO;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
@ -166,6 +165,7 @@ import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VMTemplateZoneVO;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.Volume.Type;
|
||||
import com.cloud.storage.VolumeHostVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
|
||||
@ -208,12 +208,14 @@ CREATE TABLE `cloud`.`networks` (
|
||||
`created` datetime NOT NULL COMMENT 'date created',
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
`specify_ip_ranges` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network provides an ability to define ip ranges',
|
||||
`vpc_id` bigint unsigned COMMENT 'vpc this network belongs to',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_networks__network_offering_id` FOREIGN KEY (`network_offering_id`) REFERENCES `network_offerings`(`id`),
|
||||
CONSTRAINT `fk_networks__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_networks__related` FOREIGN KEY(`related`) REFERENCES `networks`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_networks__account_id` FOREIGN KEY(`account_id`) REFERENCES `account`(`id`),
|
||||
CONSTRAINT `fk_networks__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`),
|
||||
CONSTRAINT `fk_networks__vpc_id` FOREIGN KEY(`vpc_id`) REFERENCES `vpc`(`id`),
|
||||
CONSTRAINT `uc_networks__uuid` UNIQUE (`uuid`),
|
||||
INDEX `i_networks__removed`(`removed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -2132,4 +2134,55 @@ CREATE TABLE `cloud`.`netscaler_pod_ref` (
|
||||
CONSTRAINT `fk_ns_pod_ref__device_id` FOREIGN KEY (`external_load_balancer_device_id`) REFERENCES `external_load_balancer_devices`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `cloud`.`vpc` (
|
||||
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
||||
`uuid` varchar(40) NOT NULL,
|
||||
`name` varchar(255) COMMENT 'vpc name',
|
||||
`display_text` varchar(255) COMMENT 'vpc display text',
|
||||
`cidr` varchar(18) COMMENT 'vpc cidr',
|
||||
`vpc_offering_id` bigint unsigned NOT NULL COMMENT 'vpc offering id that this vpc is created from',
|
||||
`zone_id` bigint unsigned NOT NULL COMMENT 'the id of the zone this Vpc belongs to',
|
||||
`state` varchar(32) NOT NULL COMMENT 'state of the VP (can be Enabled and Disabled)',
|
||||
`domain_id` bigint unsigned NOT NULL COMMENT 'domain the vpc belongs to',
|
||||
`account_id` bigint unsigned NOT NULL COMMENT 'owner of this vpc',
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
`created` datetime NOT NULL COMMENT 'date created',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `i_vpc__removed`(`removed`),
|
||||
CONSTRAINT `fk_vpc__zone_id` FOREIGN KEY `fk_vpc__zone_id` (`zone_id`) REFERENCES `data_center` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_vpc__vpc_offering_id` FOREIGN KEY (`vpc_offering_id`) REFERENCES `vpc_offerings`(`id`),
|
||||
CONSTRAINT `fk_vpc__account_id` FOREIGN KEY `fk_vpc__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_vpc__domain_id` FOREIGN KEY `fk_vpc__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `cloud`.`vpc_offerings` (
|
||||
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
||||
`uuid` varchar(40) NOT NULL,
|
||||
`unique_name` varchar(64) UNIQUE COMMENT 'unique name of the vpc offering',
|
||||
`name` varchar(255) COMMENT 'vpc name',
|
||||
`display_text` varchar(255) COMMENT 'display text',
|
||||
`state` char(32) COMMENT 'state of the vpc offering that has Disabled value by default',
|
||||
`default` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if vpc offering is default',
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
`created` datetime NOT NULL COMMENT 'date created',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `i_vpc__removed`(`removed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `cloud`.`vpc_offering_service_map` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`vpc_offering_id` bigint unsigned NOT NULL COMMENT 'vpc_offering_id',
|
||||
`service` varchar(255) NOT NULL COMMENT 'service',
|
||||
`provider` varchar(255) COMMENT 'service provider',
|
||||
`created` datetime COMMENT 'date created',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_vpc_offering_service_map__vpc_offering_id` FOREIGN KEY(`vpc_offering_id`) REFERENCES `vpc_offerings`(`id`) ON DELETE CASCADE,
|
||||
UNIQUE (`vpc_offering_id`, `service`, `provider`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
|
||||
2
wscript
2
wscript
@ -3,7 +3,7 @@
|
||||
|
||||
# the following two variables are used by the target "waf dist"
|
||||
# if you change 'em here, you need to change it also in cloud.spec, add a %changelog entry there, and add an entry in debian/changelog
|
||||
VERSION = '3.0.3.2012-05-15T19:32:03Z'
|
||||
VERSION = '3.0.3.2012-05-18T01:05:37Z'
|
||||
APPNAME = 'cloud'
|
||||
|
||||
import shutil,os
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user