summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Kharin <akscram@gmail.com>2016-08-23 01:04:21 +0300
committerIlya Kharin <akscram@gmail.com>2016-08-23 17:00:14 +0300
commit7cf3fe9b3aa0965514e4370e908909e548ff918e (patch)
tree8f64d8f86a977913c2b4b410e3c54be0fc7e45e6
parentd94df3e42b96cdf08901e3917d70b8fe3b97c989 (diff)
Disallow to change operating system during upgrade
Changing of an operating system for clouds nodes is not supported and is not tested at all. That's why this additional validation was added. Change-Id: Ibf6db17f783879eff88e2366dfdb0a2871e2aa0a
Notes
Notes (review): Code-Review+2: Sergey Abramov <sabramov@mirantis.com> Code-Review+1: Nikita Zubkov <nzubkov@mirantis.com> Code-Review+1: Valyavskiy Viacheslav <vvalyavskiy@mirantis.com> Code-Review+2: Yuriy Taraday <yorik.sar@gmail.com> Workflow+1: Yuriy Taraday <yorik.sar@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 23 Aug 2016 20:14:58 +0000 Reviewed-on: https://review.openstack.org/358879 Project: openstack/fuel-nailgun-extension-cluster-upgrade Branch: refs/heads/master
-rw-r--r--cluster_upgrade/objects/adapters.py4
-rw-r--r--cluster_upgrade/tests/test_validators.py8
-rw-r--r--cluster_upgrade/validators.py6
3 files changed, 18 insertions, 0 deletions
diff --git a/cluster_upgrade/objects/adapters.py b/cluster_upgrade/objects/adapters.py
index cf4751b..7a00c0c 100644
--- a/cluster_upgrade/objects/adapters.py
+++ b/cluster_upgrade/objects/adapters.py
@@ -101,6 +101,10 @@ class NailgunReleaseAdapter(object):
101 return release 101 return release
102 102
103 @property 103 @property
104 def operating_system(self):
105 return self.release.operating_system
106
107 @property
104 def is_deployable(self): 108 def is_deployable(self):
105 return objects.Release.is_deployable(self.release) 109 return objects.Release.is_deployable(self.release)
106 110
diff --git a/cluster_upgrade/tests/test_validators.py b/cluster_upgrade/tests/test_validators.py
index 056c1cb..cf81cb8 100644
--- a/cluster_upgrade/tests/test_validators.py
+++ b/cluster_upgrade/tests/test_validators.py
@@ -58,6 +58,14 @@ class TestClusterUpgradeValidator(tests_base.BaseCloneClusterTest):
58 self.validator.validate_release_upgrade(self.dst_release, 58 self.validator.validate_release_upgrade(self.dst_release,
59 self.src_release) 59 self.src_release)
60 60
61 def test_validate_release_upgrade_to_different_os(self):
62 self.dst_release.operating_system = consts.RELEASE_OS.centos
63 msg = "^Changing of operating system is not possible during upgrade " \
64 "\(from {0} to {1}\).$".format("Ubuntu", "CentOS")
65 with self.assertRaisesRegexp(errors.InvalidData, msg):
66 self.validator.validate_release_upgrade(self.src_release,
67 self.dst_release)
68
61 def test_validate_cluster_name(self): 69 def test_validate_cluster_name(self):
62 self.validator.validate_cluster_name("cluster-42") 70 self.validator.validate_cluster_name("cluster-42")
63 71
diff --git a/cluster_upgrade/validators.py b/cluster_upgrade/validators.py
index 0dcd286..78f959e 100644
--- a/cluster_upgrade/validators.py
+++ b/cluster_upgrade/validators.py
@@ -62,6 +62,12 @@ class ClusterUpgradeValidator(base.BasicValidator):
62 "this release is equal or lower than the release of the " 62 "this release is equal or lower than the release of the "
63 "original cluster.".format(new_release.id), 63 "original cluster.".format(new_release.id),
64 log_message=True) 64 log_message=True)
65 if orig_release.operating_system != new_release.operating_system:
66 raise errors.InvalidData(
67 "Changing of operating system is not possible during upgrade "
68 "(from {0} to {1}).".format(orig_release.operating_system,
69 new_release.operating_system),
70 log_message=True)
65 71
66 @classmethod 72 @classmethod
67 def validate_cluster_name(cls, cluster_name): 73 def validate_cluster_name(cls, cluster_name):