diff --git a/utils/upgrade b/utils/upgrade index e4bb3e7..29bf061 100755 --- a/utils/upgrade +++ b/utils/upgrade @@ -35,6 +35,8 @@ CAS_CACHE_KEY = "CAS Cache Kernel Module" CAS_DISK_KEY = "CAS Disk Kernel Module" CAS_CLI_KEY = "CAS CLI Utility" +CAS_DISK_MIN_VER = 20 + OCL_BUILD_ROOT = f"{os.path.dirname(__file__)}/.." @@ -58,6 +60,11 @@ class InitUpgrade(UpgradeState): except Exception as e: return Failure(f"Failed to get current version of CAS {e}") + # Although there shouldn't be any problem with upgrade from CAS 19.9 to newer, this feature + # is not full validated so it is disabled by default. + if (int(version[CAS_DISK_KEY].split('.')[0]) < CAS_DISK_MIN_VER): + return Failure(f"Minimal cas_disk version required to perform upgrade is 20.01!") + if version[CAS_CLI_KEY] != version[CAS_CACHE_KEY]: return Failure("Mismatch between CLI and cas_cache version") diff --git a/utils/upgrade_utils.py b/utils/upgrade_utils.py index 3fffffb..7e2112e 100644 --- a/utils/upgrade_utils.py +++ b/utils/upgrade_utils.py @@ -162,9 +162,10 @@ class UpgradeState: def insert_module(name, installed=True, **params): cmd_params = [f"{param}={val}" for param, val in params.items()] - cmd = "modprobe --first-time" if installed else "insmod" + cmd = ["modprobe", "--first-time"] if installed else ["insmod"] + cmd += [name] + cmd_params - p = subprocess.run([cmd, name] + cmd_params, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if p.returncode: raise Exception(p.stderr.decode("ascii").rstrip("\n"))