reduce some logging
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-14 20:54:52 +11:00
parent 665750548f
commit 81271873f3
3 changed files with 21 additions and 31 deletions

View File

@@ -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
}
}