From 0f0d7abaca6176f63d8073cc30c6f68536a02770 Mon Sep 17 00:00:00 2001
From: Helga Velroyen <helgav@google.com>
Date: Tue, 18 Dec 2012 14:33:37 +0100
Subject: [PATCH] Add a network fields to NIC params and node group type

This adds a network field to the NIC params and a list of networks
to the node group type. It adjusts the nodegroup's unit tests accordingly.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 htest/Test/Ganeti/Objects.hs | 1 +
 htools/Ganeti/Objects.hs     | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/htest/Test/Ganeti/Objects.hs b/htest/Test/Ganeti/Objects.hs
index 03da9e7df..eccc5df60 100644
--- a/htest/Test/Ganeti/Objects.hs
+++ b/htest/Test/Ganeti/Objects.hs
@@ -131,6 +131,7 @@ $(genArbitrary ''PartialIPolicy)
 instance Arbitrary NodeGroup where
   arbitrary = NodeGroup <$> genFQDN <*> pure [] <*> arbitrary <*> arbitrary
                         <*> arbitrary <*> pure (GenericContainer Map.empty)
+                        <*> arbitrary
                         -- ts
                         <*> arbitrary <*> arbitrary
                         -- uuid
diff --git a/htools/Ganeti/Objects.hs b/htools/Ganeti/Objects.hs
index e2deb9c1b..2fea77c3a 100644
--- a/htools/Ganeti/Objects.hs
+++ b/htools/Ganeti/Objects.hs
@@ -212,6 +212,7 @@ $(buildObject "PartialNic" "nic"
   [ simpleField "mac" [t| String |]
   , optionalField $ simpleField "ip" [t| String |]
   , simpleField "nicparams" [t| PartialNicParams |]
+  , optionalField $ simpleField "network" [t| Network |]
   ])
 
 -- * Disk definitions
@@ -502,11 +503,12 @@ type DiskParams = Container (Container JSValue)
 
 $(buildObject "NodeGroup" "group" $
   [ simpleField "name"         [t| String |]
-  , defaultField  [| [] |] $ simpleField "members" [t| [String] |]
+  , defaultField [| [] |] $ simpleField "members" [t| [String] |]
   , simpleField "ndparams"     [t| PartialNDParams |]
   , simpleField "alloc_policy" [t| AllocPolicy     |]
   , simpleField "ipolicy"      [t| PartialIPolicy  |]
   , simpleField "diskparams"   [t| DiskParams      |]
+  , defaultField [| [] |] $ simpleField "networks" [t| [Network] |]
   ]
   ++ timeStampFields
   ++ uuidFields
-- 
GitLab