Added logs to all of the VMware drivers that emits each detected network device that gets enumerated for a network.

This commit is contained in:
Ali Rizvi-Santiago 2018-03-29 13:06:41 -05:00
parent 646523c5f4
commit 6e176f97a0
3 changed files with 22 additions and 0 deletions

View File

@ -296,6 +296,7 @@ func (d *VmwareDriver) GuestAddress(state multistep.StateBag) (string, error) {
return "", errors.New("couldn't find MAC address in VMX") return "", errors.New("couldn't find MAC address in VMX")
} }
} }
log.Printf("GuestAddress: Found MAC address in VMX: %s", macAddress)
res, err := net.ParseMAC(macAddress) res, err := net.ParseMAC(macAddress)
if err != nil { if err != nil {
@ -317,6 +318,11 @@ func (d *VmwareDriver) GuestIP(state multistep.StateBag) (string, error) {
network := state.Get("vmnetwork").(string) network := state.Get("vmnetwork").(string)
devices, err := netmap.NameIntoDevices(network) devices, err := netmap.NameIntoDevices(network)
// log them to see what was detected
for _, device := range devices {
log.Printf("GuestIP(%s): Discovered device: %s", network, device)
}
// we were unable to find the device, maybe it's a custom one... // we were unable to find the device, maybe it's a custom one...
// so, check to see if it's in the .vmx configuration // so, check to see if it's in the .vmx configuration
if err != nil || network == "custom" { if err != nil || network == "custom" {
@ -332,6 +338,7 @@ func (d *VmwareDriver) GuestIP(state multistep.StateBag) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
log.Printf("GuestIP(%s): Discovered custom device: %s", network, device)
} }
// figure out our MAC address for looking up the guest address // figure out our MAC address for looking up the guest address
@ -415,6 +422,11 @@ func (d *VmwareDriver) HostAddress(state multistep.StateBag) (string, error) {
network := state.Get("vmnetwork").(string) network := state.Get("vmnetwork").(string)
devices, err := netmap.NameIntoDevices(network) devices, err := netmap.NameIntoDevices(network)
// log them to see what was detected
for _, device := range devices {
log.Printf("HostAddress(%s): Discovered device: %s", network, device)
}
// we were unable to find the device, maybe it's a custom one... // we were unable to find the device, maybe it's a custom one...
// so, check to see if it's in the .vmx configuration // so, check to see if it's in the .vmx configuration
if err != nil || network == "custom" { if err != nil || network == "custom" {
@ -430,6 +442,7 @@ func (d *VmwareDriver) HostAddress(state multistep.StateBag) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
log.Printf("HostAddress(%s): Discovered custom device: %s", network, device)
} }
var lastError error var lastError error
@ -488,6 +501,11 @@ func (d *VmwareDriver) HostIP(state multistep.StateBag) (string, error) {
network := state.Get("vmnetwork").(string) network := state.Get("vmnetwork").(string)
devices, err := netmap.NameIntoDevices(network) devices, err := netmap.NameIntoDevices(network)
// log them to see what was detected
for _, device := range devices {
log.Printf("HostIP(%s): Discovered device: %s", network, device)
}
// we were unable to find the device, maybe it's a custom one... // we were unable to find the device, maybe it's a custom one...
// so, check to see if it's in the .vmx configuration // so, check to see if it's in the .vmx configuration
if err != nil || network == "custom" { if err != nil || network == "custom" {
@ -503,6 +521,7 @@ func (d *VmwareDriver) HostIP(state multistep.StateBag) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
log.Printf("HostIP(%s): Discovered custom device: %s", network, device)
} }
var lastError error var lastError error

View File

@ -3,6 +3,7 @@ package common
import ( import (
"errors" "errors"
"fmt" "fmt"
"log"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
@ -157,6 +158,7 @@ func (d *Fusion5Driver) Verify() error {
if _, err := os.Stat(pathNetworking); err != nil { if _, err := os.Stat(pathNetworking); err != nil {
return nil, fmt.Errorf("Could not find networking conf file: %s", pathNetworking) return nil, fmt.Errorf("Could not find networking conf file: %s", pathNetworking)
} }
log.Printf("Located networkmapper configuration file using Fusion5: %s", pathNetworking)
fd, err := os.Open(pathNetworking) fd, err := os.Open(pathNetworking)
if err != nil { if err != nil {

View File

@ -83,6 +83,7 @@ func (d *Fusion6Driver) Verify() error {
if _, err := os.Stat(pathNetworking); err != nil { if _, err := os.Stat(pathNetworking); err != nil {
return nil, fmt.Errorf("Could not find networking conf file: %s", pathNetworking) return nil, fmt.Errorf("Could not find networking conf file: %s", pathNetworking)
} }
log.Printf("Located networkmapper configuration file using Fusion6: %s", pathNetworking)
fd, err := os.Open(pathNetworking) fd, err := os.Open(pathNetworking)
if err != nil { if err != nil {