Skip to content

Commit 65ab9e5

Browse files
committed
CLOUDSTACK-9074: Naming convention fix and network guest types support
1 parent 4aa73f3 commit 65ab9e5

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

api/src/org/apache/cloudstack/api/response/NicResponse.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ public class NicResponse extends BaseResponse {
104104

105105
@SerializedName("nsxlogicalswitch")
106106
@Param(description = "Id of the NSX Logical Switch (if NSX based), null otherwise", since="4.6.0")
107-
private String nsxlogicalswitch;
107+
private String nsxLogicalSwitch;
108108

109109
@SerializedName("nsxlogicalswitchport")
110110
@Param(description = "Id of the NSX Logical Switch Port (if NSX based), null otherwise", since="4.6.0")
111-
private String nsxlogicalswitchport;
111+
private String nsxLogicalSwitchPort;
112112

113113
public void setVmId(String vmId) {
114114
this.vmId = vmId;
@@ -213,12 +213,12 @@ public void setSecondaryIps(List<NicSecondaryIpResponse> ipList) {
213213
this.secondaryIps = ipList;
214214
}
215215

216-
public void setNsxlogicalswitch(String nsxlogicalswitch) {
217-
this.nsxlogicalswitch = nsxlogicalswitch;
216+
public void setNsxLogicalSwitch(String nsxLogicalSwitch) {
217+
this.nsxLogicalSwitch = nsxLogicalSwitch;
218218
}
219219

220-
public void setNsxlogicalswitchport(String nsxlogicalswitchport) {
221-
this.nsxlogicalswitchport = nsxlogicalswitchport;
220+
public void setNsxLogicalSwitchPort(String nsxLogicalSwitchPort) {
221+
this.nsxLogicalSwitchPort = nsxLogicalSwitchPort;
222222
}
223223

224224
}

plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,23 @@ public NiciraNvpGuestNetworkGuru() {
113113
protected boolean canHandle(final NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
114114
// This guru handles only Guest Isolated network that supports Source nat service
115115
if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType())
116-
&& (offering.getGuestType() == Network.GuestType.Isolated || offering.getGuestType() == Network.GuestType.Shared)
116+
&& supportedGuestTypes(offering, Network.GuestType.Isolated, Network.GuestType.Shared)
117117
&& isMyIsolationMethod(physicalNetwork) && ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) {
118118
return true;
119119
} else {
120120
return false;
121121
}
122122
}
123123

124+
private boolean supportedGuestTypes(NetworkOffering offering, GuestType... types) {
125+
for (GuestType guestType : types) {
126+
if (offering.getGuestType().equals(guestType)){
127+
return true;
128+
}
129+
}
130+
return false;
131+
}
132+
124133
@Override
125134
public Network design(final NetworkOffering offering, final DeploymentPlan plan, final Network userSpecified, final Account owner) {
126135
// Check of the isolation type of the related physical network is supported

server/src/com/cloud/api/ApiResponseHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,10 +3470,10 @@ public NicResponse createNicResponse(Nic result) {
34703470

34713471
if (result instanceof NicVO){
34723472
if (((NicVO)result).getNsxLogicalSwitchUuid() != null){
3473-
response.setNsxlogicalswitch(((NicVO)result).getNsxLogicalSwitchUuid());
3473+
response.setNsxLogicalSwitch(((NicVO)result).getNsxLogicalSwitchUuid());
34743474
}
34753475
if (((NicVO)result).getNsxLogicalSwitchPortUuid() != null){
3476-
response.setNsxlogicalswitchport(((NicVO)result).getNsxLogicalSwitchPortUuid());
3476+
response.setNsxLogicalSwitchPort(((NicVO)result).getNsxLogicalSwitchPortUuid());
34773477
}
34783478
}
34793479
return response;

0 commit comments

Comments
 (0)