Skip to content
Snippets Groups Projects
Commit d4c453d2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix some hscan bugs

Currently hscan has a number of bugs:
  - doesn't add the common suffix (csf) to the instance's nodes
  - doesn't export the cpus for neither nodes nor instances
  - doesn't support single-node instances

This patch fixes these issues.
parent 877d0386
No related branches found
No related tags found
No related merge requests found
...@@ -96,14 +96,10 @@ options = ...@@ -96,14 +96,10 @@ options =
-- | Serialize a single node -- | Serialize a single node
serializeNode :: String -> Node.Node -> String serializeNode :: String -> Node.Node -> String
serializeNode csf node = serializeNode csf node =
let name = Node.name node ++ csf printf "%s|%.0f|%d|%d|%.0f|%d|%.0f|%c" (Node.name node ++ csf)
t_mem = (truncate $ Node.t_mem node)::Int (Node.t_mem node) (Node.n_mem node) (Node.f_mem node)
t_dsk = (truncate $ Node.t_dsk node)::Int (Node.t_dsk node) (Node.f_dsk node) (Node.t_cpu node)
in (if Node.offline node then 'Y' else 'N')
printf "%s|%d|%d|%d|%d|%d|%c" name
t_mem (Node.n_mem node) (Node.f_mem node)
t_dsk (Node.f_dsk node)
(if Node.offline node then 'Y' else 'N')
-- | Generate node file data from node objects -- | Generate node file data from node objects
serializeNodes :: String -> Node.List -> String serializeNodes :: String -> Node.List -> String
...@@ -115,12 +111,15 @@ serializeInstance :: String -> Node.List -> Instance.Instance -> String ...@@ -115,12 +111,15 @@ serializeInstance :: String -> Node.List -> Instance.Instance -> String
serializeInstance csf nl inst = serializeInstance csf nl inst =
let let
iname = Instance.name inst ++ csf iname = Instance.name inst ++ csf
pnode = Container.nameOf nl $ Instance.pnode inst pnode = (Container.nameOf nl $ Instance.pnode inst) ++ csf
snode = Container.nameOf nl $ Instance.snode inst sidx = Instance.snode inst
snode = (if sidx == Node.noSecondary
then ""
else (Container.nameOf nl sidx) ++ csf)
in in
printf "%s|%d|%d|%s|%s|%s" printf "%s|%d|%d|%d|%s|%s|%s"
iname (Instance.mem inst) (Instance.dsk inst) iname (Instance.mem inst) (Instance.dsk inst)
(Instance.run_st inst) (Instance.vcpus inst) (Instance.run_st inst)
pnode snode pnode snode
-- | Generate instance file data from instance objects -- | Generate instance file data from instance objects
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment