mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' into ui-cisco-asa1000v-support
This commit is contained in:
commit
2ac22efc5e
|
|
@ -26,6 +26,7 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
}
|
||||
|
||||
public static final String defaultVPCOfferingName = "Default VPC offering";
|
||||
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ import com.vmware.vim25.ClusterDasConfigInfo;
|
|||
import com.vmware.vim25.ComputeResourceSummary;
|
||||
import com.vmware.vim25.DatastoreSummary;
|
||||
import com.vmware.vim25.DynamicProperty;
|
||||
import com.vmware.vim25.GuestInfo;
|
||||
import com.vmware.vim25.HostCapability;
|
||||
import com.vmware.vim25.HostFirewallInfo;
|
||||
import com.vmware.vim25.HostFirewallRuleset;
|
||||
|
|
@ -1326,6 +1327,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
if(!isVMWareToolsInstalled(vmMo)){
|
||||
String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
|
||||
s_logger.debug(errMsg);
|
||||
return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
|
||||
}
|
||||
|
||||
// TODO need a way to specify the control of NIC device type
|
||||
VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
|
||||
|
||||
|
|
@ -1400,6 +1407,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
if(!isVMWareToolsInstalled(vmMo)){
|
||||
String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
|
||||
s_logger.debug(errMsg);
|
||||
return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
|
||||
}
|
||||
|
||||
VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac());
|
||||
if ( nic == null ) {
|
||||
return new UnPlugNicAnswer(cmd, true, "success");
|
||||
|
|
@ -5237,4 +5250,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private boolean isVMWareToolsInstalled(VirtualMachineMO vmMo) throws Exception{
|
||||
GuestInfo guestInfo = vmMo.getVmGuestInfo();
|
||||
return (guestInfo != null && guestInfo.getGuestState() != null && guestInfo.getGuestState().equalsIgnoreCase("running"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,8 +427,11 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
prodVersion = prodVersion.trim();
|
||||
}
|
||||
|
||||
if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") || prodVersion.startsWith("1.6")))
|
||||
return new XcpServerResource();
|
||||
if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) {
|
||||
return new XcpServerResource("1.1");
|
||||
} else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
|
||||
return new XcpServerResource("1.6");
|
||||
}
|
||||
|
||||
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
|
||||
return new XenServer56Resource();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
|
|||
public class CitrixHelper {
|
||||
private static final Logger s_logger = Logger.getLogger(CitrixHelper.class);
|
||||
private static final HashMap<String, String> _xcp100GuestOsMap = new HashMap<String, String>(70);
|
||||
private static final HashMap<String, String> _xcp160GuestOsMap = new HashMap<String, String>(70);
|
||||
private static final HashMap<String, String> _xenServerGuestOsMap = new HashMap<String, String>(70);
|
||||
private static final HashMap<String, String> _xenServer56FP1GuestOsMap = new HashMap<String, String>(70);
|
||||
private static final HashMap<String, String> _xenServer56FP2GuestOsMap = new HashMap<String, String>(70);
|
||||
|
|
@ -114,6 +115,83 @@ public class CitrixHelper {
|
|||
_xcp100GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
|
||||
}
|
||||
|
||||
static {
|
||||
_xcp160GuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.5 (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("CentOS 5.5 (64-bit)", "CentOS 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Debian GNU/Linux 6(32-bit)", "Debian Squeeze 6.0 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Debian GNU/Linux 6(64-bit)", "Debian Squeeze 6.0 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.5 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Oracle Enterprise Linux 5.5 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (32-bit)", "SUSE Linux Enterprise Server 11 SP1 (32-bit)");
|
||||
_xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (64-bit)", "SUSE Linux Enterprise Server 11 SP1 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Windows 7 (32-bit)", "Windows 7 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Windows 7 (64-bit)", "Windows 7 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)");
|
||||
_xcp160GuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Windows Vista (32-bit)", "Windows Vista (32-bit)");
|
||||
_xcp160GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit) (experimental)");
|
||||
_xcp160GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit) (experimental)");
|
||||
_xcp160GuestOsMap.put("Other Linux (32-bit)", "Other install media");
|
||||
_xcp160GuestOsMap.put("Other Linux (64-bit)", "Other install media");
|
||||
_xcp160GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)");
|
||||
_xcp160GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
_xenServerGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)");
|
||||
|
|
@ -694,6 +772,15 @@ public class CitrixHelper {
|
|||
return guestOS;
|
||||
}
|
||||
|
||||
public static String getXcp160GuestOsType(String stdType) {
|
||||
String guestOS = _xcp160GuestOsMap.get(stdType);
|
||||
if (guestOS == null) {
|
||||
s_logger.debug("Can't find the guest os: " + stdType + " mapping into XCP's guestOS type, start it as HVM guest");
|
||||
guestOS = "Other install media";
|
||||
}
|
||||
return guestOS;
|
||||
}
|
||||
|
||||
|
||||
public static String getXenServerGuestOsType(String stdType, boolean bootFromCD) {
|
||||
String guestOS = _xenServerGuestOsMap.get(stdType);
|
||||
|
|
|
|||
|
|
@ -39,9 +39,10 @@ import com.xensource.xenapi.Types.XenAPIException;
|
|||
@Local(value=ServerResource.class)
|
||||
public class XcpServerResource extends CitrixResourceBase {
|
||||
private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
|
||||
|
||||
public XcpServerResource() {
|
||||
private String version;
|
||||
public XcpServerResource(String version) {
|
||||
super();
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -55,7 +56,11 @@ public class XcpServerResource extends CitrixResourceBase {
|
|||
|
||||
@Override
|
||||
protected String getGuestOsType(String stdType, boolean bootFromCD) {
|
||||
return CitrixHelper.getXcpGuestOsType(stdType);
|
||||
if (version.equalsIgnoreCase("1.6")) {
|
||||
return CitrixHelper.getXcp160GuestOsType(stdType);
|
||||
} else {
|
||||
return CitrixHelper.getXcpGuestOsType(stdType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd {
|
|||
if (ciscoAsa1000vDevices != null && !ciscoAsa1000vDevices.isEmpty()) {
|
||||
for (CiscoAsa1000vDevice ciscoAsa1000vDeviceVO : ciscoAsa1000vDevices) {
|
||||
CiscoAsa1000vResourceResponse ciscoAsa1000vResourceResponse = _ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000vDeviceVO);
|
||||
ciscoAsa1000vResourceResponse.setObjectName("CiscoAsa1000vResource");
|
||||
ciscoAsa1000vResourcesResponse.add(ciscoAsa1000vResourceResponse);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,18 +77,19 @@ public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
|
|||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
|
||||
try {
|
||||
List<CiscoVnmcControllerVO> CiscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
|
||||
List<CiscoVnmcControllerVO> ciscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
|
||||
ListResponse<CiscoVnmcResourceResponse> response = new ListResponse<CiscoVnmcResourceResponse>();
|
||||
List<CiscoVnmcResourceResponse> CiscoVnmcResourcesResponse = new ArrayList<CiscoVnmcResourceResponse>();
|
||||
List<CiscoVnmcResourceResponse> ciscoVnmcResourcesResponse = new ArrayList<CiscoVnmcResourceResponse>();
|
||||
|
||||
if (CiscoVnmcResources != null && !CiscoVnmcResources.isEmpty()) {
|
||||
for (CiscoVnmcController CiscoVnmcResourceVO : CiscoVnmcResources) {
|
||||
CiscoVnmcResourceResponse CiscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(CiscoVnmcResourceVO);
|
||||
CiscoVnmcResourcesResponse.add(CiscoVnmcResourceResponse);
|
||||
if (ciscoVnmcResources != null && !ciscoVnmcResources.isEmpty()) {
|
||||
for (CiscoVnmcController ciscoVnmcResourceVO : ciscoVnmcResources) {
|
||||
CiscoVnmcResourceResponse ciscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(ciscoVnmcResourceVO);
|
||||
ciscoVnmcResourceResponse.setObjectName("CiscoVnmcResource");
|
||||
ciscoVnmcResourcesResponse.add(ciscoVnmcResourceResponse);
|
||||
}
|
||||
}
|
||||
|
||||
response.setResponses(CiscoVnmcResourcesResponse);
|
||||
response.setResponses(ciscoVnmcResourcesResponse);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} catch (InvalidParameterValueException invalidParamExcp) {
|
||||
|
|
|
|||
|
|
@ -29,60 +29,69 @@ import com.google.gson.annotations.SerializedName;
|
|||
|
||||
@EntityReference(value = CiscoAsa1000vDevice.class)
|
||||
public class CiscoAsa1000vResourceResponse extends BaseResponse {
|
||||
public static final String RESOURCE_NAME = "resourcename";
|
||||
|
||||
@SerializedName(ApiConstants.RESOURCE_ID) @Parameter(description="resource id of the Cisco ASA 1000v appliance")
|
||||
@SerializedName(ApiConstants.RESOURCE_ID)
|
||||
@Parameter(description="resource id of the Cisco ASA 1000v appliance")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
|
||||
@Parameter(description="the physical network to which this ASA 1000v belongs to", entityType = PhysicalNetworkResponse.class)
|
||||
private Long physicalNetworkId ;
|
||||
|
||||
public Long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
}
|
||||
private Long physicalNetworkId;
|
||||
|
||||
@SerializedName(ApiConstants.HOST_NAME)
|
||||
@Parameter(description="management ip address of ASA 1000v")
|
||||
private String managementIp;
|
||||
|
||||
public String getManagementIp() {
|
||||
return managementIp;
|
||||
}
|
||||
|
||||
@SerializedName(ApiConstants.ASA_INSIDE_PORT_PROFILE)
|
||||
@Parameter(description="management ip address of ASA 1000v")
|
||||
@Parameter(description="port profile associated with inside interface of ASA 1000v")
|
||||
private String inPortProfile;
|
||||
|
||||
public String getInPortProfile() {
|
||||
return inPortProfile;
|
||||
}
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK_ID)
|
||||
@Parameter(description="the guest network to which ASA 1000v is associated", entityType = NetworkResponse.class)
|
||||
private Long guestNetworkId;
|
||||
|
||||
public Long getGuestNetworkId() {
|
||||
return guestNetworkId;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String ciscoAsa1000vResourceId) {
|
||||
this.id = ciscoAsa1000vResourceId;
|
||||
}
|
||||
|
||||
public Long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
}
|
||||
|
||||
public void setPhysicalNetworkId(Long physicalNetworkId) {
|
||||
this.physicalNetworkId = physicalNetworkId;
|
||||
}
|
||||
|
||||
public String getManagementIp() {
|
||||
return managementIp;
|
||||
}
|
||||
|
||||
public void setManagementIp(String managementIp) {
|
||||
this.managementIp = managementIp;
|
||||
}
|
||||
|
||||
public String getInPortProfile() {
|
||||
return inPortProfile;
|
||||
}
|
||||
|
||||
public void setInPortProfile(String inPortProfile) {
|
||||
this.inPortProfile = inPortProfile;
|
||||
}
|
||||
|
||||
public Long getGuestNetworkId() {
|
||||
return guestNetworkId;
|
||||
}
|
||||
|
||||
public void setGuestNetworkId(Long guestNetworkId) {
|
||||
this.guestNetworkId = guestNetworkId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
|||
|
||||
import com.cloud.network.cisco.CiscoVnmcController;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value = CiscoVnmcController.class)
|
||||
public class CiscoVnmcResourceResponse extends BaseResponse {
|
||||
public static final String RESOURCE_NAME = "resourcename";
|
||||
|
|
@ -33,43 +34,52 @@ public class CiscoVnmcResourceResponse extends BaseResponse {
|
|||
@Parameter(description="resource id of the Cisco VNMC controller")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
|
||||
@Parameter(description="the physical network to which this VNMC belongs to", entityType = PhysicalNetworkResponse.class)
|
||||
private Long physicalNetworkId;
|
||||
|
||||
public Long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return providerName;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
@SerializedName(ApiConstants.PROVIDER) @Parameter(description="name of the provider")
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Parameter(description="name of the provider")
|
||||
private String providerName;
|
||||
|
||||
@SerializedName(RESOURCE_NAME)
|
||||
@SerializedName(RESOURCE_NAME)
|
||||
@Parameter(description="Cisco VNMC resource name")
|
||||
private String resourceName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String ciscoVnmcResourceId) {
|
||||
this.id = ciscoVnmcResourceId;
|
||||
}
|
||||
|
||||
public Long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
}
|
||||
|
||||
public void setPhysicalNetworkId(Long physicalNetworkId) {
|
||||
this.physicalNetworkId = physicalNetworkId;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return providerName;
|
||||
}
|
||||
|
||||
public void setProviderName(String providerName) {
|
||||
this.providerName = providerName;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ import com.cloud.network.rules.FirewallRule.Purpose;
|
|||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRouteProfile;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.db.DB;
|
||||
|
|
@ -85,7 +88,7 @@ import java.util.*;
|
|||
@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class, GslbServiceProvider.class})
|
||||
public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider,
|
||||
NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer, StaticNatServiceProvider,
|
||||
GslbServiceProvider {
|
||||
GslbServiceProvider, VpcProvider {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(NetscalerElement.class);
|
||||
public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp");
|
||||
|
|
@ -957,4 +960,33 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdownVpc(Vpc vpc, ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPrivateGateway(PrivateGateway gateway) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePrivateGateway(PrivateGateway privateGateway) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throws ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,9 @@
|
|||
<exclude>com/cloud/network/vpn/RemoteAccessVpnTest.java</exclude>
|
||||
<exclude>com/cloud/network/security/SecurityGroupManagerImpl2Test.java</exclude>
|
||||
<exclude>com/cloud/network/security/SecurityGroupManagerImpl2Test.java</exclude>
|
||||
<exclude>com/cloud/vpc/*</exclude>
|
||||
<exclude>com/cloud/vpc/VpcTestConfiguration.java</exclude>
|
||||
<exclude>com/cloud/vpc/VpcApiUnitTest.java</exclude>
|
||||
<exclude>com/cloud/vpc/VpcManagerTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
|||
|
|
@ -1121,7 +1121,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
// validate if CIDR specified overlaps with any of the CIDR's allocated for isolated networks and shared networks in the zone
|
||||
checkSharedNetworkCidrOverlap(zoneId, pNtwk.getId(), cidr);
|
||||
} else {
|
||||
throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
|
||||
// if the guest network is for the VPC, if any External Provider are supported in VPC
|
||||
// cidr will not be null as it is generated from the super cidr of vpc.
|
||||
// if cidr is not null and network is not part of vpc then throw the exception
|
||||
if (vpcId == null)
|
||||
throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
|||
if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (!_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId())) {
|
||||
return super.implement(config, offering, dest, context);
|
||||
}
|
||||
|
|
@ -145,25 +145,31 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
|||
implemented.setBroadcastUri(config.getBroadcastUri());
|
||||
}
|
||||
|
||||
// Determine the offset from the lowest vlan tag
|
||||
int offset = getVlanOffset(config.getPhysicalNetworkId(), vlanTag);
|
||||
|
||||
// Determine the new gateway and CIDR
|
||||
String[] oldCidr = config.getCidr().split("/");
|
||||
String oldCidrAddress = oldCidr[0];
|
||||
int cidrSize = getGloballyConfiguredCidrSize();
|
||||
|
||||
// If the offset has more bits than there is room for, return null
|
||||
long bitsInOffset = 32 - Integer.numberOfLeadingZeros(offset);
|
||||
if (bitsInOffset > (cidrSize - 8)) {
|
||||
throw new CloudRuntimeException("The offset " + offset + " needs " + bitsInOffset + " bits, but only have " + (cidrSize - 8) + " bits to work with.");
|
||||
int cidrSize = Integer.parseInt(oldCidr[1]);
|
||||
long newCidrAddress = (NetUtils.ip2Long(oldCidrAddress));
|
||||
// if the implementing network is for vpc, no need to generate newcidr, use the cidr that came from super cidr
|
||||
if (config.getVpcId() != null) {
|
||||
implemented.setGateway(config.getGateway());
|
||||
implemented.setCidr(config.getCidr());
|
||||
implemented.setState(State.Implemented);
|
||||
} else {
|
||||
// Determine the offset from the lowest vlan tag
|
||||
int offset = getVlanOffset(config.getPhysicalNetworkId(), vlanTag);
|
||||
cidrSize = getGloballyConfiguredCidrSize();
|
||||
// If the offset has more bits than there is room for, return null
|
||||
long bitsInOffset = 32 - Integer.numberOfLeadingZeros(offset);
|
||||
if (bitsInOffset > (cidrSize - 8)) {
|
||||
throw new CloudRuntimeException("The offset " + offset + " needs " + bitsInOffset + " bits, but only have " + (cidrSize - 8) + " bits to work with.");
|
||||
}
|
||||
newCidrAddress = (NetUtils.ip2Long(oldCidrAddress) & 0xff000000) | (offset << (32 - cidrSize));
|
||||
implemented.setGateway(NetUtils.long2Ip(newCidrAddress + 1));
|
||||
implemented.setCidr(NetUtils.long2Ip(newCidrAddress) + "/" + cidrSize);
|
||||
implemented.setState(State.Implemented);
|
||||
}
|
||||
|
||||
long newCidrAddress = (NetUtils.ip2Long(oldCidrAddress) & 0xff000000) | (offset << (32 - cidrSize));
|
||||
implemented.setGateway(NetUtils.long2Ip(newCidrAddress + 1));
|
||||
implemented.setCidr(NetUtils.long2Ip(newCidrAddress) + "/" + cidrSize);
|
||||
implemented.setState(State.Implemented);
|
||||
|
||||
// Mask the Ipv4 address of all nics that use this network with the new guest VLAN offset
|
||||
List<NicVO> nicsInNetwork = _nicDao.listByNetworkId(config.getId());
|
||||
for (NicVO nic : nicsInNetwork) {
|
||||
|
|
@ -172,8 +178,8 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
|||
nic.setIp4Address(NetUtils.long2Ip(newCidrAddress | ipMask));
|
||||
_nicDao.persist(nic);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Mask the destination address of all port forwarding rules in this network with the new guest VLAN offset
|
||||
List<PortForwardingRuleVO> pfRulesInNetwork = _pfRulesDao.listByNetwork(config.getId());
|
||||
for (PortForwardingRuleVO pfRule : pfRulesInNetwork) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
|
|
@ -87,4 +88,6 @@ public interface RulesManager extends RulesService {
|
|||
*/
|
||||
boolean applyStaticNatForNetwork(long networkId, boolean continueOnError, Account caller, boolean forRevoke);
|
||||
|
||||
List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,11 @@ import com.cloud.network.dao.FirewallRulesCidrsDao;
|
|||
import com.cloud.network.dao.FirewallRulesDao;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.IPAddressVO;
|
||||
import com.cloud.network.dao.LoadBalancerVMMapDao;
|
||||
import com.cloud.network.dao.LoadBalancerVMMapVO;
|
||||
import com.cloud.network.rules.FirewallRule.FirewallRuleType;
|
||||
import com.cloud.network.rules.FirewallRule.Purpose;
|
||||
import com.cloud.network.rules.FirewallRule.TrafficType;
|
||||
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
||||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
|
|
@ -77,6 +80,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
|
|||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import com.cloud.vm.UserVmVO;
|
||||
|
|
@ -132,6 +136,8 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
|
|||
VpcManager _vpcMgr;
|
||||
@Inject
|
||||
NicSecondaryIpDao _nicSecondaryDao;
|
||||
@Inject
|
||||
LoadBalancerVMMapDao _loadBalancerVMMapDao;
|
||||
|
||||
@Override
|
||||
public void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) {
|
||||
|
|
@ -1467,4 +1473,36 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
|
|||
protected void removePFRule(PortForwardingRuleVO rule) {
|
||||
_portForwardingDao.remove(rule.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic){
|
||||
List<FirewallRuleVO> result = new ArrayList<FirewallRuleVO>();
|
||||
// add PF rules
|
||||
result.addAll(_portForwardingDao.listByDestIpAddr(nic.getIp4Address()));
|
||||
// add static NAT rules
|
||||
List<FirewallRuleVO> staticNatRules = _firewallDao.listStaticNatByVmId(nic.getInstanceId());
|
||||
for(FirewallRuleVO rule : staticNatRules){
|
||||
if(rule.getNetworkId() == nic.getNetworkId())
|
||||
result.add(rule);
|
||||
}
|
||||
List<? extends IpAddress> staticNatIps = _ipAddressDao.listStaticNatPublicIps(nic.getNetworkId());
|
||||
for(IpAddress ip : staticNatIps){
|
||||
if(ip.getVmIp() != null && ip.getVmIp().equals(nic.getIp4Address())){
|
||||
VMInstanceVO vm = _vmInstanceDao.findById(nic.getInstanceId());
|
||||
// generate a static Nat rule on the fly because staticNATrule does not persist into db anymore
|
||||
// FIX ME
|
||||
FirewallRuleVO staticNatRule = new FirewallRuleVO(null, ip.getId(), 0, 65535, NetUtils.ALL_PROTO.toString(),
|
||||
nic.getNetworkId(), vm.getAccountId(), vm.getDomainId(), Purpose.StaticNat, null, null, null, null, null);
|
||||
result.add(staticNatRule);
|
||||
}
|
||||
}
|
||||
// add LB rules
|
||||
List<LoadBalancerVMMapVO> lbMapList = _loadBalancerVMMapDao.listByInstanceId(nic.getInstanceId());
|
||||
for(LoadBalancerVMMapVO lb : lbMapList){
|
||||
FirewallRuleVO lbRule = _firewallDao.findById(lb.getLoadBalancerId());
|
||||
if(lbRule.getNetworkId() == nic.getNetworkId())
|
||||
result.add(lbRule);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,8 +184,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("VpcChecker"));
|
||||
private List<VpcProvider> vpcElements = null;
|
||||
private final List<Service> nonSupportedServices = Arrays.asList(Service.SecurityGroup, Service.Firewall);
|
||||
private final List<Provider> supportedProviders = Arrays.asList(Provider.VPCVirtualRouter, Provider.NiciraNvp);
|
||||
|
||||
private final List<Provider> supportedProviders = Arrays.asList(Provider.VPCVirtualRouter, Provider.NiciraNvp, Provider.Netscaler);
|
||||
int _cleanupInterval;
|
||||
int _maxNetworks;
|
||||
SearchBuilder<IPAddressVO> IpAddressSearch;
|
||||
|
|
@ -215,7 +214,27 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
createVpcOffering(VpcOffering.defaultVPCOfferingName, VpcOffering.defaultVPCOfferingName, svcProviderMap,
|
||||
true, State.Enabled);
|
||||
}
|
||||
|
||||
|
||||
//configure default vpc offering with Netscaler as LB Provider
|
||||
if (_vpcOffDao.findByUniqueName(VpcOffering.defaultVPCNSOfferingName ) == null) {
|
||||
s_logger.debug("Creating default VPC offering with Netscaler as LB Provider" + VpcOffering.defaultVPCNSOfferingName);
|
||||
Map<Service, Set<Provider>> svcProviderMap = new HashMap<Service, Set<Provider>>();
|
||||
Set<Provider> defaultProviders = new HashSet<Provider>();
|
||||
defaultProviders.add(Provider.VPCVirtualRouter);
|
||||
for (Service svc : getSupportedServices()) {
|
||||
if (svc == Service.Lb) {
|
||||
Set<Provider> lbProviders = new HashSet<Provider>();
|
||||
lbProviders.add(Provider.Netscaler);
|
||||
lbProviders.add(Provider.VPCVirtualRouter);
|
||||
svcProviderMap.put(svc, lbProviders);
|
||||
} else {
|
||||
svcProviderMap.put(svc, defaultProviders);
|
||||
}
|
||||
}
|
||||
createVpcOffering(VpcOffering.defaultVPCNSOfferingName, VpcOffering.defaultVPCNSOfferingName,
|
||||
svcProviderMap, false, State.Enabled);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
Map<String, String> configs = _configDao.getConfiguration(params);
|
||||
|
|
@ -1084,6 +1103,12 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
if (guestNtwkOff.isConserveMode()) {
|
||||
throw new InvalidParameterValueException("Only networks with conserve mode Off can belong to VPC");
|
||||
}
|
||||
|
||||
//5) If Netscaler is LB provider make sure it is in dedicated mode
|
||||
if ( providers.contains(Provider.Netscaler) && !guestNtwkOff.getDedicatedLB() ) {
|
||||
throw new InvalidParameterValueException("Netscaler only with Dedicated LB can belong to VPC");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
@DB
|
||||
|
|
@ -1155,6 +1180,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
if (vpcElements == null) {
|
||||
vpcElements = new ArrayList<VpcProvider>();
|
||||
vpcElements.add((VpcProvider)_ntwkModel.getElementImplementingProvider(Provider.VPCVirtualRouter.getName()));
|
||||
vpcElements.add((VpcProvider)_ntwkModel.getElementImplementingProvider(Provider.Netscaler.getName()));
|
||||
}
|
||||
|
||||
if (vpcElements == null) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.dc.*;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
|
||||
|
|
@ -74,6 +73,13 @@ import com.cloud.cluster.ManagementServerNode;
|
|||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterIpAddressVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.PodCluster;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.ClusterVSMMapDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
|
|
@ -1638,10 +1644,10 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||
private Object dispatchToStateAdapters(ResourceStateAdapter.Event event,
|
||||
boolean singleTaker, Object... args) {
|
||||
synchronized (_resourceStateAdapters) {
|
||||
Iterator it = _resourceStateAdapters.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, ResourceStateAdapter>> it = _resourceStateAdapters.entrySet().iterator();
|
||||
Object result = null;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, ResourceStateAdapter> item = (Map.Entry<String, ResourceStateAdapter>) it
|
||||
Map.Entry<String, ResourceStateAdapter> item = it
|
||||
.next();
|
||||
ResourceStateAdapter adapter = item.getValue();
|
||||
|
||||
|
|
|
|||
|
|
@ -831,6 +831,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
if(network == null) {
|
||||
throw new InvalidParameterValueException("unable to find a network with id " + networkId);
|
||||
}
|
||||
List<NicVO> allNics = _nicDao.listByVmId(vmInstance.getId());
|
||||
for(NicVO nic : allNics){
|
||||
if(nic.getNetworkId() == network.getId())
|
||||
throw new CloudRuntimeException("A NIC already exists for VM:" + vmInstance.getInstanceName() + " in network: " + network.getUuid());
|
||||
}
|
||||
|
||||
NicProfile profile = new NicProfile(null, null);
|
||||
if(ipAddress != null) {
|
||||
profile = new NicProfile(ipAddress, null);
|
||||
|
|
@ -4242,7 +4248,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
_agentMgr.send(dest.getHost().getId(),cmds);
|
||||
PlugNicAnswer plugNicAnswer = cmds.getAnswer(PlugNicAnswer.class);
|
||||
if (!(plugNicAnswer != null && plugNicAnswer.getResult())) {
|
||||
s_logger.warn("Unable to plug nic for " + vmVO);
|
||||
s_logger.warn("Unable to plug nic for " + vmVO + " due to: " + " due to: " + plugNicAnswer.getDetails());
|
||||
return false;
|
||||
}
|
||||
} catch (OperationTimedoutException e) {
|
||||
|
|
@ -4270,7 +4276,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
_agentMgr.send(dest.getHost().getId(),cmds);
|
||||
UnPlugNicAnswer unplugNicAnswer = cmds.getAnswer(UnPlugNicAnswer.class);
|
||||
if (!(unplugNicAnswer != null && unplugNicAnswer.getResult())) {
|
||||
s_logger.warn("Unable to unplug nic for " + vmVO);
|
||||
s_logger.warn("Unable to unplug nic for " + vmVO + " due to: " + unplugNicAnswer.getDetails());
|
||||
return false;
|
||||
}
|
||||
} catch (OperationTimedoutException e) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.Collections;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -37,40 +36,56 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
||||
import com.cloud.dc.*;
|
||||
import com.cloud.agent.api.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.AgentManager.OnError;
|
||||
import com.cloud.agent.Listener;
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
import com.cloud.agent.api.AgentControlCommand;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.CheckVirtualMachineAnswer;
|
||||
import com.cloud.agent.api.CheckVirtualMachineCommand;
|
||||
import com.cloud.agent.api.ClusterSyncAnswer;
|
||||
import com.cloud.agent.api.ClusterSyncCommand;
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.MigrateAnswer;
|
||||
import com.cloud.agent.api.MigrateCommand;
|
||||
import com.cloud.agent.api.PingRoutingCommand;
|
||||
import com.cloud.agent.api.PrepareForMigrationAnswer;
|
||||
import com.cloud.agent.api.PrepareForMigrationCommand;
|
||||
import com.cloud.agent.api.RebootAnswer;
|
||||
import com.cloud.agent.api.RebootCommand;
|
||||
import com.cloud.agent.api.ScaleVmCommand;
|
||||
import com.cloud.agent.api.StartAnswer;
|
||||
import com.cloud.agent.api.StartCommand;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand.VmState;
|
||||
import com.cloud.agent.api.StopAnswer;
|
||||
import com.cloud.agent.api.StopCommand;
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.agent.manager.allocator.HostAllocator;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.consoleproxy.ConsoleProxyManager;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.deploy.DataCenterDeployment;
|
||||
|
|
@ -109,6 +124,7 @@ import com.cloud.network.NetworkManager;
|
|||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.network.rules.RulesManager;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
|
|
@ -126,9 +142,9 @@ import com.cloud.storage.VolumeVO;
|
|||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDao;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.storage.snapshot.SnapshotManager;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
|
|
@ -154,12 +170,12 @@ import com.cloud.vm.VirtualMachine.Event;
|
|||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
import com.cloud.vm.snapshot.VMSnapshotManager;
|
||||
import com.cloud.vm.snapshot.VMSnapshotVO;
|
||||
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
|
||||
@Local(value = VirtualMachineManager.class)
|
||||
public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMachineManager, Listener {
|
||||
|
|
@ -235,6 +251,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
protected VolumeDataFactory volFactory;
|
||||
@Inject
|
||||
protected ResourceLimitService _resourceLimitMgr;
|
||||
@Inject
|
||||
protected RulesManager rulesMgr;
|
||||
|
||||
protected List<DeploymentPlanner> _planners;
|
||||
public List<DeploymentPlanner> getPlanners() {
|
||||
|
|
@ -2845,6 +2863,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
s_logger.warn("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
|
||||
throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
|
||||
}
|
||||
|
||||
// if specified nic is associated with PF/LB/Static NAT
|
||||
if(rulesMgr.listAssociatedRulesForGuestNic(nic).size() > 0){
|
||||
throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network
|
||||
+ ", nic has associated Port forwarding or Load balancer or Static NAT rules.");
|
||||
}
|
||||
|
||||
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(),
|
||||
_networkModel.getNetworkRate(network.getId(), vm.getId()),
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.exception.InsufficientAddressCapacityException;
|
|||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.FirewallRuleVO;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.rules.PortForwardingRuleVO;
|
||||
import com.cloud.network.rules.RulesManager;
|
||||
|
|
@ -40,6 +41,7 @@ import com.cloud.utils.Pair;
|
|||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
@Local(value = {RulesManager.class, RulesService.class})
|
||||
|
|
@ -310,4 +312,10 @@ public class MockRulesManagerImpl extends ManagerBase implements RulesManager, R
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,269 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
// contributor license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright ownership.
|
||||
// The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
// (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.cloud.vpc;
|
||||
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.NetworkService;
|
||||
import com.cloud.network.dao.FirewallRulesDao;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||
import com.cloud.network.dao.Site2SiteVpnGatewayDao;
|
||||
import com.cloud.network.vpc.*;
|
||||
import com.cloud.network.vpc.dao.PrivateIpDao;
|
||||
import com.cloud.network.vpc.dao.StaticRouteDao;
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
import com.cloud.network.vpc.dao.VpcGatewayDao;
|
||||
import com.cloud.network.vpc.dao.VpcOfferingDao;
|
||||
import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
|
||||
import com.cloud.network.vpc.dao.VpcServiceMapDao;
|
||||
import com.cloud.network.vpn.Site2SiteVpnManager;
|
||||
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.tags.dao.ResourceTagDao;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
|
||||
import org.apache.cloudstack.api.command.user.vpc.CreateVPCCmd;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.core.type.filter.TypeFilter;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
|
||||
public class VpcTest extends TestCase {
|
||||
|
||||
@Inject
|
||||
VpcService _vpcService;
|
||||
|
||||
@Inject
|
||||
AccountManager _accountMgr;
|
||||
|
||||
@Inject
|
||||
VpcManager _vpcMgr;
|
||||
|
||||
@Inject
|
||||
VpcDao _vpcDao;
|
||||
|
||||
@Inject
|
||||
VpcOfferingDao _vpcOfferinDao;
|
||||
|
||||
private VpcVO vpc;
|
||||
private static final Logger s_logger = Logger.getLogger(VpcTest.class);
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
ComponentContext.initComponentsLifeCycle();
|
||||
Account account = new AccountVO("testaccount", 1, "testdomain", (short) 0, UUID.randomUUID().toString());
|
||||
UserContext.registerContext(1, account, null, true);
|
||||
vpc = new VpcVO(1, "myvpc", "myvpc", 2, 1, 1, "10.0.1.0/16", "mydomain");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateVpc() throws Exception {
|
||||
Mockito.when(
|
||||
_vpcMgr.createVpc(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString(),
|
||||
Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(vpc);
|
||||
Mockito.when(_vpcOfferinDao.persist(Mockito.any(VpcOfferingVO.class))).thenReturn(
|
||||
new VpcOfferingVO("test", "test", 1L));
|
||||
Vpc vpc1 = _vpcMgr.createVpc(1, 1, 1, "myVpc", "my Vpc", "10.0.0.0/16", "test");
|
||||
assertNotNull("Vpc is created", vpc1);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses = { VpcManager.class }, includeFilters = { @ComponentScan.Filter(value = VpcTestConfiguration.Library.class, type = FilterType.CUSTOM) }, useDefaultFilters = false)
|
||||
public static class VpcTestConfiguration extends SpringUtils.CloudStackTestConfiguration {
|
||||
|
||||
@Bean
|
||||
public AccountManager accountManager() {
|
||||
return Mockito.mock(AccountManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NetworkManager networkManager() {
|
||||
return Mockito.mock(NetworkManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NetworkModel networkModel() {
|
||||
return Mockito.mock(NetworkModel.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VpcManager vpcManager() {
|
||||
return Mockito.mock(VpcManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceTagDao resourceTagDao() {
|
||||
return Mockito.mock(ResourceTagDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VpcDao VpcDao() {
|
||||
return Mockito.mock(VpcDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VpcOfferingDao vpcOfferingDao() {
|
||||
return Mockito.mock(VpcOfferingDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VpcOfferingServiceMapDao vpcOfferingServiceMapDao() {
|
||||
return Mockito.mock(VpcOfferingServiceMapDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurationDao configurationDao() {
|
||||
return Mockito.mock(ConfigurationDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurationManager configurationManager() {
|
||||
return Mockito.mock(ConfigurationManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NetworkDao networkDao() {
|
||||
return Mockito.mock(NetworkDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NetworkACLManager networkACLManager() {
|
||||
return Mockito.mock(NetworkACLManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IPAddressDao ipAddressDao() {
|
||||
return Mockito.mock(IPAddressDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DomainRouterDao domainRouterDao() {
|
||||
return Mockito.mock(DomainRouterDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VpcGatewayDao vpcGatewayDao() {
|
||||
return Mockito.mock(VpcGatewayDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PrivateIpDao privateIpDao() {
|
||||
return Mockito.mock(PrivateIpDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public StaticRouteDao staticRouteDao() {
|
||||
return Mockito.mock(StaticRouteDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NetworkOfferingServiceMapDao networkOfferingServiceMapDao() {
|
||||
return Mockito.mock(NetworkOfferingServiceMapDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PhysicalNetworkDao physicalNetworkDao() {
|
||||
return Mockito.mock(PhysicalNetworkDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FirewallRulesDao firewallRulesDao() {
|
||||
return Mockito.mock(FirewallRulesDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Site2SiteVpnGatewayDao site2SiteVpnGatewayDao() {
|
||||
return Mockito.mock(Site2SiteVpnGatewayDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Site2SiteVpnManager site2SiteVpnManager() {
|
||||
return Mockito.mock(Site2SiteVpnManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VlanDao vlanDao() {
|
||||
return Mockito.mock(VlanDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceLimitService resourceLimitService() {
|
||||
return Mockito.mock(ResourceLimitService.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VpcServiceMapDao vpcServiceMapDao() {
|
||||
return Mockito.mock(VpcServiceMapDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NetworkService networkService() {
|
||||
return Mockito.mock(NetworkService.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataCenterDao dataCenterDao() {
|
||||
return Mockito.mock(DataCenterDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurationServer configurationServer() {
|
||||
return Mockito.mock(ConfigurationServer.class);
|
||||
}
|
||||
|
||||
public static class Library implements TypeFilter {
|
||||
@Override
|
||||
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
|
||||
mdr.getClassMetadata().getClassName();
|
||||
ComponentScan cs = VpcTestConfiguration.class.getAnnotation(ComponentScan.class);
|
||||
return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ import com.cloud.network.Network;
|
|||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.offering.NetworkOffering.Availability;
|
||||
import com.cloud.offerings.NetworkOfferingServiceMapVO;
|
||||
import com.cloud.offerings.NetworkOfferingVO;
|
||||
|
|
@ -72,6 +73,9 @@ public class CreateNetworkOfferingTest extends TestCase{
|
|||
@Inject
|
||||
AccountManager accountMgr;
|
||||
|
||||
@Inject
|
||||
VpcManager vpcMgr;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
ComponentContext.initComponentsLifeCycle();
|
||||
|
|
@ -180,4 +184,43 @@ public class CreateNetworkOfferingTest extends TestCase{
|
|||
assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createVpcNtwkOff() {
|
||||
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
|
||||
Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
|
||||
vrProvider.add(Provider.VPCVirtualRouter);
|
||||
serviceProviderMap.put(Network.Service.Dhcp , vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Dns , vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Lb , vrProvider);
|
||||
serviceProviderMap.put(Network.Service.SourceNat , vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Gateway , vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Lb , vrProvider);
|
||||
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
|
||||
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false,
|
||||
null, false, null, false, false);
|
||||
// System.out.println("Creating Vpc Network Offering");
|
||||
assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createVpcNtwkOffWithNetscaler() {
|
||||
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
|
||||
Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
|
||||
Set<Network.Provider> lbProvider = new HashSet<Network.Provider>();
|
||||
vrProvider.add(Provider.VPCVirtualRouter);
|
||||
lbProvider.add(Provider.Netscaler);
|
||||
serviceProviderMap.put(Network.Service.Dhcp, vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Dns, vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Lb, vrProvider);
|
||||
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Gateway, vrProvider);
|
||||
serviceProviderMap.put(Network.Service.Lb, lbProvider);
|
||||
NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
|
||||
Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false,
|
||||
null, false, false);
|
||||
// System.out.println("Creating Vpc Network Offering");
|
||||
assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -934,7 +934,7 @@
|
|||
var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
|
||||
var items = [];
|
||||
$(serviceofferings).each(function() {
|
||||
items.push({id: this.id, description: this.displaytext});
|
||||
items.push({id: this.id, description: this.name});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue