mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Enable debug by default, but only if LIBVIRT_DEBUG=1. Use generic macro for debug output
This commit is contained in:
parent
02b98afe29
commit
e8d690aeb5
@ -1,3 +1,12 @@
|
|||||||
|
Sat Jan 19 13:32:22 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/configure.in: enable debug by default. print status of
|
||||||
|
compiler warning flags in configure summary
|
||||||
|
* src/internal.h: Provide a generic VIR_DEBUG macro for logging
|
||||||
|
* src/libvirt.c, src/remote_internal.c, src/xen_unified.c,
|
||||||
|
src/xend_internal.c: Use generic VIR_DEBUG macro for logging.
|
||||||
|
Enable debug when env var LIBVIRT_DEBUG=1
|
||||||
|
|
||||||
Tue Jan 15 16:25:57 CET Jim Meyering <meyering@redhat.com>
|
Tue Jan 15 16:25:57 CET Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
* docs/examples/examples.xml: Regenerate, now that *.c file names
|
* docs/examples/examples.xml: Regenerate, now that *.c file names
|
||||||
|
@ -147,7 +147,7 @@ AC_SUBST(STATIC_BINARIES)
|
|||||||
dnl --enable-debug=(yes|no)
|
dnl --enable-debug=(yes|no)
|
||||||
AC_ARG_ENABLE(debug,
|
AC_ARG_ENABLE(debug,
|
||||||
AC_HELP_STRING([--enable-debug=no/yes],
|
AC_HELP_STRING([--enable-debug=no/yes],
|
||||||
[enable debugging output]),[],[enable_debug=no])
|
[enable debugging output]),[],[enable_debug=yes])
|
||||||
if test x"$enable_debug" = x"yes"; then
|
if test x"$enable_debug" = x"yes"; then
|
||||||
AC_DEFINE(ENABLE_DEBUG, [], [whether debugging is enabled])
|
AC_DEFINE(ENABLE_DEBUG, [], [whether debugging is enabled])
|
||||||
fi
|
fi
|
||||||
@ -725,5 +725,6 @@ AC_MSG_NOTICE([])
|
|||||||
AC_MSG_NOTICE([Miscellaneous])
|
AC_MSG_NOTICE([Miscellaneous])
|
||||||
AC_MSG_NOTICE([])
|
AC_MSG_NOTICE([])
|
||||||
AC_MSG_NOTICE([ Debug: $enable_debug])
|
AC_MSG_NOTICE([ Debug: $enable_debug])
|
||||||
|
AC_MSG_NOTICE([ Warnings: $enable_compile_warnings])
|
||||||
AC_MSG_NOTICE([ Readline: $lv_use_readline])
|
AC_MSG_NOTICE([ Readline: $lv_use_readline])
|
||||||
AC_MSG_NOTICE([])
|
AC_MSG_NOTICE([])
|
||||||
|
@ -54,6 +54,19 @@ extern "C" {
|
|||||||
#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
|
#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
|
||||||
#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
|
#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
|
||||||
|
|
||||||
|
|
||||||
|
/* If configured with --enable-debug=yes then library calls
|
||||||
|
* are printed to stderr for debugging.
|
||||||
|
*/
|
||||||
|
#ifdef ENABLE_DEBUG
|
||||||
|
extern int debugFlag;
|
||||||
|
#define VIR_DEBUG(category, fmt,...) \
|
||||||
|
do { if (debugFlag) fprintf (stderr, "DEBUG: %s: %s (" fmt ")\n", category, __func__, __VA_ARGS__); } while (0)
|
||||||
|
#else
|
||||||
|
#define VIR_DEBUG(category, fmt,...)
|
||||||
|
do { } while (0)
|
||||||
|
#endif /* !ENABLE_DEBUG */
|
||||||
|
|
||||||
/* C99 uses __func__. __FUNCTION__ is legacy. */
|
/* C99 uses __func__. __FUNCTION__ is legacy. */
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#define __FUNCTION__ __func__
|
#define __FUNCTION__ __func__
|
||||||
|
@ -55,18 +55,12 @@ static virStateDriverPtr virStateDriverTab[MAX_DRIVERS];
|
|||||||
static int virStateDriverTabCount = 0;
|
static int virStateDriverTabCount = 0;
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
|
|
||||||
/* If configured with --enable-debug=yes then library calls
|
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
|
||||||
* are printed to stderr for debugging.
|
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
|
||||||
*/
|
|
||||||
#ifdef ENABLE_DEBUG
|
#ifdef ENABLE_DEBUG
|
||||||
#define DEBUG(fs,...) \
|
int debugFlag = 0;
|
||||||
fprintf (stderr, "libvirt: %s (" fs ")\n", __func__, __VA_ARGS__)
|
#endif
|
||||||
#define DEBUG0 \
|
|
||||||
fprintf (stderr, "libvirt: %s ()\n", __func__)
|
|
||||||
#else
|
|
||||||
#define DEBUG0
|
|
||||||
#define DEBUG(fs,...)
|
|
||||||
#endif /* !ENABLE_DEBUG */
|
|
||||||
|
|
||||||
static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
|
static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
|
||||||
unsigned int ncred,
|
unsigned int ncred,
|
||||||
@ -179,11 +173,21 @@ winsock_init (void)
|
|||||||
int
|
int
|
||||||
virInitialize(void)
|
virInitialize(void)
|
||||||
{
|
{
|
||||||
DEBUG0;
|
#ifdef ENABLE_DEBUG
|
||||||
|
char *debugEnv;
|
||||||
|
#endif
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return(0);
|
return(0);
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
|
|
||||||
|
#ifdef ENABLE_DEBUG
|
||||||
|
debugEnv = getenv("LIBVIRT_DEBUG");
|
||||||
|
if (debugEnv && *debugEnv && *debugEnv != '0')
|
||||||
|
debugFlag = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DEBUG0("register drivers");
|
||||||
|
|
||||||
#if HAVE_WINSOCK2_H
|
#if HAVE_WINSOCK2_H
|
||||||
if (winsock_init () == -1) return -1;
|
if (winsock_init () == -1) return -1;
|
||||||
#endif
|
#endif
|
||||||
@ -542,20 +546,17 @@ do_open (const char *name,
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("name \"%s\" to URI components:\n"
|
||||||
fprintf (stderr,
|
" scheme %s\n"
|
||||||
"libvirt: do_open: name \"%s\" to URI components:\n"
|
" opaque %s\n"
|
||||||
" scheme %s\n"
|
" authority %s\n"
|
||||||
" opaque %s\n"
|
" server %s\n"
|
||||||
" authority %s\n"
|
" user %s\n"
|
||||||
" server %s\n"
|
" port %d\n"
|
||||||
" user %s\n"
|
" path %s\n",
|
||||||
" port %d\n"
|
name,
|
||||||
" path %s\n",
|
uri->scheme, uri->opaque, uri->authority, uri->server,
|
||||||
name,
|
uri->user, uri->port, uri->path);
|
||||||
uri->scheme, uri->opaque, uri->authority, uri->server,
|
|
||||||
uri->user, uri->port, uri->path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret->name = strdup (name);
|
ret->name = strdup (name);
|
||||||
if (!ret->name) {
|
if (!ret->name) {
|
||||||
@ -564,18 +565,14 @@ do_open (const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < virDriverTabCount; i++) {
|
for (i = 0; i < virDriverTabCount; i++) {
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("trying driver %d (%s) ...",
|
||||||
fprintf (stderr, "libvirt: do_open: trying driver %d (%s) ...\n",
|
i, virDriverTab[i]->name);
|
||||||
i, virDriverTab[i]->name);
|
|
||||||
#endif
|
|
||||||
res = virDriverTab[i]->open (ret, uri, auth, flags);
|
res = virDriverTab[i]->open (ret, uri, auth, flags);
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("driver %d %s returned %s",
|
||||||
fprintf (stderr, "libvirt: do_open: driver %d %s returned %s\n",
|
i, virDriverTab[i]->name,
|
||||||
i, virDriverTab[i]->name,
|
res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" :
|
||||||
res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" :
|
(res == VIR_DRV_OPEN_DECLINED ? "DECLINED" :
|
||||||
(res == VIR_DRV_OPEN_DECLINED ? "DECLINED" :
|
(res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
|
||||||
(res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
|
|
||||||
#endif
|
|
||||||
if (res == VIR_DRV_OPEN_ERROR) goto failed;
|
if (res == VIR_DRV_OPEN_ERROR) goto failed;
|
||||||
else if (res == VIR_DRV_OPEN_SUCCESS) {
|
else if (res == VIR_DRV_OPEN_SUCCESS) {
|
||||||
ret->driver = virDriverTab[i];
|
ret->driver = virDriverTab[i];
|
||||||
@ -591,13 +588,11 @@ do_open (const char *name,
|
|||||||
|
|
||||||
for (i = 0; i < virNetworkDriverTabCount; i++) {
|
for (i = 0; i < virNetworkDriverTabCount; i++) {
|
||||||
res = virNetworkDriverTab[i]->open (ret, uri, auth, flags);
|
res = virNetworkDriverTab[i]->open (ret, uri, auth, flags);
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("network driver %d %s returned %s",
|
||||||
fprintf (stderr, "libvirt: do_open: network driver %d %s returned %s\n",
|
i, virNetworkDriverTab[i]->name,
|
||||||
i, virNetworkDriverTab[i]->name,
|
res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" :
|
||||||
res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" :
|
(res == VIR_DRV_OPEN_DECLINED ? "DECLINED" :
|
||||||
(res == VIR_DRV_OPEN_DECLINED ? "DECLINED" :
|
(res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
|
||||||
(res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
|
|
||||||
#endif
|
|
||||||
if (res == VIR_DRV_OPEN_ERROR) {
|
if (res == VIR_DRV_OPEN_ERROR) {
|
||||||
if (STREQ(virNetworkDriverTab[i]->name, "remote")) {
|
if (STREQ(virNetworkDriverTab[i]->name, "remote")) {
|
||||||
virLibConnWarning (NULL, VIR_WAR_NO_NETWORK,
|
virLibConnWarning (NULL, VIR_WAR_NO_NETWORK,
|
||||||
|
@ -72,6 +72,9 @@
|
|||||||
#include "remote_internal.h"
|
#include "remote_internal.h"
|
||||||
#include "remote_protocol.h"
|
#include "remote_protocol.h"
|
||||||
|
|
||||||
|
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
|
||||||
|
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
|
||||||
|
|
||||||
/* Per-connection private data. */
|
/* Per-connection private data. */
|
||||||
#define MAGIC 999 /* private_data->magic if OK */
|
#define MAGIC 999 /* private_data->magic if OK */
|
||||||
#define DEAD 998 /* private_data->magic if dead/closed */
|
#define DEAD 998 /* private_data->magic if dead/closed */
|
||||||
@ -159,22 +162,6 @@ remoteStartup(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_SASL || HAVE_POLKIT
|
|
||||||
static void
|
|
||||||
remoteDebug(struct private_data *priv, const char *msg,...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
if (priv->debugLog == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_start(args, msg);
|
|
||||||
vfprintf(priv->debugLog, msg, args);
|
|
||||||
va_end(args);
|
|
||||||
fprintf(priv->debugLog, "\n");
|
|
||||||
}
|
|
||||||
#endif /* HAVE_SASL */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remoteFindServerPath:
|
* remoteFindServerPath:
|
||||||
*
|
*
|
||||||
@ -426,14 +413,9 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
priv->debugLog = stdout;
|
priv->debugLog = stdout;
|
||||||
else
|
else
|
||||||
priv->debugLog = stderr;
|
priv->debugLog = stderr;
|
||||||
}
|
} else
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("passing through variable '%s' ('%s') to remote end",
|
||||||
else
|
var->name, var->value);
|
||||||
fprintf (stderr,
|
|
||||||
"remoteOpen: "
|
|
||||||
"passing through variable '%s' ('%s') to remote end\n",
|
|
||||||
var->name, var->value);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XMLURI_QUERY_RAW
|
#ifdef HAVE_XMLURI_QUERY_RAW
|
||||||
@ -478,9 +460,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert (name);
|
assert (name);
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("proceeding with name = %s", name);
|
||||||
fprintf (stderr, "remoteOpen: proceeding with name = %s\n", name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Connect to the remote service. */
|
/* Connect to the remote service. */
|
||||||
switch (transport) {
|
switch (transport) {
|
||||||
@ -910,9 +890,7 @@ initialise_gnutls (virConnectPtr conn)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Set the trusted CA cert. */
|
/* Set the trusted CA cert. */
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("loading CA file %s", LIBVIRT_CACERT);
|
||||||
fprintf (stderr, "loading CA file %s\n", LIBVIRT_CACERT);
|
|
||||||
#endif
|
|
||||||
err =
|
err =
|
||||||
gnutls_certificate_set_x509_trust_file (x509_cred, LIBVIRT_CACERT,
|
gnutls_certificate_set_x509_trust_file (x509_cred, LIBVIRT_CACERT,
|
||||||
GNUTLS_X509_FMT_PEM);
|
GNUTLS_X509_FMT_PEM);
|
||||||
@ -922,10 +900,8 @@ initialise_gnutls (virConnectPtr conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set the client certificate and private key. */
|
/* Set the client certificate and private key. */
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("loading client cert and key from files %s and %s",
|
||||||
fprintf (stderr, "loading client cert and key from files %s and %s\n",
|
LIBVIRT_CLIENTCERT, LIBVIRT_CLIENTKEY);
|
||||||
LIBVIRT_CLIENTCERT, LIBVIRT_CLIENTKEY);
|
|
||||||
#endif
|
|
||||||
err =
|
err =
|
||||||
gnutls_certificate_set_x509_key_file (x509_cred,
|
gnutls_certificate_set_x509_key_file (x509_cred,
|
||||||
LIBVIRT_CLIENTCERT,
|
LIBVIRT_CLIENTCERT,
|
||||||
@ -1000,10 +976,9 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
|
|||||||
|
|
||||||
/* Verify certificate. */
|
/* Verify certificate. */
|
||||||
if (verify_certificate (conn, priv, session) == -1) {
|
if (verify_certificate (conn, priv, session) == -1) {
|
||||||
fprintf (stderr,
|
DEBUG0("failed to verify peer's certificate");
|
||||||
"remote_internal: failed to verify peer's certificate\n");
|
if (!no_verify) return NULL;
|
||||||
if (!no_verify) return NULL;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* At this point, the server is verifying _our_ certificate, IP address,
|
/* At this point, the server is verifying _our_ certificate, IP address,
|
||||||
* etc. If we make the grade, it will send us a '\1' byte.
|
* etc. If we make the grade, it will send us a '\1' byte.
|
||||||
@ -3013,7 +2988,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
const char *mechlist;
|
const char *mechlist;
|
||||||
|
|
||||||
remoteDebug(priv, "Client initialize SASL authentication");
|
DEBUG0("Client initialize SASL authentication");
|
||||||
/* Sets up the SASL library as a whole */
|
/* Sets up the SASL library as a whole */
|
||||||
err = sasl_client_init(NULL);
|
err = sasl_client_init(NULL);
|
||||||
if (err != SASL_OK) {
|
if (err != SASL_OK) {
|
||||||
@ -3085,7 +3060,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
}
|
}
|
||||||
ssf *= 8; /* key size is bytes, sasl wants bits */
|
ssf *= 8; /* key size is bytes, sasl wants bits */
|
||||||
|
|
||||||
remoteDebug(priv, "Setting external SSF %d", ssf);
|
DEBUG("Setting external SSF %d", ssf);
|
||||||
err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf);
|
err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf);
|
||||||
if (err != SASL_OK) {
|
if (err != SASL_OK) {
|
||||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||||
@ -3135,7 +3110,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
}
|
}
|
||||||
restart:
|
restart:
|
||||||
/* Start the auth negotiation on the client end first */
|
/* Start the auth negotiation on the client end first */
|
||||||
remoteDebug(priv, "Client start negotiation mechlist '%s'", mechlist);
|
DEBUG("Client start negotiation mechlist '%s'", mechlist);
|
||||||
err = sasl_client_start(saslconn,
|
err = sasl_client_start(saslconn,
|
||||||
mechlist,
|
mechlist,
|
||||||
&interact,
|
&interact,
|
||||||
@ -3195,7 +3170,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
sargs.data.data_val = (char*)clientout;
|
sargs.data.data_val = (char*)clientout;
|
||||||
sargs.data.data_len = clientoutlen;
|
sargs.data.data_len = clientoutlen;
|
||||||
sargs.mech = (char*)mech;
|
sargs.mech = (char*)mech;
|
||||||
remoteDebug(priv, "Server start negotiation with mech %s. Data %d bytes %p", mech, clientoutlen, clientout);
|
DEBUG("Server start negotiation with mech %s. Data %d bytes %p", mech, clientoutlen, clientout);
|
||||||
|
|
||||||
/* Now send the initial auth data to the server */
|
/* Now send the initial auth data to the server */
|
||||||
memset (&sret, 0, sizeof sret);
|
memset (&sret, 0, sizeof sret);
|
||||||
@ -3208,8 +3183,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
/* NB, distinction of NULL vs "" is *critical* in SASL */
|
/* NB, distinction of NULL vs "" is *critical* in SASL */
|
||||||
serverin = sret.nil ? NULL : sret.data.data_val;
|
serverin = sret.nil ? NULL : sret.data.data_val;
|
||||||
serverinlen = sret.data.data_len;
|
serverinlen = sret.data.data_len;
|
||||||
remoteDebug(priv, "Client step result complete: %d. Data %d bytes %p",
|
DEBUG("Client step result complete: %d. Data %d bytes %p",
|
||||||
complete, serverinlen, serverin);
|
complete, serverinlen, serverin);
|
||||||
|
|
||||||
/* Loop-the-loop...
|
/* Loop-the-loop...
|
||||||
* Even if the server has completed, the client must *always* do at least one step
|
* Even if the server has completed, the client must *always* do at least one step
|
||||||
@ -3262,7 +3237,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
free(serverin);
|
free(serverin);
|
||||||
serverin = NULL;
|
serverin = NULL;
|
||||||
}
|
}
|
||||||
remoteDebug(priv, "Client step result %d. Data %d bytes %p", err, clientoutlen, clientout);
|
DEBUG("Client step result %d. Data %d bytes %p", err, clientoutlen, clientout);
|
||||||
|
|
||||||
/* Previous server call showed completion & we're now locally complete too */
|
/* Previous server call showed completion & we're now locally complete too */
|
||||||
if (complete && err == SASL_OK)
|
if (complete && err == SASL_OK)
|
||||||
@ -3274,7 +3249,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
pargs.nil = clientout ? 0 : 1;
|
pargs.nil = clientout ? 0 : 1;
|
||||||
pargs.data.data_val = (char*)clientout;
|
pargs.data.data_val = (char*)clientout;
|
||||||
pargs.data.data_len = clientoutlen;
|
pargs.data.data_len = clientoutlen;
|
||||||
remoteDebug(priv, "Server step with %d bytes %p", clientoutlen, clientout);
|
DEBUG("Server step with %d bytes %p", clientoutlen, clientout);
|
||||||
|
|
||||||
memset (&pret, 0, sizeof pret);
|
memset (&pret, 0, sizeof pret);
|
||||||
if (call (conn, priv, in_open, REMOTE_PROC_AUTH_SASL_STEP,
|
if (call (conn, priv, in_open, REMOTE_PROC_AUTH_SASL_STEP,
|
||||||
@ -3287,8 +3262,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
serverin = pret.nil ? NULL : pret.data.data_val;
|
serverin = pret.nil ? NULL : pret.data.data_val;
|
||||||
serverinlen = pret.data.data_len;
|
serverinlen = pret.data.data_len;
|
||||||
|
|
||||||
remoteDebug(priv, "Client step result complete: %d. Data %d bytes %p",
|
DEBUG("Client step result complete: %d. Data %d bytes %p",
|
||||||
complete, serverinlen, serverin);
|
complete, serverinlen, serverin);
|
||||||
|
|
||||||
/* This server call shows complete, and earlier client step was OK */
|
/* This server call shows complete, and earlier client step was OK */
|
||||||
if (complete && err == SASL_OK) {
|
if (complete && err == SASL_OK) {
|
||||||
@ -3308,7 +3283,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ssf = *(const int *)val;
|
ssf = *(const int *)val;
|
||||||
remoteDebug(priv, "SASL SSF value %d", ssf);
|
DEBUG("SASL SSF value %d", ssf);
|
||||||
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
|
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
|
||||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||||
@ -3317,7 +3292,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteDebug(priv, "SASL authentication complete");
|
DEBUG0("SASL authentication complete");
|
||||||
priv->saslconn = saslconn;
|
priv->saslconn = saslconn;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -3352,7 +3327,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
remoteDebug(priv, "Client initialize PolicyKit authentication");
|
DEBUG0("Client initialize PolicyKit authentication");
|
||||||
|
|
||||||
if (auth && auth->cb) {
|
if (auth && auth->cb) {
|
||||||
/* Check if the neccessary credential type for PolicyKit is supported */
|
/* Check if the neccessary credential type for PolicyKit is supported */
|
||||||
@ -3370,10 +3345,10 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
remoteDebug(priv, "Client auth callback does not support PolicyKit");
|
DEBUG0("Client auth callback does not support PolicyKit");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
remoteDebug(priv, "No auth callback provided");
|
DEBUG0("No auth callback provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
memset (&ret, 0, sizeof ret);
|
||||||
@ -3383,7 +3358,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
return -1; /* virError already set by call */
|
return -1; /* virError already set by call */
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteDebug(priv, "PolicyKit authentication complete");
|
DEBUG0("PolicyKit authentication complete");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_POLKIT */
|
#endif /* HAVE_POLKIT */
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include "xm_internal.h"
|
#include "xm_internal.h"
|
||||||
#include "xml.h"
|
#include "xml.h"
|
||||||
|
|
||||||
|
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info);
|
xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info);
|
||||||
static int
|
static int
|
||||||
@ -271,15 +273,11 @@ xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int f
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (drivers[i]->open) {
|
if (drivers[i]->open) {
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("trying Xen sub-driver %d", i);
|
||||||
fprintf (stderr, "libvirt: xenUnifiedOpen: trying Xen sub-driver %d\n", i);
|
|
||||||
#endif
|
|
||||||
if (drivers[i]->open (conn, uri, auth, flags) == VIR_DRV_OPEN_SUCCESS)
|
if (drivers[i]->open (conn, uri, auth, flags) == VIR_DRV_OPEN_SUCCESS)
|
||||||
priv->opened[i] = 1;
|
priv->opened[i] = 1;
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("Xen sub-driver %d open %s\n",
|
||||||
fprintf (stderr, "libvirt: xenUnifiedOpen: Xen sub-driver %d open %s\n",
|
i, priv->opened[i] ? "ok" : "failed");
|
||||||
i, priv->opened[i] ? "ok" : "failed");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If as root, then all drivers must succeed.
|
/* If as root, then all drivers must succeed.
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
/* required for cpumap_t */
|
/* required for cpumap_t */
|
||||||
#include <xen/dom0_ops.h>
|
#include <xen/dom0_ops.h>
|
||||||
|
|
||||||
|
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
|
||||||
|
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
|
||||||
|
|
||||||
#ifndef PROXY
|
#ifndef PROXY
|
||||||
static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
|
static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
|
||||||
static int xenDaemonNumOfDomains(virConnectPtr conn);
|
static int xenDaemonNumOfDomains(virConnectPtr conn);
|
||||||
@ -3410,9 +3413,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG("hostname = %s, port = %s", hostname, port);
|
||||||
fprintf (stderr, "hostname = %s, port = %s\n", hostname, port);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make the call. */
|
/* Make the call. */
|
||||||
ret = xend_op (domain->conn, domain->name,
|
ret = xend_op (domain->conn, domain->name,
|
||||||
@ -3424,9 +3425,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
NULL);
|
NULL);
|
||||||
free (hostname);
|
free (hostname);
|
||||||
|
|
||||||
#ifdef ENABLE_DEBUG
|
DEBUG0("migration done");
|
||||||
fprintf (stderr, "migration done\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user