reduce some logging
This commit is contained in:
@@ -189,7 +189,7 @@ func (v *Vcenter) ConvertObjToMoVM(vmObj *object.VirtualMachine) (*mo.VirtualMac
|
||||
}
|
||||
|
||||
// Return the found mo.VirtualMachine object
|
||||
v.Logger.Debug("Found VM in datacenter", "vm_name", moVM.Name, "dc_name", datacenterName)
|
||||
//v.Logger.Debug("Found VM in datacenter", "vm_name", moVM.Name, "dc_name", datacenterName)
|
||||
return &moVM, nil
|
||||
}
|
||||
|
||||
@@ -448,30 +448,10 @@ func (v *Vcenter) FindVMByIDWithDatacenter(vmID string, dcID string) (*mo.Virtua
|
||||
//err := v.client.RetrieveOne(v.ctx, vmRef, []string{"config", "name"}, &vm)
|
||||
err = v.client.RetrieveOne(v.ctx, vmRef, nil, &vm)
|
||||
if err == nil {
|
||||
v.Logger.Debug("Found VM")
|
||||
|
||||
/*
|
||||
// Retrieve the resource pool the VM is in
|
||||
if vm.ResourcePool != nil {
|
||||
rp := object.NewResourcePool(v.client.Client, *vm.ResourcePool)
|
||||
rpName, err := rp.ObjectName(v.ctx)
|
||||
if err != nil {
|
||||
v.Logger.Error("failed to get resource pool name", "error", err)
|
||||
} else {
|
||||
v.Logger.Debug("Found resource pool name", "rp_name", rpName)
|
||||
resourcePool = rpName
|
||||
}
|
||||
}
|
||||
*/
|
||||
//v.Logger.Debug("Found VM")
|
||||
|
||||
return &vm, nil
|
||||
/*
|
||||
return &VmProperties{
|
||||
//Datacenter: dcName,
|
||||
Vm: vm,
|
||||
ResourcePool: resourcePool,
|
||||
}, nil
|
||||
*/
|
||||
|
||||
} else if _, ok := err.(*find.NotFoundError); !ok {
|
||||
// If the error is not a NotFoundError, return it
|
||||
//return nil, fmt.Errorf("failed to retrieve VM with ID %s in datacenter %s: %w", vmID, dc.Name(), err)
|
||||
@@ -492,7 +472,7 @@ func (v *Vcenter) GetVmResourcePool(vm mo.VirtualMachine) (string, error) {
|
||||
v.Logger.Error("failed to get resource pool name", "error", err)
|
||||
return resourcePool, err
|
||||
} else {
|
||||
v.Logger.Debug("Found resource pool name", "rp_name", rpName)
|
||||
//v.Logger.Debug("Found resource pool name", "rp_name", rpName)
|
||||
resourcePool = rpName
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user