Skip to content

Commit cb45133

Browse files
author
Anthony Xu
committed
for windows guest OS, configure gateway for each nic
1 parent d0da107 commit cb45133

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
import com.cloud.server.ConfigurationServer;
181181
import com.cloud.service.ServiceOfferingVO;
182182
import com.cloud.service.dao.ServiceOfferingDao;
183+
import com.cloud.storage.GuestOSVO;
183184
import com.cloud.storage.Storage.ProvisioningType;
184185
import com.cloud.storage.VMTemplateVO;
185186
import com.cloud.storage.Volume;
@@ -3656,10 +3657,12 @@ private void createDhcpEntryCommand(final VirtualRouter router, final UserVm vm,
36563657
final DhcpEntryCommand dhcpCommand =
36573658
new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName(), nic.getIp6Address(), _networkModel.getExecuteInSeqNtwkElmtCmd());
36583659
final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
3659-
final Nic defaultNic = findGatewayIp(vm.getId());
3660-
String gatewayIp = defaultNic.getGateway();
3661-
if (gatewayIp != null && !gatewayIp.equals(nic.getGateway())) {
3662-
gatewayIp = "0.0.0.0";
3660+
String gatewayIp = nic.getGateway();
3661+
if (!nic.isDefaultNic() ) {
3662+
GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
3663+
if ( guestOS == null || !guestOS.getDisplayName().toLowerCase().contains("windows")) {
3664+
gatewayIp = "0.0.0.0";
3665+
}
36633666
}
36643667
dhcpCommand.setDefaultRouter(gatewayIp);
36653668
dhcpCommand.setIp6Gateway(nic.getIp6Gateway());

0 commit comments

Comments
 (0)