Skip to content

Commit af5bf94

Browse files
ustcweizhouchipchilders
authored andcommitted
CLOUDSTACK-2319: fix "unable to add egress rules" in SecurityGroup
Signed-off-by: Chip Childers <chip.childers@gmail.com>
1 parent 599023b commit af5bf94

4 files changed

Lines changed: 164 additions & 151 deletions

File tree

api/src/com/cloud/network/security/SecurityGroupRules.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public interface SecurityGroupRules extends InternalIdentity {
3131

3232
Long getRuleId();
3333

34+
String getRuleUuid();
35+
3436
int getStartPort();
3537

3638
int getEndPort();

core/src/com/cloud/network/security/SecurityGroupRulesVO.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public class SecurityGroupRulesVO implements SecurityGroupRules {
5454
@Column(name = "id", table = "security_group_rule", insertable = false, updatable = false)
5555
private Long ruleId;
5656

57+
@Column(name = "uuid", table = "security_group_rule", insertable = false, updatable = false)
58+
private String ruleUuid;
59+
5760
@Column(name = "start_port", table = "security_group_rule", insertable = false, updatable = false)
5861
private int startPort;
5962

@@ -75,14 +78,19 @@ public class SecurityGroupRulesVO implements SecurityGroupRules {
7578
public SecurityGroupRulesVO() {
7679
}
7780

78-
public SecurityGroupRulesVO(long id, String name, String description, Long domainId, Long accountId, Long ruleId, int startPort, int endPort, String protocol, Long allowedNetworkId,
81+
public SecurityGroupRulesVO(long id) {
82+
this.id = id;
83+
}
84+
85+
public SecurityGroupRulesVO(long id, String name, String description, Long domainId, Long accountId, Long ruleId, String ruleUuid, int startPort, int endPort, String protocol, Long allowedNetworkId,
7986
String allowedSourceIpCidr) {
8087
this.id = id;
8188
this.name = name;
8289
this.description = description;
8390
this.domainId = domainId;
8491
this.accountId = accountId;
8592
this.ruleId = ruleId;
93+
this.ruleUuid = ruleUuid;
8694
this.startPort = startPort;
8795
this.endPort = endPort;
8896
this.protocol = protocol;
@@ -120,6 +128,11 @@ public Long getRuleId() {
120128
return ruleId;
121129
}
122130

131+
@Override
132+
public String getRuleUuid() {
133+
return ruleUuid;
134+
}
135+
123136
@Override
124137
public int getStartPort() {
125138
return startPort;

server/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,13 @@ public List<SecurityGroupRulesVO> listSecurityRulesByGroupId(long groupId) {
8484
sc.setParameters("groupId", groupId);
8585
return listBy(sc, searchFilter);
8686
}
87+
88+
@Override
89+
public SecurityGroupRulesVO findByUuidIncludingRemoved(final String uuid) {
90+
SearchCriteria<SecurityGroupRulesVO> sc = createSearchCriteria();
91+
sc.addAnd("ruleUuid", SearchCriteria.Op.EQ, uuid);
92+
SecurityGroupRulesVO rule = findOneIncludingRemovedBy(sc);
93+
SecurityGroupRulesVO newRule = new SecurityGroupRulesVO(rule.getRuleId());
94+
return newRule;
95+
}
8796
}

0 commit comments

Comments
 (0)