mirror of https://github.com/apache/cloudstack.git
Always add default security group when deploy vm in Basic zone
This commit is contained in:
parent
ec8ca477a0
commit
af08b2e0a9
|
|
@ -120,10 +120,11 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
|
|||
}
|
||||
|
||||
if (securityGroupName != null) {
|
||||
securityGroupId = _responseGenerator.getSecurityGroupId(securityGroupName, getEntityOwnerId());
|
||||
if (securityGroupId == null) {
|
||||
Long groupId = _responseGenerator.getSecurityGroupId(securityGroupName, getEntityOwnerId());
|
||||
if (groupId == null) {
|
||||
throw new InvalidParameterValueException("Unable to find security group " + securityGroupName + " for account id=" + getEntityOwnerId());
|
||||
}
|
||||
return groupId;
|
||||
}
|
||||
|
||||
return securityGroupId;
|
||||
|
|
|
|||
|
|
@ -53,10 +53,12 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
|
|||
}
|
||||
|
||||
if (name != null) {
|
||||
id = _responseGenerator.getSecurityGroupId(name, getEntityOwnerId());
|
||||
if (id == null) {
|
||||
Long groupId = _responseGenerator.getSecurityGroupId(name, getEntityOwnerId());
|
||||
if (groupId == null) {
|
||||
throw new InvalidParameterValueException("Unable to find security group by name " + name + " for the account id=" + getEntityOwnerId());
|
||||
}
|
||||
|
||||
return groupId;
|
||||
}
|
||||
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -147,21 +147,22 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
public List<Long> getSecurityGroupIdList() {
|
||||
if (securityGroupIdList != null && securityGroupIdList != null) {
|
||||
if (securityGroupIdList != null && securityGroupNameList != null) {
|
||||
throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
|
||||
}
|
||||
|
||||
//transform group names to ids here
|
||||
if (securityGroupNameList != null) {
|
||||
securityGroupIdList = new ArrayList<Long>();
|
||||
List<Long> securityGroupIdListToReturn = new ArrayList<Long>();
|
||||
for (String groupName : securityGroupNameList) {
|
||||
Long groupId = _responseGenerator.getSecurityGroupId(groupName, getEntityOwnerId());
|
||||
if (groupId == null) {
|
||||
throw new InvalidParameterValueException("Unable to find group by name " + groupName + " for account " + getEntityOwnerId());
|
||||
} else {
|
||||
securityGroupIdList.add(groupId);
|
||||
securityGroupIdListToReturn.add(groupId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return securityGroupIdListToReturn;
|
||||
}
|
||||
|
||||
return securityGroupIdList;
|
||||
|
|
|
|||
|
|
@ -1953,8 +1953,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
|
||||
if (securityGroupIdList != null && isVmWare) {
|
||||
throw new InvalidParameterValueException("Security group feature is not supported for vmWare hypervisor");
|
||||
} else if (securityGroupIdList == null && !isVmWare) {
|
||||
securityGroupIdList = new ArrayList<Long>();
|
||||
} else if (!isVmWare) {
|
||||
if (securityGroupIdList == null) {
|
||||
securityGroupIdList = new ArrayList<Long>();
|
||||
}
|
||||
|
||||
SecurityGroup defaultGroup = _securityGroupMgr.getDefaultSecurityGroup(owner.getId());
|
||||
if (defaultGroup != null) {
|
||||
//check if security group id list already contains Default security group, and if not - add it
|
||||
|
|
|
|||
Loading…
Reference in New Issue