Make hv and disk states default fields with notSerializeDefaultField
flag set in haskell objects in order to make them consistent with
the corresponding fields in python objects.

Partially cherry-picked from: 553363a33cfb00bbae88c94ae6408d6e1a81a194

Signed-off-by: Oleg Ponomarev <[email protected]>
---
 src/Ganeti/Objects.hs | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
index 1b25933..c99c1c2 100644
--- a/src/Ganeti/Objects.hs
+++ b/src/Ganeti/Objects.hs
@@ -684,6 +684,18 @@ $(buildParam "ND" "ndp"
   , simpleField "cpu_speed"     [t| Double |]
   ])
 
+-- | Disk state parameters.
+--
+-- As according to the documentation this option is unused by Ganeti,
+-- the content is just a 'JSValue'.
+type DiskState = Container JSValue
+
+-- | Hypervisor state parameters.
+--
+-- As according to the documentation this option is unused by Ganeti,
+-- the content is just a 'JSValue'.
+type HypervisorState = Container JSValue
+
 $(buildObject "Node" "node" $
   [ simpleField "name"             [t| String |]
   , simpleField "primary_ip"       [t| String |]
@@ -696,6 +708,10 @@ $(buildObject "Node" "node" $
   , simpleField "vm_capable"       [t| Bool   |]
   , simpleField "ndparams"         [t| PartialNDParams |]
   , simpleField "powered"          [t| Bool   |]
+  , notSerializeDefaultField [| emptyContainer |] $
+    simpleField "hv_state_static"   [t| HypervisorState |]
+  , notSerializeDefaultField [| emptyContainer |] $
+    simpleField "disk_state_static" [t| DiskState       |]
   ]
   ++ timeStampFields
   ++ uuidFields
@@ -731,6 +747,10 @@ $(buildObject "NodeGroup" "group" $
   , simpleField "ipolicy"      [t| PartialIPolicy  |]
   , simpleField "diskparams"   [t| GroupDiskParams |]
   , simpleField "networks"     [t| Networks        |]
+  , notSerializeDefaultField [| emptyContainer |] $
+    simpleField "hv_state_static"   [t| HypervisorState |]
+  , notSerializeDefaultField [| emptyContainer |] $
+    simpleField "disk_state_static" [t| DiskState       |]
   ]
   ++ timeStampFields
   ++ uuidFields
@@ -796,18 +816,6 @@ type IAllocatorParams = Container JSValue
 -- | The master candidate client certificate digests
 type CandidateCertificates = Container String
 
--- | Disk state parameters.
---
--- As according to the documentation this option is unused by Ganeti,
--- the content is just a 'JSValue'.
-type DiskState = Container JSValue
-
--- | Hypervisor state parameters.
---
--- As according to the documentation this option is unused by Ganeti,
--- the content is just a 'JSValue'.
-type HypervisorState = Container JSValue
-
 -- * Cluster definitions
 $(buildObject "Cluster" "cluster" $
   [ simpleField "rsahostkeypub"                  [t| String                 |]
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to