This commit is contained in:
18
main.go
18
main.go
@@ -120,8 +120,7 @@ func main() {
|
|||||||
// Login to vcenter
|
// Login to vcenter
|
||||||
c, err = govmomi.NewClient(ctx, u, *vInsecure)
|
c, err = govmomi.NewClient(ctx, u, *vInsecure)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Logging in error: %s\n", err)
|
log.Fatalf("Logging in error: %s\n", err)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
defer c.Logout(ctx)
|
defer c.Logout(ctx)
|
||||||
|
|
||||||
@@ -163,12 +162,15 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve host properties
|
// Retrieve host properties
|
||||||
var hostProperties []mo.HostSystem
|
/*
|
||||||
err = dcView.Retrieve(ctx, []string{"HostSystem"}, []string{"name", "hardware.systemInfo", "configManager"}, &hostProperties)
|
var hostProperties []mo.HostSystem
|
||||||
if err != nil {
|
err = dcView.Retrieve(ctx, []string{"HostSystem"}, []string{"name", "hardware.systemInfo", "configManager"}, &hostProperties)
|
||||||
log.Printf("Failed to retrieve host properties in datacenter %s: %v", dc.Name, err)
|
if err != nil {
|
||||||
continue
|
log.Printf("Failed to retrieve host properties in datacenter %s: %v", dc.Name, err)
|
||||||
}
|
continue
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
log.Printf("DC %s contains %d hosts\n", dc.Name, len(hosts))
|
||||||
|
|
||||||
// Print hosts
|
// Print hosts
|
||||||
for _, host := range hosts {
|
for _, host := range hosts {
|
||||||
|
Reference in New Issue
Block a user