Implement targeted VM property refresh and backfill logic for snapshot rows
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -296,6 +296,24 @@ func (v *Vcenter) GetAllVMsWithProps() ([]mo.VirtualMachine, error) {
|
||||
return vms, nil
|
||||
}
|
||||
|
||||
// GetVMWithSnapshotPropsByRef retrieves snapshot-critical properties for a single VM reference.
|
||||
// Used as a targeted fallback when bulk retrieval returns partial data for a VM.
|
||||
func (v *Vcenter) GetVMWithSnapshotPropsByRef(ref types.ManagedObjectReference) (*mo.VirtualMachine, error) {
|
||||
var vm mo.VirtualMachine
|
||||
props := []string{
|
||||
"name",
|
||||
"parent",
|
||||
"config",
|
||||
"runtime.powerState",
|
||||
"runtime.host",
|
||||
"resourcePool",
|
||||
}
|
||||
if err := v.client.RetrieveOne(v.ctx, ref, props, &vm); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &vm, nil
|
||||
}
|
||||
|
||||
// FindVmDeletionEvents returns a map of MoRef (VmId) to the deletion event time within the given window.
|
||||
func (v *Vcenter) FindVmDeletionEvents(ctx context.Context, begin, end time.Time) (map[string]time.Time, error) {
|
||||
return v.findVmDeletionEvents(ctx, begin, end, nil)
|
||||
|
||||
Reference in New Issue
Block a user