Add default values for hv_state_static and disk_state_static
authorKlaus Aehlig <aehlig@google.com>
Mon, 30 Mar 2015 14:42:35 +0000 (16:42 +0200)
committerKlaus Aehlig <aehlig@google.com>
Tue, 31 Mar 2015 08:11:43 +0000 (10:11 +0200)
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 <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

src/Ganeti/Objects.hs

index ccc02fd..be0c056 100644 (file)
@@ -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                    |]