Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NC | Online Upgrade | add host config dir version to system.json | Health - add blocked hosts check #8627

Conversation

romayalon
Copy link
Contributor

@romayalon romayalon commented Dec 25, 2024

Explain the changes

  1. Added config_dir_version info per host in system.json.
> sudo cat /etc/noobaa.conf.d/system.json | jq .
{
  "config_directory": {
    "config_dir_version": "1.0.0",
    "upgrade_package_version": "5.18.0",
    "phase": "CONFIG_DIR_UNLOCKED",
    "upgrade_history": {
      "successful_upgrades": []
    }
  },
  "hostname1": {
    "current_version": "5.20.0",
    "config_dir_version": "3.0.0", // <- this is the new added property
    "upgrade_history": {
      "successful_upgrades": [
        {
          "timestamp": 1735114113164,
          "from_version": "5.18.0",
          "to_version": "5.20.0"
        }
      ]
    }
  }
}
  1. Health script - added a check that reports on hosts that are blocked for config directory updates based on the comparison of the new property config_dir_version per hosts and the config_directory.config_dir_version. Both compared items are read from system.json
> noobaa-cli diagnose health 2>/dev/null
{
  "response": {
    "code": "HealthStatus",
    "reply": {
      "service_name": "noobaa",
      "status": "NOTOK",
      ......
        },
        "config_directory_status": {
          "phase": "CONFIG_DIR_UNLOCKED",
          "config_dir_version": "1.0.0",
          "upgrade_package_version": "5.18.0",
          "upgrade_status": {
            "message": "there is no in-progress upgrade"
          },
          "blocked_hosts": { // <- this is the new check
            "hostaname1": {
              "host_version": "5.20.0",
              "host_config_dir_version": "3.0.0",
              "error": "running code config_dir_version=3.0.0 is higher than the config dir version mentioned in system.json=1.0.0, any updates to the config directory are blocked until the config dir upgrade"
            }
          }
        }
      }
    }
  }

Issues: Fixed #xxx / Gap #xxx

  1. Fixed partially NC | Online upgrade improvements #8586

Testing Instructions:

  • Automatic tests -
sudo  jest --testRegex=jest_tests/test_config_fs.test.js
sudo  jest --testRegex=jest_tests/test_nc_upgrade_manager.test.js
sudo node ./node_modules/mocha/bin/mocha src/test/unit_tests/test_nc_health.js
  • Manual tests -
  1. start noobaa 5.17.z - sudo node noobaa-core/src/cmd/nsfs.js --debug, stop noobaa by CTRL+C
  2. git checkout 5.18.0
  3. start noobaa 5.18.0 - sudo node noobaa-core/src/cmd/nsfs.js --debug, stop noobaa by CTRL+C
  4. run Health CLI - noobaa-cli diagnose health 2>/dev/null
  5. expect to see the following blocked hosts in the health response -
"config_directory_status": {
          "error": "config directory data is missing, must upgrade config directory",
          "blocked_hosts": {
            "hostname1": {
              "host_version": "5.18.0",
              "host_config_dir_version": "1.0.0",
              "error": "host's config_dir_version is 1.0.0, system's config_dir_version is undefined"
            }
          }
        }
  1. upgrade the config directory - noobaa-cli upgrade start --expected_version 5.18.0 --expected_hosts hostname1 2>/dev/null
  2. run again Health CLI - noobaa-cli diagnose health 2>/dev/null
  3. expect to not see the blocked host in the new health response -
"config_directory_status": {
    "phase": "CONFIG_DIR_UNLOCKED",
    "config_dir_version": "1.0.0",
    "upgrade_package_version": "5.18.0",
    "upgrade_status": {
      "message": "there is no in-progress upgrade"
    }
}
  • Doc added/updated
  • Tests added

@romayalon romayalon force-pushed the romy-add-config-dir-to-hostname-system-json branch from 71af0ce to 03e86aa Compare December 26, 2024 06:48
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 26, 2024
@romayalon romayalon mentioned this pull request Dec 26, 2024
12 tasks
@romayalon romayalon requested a review from shirady December 26, 2024 08:33
src/sdk/config_fs.js Outdated Show resolved Hide resolved
src/sdk/config_fs.js Outdated Show resolved Hide resolved
src/cmd/nsfs.js Show resolved Hide resolved
src/sdk/config_fs.js Show resolved Hide resolved
src/sdk/config_fs.js Outdated Show resolved Hide resolved
src/manage_nsfs/health.js Outdated Show resolved Hide resolved
src/manage_nsfs/health.js Outdated Show resolved Hide resolved
src/test/unit_tests/test_nc_health.js Outdated Show resolved Hide resolved
src/test/unit_tests/test_nc_health.js Outdated Show resolved Hide resolved
src/test/unit_tests/test_nc_health.js Show resolved Hide resolved
@romayalon romayalon requested a review from shirady January 2, 2025 14:39
Copy link
Contributor

@shirady shirady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/manage_nsfs/health.js Outdated Show resolved Hide resolved
…ked hosts check

Signed-off-by: Romy <35330373+romayalon@users.noreply.github.com>
@romayalon romayalon force-pushed the romy-add-config-dir-to-hostname-system-json branch from 6bbba15 to 77dc740 Compare January 5, 2025 07:52
@romayalon romayalon merged commit 8ec7dd5 into noobaa:master Jan 5, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants