Skip to content

Commit

Permalink
Search all resource pools when looking for a vic vApp (vmware#7823)
Browse files Browse the repository at this point in the history
If a cluster only has vApp(s) installed then there will only be
a single resource pool -- since there is only one pool vic-machine
ls assumes that DRS is disabled and doesn't look for a vApp.

This change will now search all resource pools for a vic
vApp.

Fixes vmware#7800
  • Loading branch information
Clint Greenwood authored and Anchal Agrawal committed Apr 24, 2018
1 parent def7889 commit c5e604c
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lib/install/management/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,25 +341,24 @@ func (d *Dispatcher) searchResourcePools(pools []*object.ResourcePool) []*vm.Vir
} else {
vchs = append(vchs, children...)
}
// if we have more than one resource pool we will search for vApps
// in each of the pools
if multiPool {
vappPath := path.Join(pool.InventoryPath, "*")
vapps, err := d.session.Finder.VirtualAppList(d.op, vappPath)
if err != nil {
if _, ok := err.(*find.NotFoundError); !ok {
d.op.Errorf("Failed to query vapp %q: %s", vappPath, err)
}

// search for a vApp
vappPath := path.Join(pool.InventoryPath, "*")
vapps, err := d.session.Finder.VirtualAppList(d.op, vappPath)
if err != nil {
if _, ok := err.(*find.NotFoundError); !ok {
d.op.Errorf("Failed to query vapp %q: %s", vappPath, err)
}
for _, vapp := range vapps {
children, err := d.findVCHs(vapp.ResourcePool, multiPool)
if err != nil {
d.op.Warnf("Failed to get VCH from vApp resource pool %q: %s", pool.InventoryPath, err)
continue
}
vchs = append(vchs, children...)
}
for _, vapp := range vapps {
children, err := d.findVCHs(vapp.ResourcePool, multiPool)
if err != nil {
d.op.Warnf("Failed to get VCH from vApp resource pool %q: %s", pool.InventoryPath, err)
continue
}
vchs = append(vchs, children...)
}

}
return vchs
}
Expand Down

0 comments on commit c5e604c

Please sign in to comment.