When parsing the cluster configuration, accept that "hv_state_static"
and "disk_state_static" can be missing; in this case, just use the
default value. This follows the implicit upgrade that was present
for these parameters in the python code all the time. In this way,
upgrading from very old versions of Ganeti runs more smoothly
(issue 1019).

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/Objects.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
index ccc02fd..be0c056 100644
--- a/src/Ganeti/Objects.hs
+++ b/src/Ganeti/Objects.hs
@@ -848,8 +848,10 @@ $(buildObject "Cluster" "cluster" $
   , simpleField "primary_ip_family"              [t| IpFamily               |]
   , simpleField "prealloc_wipe_disks"            [t| Bool                   |]
   , simpleField "ipolicy"                        [t| FilledIPolicy          |]
-  , simpleField "hv_state_static"                [t| HypervisorState        |]
-  , simpleField "disk_state_static"              [t| DiskState              |]
+  , defaultField [| emptyContainer |] $
+    simpleField "hv_state_static"                [t| HypervisorState        |]
+  , defaultField [| emptyContainer |] $
+    simpleField "disk_state_static"              [t| DiskState              |]
   , simpleField "enabled_disk_templates"         [t| [DiskTemplate]         |]
   , simpleField "candidate_certs"                [t| CandidateCertificates  |]
   , simpleField "max_running_jobs"               [t| Int                    |]
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to