Commit a9532fb0 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

masterd: implement query via luxi

The master daemon so far still did queries via the python
implementation. This patch implements that it uses the
haskell implementation and removes the node queries from
the list of OP-queriable entities.
Signed-off-by: default avatarHelga Velroyen <>
Reviewed-by: default avatarHrvoje Ribicic <>
parent 87747cda
......@@ -31,7 +31,6 @@ from import GroupQuery
from ganeti.cmdlib.instance_query import InstanceQuery
from ganeti.cmdlib.misc import ExtStorageQuery
from import NetworkQuery
from ganeti.cmdlib.node import NodeQuery
from ganeti.cmdlib.operating_system import OsQuery
......@@ -39,7 +38,6 @@ from ganeti.cmdlib.operating_system import OsQuery
constants.QR_CLUSTER: ClusterQuery,
constants.QR_INSTANCE: InstanceQuery,
constants.QR_NODE: NodeQuery,
constants.QR_GROUP: GroupQuery,
constants.QR_NETWORK: NetworkQuery,
constants.QR_OS: OsQuery,
......@@ -581,7 +581,9 @@ TInstCreateMode = TElemOf(constants.INSTANCE_CREATE_MODES)
TRebootType = TElemOf(constants.REBOOT_TYPES)
TFileDriver = TElemOf(constants.FILE_DRIVER)
TOobCommand = TElemOf(constants.OOB_COMMANDS)
TQueryTypeOp = TElemOf(constants.QR_VIA_OP)
# FIXME: adjust this after all queries are in haskell
TQueryTypeOp = TElemOf(set(constants.QR_VIA_OP)
TDiskParams = \
Comment("Disk parameters")(TDictOf(TNonEmptyString,
......@@ -361,7 +361,8 @@ class ClientOps:
elif what == constants.QR_JOB:
return queue.QueryJobs(fields, qfilter)
elif what in constants.QR_VIA_LUXI:
raise NotImplementedError
luxi_client = runtime.GetClient(query=True)
result = luxi_client.Query(what, fields, qfilter).ToDict()
raise errors.OpPrereqError("Resource type '%s' unknown" % what,
......@@ -3338,7 +3338,6 @@ qrViaOp :: FrozenSet String
qrViaOp =
ConstantUtils.mkSet [qrCluster,
......@@ -3347,11 +3346,11 @@ qrViaOp =
-- | List of resources which can be queried using Local UniX Interface
qrViaLuxi :: FrozenSet String
qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob, qrNode]
-- | List of resources which can be queried using RAPI
qrViaRapi :: FrozenSet String
qrViaRapi = qrViaLuxi
qrViaRapi = ConstantUtils.mkSet [qrLock, qrJob]
-- * Query field types
......@@ -23,7 +23,6 @@
import unittest
import operator
import itertools
import copy
......@@ -31,19 +30,15 @@ from ganeti import constants
from ganeti import mcpu
from ganeti import cmdlib
from ganeti.cmdlib import cluster
from ganeti.cmdlib import instance
from ganeti.cmdlib import instance_storage
from ganeti.cmdlib import instance_utils
from ganeti.cmdlib import common
from ganeti.cmdlib import query
from ganeti import opcodes
from ganeti import errors
from ganeti import utils
from ganeti import luxi
from ganeti import ht
from ganeti import objects
from ganeti import compat
from ganeti import rpc
from ganeti import locking
from ganeti.masterd import iallocator
......@@ -141,7 +136,7 @@ class TestLUQuery(unittest.TestCase):
assert constants.QR_NODE in constants.QR_VIA_OP
assert constants.QR_NODE in constants.QR_VIA_LUXI
assert constants.QR_INSTANCE in constants.QR_VIA_OP
for i in constants.QR_VIA_OP:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment