|
81 | 81 | import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd; |
82 | 82 | import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd; |
83 | 83 | import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd; |
84 | | -import com.cloud.agent.api.to.deployasis.OVFNetworkTO; |
85 | 84 | import org.apache.cloudstack.backup.Backup; |
86 | 85 | import org.apache.cloudstack.backup.BackupManager; |
87 | 86 | import org.apache.cloudstack.backup.dao.BackupDao; |
|
145 | 144 | import com.cloud.agent.api.to.DiskTO; |
146 | 145 | import com.cloud.agent.api.to.NicTO; |
147 | 146 | import com.cloud.agent.api.to.VirtualMachineTO; |
| 147 | +import com.cloud.agent.api.to.deployasis.OVFNetworkTO; |
148 | 148 | import com.cloud.agent.api.to.deployasis.OVFPropertyTO; |
149 | 149 | import com.cloud.agent.manager.Commands; |
150 | 150 | import com.cloud.alert.AlertManager; |
@@ -1333,12 +1333,8 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV |
1333 | 1333 | throw new InvalidParameterValueException("unable to find a network with id " + networkId); |
1334 | 1334 | } |
1335 | 1335 |
|
1336 | | - if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { |
1337 | | - if (!(network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Domain) |
1338 | | - && !(network.getAclType() == ACLType.Account && network.getAccountId() == vmInstance.getAccountId())) { |
1339 | | - throw new InvalidParameterValueException("only shared network or isolated network with the same account_id can be added to vmId: " + vmId); |
1340 | | - } |
1341 | | - } |
| 1336 | + Account vmOwner = _accountMgr.getAccount(vmInstance.getAccountId()); |
| 1337 | + _networkModel.checkNetworkPermissions(vmOwner, network); |
1342 | 1338 |
|
1343 | 1339 | List<NicVO> allNics = _nicDao.listByVmId(vmInstance.getId()); |
1344 | 1340 | for (NicVO nic : allNics) { |
|
0 commit comments