From fe52d98aa7cdb18637f6322808bef974b6f71751 Mon Sep 17 00:00:00 2001 From: Tom Nabarro Date: Fri, 29 Nov 2024 15:41:43 +0000 Subject: [PATCH] DAOS-16838 control: Fix dmg storage query usage with emulated NVMe Features: control Required-githooks: true Signed-off-by: Tom Nabarro --- src/control/server/instance_storage_rpc.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/control/server/instance_storage_rpc.go b/src/control/server/instance_storage_rpc.go index 3097440f500e..91e1a6fa904f 100644 --- a/src/control/server/instance_storage_rpc.go +++ b/src/control/server/instance_storage_rpc.go @@ -460,6 +460,7 @@ func bdevScanEngineAssigned(ctx context.Context, engine Engine, req *ctlpb.ScanN return scanEngineBdevsOverDrpc(ctx, engine, req) } +// Accommodate for VMD backing devices and emulated NVMe (AIO). func getEffCtrlrCount(ctrlrs []*ctlpb.NvmeController) (int, error) { pas := hardware.MustNewPCIAddressSet() for _, c := range ctrlrs { @@ -471,11 +472,13 @@ func getEffCtrlrCount(ctrlrs []*ctlpb.NvmeController) (int, error) { if npas, err := pas.BackingToVMDAddresses(); err != nil { return 0, err } else { - pas = npas + return npas.Len(), nil } } - return pas.Len(), nil + // Return inputted number of controllers rather than number of parsed addresses to cater for + // the case of emulated NVMe where there will be no valid PCI address. + return len(ctrlrs), nil } // bdevScanEngine calls either in to the private engine storage provider to scan bdevs if engine process