Skip to content

Commit

Permalink
Enable to Leave network card without ip address
Browse files Browse the repository at this point in the history
fix issue #502
  • Loading branch information
MalloZup committed Feb 22, 2019
1 parent 6d80735 commit 49bb0c9
Showing 1 changed file with 10 additions and 11 deletions.
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

0 comments on commit 49bb0c9

Please sign in to comment.