Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@


SOURCE=SOURCES/weka-tools.tgz
SPECS=$(wildcard SPECS/*)

TARG=RPMS/noarch/weka-tools-8.10-1.el8.x86_64.rpm
.PHONY: all clean Makefile

all: ${SOURCE} ${TARG}
echo Done

${TARG}: ${SOURCE} ${SPECS}
rpmbuild --define "_topdir ${CURDIR}" -ba ${SPECS}

${SOURCE}:
tar -czvf ${SOURCE} --exclude-from=tar_excludes.txt *

clean:
rm -rf ${TARG} BUILD BUILDROOT RPMS SRPMS ${SOURCE}/*
46 changes: 46 additions & 0 deletions SPECS/wekatools.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Name: weka-tools
Version: 1.0
Release: 1%{?dist}
Summary: WEKA Tools Collection
BuildArch: x86_64

License: GPL
URL: https://weka.io

# unset __brp_mangle_shebangs - it chokes on ansible files.
%define __brp_mangle_shebangs /usr/bin/true


Requires: coreutils
Requires: tar
Requires: findutils

# These all get installed in /opt/tools
Source0: weka-tools.tgz

%define destdir /opt/tools

%description
WEKA Tools Collection

%build
echo Good

%install
rm -rf $RPM_BUILD_ROOT

install -d -m 0755 %{buildroot}%{destdir}
tar xvf %{SOURCE0} -C %{buildroot}%{destdir}

%pre
# detach it from the git repo, if it exists
if [ -d %{destdir}/.git ]; then
rm -rf %{destdir}/.git
fi

%files
%{destdir}/*

%changelog
* Thu Feb 13 2025 Vince Fleming <vince@weka.io>
--
Binary file modified install/wekaconfig
Binary file not shown.
9 changes: 9 additions & 0 deletions tar_excludes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tar_excludes.txt
.git*
BUILD*
RPMS
S*
Makefile
CNAME
_config.yml
.vscode
21 changes: 11 additions & 10 deletions weka_upgrade_checker/upgrade_path.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"4.4.1-2": ["4.2.16"],
"4.4.1": ["4.2.16"],
"4.4.0": ["4.2.16"],
"4.3.5.105": ["4.2.16"],
"4.3.5": ["4.2.16"],
"4.3.4-2": ["4.2.16"],
"4.3.3": ["4.2.16"],
"4.3.2.161": ["4.2.16"],
"4.3.0": ["4.2.16"],
"4.4.1-2": ["4.3.5.105"],
"4.4.1": ["4.3.5.105"],
"4.4.0": ["4.3.5.105"],
"4.3.5.105": ["4.3.0"],
"4.3.5": ["4.3.0"],
"4.3.4-2": ["4.3.0"],
"4.3.3": ["4.3.0"],
"4.3.2.161": ["4.3.0"],
"4.3.0": [""],
"4.2.18.14": ["4.1.2.36"],
"4.2.16": ["4.1.2.36"],
"4.2.15": ["4.1.2.36"],
"4.2.14": ["4.1.2.36"],
Expand Down Expand Up @@ -40,4 +41,4 @@
"4.0.2": ["3.14.1"],
"4.0.1": ["3.14.1"],
"4.0": ["3.14.1"]
}
}
2 changes: 1 addition & 1 deletion weka_upgrade_checker/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.03
1.4.05
Binary file modified weka_upgrade_checker/weka_upgrade_checker
Binary file not shown.
64 changes: 35 additions & 29 deletions weka_upgrade_checker/weka_upgrade_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
InvalidVersion = ValueError # Since distutils doesn't have InvalidVersion, we use a generic exception


pg_version = "1.4.03"
pg_version = "1.4.05"


log_file_path = os.path.abspath("./weka_upgrade_checker.log")
Expand Down Expand Up @@ -360,7 +360,7 @@ def check_version():
check_version()


def weka_cluster_checks(skip_mtu_check):
def weka_cluster_checks(skip_mtu_check, target_version):
INFO("VERIFYING WEKA AGENT STATUS")
weka_agent_service = subprocess.call(
["sudo", "service", "weka-agent", "status"],
Expand Down Expand Up @@ -442,6 +442,12 @@ def clean_version_string(version_string):

weka_version = clean_version_string(weka_versions)

if V(target_version) <= V(weka_version):
BAD(
f"Target version {target_version} should be higher than cluster version {weka_version}, cannot continue"
)
sys.exit(1)

class Machine:
def __init__(self, machine_json):
self.name = str(machine_json["name"])
Expand Down Expand Up @@ -990,7 +996,7 @@ def run_command(node_id):
ratio = usable_capacity / total_compute_memory
if ratio > 2000:
WARN(
f"The current ratio of {ratio} is below the recommended value, it is recommended to increase compute RAM"
f"The current ratio of {ratio} is below the recommended value and may cause performance issues during upgrade, it is recommended to increase compute RAM"
)
else:
GOOD("Memory to SSD ratio validation ok")
Expand Down Expand Up @@ -3999,19 +4005,28 @@ def load_upgrade_map(upgrade_path):

def parse_version(version):
"""Converts a version string into a Version object for comparison."""
if not version or not isinstance(version, str) or version.strip() == "":
return None # Return None to indicate an invalid version
return V(version)


def find_upgrade_path(weka_version, target_version, upgrade_map):
path = [weka_version] # Start the path with the current version
weka_version = parse_version(weka_version)
target_version = parse_version(target_version)

if weka_version is None or target_version is None:
WARN("No valid upgrade path due to an invalid version in the upgrade map.")
return []

while weka_version < target_version:
next_versions = [
(ver, parse_version(ver))
for ver, min_ver in upgrade_map.items()
if isinstance(min_ver, list)
and len(min_ver) > 0
and parse_version(min_ver[0]) is not None
and parse_version(ver) is not None
and parse_version(min_ver[0]) <= weka_version
and parse_version(ver) > weka_version
]
Expand All @@ -4032,29 +4047,17 @@ def find_upgrade_path(weka_version, target_version, upgrade_map):
try:
upgrade_map = load_upgrade_map(upgrade_path)
if not upgrade_map:
WARN(
"Invalid or empty upgrade map. Ensure upgrade_path.json exists and not empty."
)
WARN("Invalid or empty upgrade map. Ensure upgrade_path.json exists and is not empty.")
return

upgrade_hops = find_upgrade_path(weka_version, target_version, upgrade_map)

if isinstance(upgrade_hops, list):
if len(upgrade_hops) >= 1:
total_hops = len(upgrade_hops) - 1
if total_hops == 1:
total_hops = "Direct path upgrade"
print(
f"{colors.OKCYAN}Total upgrade hops: {total_hops}.{colors.ENDC}"
)
elif len(upgrade_hops) > 1:
print(
f"{colors.OKCYAN}Total upgrade hops: {total_hops}.{colors.ENDC}"
)

print(
f"{colors.OKCYAN}Upgrade path: {' > '.join(upgrade_hops)}{colors.ENDC}"
)
if upgrade_hops: # Only proceed if a valid path exists
total_hops = len(upgrade_hops) - 1
if total_hops == 1:
total_hops = "Direct path upgrade"
print(f"{colors.OKCYAN}Total upgrade hops: {total_hops}.{colors.ENDC}")
print(f"{colors.OKCYAN}Upgrade path: {' > '.join(upgrade_hops)}{colors.ENDC}")

# Check for known issues with protocol filtering
check_known_issues(
Expand All @@ -4066,10 +4069,9 @@ def find_upgrade_path(weka_version, target_version, upgrade_map):
link_type,
obj_store_enabled,
)
else:
WARN("Error: Upgrade path is not a valid list.")

except (FileNotFoundError, ValueError) as e:
WARN("Error:", e)
WARN(f"Error: {e}")


def main():
Expand Down Expand Up @@ -4127,6 +4129,8 @@ def main():
parser.add_argument(
"-t",
"--target-version",
type=str,
required=True,
help="Specify the target version for upgrade path calculation.",
)
parser.add_argument(
Expand All @@ -4137,6 +4141,8 @@ def main():
)

args = parser.parse_args()
if not args.target_version:
parser.error("--target-version is required.")

ssh_identity = args.ssh_identity or None

Expand All @@ -4145,7 +4151,7 @@ def main():
sys.exit(0)

if args.run_all_checks:
weka_cluster_results = weka_cluster_checks(skip_mtu_check=args.skip_mtu_check)
weka_cluster_results = weka_cluster_checks(skip_mtu_check=args.skip_mtu_check, target_version=args.target_version)
backend_hosts = weka_cluster_results[0]
ssh_bk_hosts = weka_cluster_results[1]
client_hosts = weka_cluster_results[2]
Expand All @@ -4171,13 +4177,13 @@ def main():
sys.exit(0)

elif args.cluster_checks_only:
weka_cluster_checks(skip_mtu_check=args.skip_mtu_check)
weka_cluster_checks(skip_mtu_check=args.skip_mtu_check, target_version=args.target_version)
cluster_summary()
INFO(f"Cluster upgrade checks complete!")
sys.exit(0)

elif args.check_specific_backend_hosts:
weka_cluster_results = weka_cluster_checks(skip_mtu_check=args.skip_mtu_check)
weka_cluster_results = weka_cluster_checks(skip_mtu_check=args.skip_mtu_check, target_version=args.target_version)
backend_hosts = weka_cluster_results[0]
ssh_bk_hosts = weka_cluster_results[1]
client_hosts = weka_cluster_results[2]
Expand All @@ -4202,7 +4208,7 @@ def main():
sys.exit(0)

elif args.skip_client_checks:
weka_cluster_results = weka_cluster_checks(skip_mtu_check=args.skip_mtu_check)
weka_cluster_results = weka_cluster_checks(skip_mtu_check=args.skip_mtu_check, target_version=args.target_version)
backend_hosts = weka_cluster_results[0]
ssh_bk_hosts = weka_cluster_results[1]
client_hosts = weka_cluster_results[2]
Expand Down