Support group networks in Text backend
authorThomas Thrainer <thomasth@google.com>
Fri, 24 May 2013 08:03:02 +0000 (10:03 +0200)
committerThomas Thrainer <thomasth@google.com>
Wed, 29 May 2013 07:52:54 +0000 (09:52 +0200)
The Text backend now parses network UUID (comma separated) and
serializes them in the same form.
The test data is adapted to the new format.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

14 files changed:
man/htools.rst
src/Ganeti/HTools/Backend/Text.hs
test/data/htools/clean-nonzero-score.data
test/data/htools/common-suffix.data
test/data/htools/empty-cluster.data
test/data/htools/hbal-excl-tags.data
test/data/htools/hbal-split-insts.data
test/data/htools/hspace-tiered-dualspec.data
test/data/htools/hspace-tiered.data
test/data/htools/invalid-node.data
test/data/htools/missing-resources.data
test/data/htools/multiple-master.data
test/data/htools/n1-failure.data
test/data/htools/unique-reboot-order.data

index 22b67bb..8b83526 100644 (file)
@@ -163,6 +163,7 @@ support all options. Some common options are:
   - group uuid
   - allocation policy
   - tags (separated by comma)
+  - networks (UUID's, separated by comma)
 
   The second sections contains node data, with the following columns:
 
index 96a5290..54ad41d 100644 (file)
@@ -69,9 +69,10 @@ commaSplit = sepSplit ','
 -- | Serialize a single group.
 serializeGroup :: Group.Group -> String
 serializeGroup grp =
-  printf "%s|%s|%s|%s" (Group.name grp) (Group.uuid grp)
+  printf "%s|%s|%s|%s|%s" (Group.name grp) (Group.uuid grp)
            (allocPolicyToRaw (Group.allocPolicy grp))
            (intercalate "," (Group.allTags grp))
+           (intercalate "," (Group.networks grp))
 
 -- | Generate group file data from a group list.
 serializeGroups :: Group.List -> String
@@ -182,12 +183,12 @@ serializeCluster (ClusterData gl nl il ctags cpol) =
 loadGroup :: (Monad m) => [String]
           -> m (String, Group.Group) -- ^ The result, a tuple of group
                                      -- UUID and group object
-loadGroup [name, gid, apol, tags] = do
+loadGroup [name, gid, apol, tags, nets] = do
   xapol <- allocPolicyFromRaw apol
   let xtags = commaSplit tags
-  -- TODO: parse networks to which this group is connected
-  return (gid, Group.create name gid xapol [] defIPolicy xtags)
-
+  let xnets = commaSplit nets
+  return (gid, Group.create name gid xapol xnets defIPolicy xtags)
+loadGroup [name, gid, apol, tags] = loadGroup [name, gid, apol, tags, ""]
 loadGroup s = fail $ "Invalid/incomplete group data: '" ++ show s ++ "'"
 
 -- | Load a node from a field list.
index 28ebdf1..8380fb1 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01-001|91552|0|91424|953674|953674|16|N|fake-uuid-01|1
 node-01-002|91552|0|91296|953674|953674|16|N|fake-uuid-01|1
index 1e34c94..bce119d 100644 (file)
@@ -1,4 +1,4 @@
-default|fake-uuid-01|preferred|
+default|fake-uuid-01|preferred||
 
 node1.example.com|1024|0|1024|95367|95367|4|N|fake-uuid-01|1
 node2.example.com|1024|0|896|95367|94343|4|N|fake-uuid-01|1
index 9e17bbb..c58b412 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 
 
index c243aef..6c53395 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01|16384|0|14336|409600|153600|16|N|fake-uuid-01|1
 node-02|16384|0|13312|409600|153600|16|N|fake-uuid-01|1
index fe3bb22..4d00956 100644 (file)
@@ -1,5 +1,5 @@
-group-01|fake-uuid-01|preferred|
-group-02|fake-uuid-02|preferred|
+group-01|fake-uuid-01|preferred||
+group-02|fake-uuid-02|preferred||
 
 node-01-001|98304|0|96256|8388608|8355840|16|N|fake-uuid-01|1
 node-01-002|98304|0|96256|8388608|8355840|16|N|fake-uuid-01|1
index 46e44ce..8cb684c 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01-001|262144|65536|196608|2097152|2097152|8|N|fake-uuid-01|1
 node-01-002|262144|65536|196608|2097152|2097152|8|N|fake-uuid-01|1
index 61ee4c1..6d0698b 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01-001|262144|65536|196608|2097152|2097152|8|N|fake-uuid-01|1
 node-01-002|262144|65536|196608|2097152|2097152|8|N|fake-uuid-01|1
index 9655f72..1aa5324 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01-001|1024|0|1024|95367|95367|4|N|fake-uuid-01|1
 node-01-002|1024|0|896|95367|94343|4|N|fake-uuid-01|1
index 500576a..15b55c0 100644 (file)
@@ -1,4 +1,4 @@
-default|fake-uuid-01|preferred|
+default|fake-uuid-01|preferred||
 
 node1|1024|0|1024|95367|95367|4|N|fake-uuid-01|1
 node2|1024|0|0|95367|0|4|N|fake-uuid-01|1
index 5d4fc52..2050835 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01-001|91552|0|91424|953674|953674|16|M|fake-uuid-01|1
 node-01-002|91552|0|91296|953674|953674|16|N|fake-uuid-01|1
index 5218750..482b1ed 100644 (file)
@@ -1,5 +1,5 @@
-group-01|fake-uuid-01|preferred|
-group-02|fake-uuid-02|unallocable|
+group-01|fake-uuid-01|preferred||
+group-02|fake-uuid-02|unallocable||
 
 node-01-001|256|0|0|7629394|7625298|16|N|fake-uuid-01|1
 node-01-002|256|0|0|7629394|7625298|16|N|fake-uuid-01|1
index a756a05..7007aee 100644 (file)
@@ -1,4 +1,4 @@
-group-01|fake-uuid-01|preferred|
+group-01|fake-uuid-01|preferred||
 
 node-01-001|91552|0|91424|953674|953674|16|M|fake-uuid-01|1
 node-01-002|91552|0|91296|953674|953674|16|N|fake-uuid-01|1