Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss

This commit is contained in:
Brian Federle 2011-11-11 14:20:36 -08:00
commit 972235ca61
47 changed files with 347 additions and 202 deletions

View File

@ -25,6 +25,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -45,9 +46,11 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID to add the provider to")
private Long physicalNetworkId;
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.DEST_PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the destination Physical Network ID to bridge to")
private Long destinationPhysicalNetworkId;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -43,6 +44,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.PlugService;
@ -50,9 +51,11 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName = "virtual_router_providers")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the virtual router provider")
private Long id;
@IdentityMapper(entityTableName = "physical_network_service_providers")
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, required=true, description="Enabled/Disabled the service provider")
private Boolean enabled;

View File

@ -95,6 +95,7 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="Access control type; supported values are account and domain. If not specified, defaulted to Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network")
private String aclType;
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID the network belongs to")
private Long physicalNetworkId;

View File

@ -25,6 +25,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -45,6 +46,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the physical network")
private Long zoneId;
@ -54,6 +56,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
@Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
private String speed;
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a physical network")
private Long domainId;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.PlugService;
@ -50,6 +51,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.LONG, required=true, description="the network service provider ID of the virtual router element")
@IdentityMapper(entityTableName="physical_network_service_providers")
private Long nspId;
/////////////////////////////////////////////////////

View File

@ -84,6 +84,7 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the network id")
private Long networkID;
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the physical network id")
private Long physicalNetworkId;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -41,7 +42,8 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network_service_providers")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network service provider")
private Long id;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -40,7 +41,7 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Physical network")
private Long id;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -39,7 +40,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network_traffic_types")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="traffic type id")
private Long id;

View File

@ -25,6 +25,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.ListResponse;
@ -42,6 +43,7 @@ public class ListNetworkServiceProvidersCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;

View File

@ -75,6 +75,7 @@ public class ListNetworksCmd extends BaseListCmd {
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list networks by project id")
private Long projectId;
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="list networks by physical network id")
private Long physicalNetworkId;

View File

@ -45,7 +45,7 @@ public class ListPhysicalNetworksCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_networks")
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list physical network by id")
private Long id;

View File

@ -77,6 +77,10 @@ public class ListPublicIpAddressesCmd extends BaseListCmd {
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list ips by project")
private Long projectId;
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="lists all public IP addresses by physical network id")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -116,6 +120,10 @@ public class ListPublicIpAddressesCmd extends BaseListCmd {
public Long getProjectId() {
return projectId;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////

View File

@ -25,6 +25,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.ListResponse;
@ -42,7 +43,7 @@ public class ListTrafficTypesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;

View File

@ -7,6 +7,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.PlugService;
@ -31,9 +32,11 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName = "virtual_router_providers")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list virtual router elements by id")
private Long id;
@IdentityMapper(entityTableName = "physical_network_service_providers")
@Parameter(name=ApiConstants.NSP_ID, type=CommandType.LONG, description="list virtual router elements by network service provider id")
private Long nspId;

View File

@ -27,7 +27,6 @@ import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.VlanIpRangeResponse;
import com.cloud.dc.Vlan;
@ -74,6 +73,10 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
@Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="true if VLAN is of Virtual type, false if Direct")
private Boolean forVirtualNetwork;
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="physical network id of the VLAN IP range")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -115,6 +118,10 @@ public class ListVlanIpRangesCmd extends BaseListCmd {
return projectId;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -25,6 +25,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -45,6 +46,7 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled/Shutdown the physical network service provider")
private String state;
@IdentityMapper(entityTableName="physical_network_service_providers")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="network service provider id")
private Long id;

View File

@ -25,6 +25,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -42,7 +43,7 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="physical network id")
private Long id;

View File

@ -23,6 +23,7 @@ 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.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
@ -41,6 +42,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_network_traffic_types")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="traffic type id")
private Long id;

View File

