Fix reconnect host failed when nic has no ip
Resolves
@@ -190,7 +190,7 @@ public class FlatDhcpBackend extends AbstractService implements NetworkServiceDh
if (info.isDefaultL3Network) {
info.hostname = hostnames.get(nic.getVmInstanceUuid());
- if (info.hostname == null) {
+ if (info.hostname == null && nic.getIp() != null) {
info.hostname = nic.getIp().replaceAll("\\.", "-");
}
@@ -549,7 +549,7 @@ public class FlatDhcpBackend extends AbstractService implements NetworkServiceDh
if (info.isDefaultL3Network) {
info.hostname = hostnames.get(nic.getVmInstanceUuid());
- if (info.hostname == null) {
+ if (info.hostname == null && nic.getIp() != null) {
info.hostname = nic.getIp().replaceAll("\\.", "-");
}
