Skip to content

Commit 0e6fcbc

Browse files
committed
kvm2 driver: add static ip
1 parent 88ed7f2 commit 0e6fcbc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: pkg/drivers/kvm/network.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func dhcpLease(conn *libvirt.Connect, network, hostname, mac, ip string) (lease
443443
return nil, nil
444444
}
445445

446-
// ipFromAPI returns current IP address of domain interface in network.
446+
// ipFromAPI returns current primary IP address of domain interface in network.
447447
func ipFromAPI(conn *libvirt.Connect, domain, network string) (string, error) {
448448
mac, err := macFromXML(conn, domain, network)
449449
if err != nil {
@@ -457,7 +457,7 @@ func ipFromAPI(conn *libvirt.Connect, domain, network string) (string, error) {
457457
for _, i := range ifaces {
458458
if i.Hwaddr == mac {
459459
if i.Addrs != nil {
460-
log.Debugf("domain %s has current IP address %s and MAC address %s in network %s", domain, i.Addrs, mac, network)
460+
log.Debugf("domain %s has current primary IP address %s and MAC address %s in network %s", domain, i.Addrs[0].Addr, mac, network)
461461
return i.Addrs[0].Addr, nil
462462
}
463463
log.Debugf("domain %s with MAC address %s doesn't have current IP address in network %s: %+v", domain, mac, network, i)

0 commit comments

Comments
 (0)