From b3c5e8de0fe3cb01f4a0b2e90e7759cd0a2737b4 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 2 Jul 2011 23:22:11 +0200
Subject: [PATCH] htools: read the disk_template in the Luxi backend

We need to request the disk template in the Luxi query and then use it
when parsing the response.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 htools/Ganeti/HTools/Luxi.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htools/Ganeti/HTools/Luxi.hs b/htools/Ganeti/HTools/Luxi.hs
index ce0f21aa8..9b3fa9c50 100644
--- a/htools/Ganeti/HTools/Luxi.hs
+++ b/htools/Ganeti/HTools/Luxi.hs
@@ -77,7 +77,7 @@ queryInstancesMsg :: L.LuxiOp
 queryInstancesMsg =
   L.QueryInstances [] ["name", "disk_usage", "be/memory", "be/vcpus",
                        "status", "pnode", "snodes", "tags", "oper_ram",
-                       "be/auto_balance"] False
+                       "be/auto_balance", "disk_template"] False
 
 -- | The input data for cluster query.
 queryClusterInfoMsg :: L.LuxiOp
@@ -115,7 +115,7 @@ parseInstance :: NameAssoc
               -> Result (String, Instance.Instance)
 parseInstance ktn (JSArray [ name, disk, mem, vcpus
                            , status, pnode, snodes, tags, oram
-                           , auto_balance ]) = do
+                           , auto_balance, disk_template ]) = do
   xname <- annotateResult "Parsing new instance" (fromJVal name)
   let convert a = genericConvert "Instance" xname a
   xdisk <- convert "disk_usage" disk
@@ -130,8 +130,9 @@ parseInstance ktn (JSArray [ name, disk, mem, vcpus
   xrunning <- convert "status" status
   xtags <- convert "tags" tags
   xauto_balance <- convert "auto_balance" auto_balance
+  xdt <- convert "disk_template" disk_template
   let inst = Instance.create xname xmem xdisk xvcpus
-             xrunning xtags xauto_balance xpnode snode DTDrbd8
+             xrunning xtags xauto_balance xpnode snode xdt
   return (xname, inst)
 
 parseInstance _ v = fail ("Invalid instance query result: " ++ show v)
-- 
GitLab