From 38a6e2e1b5de46e3499f5c24f6a41238e511ede2 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 23 Jan 2012 13:06:35 +0100 Subject: [PATCH] Fix upgrading the cluster ipolicy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running from git HEAD, just initialising the ipolicy when non-existing is not good enough; we need to upgrade also missing keys, etc. This has downsides though, as it means we'll always 'rewrite' the ipolicy, which might create silent data loss for unhandled changes (e.g. key removal). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/objects.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/objects.py b/lib/objects.py index 8cba493a0..d844628d1 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -1508,6 +1508,11 @@ class Cluster(TaggableObject): # instance policy added before 2.6 if self.ipolicy is None: self.ipolicy = FillIPolicy(constants.IPOLICY_DEFAULTS, {}) + else: + # we can either make sure to upgrade the ipolicy always, or only + # do it in some corner cases (e.g. missing keys); note that this + # will break any removal of keys from the ipolicy dict + self.ipolicy = FillIPolicy(constants.IPOLICY_DEFAULTS, self.ipolicy) @property def primary_hypervisor(self): -- GitLab