@ -88,6 +88,9 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
@SerializedName(ApiConstants.STATE) @Param(description="State of the ip address. Can be: Allocatin, Allocated and Releasing")
private String state;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
/*
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume")
@ -196,4 +199,12 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId.setValue(physicalNetworkId);
}
public long getphysicalNetworkId() {
return physicalNetworkId.getValue();
}
}

View File

@ -119,7 +119,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
private String networkDomain;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network id")
private Long physicalNetworkId;
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
@SerializedName(ApiConstants.ACL_TYPE) @Param(description="acl type - access type to the network")
private String aclType;
@ -248,7 +248,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
}
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
this.physicalNetworkId.setValue(physicalNetworkId);
}
public void setAclType(String aclType) {

View File

@ -25,10 +25,11 @@ import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class PhysicalNetworkResponse extends BaseResponse{
@SerializedName(ApiConstants.ID) @Param(description="the id of the physical network")
private IdentityProxy id = new IdentityProxy("physical_networks");
@SerializedName(ApiConstants.ID) @Param(description="the uuid of the physical network")
private String id;
@SerializedName(ApiConstants.BROADCAST_DOMAIN_RANGE) @Param(description="Broadcast domain range of the physical network")
private String broadcastDomainRange;
@ -43,7 +44,7 @@ public class PhysicalNetworkResponse extends BaseResponse{
private String vlan;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the physical network owner")
private Long domainId;
private IdentityProxy domainId = new IdentityProxy("domain");
@SerializedName(ApiConstants.TAGS) @Param(description="comma separated tag")
private String tags;
@ -54,8 +55,8 @@ public class PhysicalNetworkResponse extends BaseResponse{
@SerializedName(ApiConstants.NETWORK_SPEED) @Param(description="the speed of the physical network")
private String networkSpeed;
public void setId(long id) {
this.id.setValue(id);
public void setId(String uuid) {
this.id = uuid;
}
public void setZoneId(Long zoneId) {
@ -68,7 +69,7 @@ public class PhysicalNetworkResponse extends BaseResponse{
public void setDomainId(Long domainId) {
this.domainId = domainId;
this.domainId.setValue(domainId);
}
public void setVlan(String vlan) {

View File

@ -20,6 +20,7 @@ package com.cloud.api.response;
import java.util.List;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@ -30,16 +31,16 @@ public class ProviderResponse extends BaseResponse {
private String name;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private Long physicalNetworkId;
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
@SerializedName(ApiConstants.DEST_PHYSICAL_NETWORK_ID) @Param(description="the destination physical network")
private Long destinationPhysicalNetworkId;
private IdentityProxy destinationPhysicalNetworkId = new IdentityProxy("physical_network");
@SerializedName(ApiConstants.STATE) @Param(description="state of the network provider")
private String state;
@SerializedName(ApiConstants.ID) @Param(description="id of the network provider")
private Long id;
@SerializedName(ApiConstants.ID) @Param(description="uuid of the network provider")
private String id;
@SerializedName(ApiConstants.SERVICE_LIST) @Param(description="services for this provider")
private List<String> services;
@ -56,19 +57,19 @@ public class ProviderResponse extends BaseResponse {
}
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
this.physicalNetworkId.setValue(physicalNetworkId);
}
public long getphysicalNetworkId() {
return physicalNetworkId;
return physicalNetworkId.getValue();
}
public void setDestinationPhysicalNetworkId(long destPhysicalNetworkId) {
this.destinationPhysicalNetworkId = destPhysicalNetworkId;
this.destinationPhysicalNetworkId.setValue(destPhysicalNetworkId);
}
public long getDestinationPhysicalNetworkId() {
return destinationPhysicalNetworkId;
return destinationPhysicalNetworkId.getValue();
}
public void setState(String state) {
@ -79,11 +80,11 @@ public class ProviderResponse extends BaseResponse {
return this.state;
}
public void setId(Long id) {
public void setId(String uuid) {
this.id = id;
}
public Long getId() {
public String getId() {
return this.id;
}

View File

@ -18,6 +18,7 @@
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@ -25,13 +26,13 @@ import com.google.gson.annotations.SerializedName;
public class TrafficTypeResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="id of the network provider")
private Long id;
private String id;
@SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the trafficType to be added to the physical network")
private String trafficType;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private Long physicalNetworkId;
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
@SerializedName(ApiConstants.XEN_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a XenServer host")
private String xenNetworkLabel;
@ -43,18 +44,18 @@ public class TrafficTypeResponse extends BaseResponse {
private String vmwareNetworkLabel;
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
this.physicalNetworkId.setValue(physicalNetworkId);
}
public long getphysicalNetworkId() {
return physicalNetworkId;
return physicalNetworkId.getValue();
}
public void setId(Long id) {
this.id = id;
public void setId(String uuid) {
this.id = uuid;
}
public Long getId() {
public String getId() {
return this.id;
}

View File

@ -1,15 +1,16 @@
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class VirtualRouterProviderResponse extends BaseResponse implements ControlledEntityResponse {
@SerializedName(ApiConstants.ID) @Param(description="the id of the router")
private Long id;
private IdentityProxy id = new IdentityProxy("virtual_router_providers");
@SerializedName(ApiConstants.NSP_ID) @Param(description="the physical network service provider id of the provider")
private Long nspId;
private IdentityProxy nspId = new IdentityProxy("physical_network_service_providers");
@SerializedName(ApiConstants.ENABLED) @Param(description="Enabled/Disabled the service provider")
private Boolean enabled;
@ -35,11 +36,7 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
this.id.setValue(id);
}
@Override
@ -63,19 +60,10 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
}
public void setNspId(Long nspId) {
this.nspId = nspId;
}
public Long getNspId() {
return nspId;
this.nspId.setValue(nspId);
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Boolean getEnabled() {
return enabled;
}
}

View File

@ -76,7 +76,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
private String projectName;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private Long physicalNetworkId;
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
public void setId(Long id) {
this.id.setValue(id);
@ -149,10 +149,10 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
}
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
this.physicalNetworkId.setValue(physicalNetworkId);
}
public long getphysicalNetworkId() {
return physicalNetworkId;
return physicalNetworkId.getValue();
}
}

View File

@ -69,6 +69,8 @@ public interface IpAddress extends ControlledEntity {
Long getAssociatedWithVmId();
public Long getPhysicalNetworkId();
/**
* @return database id.
*/

View File

@ -65,4 +65,6 @@ public interface PhysicalNetwork {
String getSpeed();
String getUuid();
}

