Commit 38a6e2e1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix upgrading the cluster ipolicy



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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent f626cef4
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment