Skip to content

Commit 4976a67

Browse files
author
Alena Prokharchyk
committed
CLOUDSTACK-4193: don't let privateGateway to be created with NULL networkId
1 parent 35d20d1 commit 4976a67

6 files changed

Lines changed: 7 additions & 17 deletions

File tree

api/src/com/cloud/network/vpc/VpcGateway.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public enum State {
5656
/**
5757
* @return
5858
*/
59-
Long getNetworkId();
59+
long getNetworkId();
6060

6161
/**
6262
* @return

engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class VpcGatewayVO implements VpcGateway {
6363
long zoneId;
6464

6565
@Column(name="network_id")
66-
Long networkId;
66+
long networkId;
6767

6868
@Column(name=GenericDao.CREATED_COLUMN)
6969
Date created;
@@ -110,7 +110,7 @@ protected VpcGatewayVO(){
110110
* @param account_id
111111
* @param sourceNat
112112
*/
113-
public VpcGatewayVO(String ip4Address, Type type, Long vpcId, long zoneId, Long networkId, String vlanTag,
113+
public VpcGatewayVO(String ip4Address, Type type, long vpcId, long zoneId, long networkId, String vlanTag,
114114
String gateway, String netmask, long accountId, long domainId, boolean sourceNat, long networkACLId) {
115115
this.ip4Address = ip4Address;
116116
this.type = type;
@@ -160,7 +160,7 @@ public long getZoneId() {
160160
}
161161

162162
@Override
163-
public Long getNetworkId() {
163+
public long getNetworkId() {
164164
return networkId;
165165
}
166166

engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
// under the License.
1717
package com.cloud.network.vpc.dao;
1818

19+
import java.util.List;
20+
1921
import com.cloud.network.vpc.VpcGateway;
2022
import com.cloud.network.vpc.VpcGatewayVO;
2123
import com.cloud.utils.db.GenericDao;
2224

23-
import java.util.List;
24-
2525

2626
public interface VpcGatewayDao extends GenericDao<VpcGatewayVO, Long>{
2727
VpcGatewayVO getPrivateGatewayForVpc(long vpcId);
28-
VpcGatewayVO getVpnGatewayForVpc(long vpcId);
2928

3029
Long getNetworkAclIdForPrivateIp(long vpcId, long networkId, String ipaddr);
3130

engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDaoImpl.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ public VpcGatewayVO getPrivateGatewayForVpc(long vpcId) {
5555
return findOneBy(sc);
5656
}
5757

58-
@Override
59-
public VpcGatewayVO getVpnGatewayForVpc(long vpcId) {
60-
SearchCriteria<VpcGatewayVO> sc = AllFieldsSearch.create();
61-
sc.setParameters("vpcId", vpcId);
62-
sc.setParameters("type", VpcGateway.Type.Vpn);
63-
64-
return findOneBy(sc);
65-
}
6658

6759
@Override
6860
public Long getNetworkAclIdForPrivateIp (long vpcId, long networkId, String ipaddr) {

server/src/com/cloud/network/element/VpcVirtualRouterElement.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ public boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throw
448448

449449
@Override
450450
public boolean applyACLItemsToPrivateGw(PrivateGateway gateway,List<? extends NetworkACLItem> rules) throws ResourceUnavailableException {
451-
VpcGatewayVO vpcGatewayVo = _vpcGatewayDao.findById(gateway.getId());
452451
Network config = _networkDao.findById(gateway.getNetworkId());
453452
boolean isPrivateGateway = true;
454453

server/src/com/cloud/network/vpc/PrivateGatewayProfile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public long getZoneId() {
5757
}
5858

5959
@Override
60-
public Long getNetworkId() {
60+
public long getNetworkId() {
6161
return vpcGateway.getNetworkId();
6262
}
6363

0 commit comments

Comments
 (0)