View File

@ -70,4 +70,6 @@ public interface PhysicalNetworkServiceProvider {
boolean isSecuritygroupServiceProvided();
List<Service> getEnabledServices();
String getUuid();
}

View File

@ -42,4 +42,6 @@ public interface PhysicalNetworkTrafficType {
String getKvmNetworkLabel();
String getVmwareNetworkLabel();
String getUuid();
}

View File

@ -86,7 +86,7 @@ import com.cloud.api.response.TemplateResponse;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.api.response.UserResponse;
import com.cloud.api.response.UserVmResponse;
import com.cloud.api.response.VirtualRouterProviderResponse;
import com.cloud.api.response.VirtualRouterProviderResponse;
import com.cloud.api.response.VlanIpRangeResponse;
import com.cloud.api.response.VolumeResponse;
import com.cloud.api.response.VpnUsersResponse;
@ -128,7 +128,7 @@ import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VpnUser;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
@ -708,6 +708,7 @@ public class ApiResponseHelper implements ResponseGenerator {
ipResponse.setNetworkId(networkId);
ipResponse.setState(ipAddress.getState().toString());
ipResponse.setPhysicalNetworkId(ipAddress.getPhysicalNetworkId());
// show this info to admin only
Account account = UserContext.current().getCaller();
@ -2773,7 +2774,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setNetworkSpeed(result.getSpeed());
response.setVlan(result.getVnet());
response.setDomainId(result.getDomainId());
response.setId(result.getId());
response.setId(result.getUuid());
if(result.getBroadcastDomainRange() != null){
response.setBroadcastDomainRange(result.getBroadcastDomainRange().toString());
}
@ -2829,7 +2830,7 @@ public class ApiResponseHelper implements ResponseGenerator {
@Override
public ProviderResponse createNetworkServiceProviderResponse(PhysicalNetworkServiceProvider result){
ProviderResponse response = new ProviderResponse();
response.setId(result.getId());
response.setId(result.getUuid());
response.setName(result.getProviderName());
response.setPhysicalNetworkId(result.getPhysicalNetworkId());
response.setDestinationPhysicalNetworkId(result.getDestinationPhysicalNetworkId());
@ -2849,7 +2850,7 @@ public class ApiResponseHelper implements ResponseGenerator {
@Override
public TrafficTypeResponse createTrafficTypeResponse(PhysicalNetworkTrafficType result) {
TrafficTypeResponse response = new TrafficTypeResponse();
response.setId(result.getId());
response.setId(result.getUuid());
response.setPhysicalNetworkId(result.getPhysicalNetworkId());
response.setTrafficType(result.getTrafficType().toString());
response.setXenLabel(result.getXenNetworkLabel());

View File

@ -2610,7 +2610,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
_accountMgr.checkAccess(callerAccount, null, network);
boolean success = restartNetwork(networkId, callerAccount, callerUser, null, cleanup);
boolean success = restartNetwork(networkId, callerAccount, callerUser, cleanup);
if (success) {
s_logger.debug("Network id=" + networkId + " is restarted successfully.");
@ -2641,7 +2641,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
}
private boolean restartNetwork(long networkId, Account callerAccount, User callerUser, Long newNetworkOfferingId, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
private boolean restartNetwork(long networkId, Account callerAccount, User callerUser, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
NetworkVO network = _networksDao.findById(networkId);
@ -2656,13 +2656,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
return false;
}
//Only after network was shutdown properly, change the network offering
if (newNetworkOfferingId != null) {
s_logger.debug("Updating network " + network + " with the new network offering id=" + newNetworkOfferingId + " as a part of network restart");
network.setNetworkOfferingId(newNetworkOfferingId);
_networksDao.update(networkId, network, finalizeServicesAndProvidersForNetwork(_configMgr.getNetworkOffering(newNetworkOfferingId), network.getPhysicalNetworkId()));
}
//implement the network elements and rules again
DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
@ -3332,31 +3325,43 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
//have to restart the network
restartNetwork = true;
}
//1) Shutdown all the elements and cleanup all the rules
ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount);
if (restartNetwork) {
s_logger.debug("Shutting down elements and resources for network id=" + networkId + " as a part of network update");
_networksDao.update(networkId, network);
boolean success = true;
if (restartNetwork && (network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup)) {
//network offering id will be updated in the restartNetowrk call aftet the network elements are shutdown properly
s_logger.info("Restarting network " + network + " as a part of update network call");
try {
success = restartNetwork(networkId, callerAccount, callerUser, networkOfferingId, true);
} catch (Exception e) {
success = false;
if (!shutdownNetworkElementsAndResources(context, true, network)) {
s_logger.warn("Failed to shutdown the network elements and resources as a part of network restart: " + network.getState());
throw new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of network restart: " + network.getState());
}
if (success) {
s_logger.debug("Successully restarted the network " + network + " as a part of updateNetwork call");
} else {
s_logger.warn("Failed to restart the network " + network + " as a part of updateNetwork call");
}
} else if (networkOfferingId != null) {
network.setNetworkOfferingId(networkOfferingId);
_networksDao.update(networkId, network, finalizeServicesAndProvidersForNetwork(_configMgr.getNetworkOffering(networkOfferingId), network.getPhysicalNetworkId()));
}
return network;
//2) Only after all the elements and rules are shutdown properly, update the network VO
if (networkOfferingId != null) {
network.setNetworkOfferingId(networkOfferingId);
_networksDao.update(networkId, network, finalizeServicesAndProvidersForNetwork(_configMgr.getNetworkOffering(networkOfferingId), network.getPhysicalNetworkId()));
} else {
_networksDao.update(networkId, network);
}
//get updated network
network = _networksDao.findById(networkId);
//3) Implement the elements and rules again
if (restartNetwork) {
DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
s_logger.debug("Implementing the network " + network + " elements and resources as a part of network update");
try {
implementNetworkElementsAndResources(dest, context, network, _networkOfferingDao.findById(network.getNetworkOfferingId()));
} catch (Exception ex) {
s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network update due to ", ex);
throw new CloudRuntimeException("Failed to implement network " + network + " elements and resources as a part of network update");
}
}
return getNetwork(network.getId());
}
@Override

View File

@ -20,6 +20,7 @@ package com.cloud.network;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
@ -47,6 +48,9 @@ public class PhysicalNetworkVO implements PhysicalNetwork {
@TableGenerator(name="physical_networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="physical_networks_seq", allocationSize=1)
@Column(name="id")
long id;
@Column(name="uuid")
private String uuid;
@Column(name="data_center_id")
long dataCenterId;
@ -99,6 +103,7 @@ public class PhysicalNetworkVO implements PhysicalNetwork {
this.broadcastDomainRange = BroadcastDomainRange.ZONE;
}
this.state = State.Disabled;
this.uuid = UUID.randomUUID().toString();
}
@Override
@ -203,5 +208,14 @@ public class PhysicalNetworkVO implements PhysicalNetwork {
@Override
public String getSpeed() {
return speed;
}
}
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -19,6 +19,7 @@ package com.cloud.network.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -39,6 +40,9 @@ public class PhysicalNetworkServiceProviderVO implements PhysicalNetworkServiceP
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name="uuid")
private String uuid;
@Column(name = "physical_network_id")
private long physicalNetworkId;
@ -94,6 +98,7 @@ public class PhysicalNetworkServiceProviderVO implements PhysicalNetworkServiceP
this.physicalNetworkId = physicalNetworkId;
this.providerName = name;
this.state = State.Disabled;
this.uuid = UUID.randomUUID().toString();
}
@Override
@ -228,6 +233,15 @@ public class PhysicalNetworkServiceProviderVO implements PhysicalNetworkServiceP
this.securitygroupServiceProvided = securitygroupServiceProvided;
}
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public void setEnabledServices(List<Service> services){
this.setVpnServiceProvided(services.contains(Service.Vpn));
this.setDhcpServiceProvided(services.contains(Service.Dhcp));

View File

@ -17,6 +17,8 @@
*/
package com.cloud.network.dao;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@ -36,6 +38,9 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name="uuid")
private String uuid;
@Column(name = "physical_network_id")
private long physicalNetworkId;
@ -66,6 +71,7 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType
this.kvmNetworkLabel = kvmLabel;
this.vmwareNetworkLabel = vmwareLabel;
this.setVlan(vlan);
this.uuid = UUID.randomUUID().toString();
}
@Override
@ -116,6 +122,15 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType
public String getVlan() {
return vlan;
}
}
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -371,7 +371,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
if (routers == null || routers.isEmpty()) {
s_logger.trace("Can't find dhcp element in network " + network.getId());
s_logger.debug("Can't find virtual router element in network " + network.getId());
return true;
}
@ -390,7 +390,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
public VirtualRouterProvider configure(ConfigureVirtualRouterElementCmd cmd) {
VirtualRouterProviderVO element = _vrProviderDao.findById(cmd.getId());
if (element == null) {
s_logger.trace("Can't find element with network service provider id " + cmd.getId());
s_logger.debug("Can't find element with network service provider id " + cmd.getId());
return null;
}
@ -404,10 +404,10 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
public VirtualRouterProvider addElement(Long nspId) {
VirtualRouterProviderVO element = _vrProviderDao.findByNspIdAndType(nspId, VirtualRouterProviderType.VirtualRouter);
if (element != null) {
s_logger.trace("There is already a virtual router element with service provider id " + nspId);
s_logger.debug("There is already a virtual router element with service provider id " + nspId);
return null;
}
element = new VirtualRouterProviderVO(nspId, null, VirtualRouterProviderType.VirtualRouter);
element = new VirtualRouterProviderVO(nspId, VirtualRouterProviderType.VirtualRouter);
_vrProviderDao.persist(element);
return element;
}

View File

@ -18,6 +18,7 @@
package com.cloud.network.element;
import java.util.Date;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -56,12 +57,13 @@ public class VirtualRouterProviderVO implements VirtualRouterProvider {
Date removed;
public VirtualRouterProviderVO() {
this.uuid = UUID.randomUUID().toString();
}
public VirtualRouterProviderVO(long nspId, String uuid, VirtualRouterProviderType type) {
public VirtualRouterProviderVO(long nspId, VirtualRouterProviderType type) {
this.nspId = nspId;
this.uuid = uuid;
this.type = type;
this.uuid = UUID.randomUUID().toString();
}
@Override

View File

@ -1156,8 +1156,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (publicNetwork) {
routers = _routerDao.listByNetworkAndRole(guestNetwork.getId(), Role.VIRTUAL_ROUTER);
} else {
Long podId = dest.getPod().getId();
if (isPodBased) {
Long podId = dest.getPod().getId();
routers = _routerDao.listByNetworkAndPodAndRole(guestNetwork.getId(), podId, Role.VIRTUAL_ROUTER);
plan = new DataCenterDeployment(dcId, podId, null, null, null, null);
} else {

View File

@ -1147,6 +1147,7 @@ public class ManagementServerImpl implements ManagementServer {
Boolean forVirtual = cmd.getForVirtualNetwork();
String vlanType = null;
Long projectId = cmd.getProjectId();
Long physicalNetworkId = cmd.getPhysicalNetworkId();
if (accountName != null && domainId != null) {
if (projectId != null) {
@ -1192,6 +1193,7 @@ public class ManagementServerImpl implements ManagementServer {
sb.and("vlan", sb.entity().getVlanTag(), SearchCriteria.Op.EQ);
sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ);
sb.and("vlanType", sb.entity().getVlanType(), SearchCriteria.Op.EQ);
sb.and("physicalNetworkId", sb.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
if (accountId != null) {
SearchBuilder<AccountVlanMapVO> accountVlanMapSearch = _accountVlanMapDao.createSearchBuilder();
@ -1238,6 +1240,10 @@ public class ManagementServerImpl implements ManagementServer {
if (vlanType != null) {
sc.setParameters("vlanType", vlanType);
}
if (physicalNetworkId != null) {
sc.setParameters("physicalNetworkId", physicalNetworkId);
}
}
return _vlanDao.search(sc, searchFilter);
@ -2038,6 +2044,7 @@ public class ManagementServerImpl implements ManagementServer {
String accountName = cmd.getAccountName();
Object keyword = cmd.getKeyword();
Long projectId = cmd.getProjectId();
Long physicalNetworkId = cmd.getPhysicalNetworkId();
List<Long> permittedAccounts = new ArrayList<Long>();
@ -2107,6 +2114,7 @@ public class ManagementServerImpl implements ManagementServer {
sb.and("address", sb.entity().getAddress(), SearchCriteria.Op.EQ);
sb.and("vlanDbId", sb.entity().getVlanId(), SearchCriteria.Op.EQ);
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("physicalNetworkId", sb.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
if ((permittedAccounts.isEmpty()) && (domainId != null)) {
// if accountId isn't specified, we can do a domain match for the admin case
@ -2169,6 +2177,10 @@ public class ManagementServerImpl implements ManagementServer {
if (vlan != null) {
sc.setParameters("vlanDbId", vlan);
}
if (physicalNetworkId != null) {
sc.setParameters("physicalNetworkId", physicalNetworkId);
}
return _publicIpAddressDao.search(sc, searchFilter);
}

View File

@ -1,8 +1,6 @@
package com.cloud.agent;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
@ -12,24 +10,13 @@ import com.cloud.agent.api.Command;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.manager.AgentAttache;
import com.cloud.agent.manager.Commands;
import com.cloud.api.commands.UpdateHostPasswordCmd;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
import com.cloud.dc.PodCluster;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.ConnectionException;
import com.cloud.exception.OperationTimedoutException;
import com.cloud.host.Host;
import com.cloud.host.Host.Type;
import com.cloud.host.HostStats;
import com.cloud.host.HostVO;
import com.cloud.host.Status.Event;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.resource.ServerResource;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.User;
import com.cloud.utils.Pair;
@Local(value = { AgentManager.class })
public class MockAgentManagerImpl implements AgentManager {
@ -102,7 +89,7 @@ public class MockAgentManagerImpl implements AgentManager {
@Override
public void unregisterForHostEvents(int id) {
// TODO Auto-generated method stub
}
@Override
@ -133,46 +120,52 @@ public class MockAgentManagerImpl implements AgentManager {
return null;
}
@Override
@Override
public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
// TODO Auto-generated method stub
return false;
// TODO Auto-generated method stub
return false;
}
@Override
@Override
public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException {
// TODO Auto-generated method stub
return null;
// TODO Auto-generated method stub
return null;
}
@Override
@Override
public boolean agentStatusTransitTo(HostVO host, Event e, long msId) {
// TODO Auto-generated method stub
return false;
// TODO Auto-generated method stub
return false;
}
@Override
@Override
public AgentAttache findAttache(long hostId) {
// TODO Auto-generated method stub
return null;
// TODO Auto-generated method stub
return null;
}
@Override
@Override
public void pullAgentToMaintenance(long hostId) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
@Override
@Override
public void disconnectWithoutInvestigation(long hostId, Event event) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
@Override
@Override
public void pullAgentOutMaintenance(long hostId) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
@Override
public Answer sendToSSVM(Long dcId, Command cmd) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -168,7 +168,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
return null;
}
@Override
public PublicIp assignSourceNatIpAddress(Account owner, Network network, long callerId) throws ConcurrentOperationException, InsufficientAddressCapacityException {
@ -216,7 +216,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
@Override
public void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
ResourceUnavailableException {
ResourceUnavailableException {
// TODO Auto-generated method stub
}
@ -277,7 +277,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
@Override
public Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException {
InsufficientCapacityException {
// TODO Auto-generated method stub
return null;
}
@ -315,7 +315,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
@Override
public boolean associateIpAddressListToAccount(long userId, long accountId, long zoneId, Long vlanId, Network networkToAssociateWith) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
ConcurrentOperationException, ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@ -433,12 +433,12 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
// TODO Auto-generated method stub
return null;
}
@Override
public Map<String, Set<String>> listNetworkOfferingServices(long networkOfferingId) {
return null;
}
@Override
public List<? extends RemoteAccessVPNServiceProvider> getRemoteAccessVpnElements() {
return null;
@ -570,17 +570,17 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
return null;
}
@Override
@Override
public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException {
// TODO Auto-generated method stub
return false;
InsufficientCapacityException {
// TODO Auto-generated method stub
return false;
}
@Override
@Override
public Long getPodIdForVlan(long vlanDbId) {
// TODO Auto-generated method stub
return null;
// TODO Auto-generated method stub
return null;
}
@Override
@ -708,4 +708,10 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
// TODO Auto-generated method stub
return false;
}
@Override
public Long getPhysicalNetworkId(Network network) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -23,12 +23,6 @@ import com.cloud.utils.component.Manager;
@Local(value = { AccountManager.class, AccountService.class })
public class MockAccountManagerImpl implements Manager, AccountManager {
@Override
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean deleteUserAccount(long accountId) {
// TODO Auto-generated method stub
@ -229,45 +223,53 @@ public class MockAccountManagerImpl implements Manager, AccountManager {
public void checkAccess(Account account, AccessType accessType, ControlledEntity... entities) throws PermissionDeniedException {
// TODO Auto-generated method stub
}
@Override
public void logoutUser(Long userId) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
@Override
public UserAccount getUserAccount(String username, Long domainId) {
return null;
}
@Override
public UserAccount authenticateUser(String username, String password, Long domainId, Map<String, Object[]> requestParameters) {
return null;
}
@Override
public Pair<User, Account> findUserByApiKey(String apiKey) {
return null;
}
@Override
public UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone) {
return null;
}
@Override
public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain) {
return null;
}
@Override
public String[] createApiKeyAndSecretKey(RegisterCmd cmd) {
return null;
}
@Override
public boolean lockAccount(long accountId) {
return true;
}
@Override
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
Map details) {
// TODO Auto-generated method stub
return null;
}
@Override
public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map details) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -10,6 +10,7 @@ import javax.naming.ConfigurationException;
import com.cloud.agent.api.StopAnswer;
import com.cloud.agent.api.VmStatsEntry;
import com.cloud.agent.manager.Commands;
import com.cloud.api.commands.AssignVMCmd;
import com.cloud.api.commands.AttachVolumeCmd;
import com.cloud.api.commands.CreateTemplateCmd;
import com.cloud.api.commands.CreateVMGroupCmd;
@ -18,10 +19,10 @@ import com.cloud.api.commands.DeployVMCmd;
import com.cloud.api.commands.DestroyVMCmd;
import com.cloud.api.commands.DetachVolumeCmd;
import com.cloud.api.commands.ListVMsCmd;
import com.cloud.api.commands.MoveUserVMCmd;
import com.cloud.api.commands.RebootVMCmd;
import com.cloud.api.commands.RecoverVMCmd;
import com.cloud.api.commands.ResetVMPasswordCmd;
import com.cloud.api.commands.RestoreVMCmd;
import com.cloud.api.commands.StartVMCmd;
import com.cloud.api.commands.UpdateVMCmd;
import com.cloud.api.commands.UpgradeVMCmd;
@ -38,6 +39,7 @@ import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.offering.ServiceOffering;
import com.cloud.server.Criteria;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
@ -234,7 +236,7 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
@Override
public UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException, ResourceAllocationException {
InsufficientCapacityException, ResourceAllocationException {
// TODO Auto-generated method stub
return null;
}
@ -269,7 +271,7 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
return null;
}
@Override
public UserVm startVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
@ -310,7 +312,7 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
@Override
public void deletePrivateTemplateRecord(Long templateId) {
// TODO Auto-generated method stub
}
@Override
@ -327,7 +329,7 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
@Override
public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, StorageUnavailableException,
ResourceAllocationException {
ResourceAllocationException {
// TODO Auto-generated method stub
return null;
}
@ -365,14 +367,26 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
}
@Override
public UserVm moveVMToUser(MoveUserVMCmd moveUserVMCmd) throws ResourceAllocationException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
VirtualMachineMigrationException {
// TODO Auto-generated method stub
return null;
}
@Override
public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
VirtualMachineMigrationException {
public UserVm moveVMToUser(AssignVMCmd moveUserVMCmd) throws ResourceAllocationException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
// TODO Auto-generated method stub
return null;
}
@Override
public VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool) {
// TODO Auto-generated method stub
return null;
}
@Override
public UserVm restoreVM(RestoreVMCmd cmd) {
// TODO Auto-generated method stub
return null;
}

View File

@ -21,6 +21,7 @@ import com.cloud.network.NetworkVO;
import com.cloud.offering.ServiceOffering;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VMTemplateVO;
import com.cloud.user.Account;
import com.cloud.user.User;
@ -82,7 +83,7 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager {
@Override
public <T extends VMInstanceVO> boolean advanceStop(T vm, boolean forced, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException,
ConcurrentOperationException {
ConcurrentOperationException {
// TODO Auto-generated method stub
return false;
}
@ -113,7 +114,7 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager {
@Override
public <T extends VMInstanceVO> T migrate(T vm, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
VirtualMachineMigrationException {
VirtualMachineMigrationException {
// TODO Auto-generated method stub
return null;
}
@ -133,7 +134,7 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager {
@Override
public <T extends VMInstanceVO> T allocate(T vm, VMTemplateVO template, ServiceOfferingVO serviceOffering, Pair<? extends DiskOfferingVO, Long> rootDiskOffering,
List<Pair<DiskOfferingVO, Long>> dataDiskOfferings, List<Pair<NetworkVO, NicProfile>> networks, Map<Param, Object> params, DeploymentPlan plan, HypervisorType hyperType, Account owner)
throws InsufficientCapacityException {
throws InsufficientCapacityException {
// TODO Auto-generated method stub
return null;
}
@ -160,21 +161,21 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager {
@Override
public <T extends VMInstanceVO> T start(T vm, Map<Param, Object> params, User caller, Account account, DeploymentPlan planToDeploy) throws InsufficientCapacityException,
ResourceUnavailableException {
ResourceUnavailableException {
// TODO Auto-generated method stub
return null;
}
@Override
public <T extends VMInstanceVO> T advanceStart(T vm, Map<Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException,
ConcurrentOperationException, OperationTimedoutException {
ConcurrentOperationException, OperationTimedoutException {
// TODO Auto-generated method stub
return null;
}
@Override
public <T extends VMInstanceVO> T advanceStart(T vm, Map<Param, Object> params, User caller, Account account, DeploymentPlan planToDeploy) throws InsufficientCapacityException,
ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException {
ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException {
// TODO Auto-generated method stub
return null;
}
@ -187,7 +188,7 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager {
@Override
public <T extends VMInstanceVO> T advanceReboot(T vm, Map<Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException,
ConcurrentOperationException, OperationTimedoutException {
ConcurrentOperationException, OperationTimedoutException {
// TODO Auto-generated method stub
return null;
}
@ -198,10 +199,10 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager {
return null;
}
@Override
public VMInstanceVO findById(long vmId) {
// TODO Auto-generated method stub
return null;
@Override
public <T extends VMInstanceVO> T storageMigration(T vm, StoragePool storagePoolId) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -118,6 +118,10 @@ DROP TABLE IF EXISTS `cloud`.`network_tags`;
DROP TABLE IF EXISTS `cloud`.`op_host_transfer`;
DROP TABLE IF EXISTS `cloud`.`projects`;
DROP TABLE IF EXISTS `cloud`.`physical_network`;
DROP TABLE IF EXISTS `cloud`.`physical_network_tags`;
DROP TABLE IF EXISTS `cloud`.`physical_network_isolation_methods`;
DROP TABLE IF EXISTS `cloud`.`physical_network_traffic_types`;
DROP TABLE IF EXISTS `cloud`.`physical_network_service_providers`;
DROP TABLE IF EXISTS `cloud`.`virtual_router_elements`;
CREATE TABLE `cloud`.`version` (
@ -458,10 +462,9 @@ CREATE TABLE `cloud`.`vlan` (
`network_id` bigint unsigned NOT NULL COMMENT 'id of corresponding network offering',
`physical_network_id` bigint unsigned NOT NULL COMMENT 'physical network id that this configuration is based on',
PRIMARY KEY (`id`),
CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
#CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
CONSTRAINT `fk_vlan__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`),
CONSTRAINT `uc_vlan__uuid` UNIQUE (`uuid`),
#CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
CONSTRAINT `fk_vlan__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1851,6 +1854,7 @@ CREATE TABLE `ntwk_service_map` (
CREATE TABLE `cloud`.`physical_network` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(40),
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center id that this physical network belongs to',
`vnet` varchar(255),
`speed` varchar(32),
@ -1862,6 +1866,7 @@ CREATE TABLE `cloud`.`physical_network` (
PRIMARY KEY (`id`),
CONSTRAINT `fk_physical_network__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_physical_network__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`),
CONSTRAINT `uc_physical_networks__uuid` UNIQUE (`uuid`),
INDEX `i_physical_network__removed`(`removed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1885,6 +1890,7 @@ CREATE TABLE `cloud`.`physical_network_isolation_methods` (
CREATE TABLE `cloud`.`physical_network_traffic_types` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(40),
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network',
`traffic_type` varchar(32) NOT NULL COMMENT 'type of traffic going through this network',
`xen_network_label` varchar(255) COMMENT 'The network name label of the physical device dedicated to this traffic on a XenServer host',
@ -1893,11 +1899,13 @@ CREATE TABLE `cloud`.`physical_network_traffic_types` (
`vlan` varchar(255) COMMENT 'The vlan tag to be sent down to a VMware host',
PRIMARY KEY (`id`),
CONSTRAINT `fk_physical_network_traffic_types__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE,
CONSTRAINT `uc_traffic_types__uuid` UNIQUE (`uuid`),
UNIQUE KEY(`physical_network_id`, `traffic_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`physical_network_service_providers` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(40),
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network',
`provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name',
`state` varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'provider state',
@ -1914,7 +1922,8 @@ CREATE TABLE `cloud`.`physical_network_service_providers` (
`user_data_service_provided` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is UserData service provided',
`security_group_service_provided` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is SG service provided',
PRIMARY KEY (`id`),
CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE,
CONSTRAINT `uc_service_providers__uuid` UNIQUE (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`external_load_balancer_devices` (
@ -1974,12 +1983,13 @@ CREATE TABLE `cloud`.`network_external_firewall_device_map` (
CREATE TABLE `cloud`.`virtual_router_providers` (
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
`nsp_id` bigint unsigned NOT NULL COMMENT 'Network Service Provider ID',
`uuid` varchar(255) UNIQUE,
`uuid` varchar(40),
`type` varchar(255) NOT NULL COMMENT 'Virtual router, or ElbVM',
`enabled` int(1) NOT NULL COMMENT 'Enabled or disabled',
`removed` datetime COMMENT 'date removed if not null',
PRIMARY KEY (`id`),
CONSTRAINT `fk_virtual_router_providers__nsp_id` FOREIGN KEY (`nsp_id`) REFERENCES `physical_network_service_providers` (`id`) ON DELETE CASCADE
CONSTRAINT `fk_virtual_router_providers__nsp_id` FOREIGN KEY (`nsp_id`) REFERENCES `physical_network_service_providers` (`id`) ON DELETE CASCADE,
CONSTRAINT `uc_virtual_router_providers__uuid` UNIQUE (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET foreign_key_checks = 1;

View File

@ -38,37 +38,37 @@ import com.cloud.utils.db.GenericDao;
*/
public class MockComponentLocator extends ComponentLocator {
MockComponentLibrary _library = new MockComponentLibrary();
public MockComponentLocator(String server) {
super(server);
}
public ComponentInfo<? extends GenericDao<?, ? extends Serializable>> addDao(String name, Class<? extends GenericDao<?, ? extends Serializable>> dao) {
return _library.addDao(name, dao);
}
public ComponentInfo<Manager> addManager(String name, Class<? extends Manager> manager) {
return _library.addManager(name, manager);
}
public <T> ComponentInfo<Adapter> addOneAdapter(Class<T> interphace, String name, Class<? extends T> adapterClass) {
return _library.addOneAdapter(interphace, name, adapterClass);
}
public <T> List<ComponentInfo<Adapter>> addAdapterChain(Class<T> interphace, List<Pair<String, Class<? extends T>>> adapters) {
return _library.addAdapterChain(interphace, adapters);
}
public <T> ComponentInfo<PluggableService> addService(String name, Class<T> serviceInterphace, Class<? extends PluggableService> service) {
return _library.addService(name, serviceInterphace, service);
}
@Override
protected Pair<XmlHandler, HashMap<String, List<ComponentInfo<Adapter>>>> parse2(String filename) {
Pair<XmlHandler, HashMap<String, List<ComponentInfo<Adapter>>>> result = new Pair<XmlHandler, HashMap<String, List<ComponentInfo<Adapter>>>>(new XmlHandler("fake"), new HashMap<String, List<ComponentInfo<Adapter>>>());
_daoMap = new LinkedHashMap<String, ComponentInfo<GenericDao<?, ? extends Serializable>>>();
_managerMap = new LinkedHashMap<String, ComponentInfo<Manager>>();
_checkerMap = new HashMap<String, ComponentInfo<SystemIntegrityChecker>>();
_checkerMap = new LinkedHashMap<String, ComponentInfo<SystemIntegrityChecker>>();
_adapterMap = new HashMap<String, Adapters<? extends Adapter>>();
_factories = new HashMap<Class<?>, Class<?>>();
_daoMap.putAll(_library.getDaos());
@ -77,7 +77,7 @@ public class MockComponentLocator extends ComponentLocator {
_factories.putAll(_library.getFactories());
return result;
}
public void makeActive(InterceptorLibrary interceptors) {
s_singletons.clear();
s_locators.clear();
@ -86,24 +86,24 @@ public class MockComponentLocator extends ComponentLocator {
s_callbackFilter = new DatabaseCallbackFilter();
s_interceptors.clear();
if (interceptors != null) {
resetInterceptors(interceptors);
resetInterceptors(interceptors);
}
s_tl.set(this);
parse("fake file");
}
protected class MockComponentLibrary extends ComponentLibraryBase implements ComponentLibrary {
@Override
public Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
return _adapters;
}
@Override
public Map<Class<?>, Class<?>> getFactories() {
return new HashMap<Class<?>, Class<?>>();
}
@Override
public Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
return _daos;
@ -116,7 +116,7 @@ public class MockComponentLocator extends ComponentLocator {
@Override
public Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
return _pluggableServices;
return _pluggableServices;
}
}
}