Skip to content

Commit 5f1e11f

Browse files
committed
server: fetch IP of VMs on L2 networks
1 parent f50de89 commit 5f1e11f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2397,9 +2397,10 @@ public boolean start() {
23972397
private void loadVmDetailsInMapForExternalDhcpIp() {
23982398

23992399
List<NetworkVO> networks = _networkDao.listByGuestType(Network.GuestType.Shared);
2400+
networks.addAll(_networkDao.listByGuestType(Network.GuestType.L2));
24002401

24012402
for (NetworkVO network: networks) {
2402-
if(_networkModel.isSharedNetworkWithoutServices(network.getId())) {
2403+
if (GuestType.L2.equals(network.getGuestType()) || _networkModel.isSharedNetworkWithoutServices(network.getId())) {
24032404
List<NicVO> nics = _nicDao.listByNetworkId(network.getId());
24042405

24052406
for (NicVO nic : nics) {
@@ -3279,7 +3280,7 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityE
32793280
final List<NicVO> nics = _nicDao.listByVmId(vmId);
32803281
for (NicVO nic : nics) {
32813282
Network network = _networkModel.getNetwork(nic.getNetworkId());
3282-
if (_networkModel.isSharedNetworkWithoutServices(network.getId())) {
3283+
if (GuestType.L2.equals(network.getGuestType()) || _networkModel.isSharedNetworkWithoutServices(network.getId())) {
32833284
s_logger.debug("Adding vm " +vmId +" nic id "+ nic.getId() +" into vmIdCountMap as part of vm " +
32843285
"reboot for vm ip fetch ");
32853286
vmIdCountMap.put(nic.getId(), new VmAndCountDetails(nic.getInstanceId(), VmIpFetchTrialMax.value()));
@@ -5202,7 +5203,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
52025203
final List<NicVO> nics = _nicDao.listByVmId(vm.getId());
52035204
for (NicVO nic : nics) {
52045205
Network network = _networkModel.getNetwork(nic.getNetworkId());
5205-
if (_networkModel.isSharedNetworkWithoutServices(network.getId())) {
5206+
if (GuestType.L2.equals(network.getGuestType()) || _networkModel.isSharedNetworkWithoutServices(network.getId())) {
52065207
vmIdCountMap.put(nic.getId(), new VmAndCountDetails(nic.getInstanceId(), VmIpFetchTrialMax.value()));
52075208
}
52085209
}

0 commit comments

Comments
 (0)