From 6d9cafbf35e39ee8371c79722c6d2cb34dd36963 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Fri, 9 Nov 2012 11:02:07 -0800 Subject: [PATCH] DeployVm: when SG enabled network is passed to the command, but no SG list is defined in the request, add the vm to SG enabled network automatically Conflicts: server/src/com/cloud/vm/UserVmManagerImpl.java --- server/src/com/cloud/vm/UserVmManagerImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index a2a548fee44..96f1a2d20ef 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2145,8 +2145,13 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager } boolean isSecurityGroupEnabled = _networkMgr.isSecurityGroupSupportedInNetwork(network); - if (isSecurityGroupEnabled && networkIdList.size() > 1) { - throw new InvalidParameterValueException("Can't create a vm with multiple networks one of which is Security Group enabled"); + if (isSecurityGroupEnabled) { + if (networkIdList.size() > 1) { + throw new InvalidParameterValueException("Can't create a vm with multiple networks one of" + + " which is Security Group enabled"); + } + + isSecurityGroupEnabledNetworkUsed = true; } if (network.getTrafficType() != TrafficType.Guest || network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && !isSecurityGroupEnabled)) {