Enabled the traffic lable support the hyperv hypervisor type. Modified the physical_network_traffic_types table to introduce hyperv_network lable column. Modified associated VO's and impls classes. Modified the List/Update/Add TrafficType command api's and response classes. Fixed the Unit tests
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/19e9849d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/19e9849d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/19e9849d Branch: refs/heads/ui-restyle Commit: 19e9849d862cba607f4190ccb8d0f3d6a37dc5ae Parents: 4674ae4 Author: Rajesh Battala <rajesh.batt...@citrix.com> Authored: Fri Nov 8 19:49:10 2013 +0530 Committer: Rajesh Battala <rajesh.batt...@citrix.com> Committed: Fri Nov 8 20:21:18 2013 +0530 ---------------------------------------------------------------------- api/src/com/cloud/network/NetworkService.java | 4 ++-- .../cloud/network/PhysicalNetworkTrafficType.java | 2 ++ api/src/org/apache/cloudstack/api/ApiConstants.java | 1 + .../api/command/admin/usage/AddTrafficTypeCmd.java | 9 ++++++++- .../command/admin/usage/UpdateTrafficTypeCmd.java | 9 ++++++++- .../cloudstack/api/response/TrafficTypeResponse.java | 10 ++++++++++ .../subsystem/api/storage/DataStoreProvider.java | 2 +- .../dao/PhysicalNetworkTrafficTypeDaoImpl.java | 13 ++++++++++++- .../network/dao/PhysicalNetworkTrafficTypeVO.java | 15 ++++++++++++++- .../contrail/management/ManagementServerMock.java | 6 +++--- server/src/com/cloud/api/ApiResponseHelper.java | 1 + server/src/com/cloud/configuration/Config.java | 5 +++++ .../configuration/ConfigurationManagerImpl.java | 2 +- server/src/com/cloud/network/NetworkModelImpl.java | 13 +++++++++++++ server/src/com/cloud/network/NetworkServiceImpl.java | 13 ++++++++++--- .../test/com/cloud/vpc/MockNetworkManagerImpl.java | 4 ++-- setup/db/db/schema-421to430.sql | 1 + 17 files changed, 94 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/api/src/com/cloud/network/NetworkService.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java index 8f81697..b91a63d 100755 --- a/api/src/com/cloud/network/NetworkService.java +++ b/api/src/com/cloud/network/NetworkService.java @@ -116,11 +116,11 @@ public interface NetworkService { long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType); PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, - String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan); + String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel); PhysicalNetworkTrafficType getPhysicalNetworkTrafficType(Long id); - PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel); + PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel, String hypervLabel); boolean deletePhysicalNetworkTrafficType(Long id); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/api/src/com/cloud/network/PhysicalNetworkTrafficType.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java b/api/src/com/cloud/network/PhysicalNetworkTrafficType.java index a385b53..ad3b93d 100644 --- a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java +++ b/api/src/com/cloud/network/PhysicalNetworkTrafficType.java @@ -37,4 +37,6 @@ public interface PhysicalNetworkTrafficType extends InternalIdentity, Identity { String getVmwareNetworkLabel(); String getSimulatorNetworkLabel(); + + String getHypervNetworkLabel(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/api/src/org/apache/cloudstack/api/ApiConstants.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index ae6be63..82b2af6 100755 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -355,6 +355,7 @@ public class ApiConstants { public static final String XEN_NETWORK_LABEL = "xennetworklabel"; public static final String KVM_NETWORK_LABEL = "kvmnetworklabel"; public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel"; + public static final String HYPERV_NETWORK_LABEL = "hypervnetworklabel"; public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid"; public static final String SERVICE_LIST = "servicelist"; public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice"; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java index 3957e69..f6e4319 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java @@ -60,6 +60,9 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host") private String vmwareLabel; + @Parameter(name=ApiConstants.HYPERV_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a Hyperv host") + private String hypervLabel; + @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="The VLAN id to be used for Management traffic by VMware host") private String vlan; @@ -88,6 +91,10 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { return vmwareLabel; } + public String getHypervLabel() { + return hypervLabel; + } + public String getSimulatorLabel() { //simulators will have no labels return null; @@ -130,7 +137,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { @Override public void create() throws ResourceAllocationException { - PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getSimulatorLabel(), getVlan()); + PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getSimulatorLabel(), getVlan(), getHypervLabel()); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java index e54b87c..c1e36aa 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.BaseCmd.CommandType; import org.apache.cloudstack.api.response.TrafficTypeResponse; import org.apache.log4j.Logger; @@ -53,6 +54,8 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host") private String vmwareLabel; + @Parameter(name=ApiConstants.HYPERV_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a Hyperv host") + private String hypervLabel; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -73,6 +76,10 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd { return vmwareLabel; } + public String getHypervLabel() { + return hypervLabel; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -89,7 +96,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd { @Override public void execute(){ - PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel()); + PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getHypervLabel()); if (result != null) { TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result); response.setResponseName(getCommandName()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java b/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java index 494048e..0205daa 100644 --- a/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java @@ -45,6 +45,9 @@ public class TrafficTypeResponse extends BaseResponse { @SerializedName(ApiConstants.VMWARE_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a VMware host") private String vmwareNetworkLabel; + @SerializedName(ApiConstants.HYPERV_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a HyperV host") + private String hypervNetworkLabel; + @Override public String getObjectId() { @@ -82,10 +85,17 @@ public class TrafficTypeResponse extends BaseResponse { public String getKvmLabel() { return kvmNetworkLabel; } + public String getHypervLabel() { + return hypervNetworkLabel; + } public void setXenLabel(String xenLabel) { this.xenNetworkLabel = xenLabel; } + + public void setHypervLabel(String hypervLabel) { + this.hypervNetworkLabel = hypervLabel; + } public void setKvmLabel(String kvmLabel) { this.kvmNetworkLabel = kvmLabel; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java ---------------------------------------------------------------------- diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java index 855f085..7b5f8d9 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java @@ -27,7 +27,7 @@ public interface DataStoreProvider { static final String S3_IMAGE = "S3"; static final String SWIFT_IMAGE = "Swift"; static final String SAMPLE_IMAGE = "Sample"; - + static final String SMB = "NFS"; static final String DEFAULT_PRIMARY = "DefaultPrimary"; static enum DataStoreProviderType { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java index 2a712a6..8f7b319 100755 --- a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java +++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java @@ -41,6 +41,7 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> vmWareAllFieldsSearch; final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> simulatorAllFieldsSearch; final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> ovmAllFieldsSearch; + final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> hypervAllFieldsSearch; protected PhysicalNetworkTrafficTypeDaoImpl() { super(); @@ -55,6 +56,13 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe kvmAllFieldsSearch.selectFields(kvmAllFieldsSearch.entity().getKvmNetworkLabel()); kvmAllFieldsSearch.done(); + hypervAllFieldsSearch = createSearchBuilder(String.class); + hypervAllFieldsSearch.and("physicalNetworkId", hypervAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ); + hypervAllFieldsSearch.and("trafficType", hypervAllFieldsSearch.entity().getTrafficType(), Op.EQ); + hypervAllFieldsSearch.selectFields(hypervAllFieldsSearch.entity().getHypervNetworkLabel()); + hypervAllFieldsSearch.done(); + + xenAllFieldsSearch = createSearchBuilder(String.class); xenAllFieldsSearch.and("physicalNetworkId", xenAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ); xenAllFieldsSearch.and("trafficType", xenAllFieldsSearch.entity().getTrafficType(), Op.EQ); @@ -114,7 +122,10 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe sc = ovmAllFieldsSearch.create(); } else if (hType == HypervisorType.BareMetal) { return null; - } else { + } else if (hType == HypervisorType.Hyperv) { + sc = hypervAllFieldsSearch.create(); + } + else { assert(false) : "We don't handle this hypervisor type"; return null; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java index 4c32d0a..4c0cfd4 100644 --- a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java +++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java @@ -61,19 +61,23 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType @Column(name = "simulator_network_label") private String simulatorNetworkLabel; + @Column(name = "hyperv_network_label") + private String hypervNetworkLabel; + @Column(name = "vlan") private String vlan; public PhysicalNetworkTrafficTypeVO() { } - public PhysicalNetworkTrafficTypeVO(long physicalNetworkId, TrafficType trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) { + public PhysicalNetworkTrafficTypeVO(long physicalNetworkId, TrafficType trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel) { this.physicalNetworkId = physicalNetworkId; this.trafficType = trafficType; this.xenNetworkLabel = xenLabel; this.kvmNetworkLabel = kvmLabel; this.vmwareNetworkLabel = vmwareLabel; this.simulatorNetworkLabel = simulatorLabel; + this.hypervNetworkLabel = hypervLabel; this.setVlan(vlan); this.uuid = UUID.randomUUID().toString(); } @@ -146,4 +150,13 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType this.uuid = uuid; } + public void setHypervNetworkLabel(String hypervNetworkLable) { + this.hypervNetworkLabel = hypervNetworkLable; + + } + @Override + public String getHypervNetworkLabel() { + return hypervNetworkLabel; + } + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java index 82893f1..86750ca 100644 --- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java +++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java @@ -315,7 +315,7 @@ public class ManagementServerMock { _znet = _networkService.getPhysicalNetwork(id); List<PhysicalNetworkVO> nets = _physicalNetworkDao.listByZoneAndTrafficType(_zone.getId(), TrafficType.Public); if (nets == null || nets.isEmpty()) { - _networkService.addTrafficTypeToPhysicalNetwork(_znet.getId(), TrafficType.Public.toString(), null, null, null, null, null); + _networkService.addTrafficTypeToPhysicalNetwork(_znet.getId(), TrafficType.Public.toString(), null, null, null, null, null, null); } } catch (InvalidParameterValueException e) { List<String> isolationMethods = new ArrayList<String>(); @@ -325,7 +325,7 @@ public class ManagementServerMock { null, "znet"); List<PhysicalNetworkVO> nets = _physicalNetworkDao.listByZoneAndTrafficType(_zone.getId(), TrafficType.Public); if (nets == null || nets.isEmpty()) { - _networkService.addTrafficTypeToPhysicalNetwork(_znet.getId(), TrafficType.Public.toString(), null, null, null, null, null); + _networkService.addTrafficTypeToPhysicalNetwork(_znet.getId(), TrafficType.Public.toString(), null, null, null, null, null, null); } } if (_znet.getState() != PhysicalNetwork.State.Enabled) { @@ -344,7 +344,7 @@ public class ManagementServerMock { } if (!found) { _networkService.addTrafficTypeToPhysicalNetwork(_znet.getId(), TrafficType.Guest.toString(), - null, null, null, null, null); + null, null, null, null, null, null); } Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> providers = http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/server/src/com/cloud/api/ApiResponseHelper.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index e1c48cf..f70af5f 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -2696,6 +2696,7 @@ public class ApiResponseHelper implements ResponseGenerator { response.setXenLabel(result.getXenNetworkLabel()); response.setKvmLabel(result.getKvmNetworkLabel()); response.setVmwareLabel(result.getVmwareNetworkLabel()); + response.setHypervLabel(result.getHypervNetworkLabel()); response.setObjectName("traffictype"); return response; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/server/src/com/cloud/configuration/Config.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index e787576..bc805b7 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -275,6 +275,11 @@ public enum Config { KvmPrivateNetwork("Hidden", ManagementServer.class, String.class, "kvm.private.network.device", null, "Specify the private bridge on host for private network", null), KvmGuestNetwork("Hidden", ManagementServer.class, String.class, "kvm.guest.network.device", null, "Specify the private bridge on host for private network", null), KvmSshToAgentEnabled("Advanced", ManagementServer.class, Boolean.class, "kvm.ssh.to.agent", "true", "Specify whether or not the management server is allowed to SSH into KVM Agents", null), + + // Hyperv + HypervPublicNetwork("Hidden", ManagementServer.class, String.class, "hyperv.public.network.device", null, "Specify the public virtual switch on host for public network", null), + HypervPrivateNetwork("Hidden", ManagementServer.class, String.class, "hyperv.private.network.device", null, "Specify the virtual switch on host for private network", null), + HypervGuestNetwork("Hidden", ManagementServer.class, String.class, "hyperv.guest.network.device", null, "Specify the virtual switch on host for private network", null), // Usage UsageExecutionTimezone("Usage", ManagementServer.class, String.class, "usage.execution.timezone", null, "The timezone to use for usage job execution time", null), http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/server/src/com/cloud/configuration/ConfigurationManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index c3a196f..82256ca 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -1738,7 +1738,7 @@ ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, Co _networkSvc.addTrafficTypeToPhysicalNetwork(mgmtPhyNetwork.getId(), TrafficType.Storage.toString(), mgmtTraffic.getXenNetworkLabel(), mgmtTraffic.getKvmNetworkLabel(), mgmtTraffic.getVmwareNetworkLabel(), - mgmtTraffic.getSimulatorNetworkLabel(), mgmtTraffic.getVlan()); + mgmtTraffic.getSimulatorNetworkLabel(), mgmtTraffic.getVlan(), mgmtTraffic.getHypervNetworkLabel()); s_logger.info("No storage traffic type was specified by admin, create default storage traffic on physical network " + mgmtPhyNetwork.getId() + " with same configure of management traffic type"); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/server/src/com/cloud/network/NetworkModelImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java index c8733b0..4a298cb 100755 --- a/server/src/com/cloud/network/NetworkModelImpl.java +++ b/server/src/com/cloud/network/NetworkModelImpl.java @@ -1179,6 +1179,9 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { break; case VMware : label = mgmtTraffic.getVmwareNetworkLabel(); break; + case Hyperv: + label = mgmtTraffic.getHypervNetworkLabel(); + break; } return label; } @@ -1204,6 +1207,9 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { break; case VMware : label = storageTraffic.getVmwareNetworkLabel(); break; + case Hyperv: + label = storageTraffic.getHypervNetworkLabel(); + break; } return label; } @@ -1549,6 +1555,9 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { case VMware: label = publicTraffic.getVmwareNetworkLabel(); break; + case Hyperv: + label = publicTraffic.getHypervNetworkLabel(); + break; } return label; } @@ -1578,6 +1587,10 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { case VMware: label = guestTraffic.getVmwareNetworkLabel(); break; + case Hyperv: + label = guestTraffic.getHypervNetworkLabel(); + break; + } return label; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/server/src/com/cloud/network/NetworkServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index 7e971bd..c6c78f5 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -3542,7 +3542,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { @Override @DB @ActionEvent(eventType = EventTypes.EVENT_TRAFFIC_TYPE_CREATE, eventDescription = "Creating Physical Network TrafficType", create = true) - public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficTypeStr, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) { + public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficTypeStr, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel) { // verify input parameters PhysicalNetworkVO network = _physicalNetworkDao.findById(physicalNetworkId); @@ -3592,7 +3592,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { if (xenLabel == null) { xenLabel = getDefaultXenNetworkLabel(trafficType); } - PhysicalNetworkTrafficTypeVO pNetworktrafficType = new PhysicalNetworkTrafficTypeVO(physicalNetworkId, trafficType, xenLabel, kvmLabel, vmwareLabel, simulatorLabel, vlan); + PhysicalNetworkTrafficTypeVO pNetworktrafficType = new PhysicalNetworkTrafficTypeVO(physicalNetworkId, trafficType, xenLabel, kvmLabel, vmwareLabel, simulatorLabel, vlan, hypervLabel); pNetworktrafficType = _pNTrafficTypeDao.persist(pNetworktrafficType); return pNetworktrafficType; @@ -3636,7 +3636,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { @Override @ActionEvent(eventType = EventTypes.EVENT_TRAFFIC_TYPE_UPDATE, eventDescription = "Updating physical network TrafficType", async = true) - public PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel) { + public PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel, String hypervLabel) { PhysicalNetworkTrafficTypeVO trafficType = _pNTrafficTypeDao.findById(id); @@ -3662,6 +3662,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { } trafficType.setVmwareNetworkLabel(vmwareLabel); } + + if (hypervLabel != null) { + if("".equals(hypervLabel)){ + hypervLabel = null; + } + trafficType.setHypervNetworkLabel(hypervLabel); + } _pNTrafficTypeDao.update(id, trafficType); return trafficType; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/server/test/com/cloud/vpc/MockNetworkManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java index 35fde8e..705a254 100644 --- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java @@ -520,7 +520,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches */ @Override public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, - String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) { + String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel) { // TODO Auto-generated method stub return null; } @@ -547,7 +547,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches */ @Override public PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, - String vmwareLabel) { + String vmwareLabel, String hypervLabel) { // TODO Auto-generated method stub return null; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19e9849d/setup/db/db/schema-421to430.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql index 53cd0bf..dbfab4a 100644 --- a/setup/db/db/schema-421to430.sql +++ b/setup/db/db/schema-421to430.sql @@ -493,6 +493,7 @@ CREATE TABLE `load_balancer_cert_map` ( CONSTRAINT `fk_load_balancer_cert_map__load_balancer_id` FOREIGN KEY (`load_balancer_id`) REFERENCES `load_balancing_rules` (`id`) ON DELETE CASCADE); ALTER TABLE `cloud`.`host` ADD COLUMN `cpu_sockets` int(10) unsigned DEFAULT NULL COMMENT "the number of CPU sockets on the host" AFTER pod_id; +ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `hyperv_network_label` varchar(255) DEFAULT NULL COMMENT 'The network name label of the physical device dedicated to this traffic on a HyperV host'; DROP VIEW IF EXISTS `cloud`.`host_view`; CREATE VIEW `cloud`.`host_view` AS