diff --git a/src/control/cmd/daos/pool.go b/src/control/cmd/daos/pool.go index 2aae717766e..7a917b1a9e4 100644 --- a/src/control/cmd/daos/pool.go +++ b/src/control/cmd/daos/pool.go @@ -224,9 +224,8 @@ type poolCmd struct { type poolQueryCmd struct { poolBaseCmd - ShowEnabledRanks bool `short:"e" long:"show-enabled" description:"Show engine unique identifiers (ranks) which are enabled"` - ShowDisabledRanks bool `short:"b" long:"show-disabled" description:"Show engine unique identifiers (ranks) which are disabled"` - HealthOnly bool `short:"t" long:"health-only" description:"Only perform pool health related queries"` + ShowEnabledRanks bool `short:"e" long:"show-enabled" description:"Show engine unique identifiers (ranks) which are enabled"` + HealthOnly bool `short:"t" long:"health-only" description:"Only perform pool health related queries"` } func convertPoolSpaceInfo(in *C.struct_daos_pool_space, mt C.uint) *daos.StorageUsageStats { @@ -340,15 +339,10 @@ func (cmd *poolQueryCmd) Execute(_ []string) error { if cmd.HealthOnly { queryMask = daos.HealthOnlyPoolQueryMask } - if cmd.ShowEnabledRanks && cmd.ShowDisabledRanks { - return errors.New("show-enabled and show-disabled can't be used at the same time.") - } if cmd.ShowEnabledRanks { queryMask.SetOptions(daos.PoolQueryOptionEnabledEngines) } - if cmd.ShowDisabledRanks { - queryMask.SetOptions(daos.PoolQueryOptionDisabledEngines) - } + queryMask.SetOptions(daos.PoolQueryOptionDisabledEngines) cleanup, err := cmd.resolveAndConnect(C.DAOS_PC_RO, nil) if err != nil { diff --git a/src/control/cmd/daos/pretty/pool.go b/src/control/cmd/daos/pretty/pool.go index aa70115152d..a9f685b536f 100644 --- a/src/control/cmd/daos/pretty/pool.go +++ b/src/control/cmd/daos/pretty/pool.go @@ -50,7 +50,7 @@ func PrintPoolInfo(pi *daos.PoolInfo, out io.Writer) error { if pi.EnabledRanks != nil && pi.EnabledRanks.Count() > 0 { fmt.Fprintf(w, "- Enabled ranks: %s\n", pi.EnabledRanks) } - if pi.DisabledRanks != nil && pi.DisabledRanks.Count() > 0 { + if pi.DisabledRanks.Count() > 0 { fmt.Fprintf(w, "- Disabled ranks: %s\n", pi.DisabledRanks) } if pi.Rebuild != nil { diff --git a/src/control/cmd/dmg/pool.go b/src/control/cmd/dmg/pool.go index d7d267fbbe3..1127ab2b6f6 100644 --- a/src/control/cmd/dmg/pool.go +++ b/src/control/cmd/dmg/pool.go @@ -590,9 +590,8 @@ func (cmd *PoolReintegrateCmd) Execute(args []string) error { // PoolQueryCmd is the struct representing the command to query a DAOS pool. type PoolQueryCmd struct { poolCmd - ShowEnabledRanks bool `short:"e" long:"show-enabled" description:"Show engine unique identifiers (ranks) which are enabled"` - ShowDisabledRanks bool `short:"b" long:"show-disabled" description:"Show engine unique identifiers (ranks) which are disabled"` - HealthOnly bool `short:"t" long:"health-only" description:"Only perform pool health related queries"` + ShowEnabledRanks bool `short:"e" long:"show-enabled" description:"Show engine unique identifiers (ranks) which are enabled"` + HealthOnly bool `short:"t" long:"health-only" description:"Only perform pool health related queries"` } // Execute is run when PoolQueryCmd subcommand is activated @@ -608,9 +607,7 @@ func (cmd *PoolQueryCmd) Execute(args []string) error { if cmd.ShowEnabledRanks { req.QueryMask.SetOptions(daos.PoolQueryOptionEnabledEngines) } - if cmd.ShowDisabledRanks { - req.QueryMask.SetOptions(daos.PoolQueryOptionDisabledEngines) - } + req.QueryMask.SetOptions(daos.PoolQueryOptionDisabledEngines) resp, err := control.PoolQuery(cmd.MustLogCtx(), cmd.ctlInvoker, req) if cmd.JSONOutputEnabled() { diff --git a/src/control/cmd/dmg/pool_test.go b/src/control/cmd/dmg/pool_test.go index d1bd904e05a..b1270b0f19f 100644 --- a/src/control/cmd/dmg/pool_test.go +++ b/src/control/cmd/dmg/pool_test.go @@ -994,54 +994,6 @@ func TestPoolCommands(t *testing.T) { }, " "), nil, }, - { - "Query pool with UUID and disabled ranks", - "pool query --show-disabled 12345678-1234-1234-1234-1234567890ab", - strings.Join([]string{ - printRequest(t, &control.PoolQueryReq{ - ID: "12345678-1234-1234-1234-1234567890ab", - QueryMask: setQueryMask(func(qm *daos.PoolQueryMask) { qm.SetOptions(daos.PoolQueryOptionDisabledEngines) }), - }), - }, " "), - nil, - }, - { - "Query pool with UUID and disabled ranks", - "pool query -b 12345678-1234-1234-1234-1234567890ab", - strings.Join([]string{ - printRequest(t, &control.PoolQueryReq{ - ID: "12345678-1234-1234-1234-1234567890ab", - QueryMask: setQueryMask(func(qm *daos.PoolQueryMask) { qm.SetOptions(daos.PoolQueryOptionDisabledEngines) }), - }), - }, " "), - nil, - }, - { - "Query pool with UUID, enabled ranks and disabled ranks", - "pool query --show-disabled --show-enabled 12345678-1234-1234-1234-1234567890ab", - strings.Join([]string{ - printRequest(t, &control.PoolQueryReq{ - ID: "12345678-1234-1234-1234-1234567890ab", - QueryMask: setQueryMask(func(qm *daos.PoolQueryMask) { - qm.SetOptions(daos.PoolQueryOptionEnabledEngines, daos.PoolQueryOptionDisabledEngines) - }), - }), - }, " "), - nil, - }, - { - "Query pool with UUID, enabled ranks and disabled ranks", - "pool query -b -e 12345678-1234-1234-1234-1234567890ab", - strings.Join([]string{ - printRequest(t, &control.PoolQueryReq{ - ID: "12345678-1234-1234-1234-1234567890ab", - QueryMask: setQueryMask(func(qm *daos.PoolQueryMask) { - qm.SetOptions(daos.PoolQueryOptionEnabledEngines, daos.PoolQueryOptionDisabledEngines) - }), - }), - }, " "), - nil, - }, { "Query pool for health only", "pool query --health-only 12345678-1234-1234-1234-1234567890ab", diff --git a/src/control/lib/control/pool_test.go b/src/control/lib/control/pool_test.go index 444608dfd6c..7e342d95be8 100644 --- a/src/control/lib/control/pool_test.go +++ b/src/control/lib/control/pool_test.go @@ -840,7 +840,7 @@ func TestControl_PoolQueryResp_MarshalJSON(t *testing.T) { UpgradeLayoutVer: 8, }, }, - exp: `{"query_mask":"rebuild,space","state":"Ready","uuid":"` + poolUUID.String() + `","total_targets":1,"active_targets":2,"total_engines":3,"disabled_targets":4,"version":5,"svc_ldr":6,"svc_reps":[0,1,2],"rebuild":null,"tier_stats":null,"pool_layout_ver":7,"upgrade_layout_ver":8,"status":42}`, + exp: `{"query_mask":"disabled_engines,rebuild,space","state":"Ready","uuid":"` + poolUUID.String() + `","total_targets":1,"active_targets":2,"total_engines":3,"disabled_targets":4,"version":5,"svc_ldr":6,"svc_reps":[0,1,2],"rebuild":null,"tier_stats":null,"pool_layout_ver":7,"upgrade_layout_ver":8,"status":42}`, }, "valid rankset": { pqr: &PoolQueryResp{ @@ -862,7 +862,7 @@ func TestControl_PoolQueryResp_MarshalJSON(t *testing.T) { UpgradeLayoutVer: 8, }, }, - exp: `{"query_mask":"rebuild,space","state":"Ready","uuid":"` + poolUUID.String() + `","total_targets":1,"active_targets":2,"total_engines":3,"disabled_targets":4,"version":5,"svc_ldr":6,"svc_reps":[0,1,2],"rebuild":null,"tier_stats":null,"enabled_ranks":[0,1,2,3,5],"disabled_ranks":[],"pool_layout_ver":7,"upgrade_layout_ver":8,"status":42}`, + exp: `{"query_mask":"disabled_engines,rebuild,space","state":"Ready","uuid":"` + poolUUID.String() + `","total_targets":1,"active_targets":2,"total_engines":3,"disabled_targets":4,"version":5,"svc_ldr":6,"svc_reps":[0,1,2],"rebuild":null,"tier_stats":null,"enabled_ranks":[0,1,2,3,5],"disabled_ranks":[],"pool_layout_ver":7,"upgrade_layout_ver":8,"status":42}`, }, } { t.Run(name, func(t *testing.T) { diff --git a/src/control/lib/daos/pool.go b/src/control/lib/daos/pool.go index fe44a00e210..e47e6e2b23d 100644 --- a/src/control/lib/daos/pool.go +++ b/src/control/lib/daos/pool.go @@ -104,7 +104,7 @@ type ( const ( // DefaultPoolQueryMask defines the default pool query mask. - DefaultPoolQueryMask = PoolQueryMask(^uint64(0) &^ (C.DPI_ENGINES_ENABLED | C.DPI_ENGINES_DISABLED)) + DefaultPoolQueryMask = PoolQueryMask(^uint64(0) &^ C.DPI_ENGINES_ENABLED) // HealthOnlyPoolQueryMask defines the mask for health-only queries. HealthOnlyPoolQueryMask = PoolQueryMask(^uint64(0) &^ (C.DPI_ENGINES_ENABLED | C.DPI_SPACE)) diff --git a/src/control/lib/daos/pool_test.go b/src/control/lib/daos/pool_test.go index e76f33f4c25..3ff1ca098d2 100644 --- a/src/control/lib/daos/pool_test.go +++ b/src/control/lib/daos/pool_test.go @@ -130,7 +130,7 @@ func TestDaos_PoolQueryMask(t *testing.T) { testMask: genTestMask(func(pqm *PoolQueryMask) { *pqm = DefaultPoolQueryMask }), - expString: genOptsStr(PoolQueryOptionRebuild, PoolQueryOptionSpace), + expString: genOptsStr(PoolQueryOptionDisabledEngines, PoolQueryOptionRebuild, PoolQueryOptionSpace), }, "health-only query mask": { testMask: genTestMask(func(pqm *PoolQueryMask) { diff --git a/src/tests/ftest/control/dmg_pool_query_ranks.py b/src/tests/ftest/control/dmg_pool_query_ranks.py index 8123ed8cbff..22f45ee8d9a 100644 --- a/src/tests/ftest/control/dmg_pool_query_ranks.py +++ b/src/tests/ftest/control/dmg_pool_query_ranks.py @@ -40,28 +40,6 @@ def test_pool_query_ranks_basic(self): self.log.debug("Checking without ranks state information") data = self.dmg.pool_query(self.pool.identifier) - self.assertIsNone( - data['response'].get('enabled_ranks'), - "Invalid enabled_ranks field: want=None, got={}".format( - data['response'].get('enabled_ranks'))) - self.assertIsNone( - data['response'].get('disabled_ranks'), - "Invalid disabled_ranks field: want=None, got={}".format( - data['response'].get('disabled_ranks'))) - - self.log.debug("Checking enabled ranks state information") - data = self.dmg.pool_query(self.pool.identifier, show_enabled=True) - self.assertListEqual( - data['response'].get('enabled_ranks'), [0, 1, 2], - "Invalid enabled_ranks field: want=[0, 1, 2], got={}".format( - data['response'].get('enabled_ranks'))) - self.assertIsNone( - data['response'].get('disabled_ranks'), - "Invalid disabled_ranks field: want=None, got={}".format( - data['response'].get('disabled_ranks'))) - - self.log.debug("Checking disabled ranks state information") - data = self.dmg.pool_query(self.pool.identifier, show_disabled=True) self.assertIsNone( data['response'].get('enabled_ranks'), "Invalid enabled_ranks field: want=None, got={}".format( @@ -71,8 +49,8 @@ def test_pool_query_ranks_basic(self): "Invalid disabled_ranks field: want=[], got={}".format( data['response'].get('disabled_ranks'))) - self.log.debug("Checking enabled and disabled ranks state information") - data = self.dmg.pool_query(self.pool.identifier, show_enabled=True, show_disabled=True) + self.log.debug("Checking enabled ranks state information") + data = self.dmg.pool_query(self.pool.identifier, show_enabled=True) self.assertListEqual( data['response'].get('enabled_ranks'), [0, 1, 2], "Invalid enabled_ranks field: want=[0, 1, 2], got={}".format( @@ -110,8 +88,7 @@ def test_pool_query_ranks_mgmt(self): disabled_ranks = sorted(disabled_ranks + [rank]) self.log.debug("Checking enabled ranks state information") - data = self.dmg.pool_query( - self.pool.identifier, show_enabled=True, show_disabled=True) + data = self.dmg.pool_query(self.pool.identifier, show_enabled=True) self.assertListEqual( data['response'].get('enabled_ranks'), enabled_ranks, "Invalid enabled_ranks field: want={}, got={}".format( @@ -145,7 +122,7 @@ def test_pool_query_ranks_mgmt(self): disabled_ranks.remove(rank) self.log.debug("Checking enabled ranks state information") - data = self.dmg.pool_query(self.pool.identifier, show_enabled=True, show_disabled=True) + data = self.dmg.pool_query(self.pool.identifier, show_enabled=True) self.assertListEqual( data['response'].get('enabled_ranks'), enabled_ranks, "Invalid enabled_ranks field: want={}, got={}".format( diff --git a/src/tests/ftest/control/dmg_pool_query_test.py b/src/tests/ftest/control/dmg_pool_query_test.py index ec8c56c6260..b7c83b59b55 100644 --- a/src/tests/ftest/control/dmg_pool_query_test.py +++ b/src/tests/ftest/control/dmg_pool_query_test.py @@ -62,6 +62,7 @@ def test_pool_query_basic(self): "uuid": self.pool.uuid.lower(), "total_targets": self.params.get("total_targets", path="/run/exp_vals/*"), "active_targets": self.params.get("active_targets", path="/run/exp_vals/*"), + "disabled_ranks": self.params.get("disabled_ranks", path="/run/exp_vals/*"), "total_engines": self.params.get("total_engines", path="/run/exp_vals/*"), "disabled_targets": self.params.get("disabled_targets", path="/run/exp_vals/*"), "version": self.params.get("version", path="/run/exp_vals/*"), diff --git a/src/tests/ftest/control/dmg_pool_query_test.yaml b/src/tests/ftest/control/dmg_pool_query_test.yaml index fc9ccfdec71..c090de7a42d 100644 --- a/src/tests/ftest/control/dmg_pool_query_test.yaml +++ b/src/tests/ftest/control/dmg_pool_query_test.yaml @@ -27,12 +27,13 @@ exp_vals: pool_state: "Ready" total_targets: 4 active_targets: 4 + disabled_ranks: [] total_engines: 1 disabled_targets: 0 version: 1 leader: 0 replicas: [0] - query_mask: "rebuild,space" + query_mask: "disabled_engines,rebuild,space" scm: total: 16000008192 nvme: diff --git a/src/tests/ftest/deployment/network_failure.py b/src/tests/ftest/deployment/network_failure.py index ec67962c3d5..84c7b259370 100644 --- a/src/tests/ftest/deployment/network_failure.py +++ b/src/tests/ftest/deployment/network_failure.py @@ -227,7 +227,7 @@ def verify_network_failure(self, ior_namespace, container_namespace): # 6. Call dmg pool query -b to find the disabled ranks. self.log_step("Find the disabled ranks.") - output = dmg_cmd.pool_query(pool=self.pool.identifier, show_disabled=True) + output = dmg_cmd.pool_query(pool=self.pool.identifier) disabled_ranks = output["response"].get("disabled_ranks") self.log.info("Disabled ranks = %s", disabled_ranks) diff --git a/src/tests/ftest/deployment/server_rank_failure.py b/src/tests/ftest/deployment/server_rank_failure.py index d2156d8fc8d..d1637fe54eb 100644 --- a/src/tests/ftest/deployment/server_rank_failure.py +++ b/src/tests/ftest/deployment/server_rank_failure.py @@ -183,7 +183,7 @@ def verify_rank_failure(self, ior_namespace): errors.append("Server rank {} state isn't joined!".format(member["rank"])) # 9. Call dmg pool query -b to find the disabled ranks. - output = self.get_dmg_command().pool_query(pool=self.pool.identifier, show_disabled=True) + output = self.get_dmg_command().pool_query(pool=self.pool.identifier) disabled_ranks = output["response"].get("disabled_ranks") self.log.info("Disabled ranks = %s", disabled_ranks) diff --git a/src/tests/ftest/util/dmg_utils.py b/src/tests/ftest/util/dmg_utils.py index effc3172bac..a48b45e59dd 100644 --- a/src/tests/ftest/util/dmg_utils.py +++ b/src/tests/ftest/util/dmg_utils.py @@ -625,13 +625,12 @@ def pool_create(self, scm_size, uid=None, gid=None, nvme_size=None, return data - def pool_query(self, pool, show_enabled=False, show_disabled=False): + def pool_query(self, pool, show_enabled=False): """Query a pool with the dmg command. Args: pool (str): Pool UUID or label to query. show_enabled (bool, optional): Display enabled ranks. - show_disabled (bool, optional): Display disabled ranks. Raises: CommandFailure: if the dmg pool query command fails. @@ -677,8 +676,7 @@ def pool_query(self, pool, show_enabled=False, show_disabled=False): # "error": null, # "status": 0 # } - return self._get_json_result(("pool", "query"), pool=pool, - show_enabled=show_enabled, show_disabled=show_disabled) + return self._get_json_result(("pool", "query"), pool=pool, show_enabled=show_enabled) def pool_query_targets(self, pool, rank=None, target_idx=None): """Call dmg pool query-targets. diff --git a/src/tests/ftest/util/dmg_utils_base.py b/src/tests/ftest/util/dmg_utils_base.py index 39109320af1..951694a2251 100644 --- a/src/tests/ftest/util/dmg_utils_base.py +++ b/src/tests/ftest/util/dmg_utils_base.py @@ -533,7 +533,6 @@ def __init__(self): super().__init__("/run/dmg/pool/query/*", "query") self.pool = BasicParameter(None, position=1) self.show_enabled = FormattedParameter("--show-enabled", False) - self.show_disabled = FormattedParameter("--show-disabled", False) class QueryTargetsSubCommand(CommandWithParameters): """Defines an object for the dmg pool query-targets command.""" diff --git a/src/tests/ftest/util/test_utils_pool.py b/src/tests/ftest/util/test_utils_pool.py index fbb6484e292..7c6b5758f87 100644 --- a/src/tests/ftest/util/test_utils_pool.py +++ b/src/tests/ftest/util/test_utils_pool.py @@ -700,12 +700,11 @@ def overwrite_acl(self): self.log.error("self.acl_file isn't defined!") @fail_on(CommandFailure) - def query(self, show_enabled=False, show_disabled=False): + def query(self, show_enabled=False): """Execute dmg pool query. Args: show_enabled (bool, optional): Display enabled ranks. - show_disabled (bool, optional): Display disabled ranks. Returns: dict: the dmg json command output converted to a python dictionary @@ -720,7 +719,7 @@ def query(self, show_enabled=False, show_disabled=False): while True: try: - return self.dmg.pool_query(self.identifier, show_enabled, show_disabled) + return self.dmg.pool_query(self.identifier, show_enabled) except CommandFailure as error: if end_time is None: @@ -1119,19 +1118,18 @@ def pool_percentage_used(self): } return pool_percent - def set_query_data(self, show_enabled=False, show_disabled=False): + def set_query_data(self, show_enabled=False): """Execute dmg pool query and store the results. Args: show_enabled (bool, optional): Display enabled ranks. - show_disabled (bool, optional): Display disabled ranks. Raises: TestFail: if the dmg pool query command failed """ self.query_data = {} - self.query_data = self.query(show_enabled, show_disabled) + self.query_data = self.query(show_enabled) def _get_query_data_keys(self, *keys, refresh=False): """Get the pool version from the dmg pool query output.