Fix old-style import
[ganeti-local] / htools / Ganeti / HTools / IAlloc.hs
index d881921..3142755 100644 (file)
@@ -70,7 +70,8 @@ parseBaseInstance n a = do
   vcpus <- extract "vcpus"
   tags  <- extract "tags"
   dt    <- extract "disk_template"
-  return (n, Instance.create n mem disk vcpus Running tags True 0 0 dt 1)
+  su    <- extract "spindle_use"
+  return (n, Instance.create n mem disk vcpus Running tags True 0 0 dt su)
 
 -- | Parses an instance as found in the cluster instance list.
 parseInstance :: NameAssoc -- ^ The node name-to-index association list
@@ -269,7 +270,7 @@ processRelocate gl nl il idx 1 exndx = do
   let orig = Container.find idx il
       sorig = Instance.sNode orig
       porig = Instance.pNode orig
-      mir_type = templateMirrorType $ Instance.diskTemplate orig
+      mir_type = Instance.mirrorType orig
   (exp_node, node_type, reloc_type) <-
     case mir_type of
       MirrorNone -> fail "Can't relocate non-mirrored instances"
@@ -346,7 +347,9 @@ processRequest request =
 -- | Reads the request from the data file(s).
 readRequest :: FilePath -> IO Request
 readRequest fp = do
-  input_data <- readFile fp
+  input_data <- case fp of
+                  "-" -> getContents
+                  _   -> readFile fp
   case parseData input_data of
     Bad err -> do
       hPutStrLn stderr $ "Error: " ++ err