Revision 4b542ebc

b/man/htools.rst
177 177
    nodes, and ``M`` for the master node which is always online)
178 178
  - group UUID
179 179
  - node spindle count
180
  - node tags
180 181

  
181 182
  The third section contains instance data, with the fields:
182 183

  
b/src/Ganeti/HTools/Backend/Text.hs
82 82
              -> Node.Node  -- ^ The node to be serialised
83 83
              -> String
84 84
serializeNode gl node =
85
  printf "%s|%.0f|%d|%d|%.0f|%d|%.0f|%c|%s|%d" (Node.name node)
85
  printf "%s|%.0f|%d|%d|%.0f|%d|%.0f|%c|%s|%d|%s" (Node.name node)
86 86
           (Node.tMem node) (Node.nMem node) (Node.fMem node)
87 87
           (Node.tDsk node) (Node.fDsk node) (Node.tCpu node)
88 88
           (if Node.offline node then 'Y' else
89 89
              if Node.isMaster node then 'M' else 'N')
90 90
           (Group.uuid grp)
91 91
           (Node.spindleCount node)
92
           (intercalate "," (Node.nTags node))
92 93
    where grp = Container.find (Node.group node) gl
93 94

  
94 95
-- | Generate node file data from node objects.
......
195 196
         -> [String]              -- ^ Input data as a list of fields
196 197
         -> m (String, Node.Node) -- ^ The result, a tuple o node name
197 198
                                  -- and node object
198
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, spindles] = do
199
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, spindles, tags] = do
199 200
  gdx <- lookupGroup ktg name gu
200 201
  new_node <-
201 202
      if "?" `elem` [tm,nm,fm,td,fd,tc] || fo == "Y" then
202 203
          return $ Node.create name 0 0 0 0 0 0 True 0 gdx
203 204
      else do
205
        let vtags = commaSplit tags
204 206
        vtm <- tryRead name tm
205 207
        vnm <- tryRead name nm
206 208
        vfm <- tryRead name fm
......
208 210
        vfd <- tryRead name fd
209 211
        vtc <- tryRead name tc
210 212
        vspindles <- tryRead name spindles
211
        return . flip Node.setMaster (fo == "M") $
213
        return . flip Node.setMaster (fo == "M") . flip Node.setNodeTags vtags $
212 214
          Node.create name vtm vnm vfm vtd vfd vtc False vspindles gdx
213 215
  return (name, new_node)
214 216

  
215 217
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu] =
216 218
  loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, "1"]
217 219

  
220
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, spindles] =
221
  loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, spindles, ""]
222

  
218 223
loadNode _ s = fail $ "Invalid/incomplete node data: '" ++ show s ++ "'"
219 224

  
220 225
-- | Load an instance from a field list.
......
363 368
  {- group file: name uuid alloc_policy -}
364 369
  (ktg, gl) <- loadTabular glines loadGroup
365 370
  {- node file: name t_mem n_mem f_mem t_disk f_disk t_cpu offline grp_uuid
366
                spindles -}
371
                spindles tags -}
367 372
  (ktn, nl) <- loadTabular nlines (loadNode ktg)
368 373
  {- instance file: name mem disk vcpus status auto_bal pnode snode
369 374
                    disk_template tags spindle_use -}

Also available in: Unified diff