Skip to content

Commit 78fda2d

Browse files
With basic zone and VMware hypervisor, VR fails to start since eth1 is getting empty instead of a private IP. (#3977)
Though VMware does not support security groups, but in a basic zone with VMware and no isolation VMs should be able to deploy. Root cause: In case of VMware and basic zone control nic is set to 0.0.0.0 assuming control network will be shared with guest network. But to have access to VMware instances management/private needs to be assigned to it. Solution: Assing a private ip even in case of basic zone VMware.
1 parent d93c245 commit 78fda2d

File tree

3 files changed

+12
-40
lines changed

3 files changed

+12
-40
lines changed

plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@
200200
import com.cloud.agent.resource.virtualnetwork.VirtualRouterDeployer;
201201
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
202202
import com.cloud.configuration.Resource.ResourceType;
203-
import com.cloud.dc.DataCenter.NetworkType;
204203
import com.cloud.dc.Vlan;
205204
import com.cloud.exception.CloudException;
206205
import com.cloud.exception.InternalErrorException;
@@ -6411,16 +6410,6 @@ private static HostStatsEntry getHyperHostStats(VmwareHypervisorHost hyperHost)
64116410

64126411
private static String getRouterSshControlIp(NetworkElementCommand cmd) {
64136412
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
6414-
String routerGuestIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
6415-
String zoneNetworkType = cmd.getAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE);
6416-
6417-
if (routerGuestIp != null && zoneNetworkType != null && NetworkType.valueOf(zoneNetworkType) == NetworkType.Basic) {
6418-
if (s_logger.isDebugEnabled())
6419-
s_logger.debug("In Basic zone mode, use router's guest IP for SSH control. guest IP : " + routerGuestIp);
6420-
6421-
return routerGuestIp;
6422-
}
6423-
64246413
if (s_logger.isDebugEnabled())
64256414
s_logger.debug("Use router's private IP for SSH control. IP : " + routerIp);
64266415
return routerIp;

server/src/main/java/com/cloud/network/guru/ControlNetworkGuru.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,11 @@ public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, De
138138
// we have to get management/private ip for the control nic for vmware/hyperv due ssh issues.
139139
HypervisorType hType = vm.getHypervisorType();
140140
if (((hType == HypervisorType.VMware) || (hType == HypervisorType.Hyperv)) && isRouterVm(vm)) {
141-
if (dest.getDataCenter().getNetworkType() != NetworkType.Basic) {
142-
super.reserve(nic, config, vm, dest, context);
141+
super.reserve(nic, config, vm, dest, context);
143142

144-
String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId());
145-
nic.setMacAddress(mac);
146-
return;
147-
} else {
148-
// in basic mode and in VMware case, control network will be shared with guest network
149-
String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId());
150-
nic.setMacAddress(mac);
151-
nic.setIPv4Address("0.0.0.0");
152-
nic.setIPv4Netmask("0.0.0.0");
153-
nic.setFormat(AddressFormat.Ip4);
154-
nic.setIPv4Gateway("0.0.0.0");
155-
return;
156-
}
143+
String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId());
144+
nic.setMacAddress(mac);
145+
return;
157146
}
158147

159148
String ip = _dcDao.allocateLinkLocalIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId());

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,11 @@ public boolean finalizeVirtualMachineProfile(final VirtualMachineProfile profile
14011401

14021402
if (dc.getNetworkType() == NetworkType.Basic) {
14031403
// ask domR to setup SSH on guest network
1404-
buf.append(" sshonguest=true");
1404+
if (profile.getHypervisorType() == HypervisorType.VMware) {
1405+
buf.append(" sshonguest=false");
1406+
} else {
1407+
buf.append(" sshonguest=true");
1408+
}
14051409
}
14061410

14071411
}
@@ -1760,19 +1764,9 @@ protected NicProfile getControlNic(final VirtualMachineProfile profile) {
17601764
final DomainRouterVO router = _routerDao.findById(profile.getId());
17611765
final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
17621766
NicProfile controlNic = null;
1763-
if (profile.getHypervisorType() == HypervisorType.VMware && dcVo.getNetworkType() == NetworkType.Basic) {
1764-
// TODO this is a ugly to test hypervisor type here
1765-
// for basic network mode, we will use the guest NIC for control NIC
1766-
for (final NicProfile nic : profile.getNics()) {
1767-
if (nic.getTrafficType() == TrafficType.Guest && nic.getIPv4Address() != null) {
1768-
controlNic = nic;
1769-
}
1770-
}
1771-
} else {
1772-
for (final NicProfile nic : profile.getNics()) {
1773-
if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) {
1774-
controlNic = nic;
1775-
}
1767+
for (final NicProfile nic : profile.getNics()) {
1768+
if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) {
1769+
controlNic = nic;
17761770
}
17771771
}
17781772
return controlNic;

0 commit comments

Comments
 (0)