Skip to content

Commit fe0b685

Browse files
committed
Security group is a service now
1 parent 71b53a3 commit fe0b685

36 files changed

+229
-192
lines changed

agent-simulator/src/com/cloud/resource/AgentRoutingResource.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package com.cloud.resource;
66

7-
import java.io.File;
87
import java.util.ArrayList;
98
import java.util.HashMap;
109
import java.util.List;
@@ -18,9 +17,7 @@
1817
import com.cloud.agent.api.CheckVirtualMachineAnswer;
1918
import com.cloud.agent.api.CheckVirtualMachineCommand;
2019
import com.cloud.agent.api.Command;
21-
2220
import com.cloud.agent.api.PingCommand;
23-
import com.cloud.agent.api.PingRoutingCommand;
2421
import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
2522
import com.cloud.agent.api.PrepareForMigrationCommand;
2623
import com.cloud.agent.api.ReadyAnswer;

api/src/com/cloud/api/ApiConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ public class ApiConstants {
153153
public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
154154
public static final String SECURITY_GROUP_NAME = "securitygroupname";
155155
public static final String SECURITY_GROUP_ID = "securitygroupid";
156-
public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
157156
public static final String SENT = "sent";
158157
public static final String SENT_BYTES = "sentbytes";
159158
public static final String SERVICE_OFFERING_ID = "serviceofferingid";
@@ -283,4 +282,5 @@ public class ApiConstants {
283282
public static final String SERVICE_NAME = "servicename";
284283
public static final String DHCP_RANGE = "dhcprange";
285284
public static final String UUID = "uuid";
285+
public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
286286
}

api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
9797
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
9898
private Map serviceProviderList;
9999

100-
@Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="true is security group is enabled for the network offering")
101-
private Boolean securityGroupEnabled;
102-
103100
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, required=true, description="type of the network offering: Shared or Isolated")
104101
private String type;
105102

@@ -207,10 +204,6 @@ public Map<String, List<String>> getServiceProviders() {
207204
return serviceProviderMap;
208205
}
209206

210-
public Boolean getSecurityGroupEnabled() {
211-
return securityGroupEnabled == null ? false : securityGroupEnabled;
212-
}
213-
214207
/////////////////////////////////////////////////////
215208
/////////////// API Implementation///////////////////
216209
/////////////////////////////////////////////////////

api/src/com/cloud/api/commands/CreateZoneCmd.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public class CreateZoneCmd extends BaseCmd {
6868

6969
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Zone for allocation of new resources")
7070
private String allocationState;
71+
72+
@Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="true if network is security group enabled, false otherwise")
73+
private Boolean securitygroupenabled;
7174

7275
/////////////////////////////////////////////////////
7376
/////////////////// Accessors ///////////////////////
@@ -111,12 +114,18 @@ public String getNetworkType(){
111114

112115
public String getAllocationState() {
113116
return allocationState;
114-
}
117+
}
118+
119+
public Boolean getSecuritygroupenabled() {
120+
if (securitygroupenabled == null) {
121+
return false;
122+
}
123+
return securitygroupenabled;
124+
}
115125

116126

117127
/////////////////////////////////////////////////////
118128
/////////////// API Implementation///////////////////
119-
120129
@Override
121130
public String getCommandName() {
122131
return s_name;

api/src/com/cloud/api/commands/DeployVMCmd.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,10 @@ public void create() throws ResourceAllocationException{
371371
displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
372372
}
373373
} else {
374-
if (zone.isSecurityGroupEnabled()) {
374+
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
375375
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
376376
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
377377
} else {
378-
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
379-
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
380-
}
381378
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
382379
diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
383380
}

api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
6868
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list netowrk offerings available for network creation in specific zone")
6969
private Long zoneId;
7070

71-
@Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="list network offerings that have security group feature enabled")
72-
private Boolean securityGroupEnabled;
73-
7471
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list network offerings by state")
7572
private String state;
7673

@@ -120,10 +117,6 @@ public Long getZoneId() {
120117
return zoneId;
121118
}
122119

123-
public Boolean getSecurityGroupEnabled() {
124-
return securityGroupEnabled;
125-
}
126-
127120
public String getState() {
128121
return state;
129122
}

api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
8888

8989
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list network offerings by state")
9090
private String state;
91-
92-
@Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="true is security group is enabled for the network offering")
93-
private Boolean securityGroupEnabled;
9491

9592
/////////////////////////////////////////////////////
9693
/////////////////// Accessors ///////////////////////
@@ -172,10 +169,6 @@ public String getState() {
172169
return state;
173170
}
174171

175-
public Boolean getSecurityGroupEnabled() {
176-
return securityGroupEnabled;
177-
}
178-
179172
/////////////////////////////////////////////////////
180173
/////////////// API Implementation///////////////////
181174
/////////////////////////////////////////////////////

api/src/com/cloud/api/response/HypervisorCapabilitiesResponse.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public class HypervisorCapabilitiesResponse extends BaseResponse {
3838
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is supported")
3939
private boolean isSecurityGroupEnabled;
4040

41-
42-
4341
@Override
4442
public Long getObjectId() {
4543
return getId();

api/src/com/cloud/api/response/NetworkOfferingResponse.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ public class NetworkOfferingResponse extends BaseResponse{
6262
@SerializedName(ApiConstants.NETWORKRATE) @Param(description="data transfer rate in megabits per second allowed.")
6363
private Integer networkRate;
6464

65-
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is enabled, false otherwise")
66-
private Boolean isSecurityGroupEnabled;
67-
6865
@SerializedName(ApiConstants.STATE) @Param(description="state of the network offering. Can be Disabled/Enabled/Inactive")
6966
private String state;
7067

@@ -122,10 +119,6 @@ public void setNetworkRate(Integer networkRate) {
122119
this.networkRate = networkRate;
123120
}
124121

125-
public void setIsSecurityGroupEnabled(Boolean isSecurityGroupEnabled) {
126-
this.isSecurityGroupEnabled = isSecurityGroupEnabled;
127-
}
128-
129122
public void setServices(List<ServiceResponse> services) {
130123
this.services = services;
131124
}

api/src/com/cloud/api/response/NetworkResponse.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
120120
@SerializedName(ApiConstants.NETWORK_DOMAIN) @Param(description="the network domain")
121121
private String networkDomain;
122122

123-
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is enabled, false otherwise")
124-
private Boolean isSecurityGroupEnabled;
125-
126123
@SerializedName(ApiConstants.TAGS) @Param(description="comma separated tag")
127124
private String tags;
128125

@@ -246,10 +243,6 @@ public void setNetworkDomain(String networkDomain) {
246243
this.networkDomain = networkDomain;
247244
}
248245

249-
public void setIsSecurityGroupEnabled(Boolean sgEnabled) {
250-
this.isSecurityGroupEnabled = sgEnabled;
251-
}
252-
253246
public void setTags(List<String> tags) {
254247
if (tags == null || tags.size() == 0) {
255248
return;

0 commit comments

Comments
 (0)