mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Make sure other than user VMs can have multiple NICs in a network (#5896)
* only check user VMs * Update engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java Co-authored-by: Daan Hoogland <dahn@onecht.net> Co-authored-by: Wei Zhou <weizhou@apache.org>
This commit is contained in:
parent
c1bba2a308
commit
fde34df560
@ -4043,7 +4043,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
/**
|
||||
* duplicated in {@see UserVmManagerImpl} for a {@see UserVmVO}
|
||||
*/
|
||||
private void checkIfNetworkExistsForVM(VirtualMachine virtualMachine, Network network) {
|
||||
private void checkIfNetworkExistsForUserVM(VirtualMachine virtualMachine, Network network) {
|
||||
if (virtualMachine.getType() != VirtualMachine.Type.User) {
|
||||
return; // others may have multiple nics in the same network
|
||||
}
|
||||
List<NicVO> allNics = _nicsDao.listByVmId(virtualMachine.getId());
|
||||
for (NicVO nic : allNics) {
|
||||
if (nic.getNetworkId() == network.getId()) {
|
||||
@ -4056,7 +4059,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
InsufficientCapacityException {
|
||||
final CallContext cctx = CallContext.current();
|
||||
|
||||
checkIfNetworkExistsForVM(vm, network);
|
||||
checkIfNetworkExistsForUserVM(vm, network);
|
||||
s_logger.debug("Adding vm " + vm + " to network " + network + "; requested nic profile " + requested);
|
||||
final VMInstanceVO vmVO = _vmDao.findById(vm.getId());
|
||||
final ReservationContext context = new ReservationContextImpl(null, null, cctx.getCallingUser(), cctx.getCallingAccount());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user