We need to only query the default (first enabled) hypervisor, not all
hypervisors. For this, we need to add a manual check to ensure that we
don't have a corrupt config (there's no "NonEmptyList" type…).

Signed-off-by: Iustin Pop <[email protected]>
---
 htools/Ganeti/Query/Query.hs |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/htools/Ganeti/Query/Query.hs b/htools/Ganeti/Query/Query.hs
index a42cde6..ff7d33d 100644
--- a/htools/Ganeti/Query/Query.hs
+++ b/htools/Ganeti/Query/Query.hs
@@ -103,7 +103,9 @@ maybeCollectLiveData False _ nodes =
 
 maybeCollectLiveData True cfg nodes = do
   let vgs = [clusterVolumeGroupName $ configCluster cfg]
-      hvs = clusterEnabledHypervisors $ configCluster cfg
+      hvs = case clusterEnabledHypervisors $ configCluster cfg of
+              []  -> [XenPvm] -- this case shouldn't happen, but we handle it
+              x:_ -> [x]
   executeRpcCall nodes (RpcCallNodeInfo vgs hvs)
 
 -- | Check whether list of queried fields contains live fields.
-- 
1.7.10.4

Reply via email to