Skip to content

Commit

Permalink
Merge pull request #404 from atc0005/i399-shortcircuit-rps-eval-if-hi…
Browse files Browse the repository at this point in the history
…dden-pool-is-used

Eval only parent resource pool if needed
  • Loading branch information
atc0005 authored Oct 15, 2021
2 parents 2622c18 + f7a15a4 commit d62fc36
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/vsphere/resource-pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,20 @@ func GetEligibleRPs(ctx context.Context, c *vim25.Client, includeRPs []string, e
// Because this is a hidden pool and non-obvious, we try to avoid
// requiring the sysadmin to specify it explicitly.
if strings.EqualFold(rp.Name, ParentResourcePool) {
if len(includeRPs) != 0 {
continue

// Someone has explicitly requested that only ParentResourcePool
// be included for evaluation. Record it, skip all others.
if len(includeRPs) == 1 &&
strings.EqualFold(includeRPs[0], ParentResourcePool) {
rps = append(rps, rp)
break
}

// No inclusion or exclusion lists have been specified. Record
// ParentResourcePool, skip all others.
if len(includeRPs) == 0 && len(excludeRPs) == 0 {
rps = append(rps, rp)
break
}
}

Expand Down

0 comments on commit d62fc36

Please sign in to comment.