From c5e604c345787401521f36108bee94acd2e855b8 Mon Sep 17 00:00:00 2001 From: Clint Greenwood Date: Tue, 24 Apr 2018 16:09:25 -0400 Subject: [PATCH] Search all resource pools when looking for a vic vApp (#7823) 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 #7800 --- lib/install/management/finder.go | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/install/management/finder.go b/lib/install/management/finder.go index d7862d06ca..d16022efb6 100644 --- a/lib/install/management/finder.go +++ b/lib/install/management/finder.go @@ -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 }