Commit 42ab9ac4 authored by Iustin Pop's avatar Iustin Pop

Add configure-time switch for split queries

And expand cli.GetClient() to allow opening the query socket, instead
of the main master socket.

Finally, enable the query socket use in gnt-cluster version, since
that is already implemented fully in Queryd.hs/hconfd.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
parent 4b71f30c
......@@ -1142,6 +1142,7 @@ lib/_autoconf.py: Makefile | stamp-directories
echo "PY_CONFD = $(PY_CONFD)"; \
echo "HS_CONFD = $(HS_CONFD)"; \
echo "XEN_CMD = '$(XEN_CMD)'"; \
echo "ENABLE_SPLIT_QUERY = $(ENABLE_SPLIT_QUERY)"; \
} > $@
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
......@@ -1195,6 +1196,7 @@ $(REPLACE_VARS_SED): Makefile stamp-directories
echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
echo 's#@MODULES@#$(strip $(lint_python_code))#g'; \
echo 's#@ENABLE_SPLIT_QUERY@#$(ENABLE_SPLIT_QUERY)#g'; \
} > $@
# Using deferred evaluation
......
......@@ -288,7 +288,7 @@ AC_ARG_ENABLE([htools-rapi],
[],
[enable_htools_rapi=no])
# --enable-htools
# --enable-confd
ENABLE_CONFD=
AC_ARG_ENABLE([confd],
[AS_HELP_STRING([--enable-confd],
......@@ -324,6 +324,31 @@ AM_CONDITIONAL([WANT_CONFD], [test x$enable_confd = xTrue])
AM_CONDITIONAL([PY_CONFD], [test x$py_confd = xTrue])
AM_CONDITIONAL([HS_CONFD], [test x$hs_confd = xTrue])
# --enable-split-query
ENABLE_SPLIT_QUERY=
AC_ARG_ENABLE([split-query],
[AS_HELP_STRING([--enable-split-query],
[enable use of custom query daemon via Haskell confd])],
[[case "$enableval" in
no)
enable_split_query=False
;;
yes)
enable_split_query=True
;;
*)
echo "Invalid value for enable-confd '$enableval'"
exit 1
;;
esac
]],
[enable_split_query=False])
AC_SUBST(ENABLE_SPLIT_QUERY, $enable_split_query)
if test x$enable_split_query = xTrue -a x$hs_confd != xTrue; then
AC_MSG_ERROR([Split queries require the Haskell confd])
fi
# --with-disk-separator=...
AC_ARG_WITH([disk-separator],
[AS_HELP_STRING([--with-disk-separator=STRING],
......
......@@ -2082,10 +2082,23 @@ def SetGenericOpcodeOpts(opcode_list, options):
op.priority = _PRIONAME_TO_VALUE[options.priority]
def GetClient():
def GetClient(query=False):
"""Connects to the a luxi socket and returns a client.
@type query: boolean
@param query: this signifies that the client will only be
used for queries; if the build-time parameter
enable-split-queries is enabled, then the client will be
connected to the query socket instead of the masterd socket
"""
if query and constants.ENABLE_SPLIT_QUERY:
address = constants.QUERY_SOCKET
else:
address = None
# TODO: Cache object?
try:
client = luxi.Client()
client = luxi.Client(address=address)
except luxi.NoMasterError:
ss = ssconf.SimpleStore()
......
......@@ -334,7 +334,7 @@ def ShowClusterVersion(opts, args):
@return: the desired exit code
"""
cl = GetClient()
cl = GetClient(query=True)
result = cl.QueryClusterInfo()
ToStdout("Software version: %s", result["software_version"])
ToStdout("Internode protocol: %s", result["protocol_version"])
......
......@@ -175,6 +175,7 @@ CONF_DIR = SYSCONFDIR + "/ganeti"
USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
ENABLE_CONFD = _autoconf.ENABLE_CONFD
HS_CONFD = _autoconf.HS_CONFD
ENABLE_SPLIT_QUERY = _autoconf.ENABLE_SPLIT_QUERY
#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
......
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