From 80d3c7f9d65e9681ed863d217a282bb0bf4e0081 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 13 Oct 2022 15:11:53 +0300 Subject: [PATCH] [#1892] neofs-adm: Support `MaintenanceModeAllowed` network setting Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 4 ++++ cmd/neofs-adm/internal/modules/morph/config.go | 4 ++-- cmd/neofs-adm/internal/modules/morph/initialize_deploy.go | 2 ++ cmd/neofs-adm/internal/modules/morph/root.go | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f25218bd9..5116f992f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Changelog for NeoFS Node - Add new RPC `TreeService.Healthcheck` - Fallback to `GET` if `GET_RANGE` from one storage nodes to another is denied by basic ACL (#1884) - List of shards and logger level runtime reconfiguration (#1770) +- `neofs-adm morph set-config` now supports well-known `MaintenanceModeAllowed` key (#1892) ### Changed - Allow to evacuate shard data with `EvacuateShard` control RPC (#1800) @@ -64,6 +65,9 @@ Storage nodes under maintenance are not excluded from the network map, but don't serve object operations. (*) can be fetched from network configuration via `neofs-cli netmap netinfo` command. +To allow maintenance mode during neofs-adm deployments, set +`network.maintenance_mode_allowed` parameter in config. + When issuing an object session token for root (virtual, "big") objects, additionally include all members of the split-chain. If session context includes root object only, it is not spread to physical ("small") objects. diff --git a/cmd/neofs-adm/internal/modules/morph/config.go b/cmd/neofs-adm/internal/modules/morph/config.go index 03c4625b5..841af5026 100644 --- a/cmd/neofs-adm/internal/modules/morph/config.go +++ b/cmd/neofs-adm/internal/modules/morph/config.go @@ -76,7 +76,7 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%d (int)\n", k, n))) case netmapEigenTrustAlphaKey: _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (str)\n", k, v))) - case netmapHomomorphicHashDisabledKey: + case netmapHomomorphicHashDisabledKey, netmapMaintenanceAllowedKey: vBool, err := tuple[1].TryBool() if err != nil { return invalidConfigValueErr(k) @@ -168,7 +168,7 @@ func parseConfigPair(kvStr string, force bool) (key string, val interface{}, err } val = valRaw - case netmapHomomorphicHashDisabledKey: + case netmapHomomorphicHashDisabledKey, netmapMaintenanceAllowedKey: val, err = strconv.ParseBool(valRaw) if err != nil { err = fmt.Errorf("could not parse %s's value '%s' as bool: %w", key, valRaw, err) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go index da33f5d66..b0a35da17 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go @@ -60,6 +60,7 @@ const ( netmapInnerRingCandidateFeeKey = "InnerRingCandidateFee" netmapWithdrawFeeKey = "WithdrawFee" netmapHomomorphicHashDisabledKey = "HomomorphicHashingDisabled" + netmapMaintenanceAllowedKey = "MaintenanceModeAllowed" defaultEigenTrustIterations = 4 defaultEigenTrustAlpha = "0.1" @@ -550,6 +551,7 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in netmapInnerRingCandidateFeeKey, viper.GetInt64(candidateFeeInitFlag), netmapWithdrawFeeKey, viper.GetInt64(withdrawFeeInitFlag), netmapHomomorphicHashDisabledKey, viper.GetBool(homomorphicHashDisabledInitFlag), + netmapMaintenanceAllowedKey, viper.GetBool(maintenanceModeAllowedInitFlag), } items = append(items, c.Contracts[balanceContract].Hash, diff --git a/cmd/neofs-adm/internal/modules/morph/root.go b/cmd/neofs-adm/internal/modules/morph/root.go index 5d7aeeb8f..699a6fdf7 100644 --- a/cmd/neofs-adm/internal/modules/morph/root.go +++ b/cmd/neofs-adm/internal/modules/morph/root.go @@ -29,6 +29,7 @@ const ( candidateFeeInitFlag = "network.fee.candidate" candidateFeeCLIFlag = "candidate-fee" homomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled" + maintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed" homomorphicHashDisabledCLIFlag = "homomorphic-disabled" withdrawFeeInitFlag = "network.fee.withdraw" withdrawFeeCLIFlag = "withdraw-fee"