Revision d4c453d2 hscan.hs

b/hscan.hs
96 96
-- | Serialize a single node
97 97
serializeNode :: String -> Node.Node -> String
98 98
serializeNode csf node =
99
    let name = Node.name node ++ csf
100
        t_mem = (truncate $ Node.t_mem node)::Int
101
        t_dsk = (truncate $ Node.t_dsk node)::Int
102
    in
103
      printf "%s|%d|%d|%d|%d|%d|%c" name
104
             t_mem (Node.n_mem node) (Node.f_mem node)
105
             t_dsk (Node.f_dsk node)
106
             (if Node.offline node then 'Y' else 'N')
99
    printf "%s|%.0f|%d|%d|%.0f|%d|%.0f|%c" (Node.name node ++ csf)
100
               (Node.t_mem node) (Node.n_mem node) (Node.f_mem node)
101
               (Node.t_dsk node) (Node.f_dsk node) (Node.t_cpu node)
102
               (if Node.offline node then 'Y' else 'N')
107 103

  
108 104
-- | Generate node file data from node objects
109 105
serializeNodes :: String -> Node.List -> String
......
115 111
serializeInstance csf nl inst =
116 112
    let
117 113
        iname = Instance.name inst ++ csf
118
        pnode = Container.nameOf nl $ Instance.pnode inst
119
        snode = Container.nameOf nl $ Instance.snode inst
114
        pnode = (Container.nameOf nl $ Instance.pnode inst) ++ csf
115
        sidx = Instance.snode inst
116
        snode = (if sidx == Node.noSecondary
117
                    then ""
118
                    else (Container.nameOf nl sidx) ++ csf)
120 119
    in
121
      printf "%s|%d|%d|%s|%s|%s"
120
      printf "%s|%d|%d|%d|%s|%s|%s"
122 121
             iname (Instance.mem inst) (Instance.dsk inst)
123
             (Instance.run_st inst)
122
             (Instance.vcpus inst) (Instance.run_st inst)
124 123
             pnode snode
125 124

  
126 125
-- | Generate instance file data from instance objects

Also available in: Unified diff