|
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; |
@@ -1310,12 +1310,8 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV |
1310 | 1310 | throw new InvalidParameterValueException("unable to find a network with id " + networkId); |
1311 | 1311 | } |
1312 | 1312 |
|
1313 | | - if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { |
1314 | | - if (!(network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Domain) |
1315 | | - && !(network.getAclType() == ACLType.Account && network.getAccountId() == vmInstance.getAccountId())) { |
1316 | | - throw new InvalidParameterValueException("only shared network or isolated network with the same account_id can be added to vmId: " + vmId); |
1317 | | - } |
1318 | | - } |
| 1313 | + Account vmOwner = _accountMgr.getAccount(vmInstance.getAccountId()); |
| 1314 | + _networkModel.checkNetworkPermissions(vmOwner, network); |
1319 | 1315 |
|
1320 | 1316 | List<NicVO> allNics = _nicDao.listByVmId(vmInstance.getId()); |
1321 | 1317 | for (NicVO nic : allNics) { |
|
0 commit comments