Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable to Leave network card without ip address #556

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions libvirt/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,17 +676,16 @@ func setNetworkInterfaces(d *schema.ResourceData, domainDef *libvirtxml.Domain,
break
}
}
if !wait {
return fmt.Errorf("Cannot map '%s': we are not waiting for DHCP lease and no IP has been provided", hostname)
}
// the resource specifies a hostname but not an IP, so we must wait until we
// have a valid lease and then read the IP we have been assigned, so we can
// do the mapping
log.Printf("[DEBUG] Do not have an IP for '%s' yet: will wait until DHCP provides one...", hostname)
partialNetIfaces[strings.ToUpper(mac)] = &pendingMapping{
mac: strings.ToUpper(mac),
hostname: hostname,
network: network,
if wait {
// the resource specifies a hostname but not an IP, so we must wait until we
// have a valid lease and then read the IP we have been assigned, so we can
// do the mapping
log.Printf("[DEBUG] Do not have an IP for '%s' yet: will wait until DHCP provides one...", hostname)
partialNetIfaces[strings.ToUpper(mac)] = &pendingMapping{
mac: strings.ToUpper(mac),
hostname: hostname,
network: network,
}
}
}
}
Expand Down