Skip to content

Commit 49c449f

Browse files
committed
Update 11811: automatically allocate IP address on non-L2 networks
1 parent 9be6362 commit 49c449f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,9 @@ private UserVm importKvmVirtualMachineFromDisk(final ImportSource importSource,
26112611

26122612
String macAddress = networkModel.getNextAvailableMacAddressInNetwork(networkId);
26132613

2614-
Network.IpAddresses requestedIpPair = new Network.IpAddresses(null, null, macAddress);
2614+
String ipAddress = network.getGuestType() != Network.GuestType.L2 ? "auto" : null;
2615+
2616+
Network.IpAddresses requestedIpPair = new Network.IpAddresses(ipAddress, null, macAddress);
26152617

26162618
NicProfile nicProfile = new NicProfile(requestedIpPair.getIp4Address(), requestedIpPair.getIp6Address(), requestedIpPair.getMacAddress());
26172619
nicProfile.setOrderIndex(0);

0 commit comments

Comments
 (0)