Discussion:
[libvirt] [PATCH 00/30] Cleanup translation marks and remove virConnectPtr from error reporting
(too old to reply)
Matthias Bolte
2010-04-04 17:36:23 UTC
Permalink
This set of patches removes translation marks from log messages, adds
missing translation marks to error messages and removes the virConnectPtr
parameter from all error reporting functions.

This series is large, but most of it was done by search and replace.

105 files changed, 3574 insertions(+), 4005 deletions(-)

Matthias
Matthias Bolte
2010-04-04 17:36:24 UTC
Permalink
Also remove manually added function names from log messages, the logging
macros already record them and the logging framework outputs them.

Cleanup the msg_gen_function list in cfg.mk. Also don't restrict one of
the grep lines in the libvirt_unmarked_diagnostics rule to match exactly
one space between function name and opening parenthesis.

Update POTFILES.in accordingly.
---
cfg.mk | 15 +--
daemon/libvirtd.c | 223 +++++++++----------
daemon/libvirtd.h | 2 -
daemon/remote.c | 78 ++++----
...-Step-7-of-8-Implement-the-driver-methods.patch | 4 +-
po/POTFILES.in | 7 -
src/conf/secret_conf.c | 2 +-
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/network/bridge_driver.c | 12 +-
src/node_device/node_device_driver.c | 8 +-
src/node_device/node_device_linux_sysfs.c | 12 +-
src/node_device/node_device_udev.c | 4 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 2 +-
src/phyp/phyp_driver.c | 28 ++--
src/qemu/qemu_conf.c | 24 +-
src/qemu/qemu_driver.c | 48 ++--
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor_text.c | 22 +-
src/secret/secret_driver.c | 4 +-
src/security/security_apparmor.c | 2 +-
src/storage/storage_backend_mpath.c | 2 -
src/storage/storage_backend_scsi.c | 38 ++--
src/uml/uml_conf.c | 3 -
src/uml/uml_driver.c | 23 +-
src/util/bridge.c | 16 +-
src/util/logging.c | 8 +-
src/util/pci.c | 8 +-
src/util/uuid.c | 4 +-
src/xen/proxy_internal.c | 6 +-
tools/console.c | 12 +-
32 files changed, 292 insertions(+), 333 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 74fe5ed..619a8e2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -168,28 +168,16 @@ sc_prohibit_gethostby:
# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'

msg_gen_function =
-msg_gen_function += DEBUG0
-msg_gen_function += DISABLE_fprintf
-msg_gen_function += ERROR
-msg_gen_function += ERROR0
-msg_gen_function += REMOTE_DEBUG
msg_gen_function += ReportError
-msg_gen_function += VIR_FREE
-msg_gen_function += VIR_INFO
-msg_gen_function += VIR_USE_CPU
msg_gen_function += errorf
msg_gen_function += lxcError
-msg_gen_function += networkLog
msg_gen_function += networkReportError
msg_gen_function += oneError
msg_gen_function += openvzError
-msg_gen_function += openvzLog
msg_gen_function += qemudDispatchClientFailure
-msg_gen_function += qemudLog
msg_gen_function += qemudReportError
msg_gen_function += regerror
msg_gen_function += remoteDispatchFormatError
-msg_gen_function += umlLog
msg_gen_function += umlReportError
msg_gen_function += virConfError
msg_gen_function += virDomainReportError
@@ -197,7 +185,6 @@ msg_gen_function += virSecurityReportError
msg_gen_function += virHashError
msg_gen_function += virLibConnError
msg_gen_function += virLibDomainError
-msg_gen_function += virLog
msg_gen_function += virNetworkReportError
msg_gen_function += virNodeDeviceReportError
msg_gen_function += virProxyError
@@ -236,7 +223,7 @@ func_re := ($(func_or))
# "%s", _("no storage vol w..."
sc_libvirt_unmarked_diagnostics:
@grep -nE \
- '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
+ '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 208ffca..68fe95a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -272,7 +272,7 @@ remoteCheckCertFile(const char *type, const char *file)
struct stat sb;
if (stat(file, &sb) < 0) {
char ebuf[1024];
- VIR_ERROR(_("Cannot access %s '%s': %s"),
+ VIR_ERROR("Cannot access %s '%s': %s",
type, file, virStrerror(errno, ebuf, sizeof ebuf));
return -1;
}
@@ -289,7 +289,7 @@ remoteInitializeGnuTLS (void)

err = gnutls_certificate_allocate_credentials (&x509_cred);
if (err) {
- VIR_ERROR(_("gnutls_certificate_allocate_credentials: %s"),
+ VIR_ERROR("gnutls_certificate_allocate_credentials failed: %s",
gnutls_strerror (err));
return -1;
}
@@ -298,11 +298,11 @@ remoteInitializeGnuTLS (void)
if (remoteCheckCertFile("CA certificate", ca_file) < 0)
return -1;

- qemudDebug ("loading CA cert from %s", ca_file);
+ VIR_DEBUG("loading CA cert from %s", ca_file);
err = gnutls_certificate_set_x509_trust_file (x509_cred, ca_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- VIR_ERROR(_("gnutls_certificate_set_x509_trust_file: %s"),
+ VIR_ERROR("gnutls_certificate_set_x509_trust_file failed: %s",
gnutls_strerror (err));
return -1;
}
@@ -316,7 +316,7 @@ remoteInitializeGnuTLS (void)
err = gnutls_certificate_set_x509_crl_file (x509_cred, crl_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- VIR_ERROR(_("gnutls_certificate_set_x509_crl_file: %s"),
+ VIR_ERROR("gnutls_certificate_set_x509_crl_file failed: %s",
gnutls_strerror (err));
return -1;
}
@@ -327,13 +327,13 @@ remoteInitializeGnuTLS (void)
return -1;
if (remoteCheckCertFile("server key", key_file) < 0)
return -1;
- DEBUG("loading cert and key from %s and %s", cert_file, key_file);
+ DEBUG("loading cert and key from '%s' and '%s'", cert_file, key_file);
err =
gnutls_certificate_set_x509_key_file (x509_cred,
cert_file, key_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- VIR_ERROR(_("gnutls_certificate_set_x509_key_file: %s"),
+ VIR_ERROR("gnutls_certificate_set_x509_key_file failed: %s",
gnutls_strerror (err));
return -1;
}
@@ -346,12 +346,12 @@ remoteInitializeGnuTLS (void)
*/
err = gnutls_dh_params_init (&dh_params);
if (err < 0) {
- VIR_ERROR(_("gnutls_dh_params_init: %s"), gnutls_strerror (err));
+ VIR_ERROR("gnutls_dh_params_init failed: %s", gnutls_strerror (err));
return -1;
}
err = gnutls_dh_params_generate2 (dh_params, DH_BITS);
if (err < 0) {
- VIR_ERROR(_("gnutls_dh_params_generate2: %s"), gnutls_strerror (err));
+ VIR_ERROR("gnutls_dh_params_generate2 failed: %s", gnutls_strerror (err));
return -1;
}

@@ -372,7 +372,7 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED,

if (saferead(server->sigread, &siginfo, sizeof(siginfo)) != sizeof(siginfo)) {
char ebuf[1024];
- VIR_ERROR(_("Failed to read from signal pipe: %s"),
+ VIR_ERROR("Failed to read from signal pipe: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virMutexUnlock(&server->lock);
return;
@@ -380,23 +380,23 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED,

switch (siginfo.si_signo) {
case SIGHUP:
- VIR_INFO0(_("Reloading configuration on SIGHUP"));
+ VIR_INFO0("Reloading configuration on SIGHUP");
virHookCall(VIR_HOOK_DRIVER_DAEMON, "-",
VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL);
if (virStateReload() < 0)
- VIR_WARN0(_("Error while reloading drivers"));
+ VIR_WARN0("Error while reloading drivers");

break;

case SIGINT:
case SIGQUIT:
case SIGTERM:
- VIR_WARN(_("Shutting down on signal %d"), siginfo.si_signo);
+ VIR_WARN("Shutting down on signal %d", siginfo.si_signo);
server->quitEventThread = 1;
break;

default:
- VIR_INFO(_("Received unexpected signal %d"), siginfo.si_signo);
+ VIR_INFO("Received unexpected signal %d", siginfo.si_signo);
break;
}

@@ -502,27 +502,27 @@ static int qemudWritePidFile(const char *pidFile) {
return 0;

if ((fd = open(pidFile, O_WRONLY|O_CREAT|O_EXCL, 0644)) < 0) {
- VIR_ERROR(_("Failed to open pid file '%s' : %s"),
+ VIR_ERROR("Failed to open pid file '%s' : %s",
pidFile, virStrerror(errno, ebuf, sizeof ebuf));
return -1;
}

if (!(fh = fdopen(fd, "w"))) {
- VIR_ERROR(_("Failed to fdopen pid file '%s' : %s"),
+ VIR_ERROR("Failed to fdopen pid file '%s' : %s",
pidFile, virStrerror(errno, ebuf, sizeof ebuf));
close(fd);
return -1;
}

if (fprintf(fh, "%lu\n", (unsigned long)getpid()) < 0) {
- VIR_ERROR(_("Failed to write to pid file '%s' : %s"),
+ VIR_ERROR("Failed to write to pid file '%s' : %s",
pidFile, virStrerror(errno, ebuf, sizeof ebuf));
fclose(fh);
return -1;
}

if (fclose(fh) == EOF) {
- VIR_ERROR(_("Failed to close pid file '%s' : %s"),
+ VIR_ERROR("Failed to close pid file '%s' : %s",
pidFile, virStrerror(errno, ebuf, sizeof ebuf));
return -1;
}
@@ -539,7 +539,7 @@ static int qemudListenUnix(struct qemud_server *server,
char ebuf[1024];

if (VIR_ALLOC(sock) < 0) {
- VIR_ERROR("%s", _("Failed to allocate memory for struct qemud_socket"));
+ VIR_ERROR0("Failed to allocate memory for struct qemud_socket");
return -1;
}

@@ -549,7 +549,7 @@ static int qemudListenUnix(struct qemud_server *server,
sock->auth = auth;

if ((sock->fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- VIR_ERROR(_("Failed to create socket: %s"),
+ VIR_ERROR("Failed to create socket: %s",
virStrerror(errno, ebuf, sizeof ebuf));
goto cleanup;
}
@@ -561,7 +561,7 @@ static int qemudListenUnix(struct qemud_server *server,
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, path) == NULL) {
- VIR_ERROR(_("Path %s too long for unix socket"), path);
+ VIR_ERROR("Path %s too long for unix socket", path);
goto cleanup;
}
if (addr.sun_path[0] == '@')
@@ -570,23 +570,23 @@ static int qemudListenUnix(struct qemud_server *server,
oldgrp = getgid();
oldmask = umask(readonly ? ~unix_sock_ro_mask : ~unix_sock_rw_mask);
if (server->privileged && setgid(unix_sock_gid)) {
- VIR_ERROR(_("Failed to set group ID to %d"), unix_sock_gid);
+ VIR_ERROR("Failed to set group ID to %d", unix_sock_gid);
goto cleanup;
}

if (bind(sock->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- VIR_ERROR(_("Failed to bind socket to '%s': %s"),
+ VIR_ERROR("Failed to bind socket to '%s': %s",
path, virStrerror(errno, ebuf, sizeof ebuf));
goto cleanup;
}
umask(oldmask);
if (server->privileged && setgid(oldgrp)) {
- VIR_ERROR(_("Failed to restore group ID to %d"), oldgrp);
+ VIR_ERROR("Failed to restore group ID to %d", oldgrp);
goto cleanup;
}

if (listen(sock->fd, 30) < 0) {
- VIR_ERROR(_("Failed to listen for connections on '%s': %s"),
+ VIR_ERROR("Failed to listen for connections on '%s': %s",
path, virStrerror(errno, ebuf, sizeof ebuf));
goto cleanup;
}
@@ -616,7 +616,7 @@ remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *node, const c

int e = getaddrinfo (node, service, &hints, &ai);
if (e != 0) {
- VIR_ERROR(_("getaddrinfo: %s"), gai_strerror (e));
+ VIR_ERROR("getaddrinfo failed: %s", gai_strerror (e));
return -1;
}

@@ -626,7 +626,8 @@ remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *node, const c
fds[*nfds_r] = socket (runp->ai_family, runp->ai_socktype,
runp->ai_protocol);
if (fds[*nfds_r] == -1) {
- VIR_ERROR(_("socket: %s"), virStrerror (errno, ebuf, sizeof ebuf));
+ VIR_ERROR("socket failed: %s",
+ virStrerror (errno, ebuf, sizeof ebuf));
return -1;
}

@@ -650,7 +651,8 @@ remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *node, const c

if (bind (fds[*nfds_r], runp->ai_addr, runp->ai_addrlen) == -1) {
if (errno != EADDRINUSE) {
- VIR_ERROR(_("bind: %s"), virStrerror (errno, ebuf, sizeof ebuf));
+ VIR_ERROR("bind failed: %s",
+ virStrerror (errno, ebuf, sizeof ebuf));
return -1;
}
close (fds[*nfds_r]);
@@ -695,7 +697,7 @@ remoteListenTCP (struct qemud_server *server,
socklen_t salen = sizeof(s);

if (VIR_ALLOC(sock) < 0) {
- VIR_ERROR(_("remoteListenTCP: calloc: %s"),
+ VIR_ERROR("calloc failed: %s",
virStrerror (errno, ebuf, sizeof ebuf));
goto cleanup;
}
@@ -726,7 +728,7 @@ remoteListenTCP (struct qemud_server *server,
goto cleanup;

if (listen (sock->fd, 30) < 0) {
- VIR_ERROR(_("remoteListenTCP: listen: %s"),
+ VIR_ERROR("listen failed: %s",
virStrerror (errno, ebuf, sizeof ebuf));
goto cleanup;
}
@@ -755,7 +757,7 @@ static int qemudInitPaths(struct qemud_server *server,
/* Change the group ownership of /var/run/libvirt to unix_sock_gid */
if (server->privileged) {
if (chown(unix_sock_dir, -1, unix_sock_gid) < 0)
- VIR_ERROR(_("Failed to change group ownership of %s"),
+ VIR_ERROR("Failed to change group ownership of %s",
unix_sock_dir);
}
} else {
@@ -817,8 +819,7 @@ static int qemudInitPaths(struct qemud_server *server,

snprintf_error:
if (ret)
- VIR_ERROR("%s",
- _("Resulting path too long for buffer in qemudInitPaths()"));
+ VIR_ERROR0("Resulting path too long for buffer in qemudInitPaths()");

cleanup:
VIR_FREE(dir_prefix);
@@ -836,7 +837,7 @@ static struct qemud_server *qemudInitialize(void) {
struct qemud_server *server;

if (VIR_ALLOC(server) < 0) {
- VIR_ERROR0(_("Failed to allocate struct qemud_server"));
+ VIR_ERROR0("Failed to allocate struct qemud_server");
return NULL;
}

@@ -844,19 +845,19 @@ static struct qemud_server *qemudInitialize(void) {
server->sigread = server->sigwrite = -1;

if (virMutexInit(&server->lock) < 0) {
- VIR_ERROR("%s", _("cannot initialize mutex"));
+ VIR_ERROR0("cannot initialize mutex");
VIR_FREE(server);
return NULL;
}
if (virCondInit(&server->job) < 0) {
- VIR_ERROR("%s", _("cannot initialize condition variable"));
+ VIR_ERROR0("cannot initialize condition variable");
virMutexDestroy(&server->lock);
VIR_FREE(server);
return NULL;
}

if (virEventInit() < 0) {
- VIR_ERROR0(_("Failed to initialize event system"));
+ VIR_ERROR0("Failed to initialize event system");
virMutexDestroy(&server->lock);
if (virCondDestroy(&server->job) < 0)
{}
@@ -953,7 +954,7 @@ static int qemudNetworkInit(struct qemud_server *server) {
auth_tcp == REMOTE_AUTH_SASL ||
auth_tls == REMOTE_AUTH_SASL) {
if ((err = sasl_server_init(NULL, "libvirt")) != SASL_OK) {
- VIR_ERROR(_("Failed to initialize SASL authentication %s"),
+ VIR_ERROR("Failed to initialize SASL authentication %s",
sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -971,7 +972,7 @@ static int qemudNetworkInit(struct qemud_server *server) {
dbus_error_init(&derr);
server->sysbus = dbus_bus_get(DBUS_BUS_SYSTEM, &derr);
if (!(server->sysbus)) {
- VIR_ERROR(_("Failed to connect to system bus for PolicyKit auth: %s"),
+ VIR_ERROR("Failed to connect to system bus for PolicyKit auth: %s",
derr.message);
dbus_error_free(&derr);
goto cleanup;
@@ -1058,7 +1059,7 @@ static int qemudNetworkEnable(struct qemud_server *server) {
VIR_EVENT_HANDLE_HANGUP,
qemudDispatchServerEvent,
server, NULL)) < 0) {
- VIR_ERROR0(_("Failed to add server event callback"));
+ VIR_ERROR0("Failed to add server event callback");
return -1;
}

@@ -1094,8 +1095,7 @@ remoteInitializeTLSSession (void)
return session;

failed:
- VIR_ERROR(_("remoteInitializeTLSSession: %s"),
- gnutls_strerror (err));
+ VIR_ERROR("gnutls error occured: %s", gnutls_strerror (err));
return NULL;
}

@@ -1110,7 +1110,7 @@ remoteCheckDN (gnutls_x509_crt_t cert)

err = gnutls_x509_crt_get_dn (cert, name, &namesize);
if (err != 0) {
- VIR_ERROR(_("remoteCheckDN: gnutls_x509_cert_get_dn: %s"),
+ VIR_ERROR("gnutls_x509_cert_get_dn failed: %s",
gnutls_strerror (err));
return 0;
}
@@ -1127,7 +1127,7 @@ remoteCheckDN (gnutls_x509_crt_t cert)
}

/* Print the client's DN. */
- DEBUG(_("remoteCheckDN: failed: client DN is %s"), name);
+ VIR_DEBUG("remoteCheckDN failed, client DN is %s", name);

return 0; // Not found.
}
@@ -1142,40 +1142,35 @@ remoteCheckCertificate (gnutls_session_t session)
time_t now;

if ((ret = gnutls_certificate_verify_peers2 (session, &status)) < 0){
- VIR_ERROR(_("remoteCheckCertificate: verify failed: %s"),
- gnutls_strerror (ret));
+ VIR_ERROR("verify failed: %s", gnutls_strerror (ret));
return -1;
}

if (status != 0) {
if (status & GNUTLS_CERT_INVALID)
- VIR_ERROR0(_("remoteCheckCertificate: "
- "the client certificate is not trusted."));
+ VIR_ERROR0("the client certificate is not trusted.");

if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
- VIR_ERROR0(_("remoteCheckCertificate: the client "
- "certificate has unknown issuer."));
+ VIR_ERROR0("the client certificate has unknown issuer.");

if (status & GNUTLS_CERT_REVOKED)
- VIR_ERROR0(_("remoteCheckCertificate: "
- "the client certificate has been revoked."));
+ VIR_ERROR0("the client certificate has been revoked.");

#ifndef GNUTLS_1_0_COMPAT
if (status & GNUTLS_CERT_INSECURE_ALGORITHM)
- VIR_ERROR0(_("remoteCheckCertificate: the client certificate"
- " uses an insecure algorithm."));
+ VIR_ERROR0("the client certificate uses an insecure algorithm.");
#endif

return -1;
}

if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) {
- VIR_ERROR0(_("remoteCheckCertificate: certificate is not X.509"));
+ VIR_ERROR0("certificate is not X.509");
return -1;
}

if (!(certs = gnutls_certificate_get_peers(session, &nCerts))) {
- VIR_ERROR0(_("remoteCheckCertificate: no peers"));
+ VIR_ERROR0("no peers");
return -1;
}

@@ -1185,7 +1180,7 @@ remoteCheckCertificate (gnutls_session_t session)
gnutls_x509_crt_t cert;

if (gnutls_x509_crt_init (&cert) < 0) {
- VIR_ERROR0(_("remoteCheckCertificate: gnutls_x509_crt_init failed"));
+ VIR_ERROR0("gnutls_x509_crt_init failed");
return -1;
}

@@ -1195,15 +1190,13 @@ remoteCheckCertificate (gnutls_session_t session)
}

if (gnutls_x509_crt_get_expiration_time (cert) < now) {
- VIR_ERROR0(_("remoteCheckCertificate: "
- "the client certificate has expired"));
+ VIR_ERROR0("the client certificate has expired");
gnutls_x509_crt_deinit (cert);
return -1;
}

if (gnutls_x509_crt_get_activation_time (cert) > now) {
- VIR_ERROR0(_("remoteCheckCertificate: the client "
- "certificate is not yet activated"));
+ VIR_ERROR0("the client certificate is not yet activated");
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -1211,7 +1204,12 @@ remoteCheckCertificate (gnutls_session_t session)
if (i == 0) {
if (!remoteCheckDN (cert)) {
/* This is the most common error: make it informative. */
- VIR_ERROR0(_("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'openssl x509 -in clientcert.pem -text' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option."));
+ VIR_ERROR0("client's Distinguished Name is not on the list of "
+ "allowed clients (tls_allowed_dn_list). Use "
+ "'openssl x509 -in clientcert.pem -text' to view "
+ "the Distinguished Name field in the client "
+ "certificate, or run this daemon with --verbose "
+ "option.");
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -1229,16 +1227,14 @@ remoteCheckAccess (struct qemud_client *client)

/* Verify client certificate. */
if (remoteCheckCertificate (client->tlssession) == -1) {
- VIR_ERROR0(_("remoteCheckCertificate: "
- "failed to verify client's certificate"));
+ VIR_ERROR0("failed to verify client's certificate");
if (!tls_no_verify_certificate) return -1;
- else VIR_INFO0(_("remoteCheckCertificate: tls_no_verify_certificate "
- "is set so the bad certificate is ignored"));
+ else VIR_INFO0("tls_no_verify_certificate "
+ "is set so the bad certificate is ignored");
}

if (client->tx) {
- VIR_INFO("%s",
- _("client had unexpected data pending tx after access check"));
+ VIR_INFO0("client had unexpected data pending tx after access check");
return -1;
}

@@ -1266,7 +1262,7 @@ int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid) {

if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) < 0) {
char ebuf[1024];
- VIR_ERROR(_("Failed to verify client credentials: %s"),
+ VIR_ERROR("Failed to verify client credentials: %s",
virStrerror(errno, ebuf, sizeof ebuf));
return -1;
}
@@ -1294,19 +1290,19 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
char ebuf[1024];
if (errno == EAGAIN)
return 0;
- VIR_ERROR(_("Failed to accept connection: %s"),
+ VIR_ERROR("Failed to accept connection: %s",
virStrerror(errno, ebuf, sizeof ebuf));
return -1;
}

if (server->nclients >= max_clients) {
- VIR_ERROR(_("Too many active clients (%d), dropping connection"), max_clients);
+ VIR_ERROR("Too many active clients (%d), dropping connection", max_clients);
close(fd);
return -1;
}

if (VIR_REALLOC_N(server->clients, server->nclients+1) < 0) {
- VIR_ERROR0(_("Out of memory allocating clients"));
+ VIR_ERROR0("Out of memory allocating clients");
close(fd);
return -1;
}
@@ -1347,7 +1343,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
if (VIR_ALLOC(client) < 0)
goto cleanup;
if (virMutexInit(&client->lock) < 0) {
- VIR_ERROR("%s", _("cannot initialize mutex"));
+ VIR_ERROR0("cannot initialize mutex");
VIR_FREE(client);
goto cleanup;
}
@@ -1384,7 +1380,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket

/* Client is running as root, so disable auth */
if (uid == 0) {
- VIR_INFO(_("Turn off polkit auth for privileged client %d"), pid);
+ VIR_INFO("Turn off polkit auth for privileged client %d", pid);
client->auth = REMOTE_AUTH_NONE;
}
}
@@ -1423,8 +1419,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
if (qemudRegisterClientEvent (server, client) < 0)
goto cleanup;
} else {
- VIR_ERROR(_("TLS handshake failed: %s"),
- gnutls_strerror (ret));
+ VIR_ERROR("TLS handshake failed: %s", gnutls_strerror(ret));
goto cleanup;
}
}
@@ -1608,13 +1603,13 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
ssize_t ret;

if (len < 0) {
- VIR_ERROR(_("unexpected negative length request %lld"),
+ VIR_ERROR("unexpected negative length request %lld",
(long long int) len);
qemudDispatchClientFailure(client);
return -1;
}

- /*qemudDebug ("qemudClientRead: len = %d", len);*/
+ /*VIR_DEBUG("qemudClientRead: len = %d", len);*/

if (!client->tlssession) {
char ebuf[1024];
@@ -1624,7 +1619,7 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
return 0;
if (ret <= 0) {
if (ret != 0)
- VIR_ERROR(_("read: %s"),
+ VIR_ERROR("read: %s",
virStrerror (errno, ebuf, sizeof ebuf));
qemudDispatchClientFailure(client);
return -1;
@@ -1637,7 +1632,7 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
return 0;
if (ret <= 0) {
if (ret != 0)
- VIR_ERROR(_("gnutls_record_recv: %s"),
+ VIR_ERROR("gnutls_record_recv: %s",
gnutls_strerror (ret));
qemudDispatchClientFailure(client);
return -1;
@@ -1699,7 +1694,7 @@ static ssize_t qemudClientReadSASL(struct qemud_client *client) {
ret = sasl_decode(client->saslconn, encoded, encodedLen,
&client->saslDecoded, &client->saslDecodedLength);
if (ret != SASL_OK) {
- VIR_ERROR(_("failed to decode SASL data %s"),
+ VIR_ERROR("failed to decode SASL data %s",
sasl_errstring(ret, NULL, NULL));
qemudDispatchClientFailure(client);
return -1;
@@ -1748,7 +1743,7 @@ static ssize_t qemudClientRead(struct qemud_client *client) {
*/
static void qemudDispatchClientRead(struct qemud_server *server,
struct qemud_client *client) {
- /*qemudDebug ("qemudDispatchClientRead: mode = %d", client->mode);*/
+ /*VIR_DEBUG("qemudDispatchClientRead: mode = %d", client->mode);*/

readmore:
if (qemudClientRead(client) < 0)
@@ -1858,7 +1853,7 @@ static ssize_t qemudClientWriteBuf(struct qemud_client *client,
ssize_t ret;

if (len < 0) {
- VIR_ERROR(_("unexpected negative length request %lld"),
+ VIR_ERROR("unexpected negative length request %lld",
(long long int) len);
qemudDispatchClientFailure(client);
return -1;
@@ -1869,7 +1864,7 @@ static ssize_t qemudClientWriteBuf(struct qemud_client *client,
if ((ret = write(client->fd, data, len)) == -1) {
if (errno == EAGAIN || errno == EINTR)
return 0;
- VIR_ERROR(_("write: %s"), virStrerror (errno, ebuf, sizeof ebuf));
+ VIR_ERROR("write: %s", virStrerror (errno, ebuf, sizeof ebuf));
qemudDispatchClientFailure(client);
return -1;
}
@@ -1880,7 +1875,7 @@ static ssize_t qemudClientWriteBuf(struct qemud_client *client,
ret == GNUTLS_E_AGAIN)
return 0;

- VIR_ERROR(_("gnutls_record_send: %s"), gnutls_strerror (ret));
+ VIR_ERROR("gnutls_record_send: %s", gnutls_strerror (ret));
qemudDispatchClientFailure(client);
return -1;
}
@@ -1929,7 +1924,7 @@ static int qemudClientWriteSASL(struct qemud_client *client) {
&client->saslEncodedLength);

if (ret != SASL_OK) {
- VIR_ERROR(_("failed to encode SASL data %s"),
+ VIR_ERROR("failed to encode SASL data %s",
sasl_errstring(ret, NULL, NULL));
qemudDispatchClientFailure(client);
return -1;
@@ -2057,8 +2052,7 @@ qemudDispatchClientHandshake(struct qemud_client *client) {
qemudUpdateClientEvent (client);
} else {
/* Fatal error in handshake */
- VIR_ERROR(_("TLS handshake failed: %s"),
- gnutls_strerror (ret));
+ VIR_ERROR("TLS handshake failed: %s", gnutls_strerror(ret));
qemudDispatchClientFailure(client);
}
}
@@ -2205,7 +2199,7 @@ static int qemudOneLoop(void) {
if (errors) {
char ebuf[1024];
sig_errors -= errors;
- VIR_ERROR(_("Signal handler reported %d errors: last error: %s"),
+ VIR_ERROR("Signal handler reported %d errors: last error: %s",
errors, virStrerror (sig_lasterrno, ebuf, sizeof ebuf));
return -1;
}
@@ -2264,7 +2258,7 @@ static void *qemudRunLoop(void *opaque) {
(timerid = virEventAddTimeoutImpl(-1,
qemudInactiveTimer,
server, NULL)) < 0) {
- VIR_ERROR0(_("Failed to register shutdown timeout"));
+ VIR_ERROR0("Failed to register shutdown timeout");
return NULL;
}

@@ -2273,7 +2267,7 @@ static void *qemudRunLoop(void *opaque) {

server->nworkers = max_workers;
if (VIR_ALLOC_N(server->workers, server->nworkers) < 0) {
- VIR_ERROR0(_("Failed to allocate workers"));
+ VIR_ERROR0("Failed to allocate workers");
return NULL;
}

@@ -2457,13 +2451,13 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
switch (p->type) {
case VIR_CONF_STRING:
if (VIR_ALLOC_N(list, 2) < 0) {
- VIR_ERROR(_("failed to allocate memory for %s config list"), key);
+ VIR_ERROR("failed to allocate memory for %s config list", key);
return -1;
}
list[0] = strdup (p->str);
list[1] = NULL;
if (list[0] == NULL) {
- VIR_ERROR(_("failed to allocate memory for %s config list value"),
+ VIR_ERROR("failed to allocate memory for %s config list value",
key);
VIR_FREE(list);
return -1;
@@ -2476,13 +2470,12 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
for (pp = p->list; pp; pp = pp->next)
len++;
if (VIR_ALLOC_N(list, 1+len) < 0) {
- VIR_ERROR(_("failed to allocate memory for %s config list"), key);
+ VIR_ERROR("failed to allocate memory for %s config list", key);
return -1;
}
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
if (pp->type != VIR_CONF_STRING) {
- VIR_ERROR(_("remoteReadConfigFile: %s: %s:"
- " must be a string or list of strings\n"),
+ VIR_ERROR("%s: %s: must be a string or list of strings\n",
filename, key);
VIR_FREE(list);
return -1;
@@ -2493,7 +2486,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
for (j = 0 ; j < i ; j++)
VIR_FREE(list[j]);
VIR_FREE(list);
- VIR_ERROR(_("failed to allocate memory for %s config list value"),
+ VIR_ERROR("failed to allocate memory for %s config list value",
key);
return -1;
}
@@ -2504,8 +2497,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
}

default:
- VIR_ERROR(_("remoteReadConfigFile: %s: %s:"
- " must be a string or list of strings\n"),
+ VIR_ERROR("%s: %s: must be a string or list of strings\n",
filename, key);
return -1;
}
@@ -2520,8 +2512,7 @@ checkType (virConfValuePtr p, const char *filename,
const char *key, virConfType required_type)
{
if (p->type != required_type) {
- VIR_ERROR(_("remoteReadConfigFile: %s: %s: invalid type:"
- " got %s; expected %s\n"), filename, key,
+ VIR_ERROR("%s: %s: invalid type: got %s; expected %s\n", filename, key,
virConfTypeName (p->type),
virConfTypeName (required_type));
return -1;
@@ -2542,8 +2533,7 @@ checkType (virConfValuePtr p, const char *filename,
(var_name) = strdup (p->str); \
if ((var_name) == NULL) { \
char ebuf[1024]; \
- VIR_ERROR(_("remoteReadConfigFile: %s"), \
- virStrerror(errno, ebuf, sizeof ebuf)); \
+ VIR_ERROR("%s", virStrerror(errno, ebuf, sizeof ebuf)); \
goto free_and_fail; \
} \
} \
@@ -2585,8 +2575,7 @@ static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, cons
*auth = REMOTE_AUTH_POLKIT;
#endif
} else {
- VIR_ERROR(_("remoteReadConfigFile: %s: %s: unsupported auth %s"),
- filename, key, p->str);
+ VIR_ERROR("%s: %s: unsupported auth %s", filename, key, p->str);
return -1;
}

@@ -2749,7 +2738,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
GET_CONF_STR (conf, filename, unix_sock_group);
if (unix_sock_group) {
if (!server->privileged) {
- VIR_WARN0(_("Cannot set group when not running as root"));
+ VIR_WARN0("Cannot set group when not running as root");
} else {
int ret;
struct group grpdata, *grp;
@@ -2759,7 +2748,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
maxbuf = 1024;

if (VIR_ALLOC_N(buf, maxbuf) < 0) {
- VIR_ERROR("%s", _("Failed to allocate memory for buffer"));
+ VIR_ERROR0("Failed to allocate memory for buffer");
goto free_and_fail;
}

@@ -2768,13 +2757,13 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
&grp)) == ERANGE) {
maxbuf *= 2;
if (maxbuf > 65536 || VIR_REALLOC_N(buf, maxbuf) < 0) {
- VIR_ERROR("%s", _("Failed to reallocate enough memory for buffer"));
+ VIR_ERROR0("Failed to reallocate enough memory for buffer");
goto free_and_fail;
}
}

if (ret != 0 || !grp) {
- VIR_ERROR(_("Failed to lookup group '%s'"), unix_sock_group);
+ VIR_ERROR("Failed to lookup group '%s'", unix_sock_group);
goto free_and_fail;
}
unix_sock_gid = grp->gr_gid;
@@ -2786,7 +2775,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
GET_CONF_STR (conf, filename, unix_sock_ro_perms);
if (unix_sock_ro_perms) {
if (virStrToLong_i (unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) {
- VIR_ERROR(_("Failed to parse mode '%s'"), unix_sock_ro_perms);
+ VIR_ERROR("Failed to parse mode '%s'", unix_sock_ro_perms);
goto free_and_fail;
}
VIR_FREE(unix_sock_ro_perms);
@@ -2795,7 +2784,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
GET_CONF_STR (conf, filename, unix_sock_rw_perms);
if (unix_sock_rw_perms) {
if (virStrToLong_i (unix_sock_rw_perms, NULL, 8, &unix_sock_rw_mask) != 0) {
- VIR_ERROR(_("Failed to parse mode '%s'"), unix_sock_rw_perms);
+ VIR_ERROR("Failed to parse mode '%s'", unix_sock_rw_perms);
goto free_and_fail;
}
VIR_FREE(unix_sock_rw_perms);
@@ -2870,13 +2859,13 @@ qemudSetupPrivs (void)

if (__init_daemon_priv (PU_RESETGROUPS | PU_CLEARLIMITSET,
SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
- VIR_ERROR0(_("additional privileges are required"));
+ VIR_ERROR0("additional privileges are required");
return -1;
}

if (priv_set (PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
- VIR_ERROR0(_("failed to set reduced privileges"));
+ VIR_ERROR0("failed to set reduced privileges");
return -1;
}

@@ -2909,7 +2898,7 @@ daemonSetupSignals(struct qemud_server *server)
virSetCloseExec(sigpipe[0]) < 0 ||
virSetCloseExec(sigpipe[1]) < 0) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create pipe: %s"),
+ VIR_ERROR("Failed to create pipe: %s",
virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
@@ -2931,7 +2920,7 @@ daemonSetupSignals(struct qemud_server *server)
VIR_EVENT_HANDLE_READABLE,
qemudDispatchSignalEvent,
server, NULL) < 0) {
- VIR_ERROR0(_("Failed to register callback for signal pipe"));
+ VIR_ERROR0("Failed to register callback for signal pipe");
goto error;
}

@@ -3087,7 +3076,7 @@ int main(int argc, char **argv) {
if (godaemon) {
char ebuf[1024];
if ((statuswrite = daemonForkIntoBackground()) < 0) {
- VIR_ERROR(_("Failed to fork as daemon: %s"),
+ VIR_ERROR("Failed to fork as daemon: %s",
virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
@@ -3114,7 +3103,7 @@ int main(int argc, char **argv) {
if (mkdir (rundir, 0755)) {
if (errno != EEXIST) {
char ebuf[1024];
- VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
+ VIR_ERROR("unable to create rundir %s: %s", rundir,
virStrerror(errno, ebuf, sizeof(ebuf)));
ret = VIR_DAEMON_ERR_RUNDIR;
goto error;
diff --git a/daemon/libvirtd.h b/daemon/libvirtd.h
index d292681..40cba8c 100644
--- a/daemon/libvirtd.h
+++ b/daemon/libvirtd.h
@@ -109,8 +109,6 @@
# endif
# endif

-# define qemudDebug DEBUG
-
/* Whether we're passing reads & writes through a sasl SSF */
enum qemud_sasl_ssf {
QEMUD_SASL_SSF_NONE = 0,
diff --git a/daemon/remote.c b/daemon/remote.c
index 780d536..868113c 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -3223,7 +3223,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,
REMOTE_DEBUG("Initialize SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn != NULL) {
- VIR_ERROR0(_("client tried invalid SASL init request"));
+ VIR_ERROR0("client tried invalid SASL init request");
goto authfail;
}

@@ -3265,7 +3265,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,
VIR_FREE(localAddr);
VIR_FREE(remoteAddr);
if (err != SASL_OK) {
- VIR_ERROR(_("sasl context setup failed %d (%s)"),
+ VIR_ERROR("sasl context setup failed %d (%s)",
err, sasl_errstring(err, NULL, NULL));
client->saslconn = NULL;
goto authfail;
@@ -3278,7 +3278,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,

cipher = gnutls_cipher_get(client->tlssession);
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
- VIR_ERROR0(_("cannot get TLS cipher size"));
+ VIR_ERROR0("cannot get TLS cipher size");
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
goto authfail;
@@ -3287,7 +3287,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,

err = sasl_setprop(client->saslconn, SASL_SSF_EXTERNAL, &ssf);
if (err != SASL_OK) {
- VIR_ERROR(_("cannot set SASL external SSF %d (%s)"),
+ VIR_ERROR("cannot set SASL external SSF %d (%s)",
err, sasl_errstring(err, NULL, NULL));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3315,7 +3315,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,

err = sasl_setprop(client->saslconn, SASL_SEC_PROPS, &secprops);
if (err != SASL_OK) {
- VIR_ERROR(_("cannot set SASL security props %d (%s)"),
+ VIR_ERROR("cannot set SASL security props %d (%s)",
err, sasl_errstring(err, NULL, NULL));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3331,7 +3331,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,
NULL,
NULL);
if (err != SASL_OK) {
- VIR_ERROR(_("cannot list SASL mechanisms %d (%s)"),
+ VIR_ERROR("cannot list SASL mechanisms %d (%s)",
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3340,7 +3340,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server,
REMOTE_DEBUG("Available mechanisms for client: '%s'", mechlist);
ret->mechlist = strdup(mechlist);
if (!ret->mechlist) {
- VIR_ERROR0(_("cannot allocate mechlist"));
+ VIR_ERROR0("cannot allocate mechlist");
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
goto authfail;
@@ -3371,7 +3371,7 @@ remoteSASLCheckSSF (struct qemud_client *client,

err = sasl_getprop(client->saslconn, SASL_SSF, &val);
if (err != SASL_OK) {
- VIR_ERROR(_("cannot query SASL ssf on connection %d (%s)"),
+ VIR_ERROR("cannot query SASL ssf on connection %d (%s)",
err, sasl_errstring(err, NULL, NULL));
remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
@@ -3381,7 +3381,7 @@ remoteSASLCheckSSF (struct qemud_client *client,
ssf = *(const int *)val;
REMOTE_DEBUG("negotiated an SSF of %d", ssf);
if (ssf < 56) { /* 56 is good for Kerberos */
- VIR_ERROR(_("negotiated SSF %d was not strong enough"), ssf);
+ VIR_ERROR("negotiated SSF %d was not strong enough", ssf);
remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3410,7 +3410,7 @@ remoteSASLCheckAccess (struct qemud_server *server,

err = sasl_getprop(client->saslconn, SASL_USERNAME, &val);
if (err != SASL_OK) {
- VIR_ERROR(_("cannot query SASL username on connection %d (%s)"),
+ VIR_ERROR("cannot query SASL username on connection %d (%s)",
err, sasl_errstring(err, NULL, NULL));
remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
@@ -3418,7 +3418,7 @@ remoteSASLCheckAccess (struct qemud_server *server,
return -1;
}
if (val == NULL) {
- VIR_ERROR0(_("no client username was found"));
+ VIR_ERROR0("no client username was found");
remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3428,7 +3428,7 @@ remoteSASLCheckAccess (struct qemud_server *server,

client->saslUsername = strdup((const char*)val);
if (client->saslUsername == NULL) {
- VIR_ERROR0(_("out of memory copying username"));
+ VIR_ERROR0("out of memory copying username");
remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3447,7 +3447,7 @@ remoteSASLCheckAccess (struct qemud_server *server,
}

/* Denied */
- VIR_ERROR(_("SASL client %s not allowed in whitelist"), client->saslUsername);
+ VIR_ERROR("SASL client %s not allowed in whitelist", client->saslUsername);
remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3478,7 +3478,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
REMOTE_DEBUG("Start SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
- VIR_ERROR0(_("client tried invalid SASL start request"));
+ VIR_ERROR0("client tried invalid SASL start request");
goto authfail;
}

@@ -3493,14 +3493,14 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
&serveroutlen);
if (err != SASL_OK &&
err != SASL_CONTINUE) {
- VIR_ERROR(_("sasl start failed %d (%s)"),
+ VIR_ERROR("sasl start failed %d (%s)",
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
goto authfail;
}
if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) {
- VIR_ERROR(_("sasl start reply data too long %d"), serveroutlen);
+ VIR_ERROR("sasl start reply data too long %d", serveroutlen);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
goto authfail;
@@ -3566,7 +3566,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
REMOTE_DEBUG("Step SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
- VIR_ERROR0(_("client tried invalid SASL start request"));
+ VIR_ERROR0("client tried invalid SASL start request");
goto authfail;
}

@@ -3580,7 +3580,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
&serveroutlen);
if (err != SASL_OK &&
err != SASL_CONTINUE) {
- VIR_ERROR(_("sasl step failed %d (%s)"),
+ VIR_ERROR("sasl step failed %d (%s)",
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3588,7 +3588,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
}

if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) {
- VIR_ERROR(_("sasl step reply data too long %d"),
+ VIR_ERROR("sasl step reply data too long %d",
serveroutlen);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -3645,7 +3645,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED)
{
- VIR_ERROR0(_("client tried unsupported SASL init request"));
+ VIR_ERROR0("client tried unsupported SASL init request");
remoteDispatchAuthError(rerr);
return -1;
}
@@ -3659,7 +3659,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED)
{
- VIR_ERROR0(_("client tried unsupported SASL start request"));
+ VIR_ERROR0("client tried unsupported SASL start request");
remoteDispatchAuthError(rerr);
return -1;
}
@@ -3673,7 +3673,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED)
{
- VIR_ERROR0(_("client tried unsupported SASL step request"));
+ VIR_ERROR0("client tried unsupported SASL step request");
remoteDispatchAuthError(rerr);
return -1;
}
@@ -3715,33 +3715,33 @@ remoteDispatchAuthPolkit (struct qemud_server *server,

REMOTE_DEBUG("Start PolicyKit auth %d", client->fd);
if (client->auth != REMOTE_AUTH_POLKIT) {
- VIR_ERROR0(_("client tried invalid PolicyKit init request"));
+ VIR_ERROR0("client tried invalid PolicyKit init request");
goto authfail;
}

if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) {
- VIR_ERROR0(_("cannot get peer socket identity"));
+ VIR_ERROR0("cannot get peer socket identity");
goto authfail;
}

- VIR_INFO(_("Checking PID %d running as %d"), callerPid, callerUid);
+ VIR_INFO("Checking PID %d running as %d", callerPid, callerUid);

rv = snprintf(pidbuf, sizeof pidbuf, "%d", callerPid);
if (rv < 0 || rv >= sizeof pidbuf) {
- VIR_ERROR(_("Caller PID was too large %d"), callerPid);
+ VIR_ERROR("Caller PID was too large %d", callerPid);
goto authfail;
}

if (virRun(pkcheck, &status) < 0) {
- VIR_ERROR(_("Cannot invoke %s"), PKCHECK_PATH);
+ VIR_ERROR("Cannot invoke %s", PKCHECK_PATH);
goto authfail;
}
if (status != 0) {
- VIR_ERROR(_("Policy kit denied action %s from pid %d, uid %d, result: %d"),
+ VIR_ERROR("Policy kit denied action %s from pid %d, uid %d, result: %d",
action, callerPid, callerUid, status);
goto authfail;
}
- VIR_INFO(_("Policy allowed action %s from pid %d, uid %d"),
+ VIR_INFO("Policy allowed action %s from pid %d, uid %d",
action, callerPid, callerUid);
ret->complete = 1;
client->auth = REMOTE_AUTH_NONE;
@@ -3784,27 +3784,27 @@ remoteDispatchAuthPolkit (struct qemud_server *server,

REMOTE_DEBUG("Start PolicyKit auth %d", client->fd);
if (client->auth != REMOTE_AUTH_POLKIT) {
- VIR_ERROR0(_("client tried invalid PolicyKit init request"));
+ VIR_ERROR0("client tried invalid PolicyKit init request");
goto authfail;
}

if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) {
- VIR_ERROR0(_("cannot get peer socket identity"));
+ VIR_ERROR0("cannot get peer socket identity");
goto authfail;
}

- VIR_INFO(_("Checking PID %d running as %d"), callerPid, callerUid);
+ VIR_INFO("Checking PID %d running as %d", callerPid, callerUid);
dbus_error_init(&err);
if (!(pkcaller = polkit_caller_new_from_pid(server->sysbus,
callerPid, &err))) {
- VIR_ERROR(_("Failed to lookup policy kit caller: %s"), err.message);
+ VIR_ERROR("Failed to lookup policy kit caller: %s", err.message);
dbus_error_free(&err);
goto authfail;
}

if (!(pkaction = polkit_action_new())) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create polkit action %s"),
+ VIR_ERROR("Failed to create polkit action %s",
virStrerror(errno, ebuf, sizeof ebuf));
polkit_caller_unref(pkcaller);
goto authfail;
@@ -3814,7 +3814,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
if (!(pkcontext = polkit_context_new()) ||
!polkit_context_init(pkcontext, &pkerr)) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create polkit context %s"),
+ VIR_ERROR("Failed to create polkit context %s",
(pkerr ? polkit_error_get_error_message(pkerr)
: virStrerror(errno, ebuf, sizeof ebuf)));
if (pkerr)
@@ -3832,7 +3832,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
0,
&pkerr);
if (pkerr && polkit_error_is_set(pkerr)) {
- VIR_ERROR(_("Policy kit failed to check authorization %d %s"),
+ VIR_ERROR("Policy kit failed to check authorization %d %s",
polkit_error_get_error_code(pkerr),
polkit_error_get_error_message(pkerr));
goto authfail;
@@ -3846,12 +3846,12 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
polkit_caller_unref(pkcaller);
polkit_action_unref(pkaction);
if (pkresult != POLKIT_RESULT_YES) {
- VIR_ERROR(_("Policy kit denied action %s from pid %d, uid %d, result: %s"),
+ VIR_ERROR("Policy kit denied action %s from pid %d, uid %d, result: %s",
action, callerPid, callerUid,
polkit_result_to_string_representation(pkresult));
goto authfail;
}
- VIR_INFO(_("Policy allowed action %s from pid %d, uid %d, result %s"),
+ VIR_INFO("Policy allowed action %s from pid %d, uid %d, result %s",
action, callerPid, callerUid,
polkit_result_to_string_representation(pkresult));
ret->complete = 1;
@@ -3877,7 +3877,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED)
{
- VIR_ERROR0(_("client tried unsupported PolicyKit init request"));
+ VIR_ERROR0("client tried unsupported PolicyKit init request");
remoteDispatchAuthError(rerr);
return -1;
}
diff --git a/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch b/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
index 807ed78..ff1124f 100644
--- a/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
+++ b/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
@@ -146,7 +146,7 @@ index b84729f..4f73baf 100644
+ goto cleanup;
+ }
+
-+ VIR_DEBUG(_("Vport operation path is '%s'"), operation_path);
++ VIR_DEBUG("Vport operation path is '%s'", operation_path);
+
+ fd = open(operation_path, O_WRONLY);
+
@@ -959,7 +959,7 @@ index 0000000..1deb6d2
+ char buf[64];
+ struct stat st;
+
-+ VIR_DEBUG(_("Checking if host%d is an FC HBA"), d->scsi_host.host);
++ VIR_DEBUG("Checking if host%d is an FC HBA", d->scsi_host.host);
+
+ if (virAsprintf(&sysfs_path, "%s/host%d",
+ LINUX_SYSFS_FC_HOST_PREFIX,
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 417bfa1..6c93e2a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,4 @@
daemon/dispatch.c
-daemon/libvirtd.c
daemon/remote.c
daemon/stream.c
src/conf/cpu_conf.c
@@ -25,8 +24,6 @@ src/lxc/lxc_controller.c
src/lxc/lxc_driver.c
src/network/bridge_driver.c
src/node_device/node_device_driver.c
-src/node_device/node_device_linux_sysfs.c
-src/node_device/node_device_udev.c
src/nodeinfo.c
src/nwfilter/nwfilter_driver.c
src/nwfilter/nwfilter_ebiptables_driver.c
@@ -61,19 +58,16 @@ src/test/test_driver.c
src/uml/uml_conf.c
src/uml/uml_driver.c
src/util/authhelper.c
-src/util/bridge.c
src/util/conf.c
src/util/hooks.c
src/util/hostusb.c
src/util/json.c
-src/util/logging.c
src/util/macvtap.c
src/util/pci.c
src/util/processinfo.c
src/util/stats_linux.c
src/util/storage_file.c
src/util/util.c
-src/util/uuid.c
src/util/virterror.c
src/util/xml.c
src/vbox/vbox_driver.c
@@ -87,5 +81,4 @@ src/xen/xm_internal.c
src/xen/xs_internal.c
src/xenapi/xenapi_driver.c
src/xenapi/xenapi_utils.c
-tools/console.c
tools/virsh.c
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index bbdad89..b3657be 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -53,7 +53,7 @@ virSecretDefFree(virSecretDefPtr def)
break;

default:
- VIR_ERROR(_("unexpected secret usage type %d"), def->usage_type);
+ VIR_ERROR("unexpected secret usage type %d", def->usage_type);
break;
}
VIR_FREE(def);
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 706c796..018f4d5 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -716,7 +716,7 @@ static int lxcContainerDropCapabilities(void)
* be unmasked - they can never escape the bounding set. */

#else
- VIR_WARN0(_("libcap-ng support not compiled in, unable to clear capabilities"));
+ VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities");
#endif
return 0;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c120b8e..1732780 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -259,7 +259,7 @@ static int lxcControllerClearCapabilities(void)
return -1;
}
#else
- VIR_WARN0(_("libcap-ng support not compiled in, unable to clear capabilities"));
+ VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities");
#endif
return 0;
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 01330ec..fb9e010 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1684,7 +1684,7 @@ lxcAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu
int ret = lxcVmStart(data->conn, data->driver, vm);
if (ret < 0) {
virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to autostart VM '%s': %s"),
+ VIR_ERROR("Failed to autostart VM '%s': %s",
vm->def->name,
err ? err->message : "");
} else {
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 83ab00e..4eeaeed 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -806,7 +806,7 @@ networkReloadIptablesRules(struct network_driver *driver)
{
unsigned int i;

- VIR_INFO0(_("Reloading iptables rules"));
+ VIR_INFO0("Reloading iptables rules");

for (i = 0 ; i < driver->networks.count ; i++) {
virNetworkObjLock(driver->networks.objs[i]);
@@ -970,14 +970,14 @@ static int networkStartNetworkDaemon(struct network_driver *driver,
err_delbr1:
if ((err = brSetInterfaceUp(driver->brctl, network->def->bridge, 0))) {
char ebuf[1024];
- VIR_WARN(_("Failed to bring down bridge '%s' : %s"),
+ VIR_WARN("Failed to bring down bridge '%s' : %s",
network->def->bridge, virStrerror(err, ebuf, sizeof ebuf));
}

err_delbr:
if ((err = brDeleteBridge(driver->brctl, network->def->bridge))) {
char ebuf[1024];
- VIR_WARN(_("Failed to delete bridge '%s' : %s"),
+ VIR_WARN("Failed to delete bridge '%s' : %s",
network->def->bridge, virStrerror(err, ebuf, sizeof ebuf));
}

@@ -991,7 +991,7 @@ static int networkShutdownNetworkDaemon(struct network_driver *driver,
int err;
char *stateFile;

- VIR_INFO(_("Shutting down network '%s'"), network->def->name);
+ VIR_INFO("Shutting down network '%s'", network->def->name);

if (!virNetworkObjIsActive(network))
return 0;
@@ -1010,12 +1010,12 @@ static int networkShutdownNetworkDaemon(struct network_driver *driver,

char ebuf[1024];
if ((err = brSetInterfaceUp(driver->brctl, network->def->bridge, 0))) {
- VIR_WARN(_("Failed to bring down bridge '%s' : %s"),
+ VIR_WARN("Failed to bring down bridge '%s' : %s",
network->def->bridge, virStrerror(err, ebuf, sizeof ebuf));
}

if ((err = brDeleteBridge(driver->brctl, network->def->bridge))) {
- VIR_WARN(_("Failed to delete bridge '%s' : %s"),
+ VIR_WARN("Failed to delete bridge '%s' : %s",
network->def->bridge, virStrerror(err, ebuf, sizeof ebuf));
}

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index b0ea986..c0fdce6 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -51,14 +51,14 @@ static int update_caps(virNodeDeviceObjPtr dev)
if (read_wwn(cap->data.scsi_host.host,
"port_name",
&cap->data.scsi_host.wwpn) == -1) {
- VIR_ERROR(_("Failed to refresh WWPN for host%d"),
+ VIR_ERROR("Failed to refresh WWPN for host%d",
cap->data.scsi_host.host);
}

if (read_wwn(cap->data.scsi_host.host,
"node_name",
&cap->data.scsi_host.wwnn) == -1) {
- VIR_ERROR(_("Failed to refresh WWNN for host%d"),
+ VIR_ERROR("Failed to refresh WWNN for host%d",
cap->data.scsi_host.host);
}
}
@@ -432,7 +432,7 @@ nodeDeviceVportCreateDelete(const int parent_host,
goto cleanup;
}

- VIR_DEBUG(_("Vport operation path is '%s'"), operation_path);
+ VIR_DEBUG("Vport operation path is '%s'", operation_path);

if (virAsprintf(&vport_name,
"%s:%s",
@@ -455,7 +455,7 @@ nodeDeviceVportCreateDelete(const int parent_host,
cleanup:
VIR_FREE(vport_name);
VIR_FREE(operation_path);
- VIR_DEBUG("%s", _("Vport operation complete"));
+ VIR_DEBUG0("Vport operation complete");
return retval;
}

diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index c4d1d01..9ed0daa 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -53,10 +53,10 @@ static int open_wwn_file(const char *prefix,

/* fd will be closed by caller */
if ((*fd = open(wwn_path, O_RDONLY)) != -1) {
- VIR_DEBUG(_("Opened WWN path '%s' for reading"),
+ VIR_DEBUG("Opened WWN path '%s' for reading",
wwn_path);
} else {
- VIR_ERROR(_("Failed to open WWN path '%s' for reading"),
+ VIR_ERROR("Failed to open WWN path '%s' for reading",
wwn_path);
}

@@ -79,7 +79,7 @@ int read_wwn_linux(int host, const char *file, char **wwn)
memset(buf, 0, sizeof(buf));
if (saferead(fd, buf, sizeof(buf)) < 0) {
retval = -1;
- VIR_DEBUG(_("Failed to read WWN for host%d '%s'"),
+ VIR_DEBUG("Failed to read WWN for host%d '%s'",
host, file);
goto out;
}
@@ -117,7 +117,7 @@ int check_fc_host_linux(union _virNodeDevCapData *d)
int retval = 0;
struct stat st;

- VIR_DEBUG(_("Checking if host%d is an FC HBA"), d->scsi_host.host);
+ VIR_DEBUG("Checking if host%d is an FC HBA", d->scsi_host.host);

if (virAsprintf(&sysfs_path, "%s/host%d",
LINUX_SYSFS_FC_HOST_PREFIX,
@@ -137,7 +137,7 @@ int check_fc_host_linux(union _virNodeDevCapData *d)
if (read_wwn(d->scsi_host.host,
"port_name",
&d->scsi_host.wwpn) == -1) {
- VIR_ERROR(_("Failed to read WWPN for host%d"),
+ VIR_ERROR("Failed to read WWPN for host%d",
d->scsi_host.host);
retval = -1;
goto out;
@@ -146,7 +146,7 @@ int check_fc_host_linux(union _virNodeDevCapData *d)
if (read_wwn(d->scsi_host.host,
"node_name",
&d->scsi_host.wwnn) == -1) {
- VIR_ERROR(_("Failed to read WWNN for host%d"),
+ VIR_ERROR("Failed to read WWNN for host%d",
d->scsi_host.host);
retval = -1;
}
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index e3114fa..47f53f7 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -112,7 +112,7 @@ static int udevGetDeviceProperty(struct udev_device *udev_device,

udev_value = udev_device_get_property_value(udev_device, property_key);
if (udev_value == NULL) {
- VIR_INFO(_("udev reports device '%s' does not have property '%s'"),
+ VIR_INFO("udev reports device '%s' does not have property '%s'",
udev_device_get_sysname(udev_device), property_key);
ret = PROPERTY_MISSING;
goto out;
@@ -201,7 +201,7 @@ static int udevGetDeviceSysfsAttr(struct udev_device *udev_device,

udev_value = udev_device_get_sysattr_value(udev_device, attr_name);
if (udev_value == NULL) {
- VIR_INFO(_("udev reports device '%s' does not have sysfs attr '%s'"),
+ VIR_INFO("udev reports device '%s' does not have sysfs attr '%s'",
udev_device_get_sysname(udev_device), attr_name);
ret = PROPERTY_MISSING;
goto out;
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 6d66543..cffe027 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -204,7 +204,7 @@ _printDataType(virConnectPtr conn,
case DATATYPE_IPMASK:
if (snprintf(buf, bufsize, "%d",
item->u.u8) >= bufsize) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER, "%s",
_("Buffer too small for uint8 type"));
return 1;
}
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 0e1d35f..365fb08 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1234,30 +1234,30 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
dom->conn);

if (lpar_name == NULL) {
- VIR_ERROR("%s", "Unable to determine domain's name.");
+ VIR_ERROR0("Unable to determine domain's name.");
goto err;
}

if (phypGetLparUUID(def.uuid, dom->id, dom->conn) == -1) {
- VIR_ERROR("%s", "Unable to generate random uuid.");
+ VIR_ERROR0("Unable to generate random uuid.");
goto err;
}

if ((def.maxmem =
phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) {
- VIR_ERROR("%s", "Unable to determine domain's max memory.");
+ VIR_ERROR0("Unable to determine domain's max memory.");
goto err;
}

if ((def.memory =
phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) {
- VIR_ERROR("%s", "Unable to determine domain's memory.");
+ VIR_ERROR0("Unable to determine domain's memory.");
goto err;
}

if ((def.vcpus =
phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
- VIR_ERROR("%s", "Unable to determine domain's CPU.");
+ VIR_ERROR0("Unable to determine domain's CPU.");
goto err;
}

@@ -1521,9 +1521,8 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
goto err;

if (nvcpus > phypGetLparCPUMAX(dom)) {
- VIR_ERROR("%s",
- "You are trying to set a number of CPUs bigger than "
- "the max possible..");
+ VIR_ERROR0("You are trying to set a number of CPUs bigger than "
+ "the max possible..");
goto err;
}

@@ -1548,9 +1547,8 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
ret = phypExec(session, cmd, &exit_status, dom->conn);

if (exit_status < 0) {
- VIR_ERROR("%s",
- "Possibly you don't have IBM Tools installed in your LPAR."
- "Contact your support to enable this feature.");
+ VIR_ERROR0("Possibly you don't have IBM Tools installed in your LPAR."
+ "Contact your support to enable this feature.");
goto err;
}

@@ -1681,12 +1679,12 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
ret = phypExec(session, cmd, &exit_status, conn);

if (exit_status < 0) {
- VIR_ERROR("%s\"%s\"", "Unable to create LPAR. Reason: ", ret);
+ VIR_ERROR("Unable to create LPAR. Reason: %s", ret);
goto err;
}

if (phypUUIDTable_AddLpar(conn, def->uuid, def->id) == -1) {
- VIR_ERROR("%s", "Unable to add LPAR to the table");
+ VIR_ERROR0("Unable to add LPAR to the table");
goto err;
}

@@ -1828,13 +1826,13 @@ phypUUIDTable_WriteFile(virConnectPtr conn)
if (safewrite(fd, &uuid_table->lpars[i]->id,
sizeof(uuid_table->lpars[i]->id)) !=
sizeof(uuid_table->lpars[i]->id)) {
- VIR_ERROR("%s", "Unable to write information to local file.");
+ VIR_ERROR0("Unable to write information to local file.");
goto err;
}

if (safewrite(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN) !=
VIR_UUID_BUFLEN) {
- VIR_ERROR("%s", "Unable to write information to local file.");
+ VIR_ERROR0("Unable to write information to local file.");
goto err;
}
}
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 55397cd..087bb72 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -254,7 +254,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
int ctl;
if (pp->type != VIR_CONF_STRING) {
- VIR_ERROR("%s", _("cgroup_controllers must be a list of strings"));
+ VIR_ERROR0("cgroup_controllers must be a list of strings");
virConfFree(conf);
return -1;
}
@@ -292,7 +292,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
}
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
if (pp->type != VIR_CONF_STRING) {
- VIR_ERROR("%s", _("cgroup_device_acl must be a list of strings"));
+ VIR_ERROR0("cgroup_device_acl must be a list of strings");
virConfFree(conf);
return -1;
}
@@ -515,7 +515,7 @@ rewait:
if (errno == EINTR)
goto rewait;

- VIR_ERROR(_("Unexpected exit status from qemu %d pid %lu"),
+ VIR_ERROR("Unexpected exit status from qemu %d pid %lu",
WEXITSTATUS(status), (unsigned long)child);
ret = -1;
}
@@ -523,7 +523,7 @@ rewait:
* as there's really no need to throw an error if we did
* actually read a valid version number above */
if (WEXITSTATUS(status) != 0) {
- VIR_WARN(_("Unexpected exit status '%d', qemu probably failed"),
+ VIR_WARN("Unexpected exit status '%d', qemu probably failed",
WEXITSTATUS(status));
}

@@ -718,7 +718,7 @@ qemudProbeCPUModels(const char *qemu,
if (STREQ(arch, "i686") || STREQ(arch, "x86_64"))
parse = qemudParseX86Models;
else {
- VIR_DEBUG(_("don't know how to parse %s CPU models"), arch);
+ VIR_DEBUG("don't know how to parse %s CPU models", arch);
return 0;
}

@@ -750,7 +750,7 @@ rewait:
if (errno == EINTR)
goto rewait;

- VIR_ERROR(_("Unexpected exit status from qemu %d pid %lu"),
+ VIR_ERROR("Unexpected exit status from qemu %d pid %lu",
WEXITSTATUS(status), (unsigned long)child);
ret = -1;
}
@@ -758,7 +758,7 @@ rewait:
* as there's really no need to throw an error if we did
* actually read a valid version number above */
if (WEXITSTATUS(status) != 0) {
- VIR_WARN(_("Unexpected exit status '%d', qemu probably failed"),
+ VIR_WARN("Unexpected exit status '%d', qemu probably failed",
WEXITSTATUS(status));
}

@@ -838,7 +838,7 @@ qemudCapsInitGuest(virCapsPtr caps,
binary_mtime = st.st_mtime;
} else {
char ebuf[1024];
- VIR_WARN(_("Failed to stat %s, most peculiar : %s"),
+ VIR_WARN("Failed to stat %s, most peculiar : %s",
binary, virStrerror(errno, ebuf, sizeof(ebuf)));
binary_mtime = 0;
}
@@ -922,7 +922,7 @@ qemudCapsInitGuest(virCapsPtr caps,
binary_mtime = st.st_mtime;
} else {
char ebuf[1024];
- VIR_WARN(_("Failed to stat %s, most peculiar : %s"),
+ VIR_WARN("Failed to stat %s, most peculiar : %s",
binary, virStrerror(errno, ebuf, sizeof(ebuf)));
binary_mtime = 0;
}
@@ -1385,7 +1385,7 @@ rewait:
if (errno == EINTR)
goto rewait;

- VIR_ERROR(_("Unexpected exit status from qemu %d pid %lu"),
+ VIR_ERROR("Unexpected exit status from qemu %d pid %lu",
WEXITSTATUS(status), (unsigned long)child);
ret = -1;
}
@@ -1393,7 +1393,7 @@ rewait:
* as there's really no need to throw an error if we did
* actually read a valid version number above */
if (WEXITSTATUS(status) != 0) {
- VIR_WARN(_("Unexpected exit status '%d', qemu probably failed"),
+ VIR_WARN("Unexpected exit status '%d', qemu probably failed",
WEXITSTATUS(status));
}

@@ -6085,7 +6085,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
} else if (STREQ(arg, "-S")) {
/* ignore, always added by libvirt */
} else {
- VIR_WARN(_("unknown QEMU argument '%s' during conversion"), arg);
+ VIR_WARN("unknown QEMU argument '%s' during conversion", arg);
#if 0
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown argument '%s'"), arg);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index eea49bb..2ff33e0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -632,7 +632,7 @@ qemuAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
ret = qemudStartVMDaemon(data->conn, data->driver, vm, NULL, -1);
if (ret < 0) {
virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to autostart VM '%s': %s"),
+ VIR_ERROR("Failed to autostart VM '%s': %s",
vm->def->name,
err ? err->message : "");
} else {
@@ -689,12 +689,12 @@ qemudRemoveDomainStatus(struct qemud_driver *driver,
}

if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR)
- VIR_WARN(_("Failed to remove domain XML for %s: %s"),
+ VIR_WARN("Failed to remove domain XML for %s: %s",
vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_FREE(file);

if (virFileDeletePid(driver->stateDir, vm->def->name) != 0)
- VIR_WARN(_("Failed to remove PID file for %s: %s"),
+ VIR_WARN("Failed to remove PID file for %s: %s",
vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf)));


@@ -1178,7 +1178,7 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
priv->monConfig,
priv->monJSON,
&monitorCallbacks)) == NULL) {
- VIR_ERROR(_("Failed to connect monitor for %s"), vm->def->name);
+ VIR_ERROR("Failed to connect monitor for %s", vm->def->name);
return -1;
}

@@ -1279,7 +1279,7 @@ qemudSecurityInit(struct qemud_driver *qemud_drv)
ret = virSecurityDriverStartup(&security_drv,
qemud_drv->securityDriverName);
if (ret == -1) {
- VIR_ERROR0(_("Failed to start security driver"));
+ VIR_ERROR0("Failed to start security driver");
return -1;
}

@@ -1287,7 +1287,7 @@ qemudSecurityInit(struct qemud_driver *qemud_drv)
* the DAC driver on its own */
if (ret == -2) {
qemud_drv->securityDriver = &qemuDACSecurityDriver;
- VIR_INFO0(_("No security driver available"));
+ VIR_INFO0("No security driver available");
} else {
qemud_drv->securityPrimaryDriver = security_drv;
qemud_drv->securitySecondaryDriver = &qemuDACSecurityDriver;
@@ -1357,7 +1357,7 @@ qemudStartup(int privileged) {
return -1;

if (virMutexInit(&qemu_driver->lock) < 0) {
- VIR_ERROR("%s", _("cannot initialize mutex"));
+ VIR_ERROR0("cannot initialize mutex");
VIR_FREE(qemu_driver);
return -1;
}
@@ -1432,19 +1432,19 @@ qemudStartup(int privileged) {

if (virFileMakePath(qemu_driver->stateDir) != 0) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create state dir '%s': %s"),
+ VIR_ERROR("Failed to create state dir '%s': %s",
qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
if (virFileMakePath(qemu_driver->libDir) != 0) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create lib dir '%s': %s"),
+ VIR_ERROR("Failed to create lib dir '%s': %s",
qemu_driver->libDir, virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
if (virFileMakePath(qemu_driver->cacheDir) != 0) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create cache dir '%s': %s"),
+ VIR_ERROR("Failed to create cache dir '%s': %s",
qemu_driver->cacheDir, virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
@@ -1932,7 +1932,7 @@ qemudWaitForMonitor(struct qemud_driver* driver,
"console", 30);
if (close(logfd) < 0) {
char ebuf[4096];
- VIR_WARN(_("Unable to close logfile: %s"),
+ VIR_WARN("Unable to close logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
}

@@ -2750,7 +2750,7 @@ qemudReattachManagedDevice(pciDevice *dev)
}
if (pciReAttachDevice(dev) < 0) {
virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to re-attach PCI device: %s"),
+ VIR_ERROR("Failed to re-attach PCI device: %s",
err ? err->message : "");
virResetError(err);
}
@@ -2769,7 +2769,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,

if (!(pcidevs = qemuGetPciHostDeviceList(def))) {
virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),
+ VIR_ERROR("Failed to allocate pciDeviceList: %s",
err ? err->message : "");
virResetError(err);
return;
@@ -2787,7 +2787,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,
pciDevice *dev = pciDeviceListGet(pcidevs, i);
if (pciResetDevice(dev, driver->activePciHostdevs) < 0) {
virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to reset PCI device: %s"),
+ VIR_ERROR("Failed to reset PCI device: %s",
err ? err->message : "");
virResetError(err);
}
@@ -3215,29 +3215,29 @@ static int qemudStartVMDaemon(virConnectPtr conn,
tmp = progenv;
while (*tmp) {
if (safewrite(logfile, *tmp, strlen(*tmp)) < 0)
- VIR_WARN(_("Unable to write envv to logfile: %s"),
+ VIR_WARN("Unable to write envv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
if (safewrite(logfile, " ", 1) < 0)
- VIR_WARN(_("Unable to write envv to logfile: %s"),
+ VIR_WARN("Unable to write envv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
tmp++;
}
tmp = argv;
while (*tmp) {
if (safewrite(logfile, *tmp, strlen(*tmp)) < 0)
- VIR_WARN(_("Unable to write argv to logfile: %s"),
+ VIR_WARN("Unable to write argv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
if (safewrite(logfile, " ", 1) < 0)
- VIR_WARN(_("Unable to write argv to logfile: %s"),
+ VIR_WARN("Unable to write argv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
tmp++;
}
if (safewrite(logfile, "\n", 1) < 0)
- VIR_WARN(_("Unable to write argv to logfile: %s"),
+ VIR_WARN("Unable to write argv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));

if ((pos = lseek(logfile, 0, SEEK_END)) < 0)
- VIR_WARN(_("Unable to seek to end of logfile: %s"),
+ VIR_WARN("Unable to seek to end of logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));

for (i = 0 ; i < ntapfds ; i++)
@@ -7048,14 +7048,14 @@ cleanup:

try_remove:
if (vlan < 0) {
- VIR_WARN0(_("Unable to remove network backend"));
+ VIR_WARN0("Unable to remove network backend");
} else {
char *hostnet_name;
if (virAsprintf(&hostnet_name, "host%s", net->info.alias) < 0)
goto no_memory;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0)
- VIR_WARN(_("Failed to remove network backend for vlan %d, net %s"),
+ VIR_WARN("Failed to remove network backend for vlan %d, net %s",
vlan, hostnet_name);
qemuDomainObjExitMonitorWithDriver(driver, vm);
VIR_FREE(hostnet_name);
@@ -7066,7 +7066,7 @@ try_tapfd_close:
if (tapfd_name) {
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorCloseFileHandle(priv->mon, tapfd_name) < 0)
- VIR_WARN(_("Failed to close tapfd with '%s'"), tapfd_name);
+ VIR_WARN("Failed to close tapfd with '%s'", tapfd_name);
qemuDomainObjExitMonitorWithDriver(driver, vm);
}

@@ -10000,7 +10000,7 @@ endjob:
* overwrite the previous error, though, so we just throw something
* to the logs and hope for the best
*/
- VIR_ERROR(_("Failed to resume guest %s after failure"),
+ VIR_ERROR("Failed to resume guest %s after failure",
vm->def->name);
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 64779ac..ac73f0c 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -544,7 +544,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
}
quit = 1;
} else if (events) {
- VIR_ERROR(_("unhandled fd event %d for monitor fd %d"),
+ VIR_ERROR("unhandled fd event %d for monitor fd %d",
events, mon->fd);
failed = 1;
}
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index a199de7..e171483 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1399,42 +1399,42 @@ qemuMonitorTextParsePciAddReply(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
s += strlen("domain ");

if (virStrToLong_ui(s, &e, 10, &addr->domain) == -1) {
- VIR_WARN(_("Unable to parse domain number '%s'"), s);
+ VIR_WARN("Unable to parse domain number '%s'", s);
return -1;
}

if (!STRPREFIX(e, ", ")) {
- VIR_WARN(_("Expected ', ' parsing pci_add reply '%s'"), s);
+ VIR_WARN("Expected ', ' parsing pci_add reply '%s'", s);
return -1;
}
s = e + 2;
}

if (!STRPREFIX(s, "bus ")) {
- VIR_WARN(_("Expected 'bus ' parsing pci_add reply '%s'"), s);
+ VIR_WARN("Expected 'bus ' parsing pci_add reply '%s'", s);
return -1;
}
s += strlen("bus ");

if (virStrToLong_ui(s, &e, 10, &addr->bus) == -1) {
- VIR_WARN(_("Unable to parse bus number '%s'"), s);
+ VIR_WARN("Unable to parse bus number '%s'", s);
return -1;
}

if (!STRPREFIX(e, ", ")) {
- VIR_WARN(_("Expected ', ' parsing pci_add reply '%s'"), s);
+ VIR_WARN("Expected ', ' parsing pci_add reply '%s'", s);
return -1;
}
s = e + 2;

if (!STRPREFIX(s, "slot ")) {
- VIR_WARN(_("Expected 'slot ' parsing pci_add reply '%s'"), s);
+ VIR_WARN("Expected 'slot ' parsing pci_add reply '%s'", s);
return -1;
}
s += strlen("slot ");

if (virStrToLong_ui(s, &e, 10, &addr->slot) == -1) {
- VIR_WARN(_("Unable to parse slot number '%s'"), s);
+ VIR_WARN("Unable to parse slot number '%s'", s);
return -1;
}

@@ -1913,25 +1913,25 @@ qemudParseDriveAddReply(const char *reply,
s += strlen("bus ");

if (virStrToLong_ui(s, &e, 10, &addr->bus) == -1) {
- VIR_WARN(_("Unable to parse bus '%s'"), s);
+ VIR_WARN("Unable to parse bus '%s'", s);
return -1;
}

if (!STRPREFIX(e, ", ")) {
- VIR_WARN(_("Expected ', ' parsing drive_add reply '%s'"), s);
+ VIR_WARN("Expected ', ' parsing drive_add reply '%s'", s);
return -1;
}
s = e + 2;
}

if (!STRPREFIX(s, "unit ")) {
- VIR_WARN(_("Expected 'unit ' parsing drive_add reply '%s'"), s);
+ VIR_WARN("Expected 'unit ' parsing drive_add reply '%s'", s);
return -1;
}
s += strlen("bus ");

if (virStrToLong_ui(s, &e, 10, &addr->unit) == -1) {
- VIR_WARN(_("Unable to parse unit number '%s'"), s);
+ VIR_WARN("Unable to parse unit number '%s'", s);
return -1;
}

diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 22852a1..41d2cb8 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -498,7 +498,7 @@ loadSecrets(virSecretDriverStatePtr driver,
if (secret == NULL) {
virErrorPtr err = virGetLastError();

- VIR_ERROR(_("Error reading secret: %s"),
+ VIR_ERROR("Error reading secret: %s",
err != NULL ? err->message: "");
virResetError(err);
continue;
@@ -1023,7 +1023,7 @@ secretDriverStartup(int privileged)
return 0;

out_of_memory:
- VIR_ERROR0(_("Out of memory initializing secrets"));
+ VIR_ERROR0("Out of memory initializing secrets");
error:
VIR_FREE(base);
secretDriverUnlock(driverState);
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index db04d5c..8e1c794 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -483,7 +483,7 @@ AppArmorSetSecurityProcessLabel(virSecurityDriverPtr drv, virDomainObjPtr vm)
}

if (aa_change_profile(profile_name) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
+ virSecurityReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("error calling aa_change_profile()"));
goto clean;
}
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 8318969..9c6e5ed 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -318,8 +318,6 @@ virStorageBackendMpathRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
{
int retval = 0;

- VIR_ERROR(_("in %s"), __func__);
-
pool->def->allocation = pool->def->capacity = pool->def->available = 0;

virFileWaitForDevices();
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 0260818..cd01f93 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -92,7 +92,7 @@ getDeviceType(uint32_t host,
goto out;
}

- VIR_DEBUG(_("Device type is %d"), *type);
+ VIR_DEBUG("Device type is %d", *type);

out:
VIR_FREE(type_path);
@@ -221,7 +221,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
goto free_vol;
}

- VIR_DEBUG(_("Trying to create volume for '%s'"), devpath);
+ VIR_DEBUG("Trying to create volume for '%s'", devpath);

/* Now figure out the stable path
*
@@ -239,7 +239,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
!(STREQ(pool->def->target.path, "/dev") ||
STREQ(pool->def->target.path, "/dev/"))) {

- VIR_DEBUG(_("No stable path found for '%s' in '%s'"),
+ VIR_DEBUG("No stable path found for '%s' in '%s'",
devpath, pool->def->target.path);

retval = -1;
@@ -301,7 +301,7 @@ getNewStyleBlockDevice(const char *lun_path,
goto out;
}

- VIR_DEBUG(_("Looking for block device in '%s'"), block_path);
+ VIR_DEBUG("Looking for block device in '%s'", block_path);

block_dir = opendir(block_path);
if (block_dir == NULL) {
@@ -327,7 +327,7 @@ getNewStyleBlockDevice(const char *lun_path,
goto out;
}

- VIR_DEBUG(_("Block device is '%s'"), *block_device);
+ VIR_DEBUG("Block device is '%s'", *block_device);

break;
}
@@ -366,7 +366,7 @@ getOldStyleBlockDevice(const char *lun_path ATTRIBUTE_UNUSED,
goto out;
}

- VIR_DEBUG(_("Block device is '%s'"), *block_device);
+ VIR_DEBUG("Block device is '%s'", *block_device);
}

out:
@@ -436,7 +436,7 @@ processLU(virStoragePoolObjPtr pool,
int device_type;
char *block_device = NULL;

- VIR_DEBUG(_("Processing LU %u:%u:%u:%u"),
+ VIR_DEBUG("Processing LU %u:%u:%u:%u",
host, bus, target, lun);

if (getDeviceType(host, bus, target, lun, &device_type) < 0) {
@@ -457,7 +457,7 @@ processLU(virStoragePoolObjPtr pool,
goto out;
}

- VIR_DEBUG(_("%u:%u:%u:%u is a Direct-Access LUN"),
+ VIR_DEBUG("%u:%u:%u:%u is a Direct-Access LUN",
host, bus, target, lun);

if (getBlockDevice(host, bus, target, lun, &block_device) < 0) {
@@ -467,13 +467,13 @@ processLU(virStoragePoolObjPtr pool,
if (virStorageBackendSCSINewLun(pool,
host, bus, target, lun,
block_device) < 0) {
- VIR_DEBUG(_("Failed to create new storage volume for %u:%u:%u:%u"),
+ VIR_DEBUG("Failed to create new storage volume for %u:%u:%u:%u",
host, bus, target, lun);
retval = -1;
goto out;
}

- VIR_DEBUG(_("Created new storage volume for %u:%u:%u:%u successfully"),
+ VIR_DEBUG("Created new storage volume for %u:%u:%u:%u successfully",
host, bus, target, lun);

VIR_FREE(type_path);
@@ -494,7 +494,7 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
struct dirent *lun_dirent = NULL;
char devicepattern[64];

- VIR_DEBUG(_("Discovering LUs on host %u"), scanhost);
+ VIR_DEBUG("Discovering LUs on host %u", scanhost);

virFileWaitForDevices();

@@ -520,7 +520,7 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
continue;
}

- VIR_DEBUG(_("Found LU '%s'"), lun_dirent->d_name);
+ VIR_DEBUG("Found LU '%s'", lun_dirent->d_name);

processLU(pool, scanhost, bus, target, lun);
}
@@ -541,7 +541,7 @@ virStorageBackendSCSIGetHostNumber(const char *sysfs_path,
DIR *sysdir = NULL;
struct dirent *dirent = NULL;

- VIR_DEBUG(_("Finding host number from '%s'"), sysfs_path);
+ VIR_DEBUG("Finding host number from '%s'", sysfs_path);

virFileWaitForDevices();

@@ -558,7 +558,7 @@ virStorageBackendSCSIGetHostNumber(const char *sysfs_path,
if (STREQLEN(dirent->d_name, "target", strlen("target"))) {
if (sscanf(dirent->d_name,
"target%u:", host) != 1) {
- VIR_DEBUG(_("Failed to parse target '%s'"), dirent->d_name);
+ VIR_DEBUG("Failed to parse target '%s'", dirent->d_name);
retval = -1;
break;
}
@@ -578,7 +578,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host)
int retval = 0;
char *path;

- VIR_DEBUG(_("Triggering rescan of host %d"), host);
+ VIR_DEBUG("Triggering rescan of host %d", host);

if (virAsprintf(&path, "/sys/class/scsi_host/host%u/scan", host) < 0) {
virReportOOMError();
@@ -586,7 +586,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host)
goto out;
}

- VIR_DEBUG(_("Scan trigger path is '%s'"), path);
+ VIR_DEBUG("Scan trigger path is '%s'", path);

fd = open(path, O_WRONLY);

@@ -612,7 +612,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host)
free_path:
VIR_FREE(path);
out:
- VIR_DEBUG(_("Rescan of host %d complete"), host);
+ VIR_DEBUG("Rescan of host %d complete", host);
return retval;
}

@@ -627,13 +627,13 @@ virStorageBackendSCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
pool->def->allocation = pool->def->capacity = pool->def->available = 0;

if (sscanf(pool->def->source.adapter, "host%u", &host) != 1) {
- VIR_DEBUG(_("Failed to get host number from '%s'"),
+ VIR_DEBUG("Failed to get host number from '%s'",
pool->def->source.adapter);
retval = -1;
goto out;
}

- VIR_DEBUG(_("Scanning host%u"), host);
+ VIR_DEBUG("Scanning host%u", host);

if (virStorageBackendSCSITriggerRescan(host) < 0) {
retval = -1;
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 876e16b..17f4e2e 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -49,9 +49,6 @@

#define VIR_FROM_THIS VIR_FROM_UML

-#define umlLog(level, msg, ...) \
- virLogMessage(__FILE__, level, 0, msg, __VA_ARGS__)
-
virCapsPtr umlCapsInit(void) {
struct utsname utsname;
virCapsPtr caps;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 443d82e..58ffe68 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -121,7 +121,7 @@ static int umlSetCloseExec(int fd) {
goto error;
return 0;
error:
- VIR_ERROR0(_("Failed to set close-on-exec file descriptor flag"));
+ VIR_ERROR0("Failed to set close-on-exec file descriptor flag");
return -1;
}

@@ -159,7 +159,7 @@ umlAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu
virResetLastError();
if (umlStartVMDaemon(data->conn, data->driver, vm) < 0) {
virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to autostart VM '%s': %s"),
+ VIR_ERROR("Failed to autostart VM '%s': %s",
vm->def->name, err->message);
}
}
@@ -412,13 +412,13 @@ umlStartup(int privileged) {
uml_driver->caps->privateDataFreeFunc = umlDomainObjPrivateFree;

if ((uml_driver->inotifyFD = inotify_init()) < 0) {
- VIR_ERROR0(_("cannot initialize inotify"));
+ VIR_ERROR0("cannot initialize inotify");
goto error;
}

if (virFileMakePath(uml_driver->monitorDir) != 0) {
char ebuf[1024];
- VIR_ERROR(_("Failed to create monitor directory %s: %s"),
+ VIR_ERROR("Failed to create monitor directory %s: %s",
uml_driver->monitorDir, virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
@@ -450,7 +450,7 @@ umlStartup(int privileged) {
return 0;

out_of_memory:
- VIR_ERROR0(_("umlStartup: out of memory"));
+ VIR_ERROR0("umlStartup: out of memory");

error:
VIR_FREE(userdir);
@@ -887,25 +887,25 @@ static int umlStartVMDaemon(virConnectPtr conn,
tmp = progenv;
while (*tmp) {
if (safewrite(logfd, *tmp, strlen(*tmp)) < 0)
- VIR_WARN(_("Unable to write envv to logfile: %s"),
+ VIR_WARN("Unable to write envv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
if (safewrite(logfd, " ", 1) < 0)
- VIR_WARN(_("Unable to write envv to logfile: %s"),
+ VIR_WARN("Unable to write envv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
tmp++;
}
tmp = argv;
while (*tmp) {
if (safewrite(logfd, *tmp, strlen(*tmp)) < 0)
- VIR_WARN(_("Unable to write argv to logfile: %s"),
+ VIR_WARN("Unable to write argv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
if (safewrite(logfd, " ", 1) < 0)
- VIR_WARN(_("Unable to write argv to logfile: %s"),
+ VIR_WARN("Unable to write argv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
tmp++;
}
if (safewrite(logfd, "\n", 1) < 0)
- VIR_WARN(_("Unable to write argv to logfile: %s"),
+ VIR_WARN("Unable to write argv to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));

priv->monitor = -1;
@@ -953,8 +953,7 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
priv->monitor = -1;

if ((ret = waitpid(vm->pid, NULL, 0)) != vm->pid) {
- VIR_WARN(_("Got unexpected pid %d != %d"),
- ret, vm->pid);
+ VIR_WARN("Got unexpected pid %d != %d", ret, vm->pid);
}

vm->pid = -1;
diff --git a/src/util/bridge.c b/src/util/bridge.c
index b236f80..310ac20 100644
--- a/src/util/bridge.c
+++ b/src/util/bridge.c
@@ -394,14 +394,14 @@ brProbeVnetHdr(int tapfd)
struct ifreq dummy;

if (ioctl(tapfd, TUNGETFEATURES, &features) != 0) {
- VIR_INFO0(_("Not enabling IFF_VNET_HDR; "
- "TUNGETFEATURES ioctl() not implemented"));
+ VIR_INFO0("Not enabling IFF_VNET_HDR; "
+ "TUNGETFEATURES ioctl() not implemented");
return 0;
}

if (!(features & IFF_VNET_HDR)) {
- VIR_INFO0(_("Not enabling IFF_VNET_HDR; "
- "TUNGETFEATURES ioctl() reports no IFF_VNET_HDR"));
+ VIR_INFO0("Not enabling IFF_VNET_HDR; "
+ "TUNGETFEATURES ioctl() reports no IFF_VNET_HDR");
return 0;
}

@@ -409,17 +409,17 @@ brProbeVnetHdr(int tapfd)
* If TUNGETIFF is not implemented then errno == EBADFD.
*/
if (ioctl(tapfd, TUNGETIFF, &dummy) != -1 || errno != EBADFD) {
- VIR_INFO0(_("Not enabling IFF_VNET_HDR; "
- "TUNGETIFF ioctl() not implemented"));
+ VIR_INFO0("Not enabling IFF_VNET_HDR; "
+ "TUNGETIFF ioctl() not implemented");
return 0;
}

- VIR_INFO0(_("Enabling IFF_VNET_HDR"));
+ VIR_INFO0("Enabling IFF_VNET_HDR");

return 1;
# else
(void) tapfd;
- VIR_INFO0(_("Not enabling IFF_VNET_HDR; disabled at build time"));
+ VIR_INFO0("Not enabling IFF_VNET_HDR; disabled at build time");
return 0;
# endif
}
diff --git a/src/util/logging.c b/src/util/logging.c
index 6bc2ccf..248c47e 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -330,7 +330,7 @@ error:
*/
int virLogSetDefaultPriority(int priority) {
if ((priority < VIR_LOG_DEBUG) || (priority > VIR_LOG_ERROR)) {
- VIR_WARN0(_("Ignoring invalid log level setting."));
+ VIR_WARN0("Ignoring invalid log level setting.");
return(-1);
}
if (!virLogInitialized)
@@ -781,7 +781,7 @@ int virLogParseOutputs(const char *outputs) {
ret = count;
cleanup:
if (ret == -1)
- VIR_WARN0(_("Ignoring invalid log output setting."));
+ VIR_WARN0("Ignoring invalid log output setting.");
return(ret);
}

@@ -837,7 +837,7 @@ int virLogParseFilters(const char *filters) {
ret = count;
cleanup:
if (ret == -1)
- VIR_WARN0(_("Ignoring invalid log filter setting."));
+ VIR_WARN0("Ignoring invalid log filter setting.");
return(ret);
}

@@ -959,7 +959,7 @@ int virLogParseDefaultPriority(const char *priority) {
else if (STREQ(priority, "4") || STREQ(priority, "error"))
ret = virLogSetDefaultPriority(VIR_LOG_ERROR);
else
- VIR_WARN0(_("Ignoring invalid log level setting"));
+ VIR_WARN0("Ignoring invalid log level setting");

return ret;
}
diff --git a/src/util/pci.c b/src/util/pci.c
index 81193b7..e8f985c 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -173,7 +173,7 @@ pciOpenConfig(pciDevice *dev)
fd = open(dev->path, O_RDWR);
if (fd < 0) {
char ebuf[1024];
- VIR_WARN(_("Failed to open config space file '%s': %s"),
+ VIR_WARN("Failed to open config space file '%s': %s",
dev->path, virStrerror(errno, ebuf, sizeof(ebuf)));
return -1;
}
@@ -193,7 +193,7 @@ pciRead(pciDevice *dev, unsigned pos, uint8_t *buf, unsigned buflen)
if (lseek(dev->fd, pos, SEEK_SET) != pos ||
saferead(dev->fd, buf, buflen) != buflen) {
char ebuf[1024];
- VIR_WARN(_("Failed to read from '%s' : %s"), dev->path,
+ VIR_WARN("Failed to read from '%s' : %s", dev->path,
virStrerror(errno, ebuf, sizeof(ebuf)));
return -1;
}
@@ -233,7 +233,7 @@ pciWrite(pciDevice *dev, unsigned pos, uint8_t *buf, unsigned buflen)
if (lseek(dev->fd, pos, SEEK_SET) != pos ||
safewrite(dev->fd, buf, buflen) != buflen) {
char ebuf[1024];
- VIR_WARN(_("Failed to write to '%s' : %s"), dev->path,
+ VIR_WARN("Failed to write to '%s' : %s", dev->path,
virStrerror(errno, ebuf, sizeof(ebuf)));
return -1;
}
@@ -730,7 +730,7 @@ recheck:
if (virRun(backprobe, NULL) < 0 &&
virRun(stubprobe, NULL) < 0) {
char ebuf[1024];
- VIR_WARN(_("failed to load pci-stub or pciback drivers: %s"),
+ VIR_WARN("failed to load pci-stub or pciback drivers: %s",
virStrerror(errno, ebuf, sizeof ebuf));
return 0;
}
diff --git a/src/util/uuid.c b/src/util/uuid.c
index 459273a..1cfdd07 100644
--- a/src/util/uuid.c
+++ b/src/util/uuid.c
@@ -101,8 +101,8 @@ virUUIDGenerate(unsigned char *uuid)

if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN))) {
char ebuf[1024];
- VIR_WARN(_("Falling back to pseudorandom UUID,"
- " failed to generate random bytes: %s"),
+ VIR_WARN("Falling back to pseudorandom UUID, "
+ "failed to generate random bytes: %s",
virStrerror(err, ebuf, sizeof ebuf));
err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
}
diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index 26eec13..c3cade8 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -240,7 +240,7 @@ virProxyCloseSocket(xenUnifiedPrivatePtr priv) {

ret = close(priv->proxy);
if (ret != 0)
- VIR_WARN(_("Failed to close socket %d"), priv->proxy);
+ VIR_WARN("Failed to close socket %d", priv->proxy);
else
VIR_DEBUG("Closed socket %d", priv->proxy);
priv->proxy = -1;
@@ -297,7 +297,7 @@ virProxyWriteClientSocket(int fd, const char *data, int len) {

ret = safewrite(fd, data, len);
if (ret < 0) {
- VIR_WARN(_("Failed to write to socket %d"), fd);
+ VIR_WARN("Failed to write to socket %d", fd);
return(-1);
}
VIR_DEBUG("wrote %d bytes to socket %d",
@@ -452,7 +452,7 @@ retry:
goto error;
}
if (res->serial != serial) {
- VIR_WARN(_("got asynchronous packet number %d"), res->serial);
+ VIR_WARN("got asynchronous packet number %d", res->serial);
goto retry;
}

diff --git a/tools/console.c b/tools/console.c
index 4201ba4..3a29a12 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -73,7 +73,7 @@ int vshRunConsole(const char *tty) {

/* We do not want this to become the controlling TTY */
if ((ttyfd = open(tty, O_NOCTTY | O_RDWR)) < 0) {
- VIR_ERROR(_("unable to open tty %s: %s"),
+ VIR_ERROR("unable to open tty %s: %s",
tty, strerror(errno));
return -1;
}
@@ -84,7 +84,7 @@ int vshRunConsole(const char *tty) {
also ensure Ctrl-C, etc is blocked, and misc
other bits */
if (tcgetattr(STDIN_FILENO, &ttyattr) < 0) {
- VIR_ERROR(_("unable to get tty attributes: %s"),
+ VIR_ERROR("unable to get tty attributes: %s",
strerror(errno));
goto closetty;
}
@@ -93,7 +93,7 @@ int vshRunConsole(const char *tty) {
cfmakeraw(&rawattr);

if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &rawattr) < 0) {
- VIR_ERROR(_("unable to set tty attributes: %s"),
+ VIR_ERROR("unable to set tty attributes: %s",
strerror(errno));
goto closetty;
}
@@ -128,7 +128,7 @@ int vshRunConsole(const char *tty) {
if (errno == EINTR || errno == EAGAIN)
continue;

- VIR_ERROR(_("failure waiting for I/O: %s"), strerror(errno));
+ VIR_ERROR("failure waiting for I/O: %s", strerror(errno));
goto cleanup;
}

@@ -142,7 +142,7 @@ int vshRunConsole(const char *tty) {
int got, sent = 0, destfd;

if ((got = read(fds[i].fd, buf, sizeof(buf))) < 0) {
- VIR_ERROR(_("failure reading input: %s"),
+ VIR_ERROR("failure reading input: %s",
strerror(errno));
goto cleanup;
}
@@ -164,7 +164,7 @@ int vshRunConsole(const char *tty) {
int done;
if ((done = safewrite(destfd, buf + sent, got - sent))
<= 0) {
- VIR_ERROR(_("failure writing output: %s"),
+ VIR_ERROR("failure writing output: %s",
strerror(errno));
goto cleanup;
}
--
1.6.3.3
Eric Blake
2010-04-05 15:58:58 UTC
Permalink
Post by Matthias Bolte
Also remove manually added function names from log messages, the logging
macros already record them and the logging framework outputs them.
I see in [1] where the translation was first added, but no justification
there for why log messages are marked, nor in your patch why they should
not be marked. I'm not opposed to the idea, but I think it would make a
lot more sense if the commit message explained exactly why we don't
think log messages deserve translations.

[1] https://www.redhat.com/archives/libvir-list/2009-January/msg00005.html
Post by Matthias Bolte
+++ b/cfg.mk
# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
msg_gen_function =
-msg_gen_function += DEBUG0
For example, I can easily see why DEBUG0 does not need translation (it
is for developers, and should never be expanded into a log message in a
distro's installation, so why waste the translator's efforts on it)...
Post by Matthias Bolte
-msg_gen_function += DISABLE_fprintf
-msg_gen_function += ERROR
-msg_gen_function += ERROR0
-msg_gen_function += REMOTE_DEBUG
msg_gen_function += ReportError
-msg_gen_function += VIR_FREE
-msg_gen_function += VIR_INFO
But the name VIR_INFO seems like it might be something the end user may
eventually want to see in their own language. Maybe the reasoning that
I'm not seeing here is that grep-ability of system logs is more
important than translating system logs into the user's language?
Post by Matthias Bolte
@@ -236,7 +223,7 @@ func_re := ($(func_or))
# "%s", _("no storage vol w..."
@grep -nE \
- '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
+ '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
ACK to this hunk, independently of the overall issue on why we need this
patch.
Post by Matthias Bolte
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 208ffca..68fe95a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -272,7 +272,7 @@ remoteCheckCertFile(const char *type, const char *file)
struct stat sb;
if (stat(file, &sb) < 0) {
char ebuf[1024];
- VIR_ERROR(_("Cannot access %s '%s': %s"),
+ VIR_ERROR("Cannot access %s '%s': %s",
type, file, virStrerror(errno, ebuf, sizeof ebuf));
return -1;
}
Again, this seems like something the user would want to see in their own
language. So while the rest of this patch looks mechanically correct,
I'm hesitant to give an ACK without more reasoning on which functions
deserve to bypass translation; it may requiring reducing the scope of
this patch.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-05 17:18:42 UTC
Permalink
Post by Eric Blake
Post by Matthias Bolte
Also remove manually added function names from log messages, the logging
macros already record them and the logging framework outputs them.
I see in [1] where the translation was first added, but no justification
there for why log messages are marked, nor in your patch why they should
not be marked.  I'm not opposed to the idea, but I think it would make a
lot more sense if the commit message explained exactly why we don't
think log messages deserve translations.
[1] https://www.redhat.com/archives/libvir-list/2009-January/msg00005.html
Post by Matthias Bolte
+++ b/cfg.mk
 # |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
 msg_gen_function =
-msg_gen_function += DEBUG0
For example, I can easily see why DEBUG0 does not need translation (it
is for developers, and should never be expanded into a log message in a
distro's installation, so why waste the translator's efforts on it)...
Post by Matthias Bolte
-msg_gen_function += DISABLE_fprintf
-msg_gen_function += ERROR
-msg_gen_function += ERROR0
-msg_gen_function += REMOTE_DEBUG
 msg_gen_function += ReportError
-msg_gen_function += VIR_FREE
-msg_gen_function += VIR_INFO
But the name VIR_INFO seems like it might be something the end user may
eventually want to see in their own language.  Maybe the reasoning that
I'm not seeing here is that grep-ability of system logs is more
important than translating system logs into the user's language?
Post by Matthias Bolte
@@ -236,7 +223,7 @@ func_re := ($(func_or))
 #    "%s", _("no storage vol w..."
-         '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT))  \
+         '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
        | grep -v '_''(' &&                                           \
        { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
ACK to this hunk, independently of the overall issue on why we need this
patch.
Post by Matthias Bolte
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 208ffca..68fe95a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -272,7 +272,7 @@ remoteCheckCertFile(const char *type, const char *file)
     struct stat sb;
     if (stat(file, &sb) < 0) {
         char ebuf[1024];
-        VIR_ERROR(_("Cannot access %s '%s': %s"),
+        VIR_ERROR("Cannot access %s '%s': %s",
                   type, file, virStrerror(errno, ebuf, sizeof ebuf));
         return -1;
     }
Again, this seems like something the user would want to see in their own
language.  So while the rest of this patch looks mechanically correct,
I'm hesitant to give an ACK without more reasoning on which functions
deserve to bypass translation; it may requiring reducing the scope of
this patch.
DanPB's argument [1] against marking log messages for translation was
mainly that they aren't meant for the end user, but for debugging
purpose and to be included in bug reports.

On the other hand one can argue about VIR_ERROR on the libvirtd side
where it's used to report critical errors like the one you quoted
above.

[1] https://www.redhat.com/archives/libvir-list/2010-February/msg00188.html

Matthias
Daniel P. Berrange
2010-04-06 09:53:40 UTC
Permalink
Post by Matthias Bolte
Post by Eric Blake
Post by Matthias Bolte
Also remove manually added function names from log messages, the logging
macros already record them and the logging framework outputs them.
I see in [1] where the translation was first added, but no justification
there for why log messages are marked, nor in your patch why they should
not be marked.  I'm not opposed to the idea, but I think it would make a
lot more sense if the commit message explained exactly why we don't
think log messages deserve translations.
[1] https://www.redhat.com/archives/libvir-list/2009-January/msg00005.html
Post by Matthias Bolte
+++ b/cfg.mk
 # |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
 msg_gen_function =
-msg_gen_function += DEBUG0
For example, I can easily see why DEBUG0 does not need translation (it
is for developers, and should never be expanded into a log message in a
distro's installation, so why waste the translator's efforts on it)...
Post by Matthias Bolte
-msg_gen_function += DISABLE_fprintf
-msg_gen_function += ERROR
-msg_gen_function += ERROR0
-msg_gen_function += REMOTE_DEBUG
 msg_gen_function += ReportError
-msg_gen_function += VIR_FREE
-msg_gen_function += VIR_INFO
But the name VIR_INFO seems like it might be something the end user may
eventually want to see in their own language.  Maybe the reasoning that
I'm not seeing here is that grep-ability of system logs is more
important than translating system logs into the user's language?
Post by Matthias Bolte
@@ -236,7 +223,7 @@ func_re := ($(func_or))
 #    "%s", _("no storage vol w..."
-         '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT))  \
+         '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
        | grep -v '_''(' &&                                           \
        { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
ACK to this hunk, independently of the overall issue on why we need this
patch.
Post by Matthias Bolte
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 208ffca..68fe95a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -272,7 +272,7 @@ remoteCheckCertFile(const char *type, const char *file)
     struct stat sb;
     if (stat(file, &sb) < 0) {
         char ebuf[1024];
-        VIR_ERROR(_("Cannot access %s '%s': %s"),
+        VIR_ERROR("Cannot access %s '%s': %s",
                   type, file, virStrerror(errno, ebuf, sizeof ebuf));
         return -1;
     }
Again, this seems like something the user would want to see in their own
language.  So while the rest of this patch looks mechanically correct,
I'm hesitant to give an ACK without more reasoning on which functions
deserve to bypass translation; it may requiring reducing the scope of
this patch.
DanPB's argument [1] against marking log messages for translation was
mainly that they aren't meant for the end user, but for debugging
purpose and to be included in bug reports.
It would also put a huge burden on the translators since these log messages
are not easily translated & there are a hell of alot of them
Post by Matthias Bolte
On the other hand one can argue about VIR_ERROR on the libvirtd side
where it's used to report critical errors like the one you quoted
above.
I could probably be convinced about VIR_ERROR translation :-)

Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Matthias Bolte
2010-04-04 17:36:26 UTC
Permalink
---
src/node_device/node_device_hal.c | 2 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 4bf445d..0174794 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -836,7 +836,7 @@ static int halDeviceMonitorReload(void)
dbus_error_init(&err);
udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
if (udi == NULL) {
- fprintf(stderr, "%s: libhal_get_all_devices failed\n", __FUNCTION__);
+ VIR_ERROR0("libhal_get_all_devices failed");
return -1;
}
for (i = 0; i < num_devs; i++) {
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index cffe027..cdfb92e 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -2106,9 +2106,9 @@ ebiptablesDisplayRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
void *_inst)
{
ebiptablesRuleInstPtr inst = (ebiptablesRuleInstPtr)_inst;
- printf("Command Template: %s\nNeeded protocol: %s\n\n",
- inst->commandTemplate,
- virNWFilterChainSuffixTypeToString(inst->neededProtocolChain));
+ VIR_INFO("Command Template: '%s', Needed protocol: '%s'",
+ inst->commandTemplate,
+ virNWFilterChainSuffixTypeToString(inst->neededProtocolChain));
return 0;
}
--
1.6.3.3
Eric Blake
2010-04-05 16:11:50 UTC
Permalink
Post by Matthias Bolte
---
src/node_device/node_device_hal.c | 2 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 4bf445d..0174794 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -836,7 +836,7 @@ static int halDeviceMonitorReload(void)
dbus_error_init(&err);
udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
if (udi == NULL) {
- fprintf(stderr, "%s: libhal_get_all_devices failed\n", __FUNCTION__);
+ VIR_ERROR0("libhal_get_all_devices failed");
ACK, although this may need modification depending on the answer to my
question on 01/30 on why logging messages don't need translation.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-17 13:11:21 UTC
Permalink
Post by Eric Blake
---
 src/node_device/node_device_hal.c         |    2 +-
 src/nwfilter/nwfilter_ebiptables_driver.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 4bf445d..0174794 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -836,7 +836,7 @@ static int halDeviceMonitorReload(void)
     dbus_error_init(&err);
     udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
     if (udi == NULL) {
-        fprintf(stderr, "%s: libhal_get_all_devices failed\n", __FUNCTION__);
+        VIR_ERROR0("libhal_get_all_devices failed");
ACK, although this may need modification depending on the answer to my
question on 01/30 on why logging messages don't need translation.
The translation issue will be addressed separately.

Thanks, pushed.

Matthias

Matthias Bolte
2010-04-04 17:36:25 UTC
Permalink
---
cfg.mk | 2 +
po/POTFILES.in | 6 +
src/esx/esx_driver.c | 211 +++++++++++++++++----------------
src/esx/esx_util.c | 58 +++++-----
src/esx/esx_vi.c | 274 +++++++++++++++++++++---------------------
src/esx/esx_vi_methods.c | 8 +-
src/esx/esx_vi_types.c | 70 ++++++-----
src/esx/esx_vmx.c | 300 +++++++++++++++++++++++-----------------------
8 files changed, 481 insertions(+), 448 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 619a8e2..8073f34 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -169,6 +169,8 @@ sc_prohibit_gethostby:

msg_gen_function =
msg_gen_function += ReportError
+msg_gen_function += ESX_ERROR
+msg_gen_function += ESX_VI_ERROR
msg_gen_function += errorf
msg_gen_function += lxcError
msg_gen_function += networkReportError
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6c93e2a..a952910 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -17,6 +17,12 @@ src/cpu/cpu_generic.c
src/cpu/cpu_map.c
src/cpu/cpu_x86.c
src/datatypes.c
+src/esx/esx_driver.c
+src/esx/esx_util.c
+src/esx/esx_vi.c
+src/esx/esx_vi_methods.c
+src/esx/esx_vi_types.c
+src/esx/esx_vmx.c
src/interface/netcf_driver.c
src/libvirt.c
src/lxc/lxc_container.c
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index e55c948..a5b87df 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -84,8 +84,8 @@ esxSupportsLongMode(esxPrivate *priv)
}

if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}

@@ -108,9 +108,9 @@ esxSupportsLongMode(esxPrivate *priv)
"%*c%*c%c%*c:"_SKIP12":"_SKIP12":%*c%*c%*c%c",
&edxLongModeBit, &edxFirstBit) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HostSystem property 'hardware.cpuFeature[].edx' "
- "with value '%s' doesn't have expected format "
- "'----:----:----:----:----:----:----:----'",
+ _("HostSystem property 'hardware.cpuFeature[].edx' "
+ "with value '%s' doesn't have expected format "
+ "'----:----:----:----:----:----:----:----'"),
hostCpuIdInfo->edx);
goto failure;
}
@@ -124,10 +124,10 @@ esxSupportsLongMode(esxPrivate *priv)
priv->supportsLongMode = esxVI_Boolean_False;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Bit 29 (Long Mode) of HostSystem property "
- "'hardware.cpuFeature[].edx' with value '%s' "
- "has unexpected value '%c', expecting '0' "
- "or '1'", hostCpuIdInfo->edx, edxLongModeBit);
+ _("Bit 29 (Long Mode) of HostSystem property "
+ "'hardware.cpuFeature[].edx' with value '%s' "
+ "has unexpected value '%c', expecting '0' "
+ "or '1'"), hostCpuIdInfo->edx, edxLongModeBit);
goto failure;
}

@@ -358,7 +358,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
username = virRequestUsername(auth, "root", conn->uri->server);

if (username == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto failure;
}
}
@@ -370,7 +370,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
password = virRequestPassword(auth, username, conn->uri->server);

if (password == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto failure;
}

@@ -383,14 +383,14 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (priv->host->productVersion != esxVI_ProductVersion_ESX35 &&
priv->host->productVersion != esxVI_ProductVersion_ESX40) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s is neither an ESX 3.5 host nor an ESX 4.0 host",
+ _("%s is neither an ESX 3.5 host nor an ESX 4.0 host"),
conn->uri->server);
goto failure;
}
} else { /* GSX */
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s isn't a GSX 2.0 host", conn->uri->server);
+ _("%s isn't a GSX 2.0 host"), conn->uri->server);
goto failure;
}
}
@@ -457,16 +457,17 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (virStrcpyStatic(vCenterIpAddress,
dynamicProperty->val->string) == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "vCenter IP address %s too big for "
- "destination", dynamicProperty->val->string);
+ _("vCenter IP address %s too big for "
+ "destination"),
+ dynamicProperty->val->string);
goto failure;
}
} else if (STRNEQ(vCenterIpAddress,
dynamicProperty->val->string)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "This host is managed by a vCenter with IP "
- "address %s, but a mismachting vCenter '%s' "
- "(%s) has been specified",
+ _("This host is managed by a vCenter with IP "
+ "address %s, but a mismachting vCenter '%s' "
+ "(%s) has been specified"),
dynamicProperty->val->string, vCenter,
vCenterIpAddress);
goto failure;
@@ -477,8 +478,8 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
}

if (STREQ(vCenter, "*")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "This host is not managed by a vCenter");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("This host is not managed by a vCenter"));
goto failure;
}

@@ -495,14 +496,14 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
username = virRequestUsername(auth, "administrator", vCenter);

if (username == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto failure;
}

password = virRequestPassword(auth, username, vCenter);

if (password == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto failure;
}

@@ -514,8 +515,8 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 &&
priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s is neither a vCenter 2.5 server nor a vCenter "
- "4.0 server", conn->uri->server);
+ _("%s is neither a vCenter 2.5 server nor a vCenter "
+ "4.0 server"), conn->uri->server);
goto failure;
}
}
@@ -613,8 +614,8 @@ esxSupportsVMotion(esxPrivate *priv)
}

if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}

@@ -688,7 +689,7 @@ esxGetVersion(virConnectPtr conn, unsigned long *version)
if (virParseVersionString(priv->host->service->about->version,
version) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse version number from '%s'",
+ _("Could not parse version number from '%s'"),
priv->host->service->about->version);

return -1;
@@ -725,8 +726,8 @@ esxGetHostname(virConnectPtr conn)
}

if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}

@@ -754,8 +755,8 @@ esxGetHostname(virConnectPtr conn)
}

if (hostName == NULL || strlen(hostName) < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing or empty 'hostName' property");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing or empty 'hostName' property"));
goto failure;
}

@@ -824,8 +825,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
}

if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}

@@ -906,7 +907,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
sizeof(nodeinfo->model) - 1,
sizeof(nodeinfo->model)) == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "CPU Model %s too long for destination",
+ _("CPU Model %s too long for destination"),
dynamicProperty->val->string);
goto failure;
}
@@ -1003,7 +1004,7 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
&ids[count]) < 0 ||
ids[count] <= 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Failed to parse positive integer from '%s'",
+ _("Failed to parse positive integer from '%s'"),
virtualMachine->obj->value);
goto failure;
}
@@ -1110,7 +1111,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
}

if (domain == NULL) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with ID %d", id);
+ ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
}

cleanup:
@@ -1208,7 +1209,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
}

if (virtualMachine == NULL) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with name '%s'", name);
+ ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"), name);
goto failure;
}

@@ -1274,7 +1275,8 @@ esxDomainSuspend(virDomainPtr domain)
}

if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}

@@ -1285,7 +1287,7 @@ esxDomainSuspend(virDomainPtr domain)
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not suspend domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not suspend domain"));
goto failure;
}

@@ -1329,7 +1331,7 @@ esxDomainResume(virDomainPtr domain)
}

if (powerState != esxVI_VirtualMachinePowerState_Suspended) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not suspended");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not suspended"));
goto failure;
}

@@ -1340,7 +1342,7 @@ esxDomainResume(virDomainPtr domain)
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not resume domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not resume domain"));
goto failure;
}

@@ -1382,7 +1384,8 @@ esxDomainShutdown(virDomainPtr domain)
}

if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}

@@ -1427,7 +1430,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
}

if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}

@@ -1481,7 +1485,8 @@ esxDomainDestroy(virDomainPtr domain)
}

if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}

@@ -1492,7 +1497,7 @@ esxDomainDestroy(virDomainPtr domain)
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not destroy domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not destroy domain"));
goto failure;
}

@@ -1556,7 +1561,8 @@ esxDomainGetMaxMemory(virDomainPtr domain)
}

if (dynamicProperty->val->int32 < 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Got invalid memory size %d",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Got invalid memory size %d"),
dynamicProperty->val->int32);
} else {
memoryMB = dynamicProperty->val->int32;
@@ -1616,7 +1622,7 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)

if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not set max-memory to %lu kilobytes", memory);
+ _("Could not set max-memory to %lu kilobytes"), memory);
goto failure;
}

@@ -1670,7 +1676,7 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)

if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not set memory to %lu kilobytes", memory);
+ _("Could not set memory to %lu kilobytes"), memory);
goto failure;
}

@@ -1962,8 +1968,8 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
esxVI_TaskInfoState taskInfoState;

if (nvcpus < 1) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Requested number of virtual CPUs must at least be 1");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Requested number of virtual CPUs must at least be 1"));
goto failure;
}

@@ -1979,8 +1985,8 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)

if (nvcpus > maxVcpus) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Requested number of virtual CPUs is greater than max "
- "allowable number of virtual CPUs for the domain: %d > %d",
+ _("Requested number of virtual CPUs is greater than max "
+ "allowable number of virtual CPUs for the domain: %d > %d"),
nvcpus, maxVcpus);
goto failure;
}
@@ -2004,7 +2010,7 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)

if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not set number of virtual CPUs to %d", nvcpus);
+ _("Could not set number of virtual CPUs to %d"), nvcpus);
goto failure;
}

@@ -2048,8 +2054,8 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
}

if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}

@@ -2193,7 +2199,7 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,

if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Unsupported config format '%s'", nativeFormat);
+ _("Unsupported config format '%s'"), nativeFormat);
return NULL;
}

@@ -2222,7 +2228,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,

if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Unsupported config format '%s'", nativeFormat);
+ _("Unsupported config format '%s'"), nativeFormat);
return NULL;
}

@@ -2373,7 +2379,8 @@ esxDomainCreate(virDomainPtr domain)
}

if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered off");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered off"));
goto failure;
}

@@ -2384,7 +2391,7 @@ esxDomainCreate(virDomainPtr domain)
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not start domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not start domain"));
goto failure;
}

@@ -2446,9 +2453,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)

if (virtualMachine != NULL) {
/* FIXME */
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Domain already exists, editing existing domains is not "
- "supported yet");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain already exists, editing existing domains is not "
+ "supported yet"));
goto failure;
}

@@ -2467,9 +2474,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
* datastore isn't perfect but should work in the majority of cases.
*/
if (def->ndisks < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Domain XML doesn't contain any disks, cannot deduce "
- "datastore and path for VMX file");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain XML doesn't contain any disks, cannot deduce "
+ "datastore and path for VMX file"));
goto failure;
}

@@ -2482,16 +2489,16 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
}

if (disk == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Domain XML doesn't contain any file-based harddisks, "
- "cannot deduce datastore and path for VMX file");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain XML doesn't contain any file-based harddisks, "
+ "cannot deduce datastore and path for VMX file"));
goto failure;
}

if (disk->src == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "First file-based harddisk has no source, cannot deduce "
- "datastore and path for VMX file");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("First file-based harddisk has no source, cannot deduce "
+ "datastore and path for VMX file"));
goto failure;
}

@@ -2502,8 +2509,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)

if (! virFileHasSuffix(fileName, ".vmdk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting source '%s' of first file-based harddisk to be a "
- "VMDK image", disk->src);
+ _("Expecting source '%s' of first file-based harddisk to "
+ "be a VMDK image"), disk->src);
goto failure;
}

@@ -2572,7 +2579,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not define domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not define domain"));
goto failure;
}

@@ -2641,8 +2648,8 @@ esxDomainUndefine(virDomainPtr domain)

if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID,
- "Domain is not suspended or powered off");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not suspended or powered off"));
goto failure;
}

@@ -2725,8 +2732,8 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
int i = 0;

if (*nparams < 3) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Parameter array must have space for 3 items");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Parameter array must have space for 3 items"));
goto failure;
}

@@ -2810,7 +2817,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,

default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Shares level has unknown value %d",
+ _("Shares level has unknown value %d"),
(int)sharesInfo->level);
goto failure;
}
@@ -2874,8 +2881,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,

if (params[i].value.l < 0) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Could not set reservation to %lld MHz, expecting "
- "positive value", params[i].value.l);
+ _("Could not set reservation to %lld MHz, expecting "
+ "positive value"), params[i].value.l);
goto failure;
}

@@ -2888,8 +2895,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,

if (params[i].value.l < -1) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Could not set limit to %lld MHz, expecting "
- "positive value or -1 (unlimited)",
+ _("Could not set limit to %lld MHz, expecting "
+ "positive value or -1 (unlimited)"),
params[i].value.l);
goto failure;
}
@@ -2928,14 +2935,14 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,

default:
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Could not set shares to %d, expecting positive "
- "value or -1 (low), -2 (normal) or -3 (high)",
+ _("Could not set shares to %d, expecting positive "
+ "value or -1 (low), -2 (normal) or -3 (high)"),
params[i].value.i);
goto failure;
}
}
} else {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "Unknown field '%s'",
+ ESX_ERROR(VIR_ERR_INVALID_ARG, _("Unknown field '%s'"),
params[i].field);
goto failure;
}
@@ -2949,8 +2956,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not change scheduler parameters");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not change scheduler parameters"));
goto failure;
}

@@ -3028,14 +3035,14 @@ esxDomainMigratePerform(virDomainPtr domain,
esxVI_TaskInfoState taskInfoState;

if (priv->vCenter == NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Migration not possible without a vCenter");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Migration not possible without a vCenter"));
goto failure;
}

if (dname != NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Renaming domains on migration not supported");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Renaming domains on migration not supported"));
goto failure;
}

@@ -3086,12 +3093,12 @@ esxDomainMigratePerform(virDomainPtr domain,
*/
if (eventList->fullFormattedMessage != NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not migrate domain, validation reported a "
- "problem: %s", eventList->fullFormattedMessage);
+ _("Could not migrate domain, validation reported a "
+ "problem: %s"), eventList->fullFormattedMessage);
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not migrate domain, validation reported a "
- "problem");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not migrate domain, validation reported a "
+ "problem"));
}

goto failure;
@@ -3109,9 +3116,9 @@ esxDomainMigratePerform(virDomainPtr domain,
}

if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not migrate domain, migration task finished with "
- "an error");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not migrate domain, migration task finished with "
+ "an error"));
goto failure;
}

@@ -3201,8 +3208,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
}

if (resourcePoolResourceUsage == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve memory usage of resource pool");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve memory usage of resource pool"));
goto failure;
}

diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 801b4b0..e8fd261 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -101,8 +101,8 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,

if (STRNEQ(*transport, "http") && STRNEQ(*transport, "https")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Query parameter 'transport' has unexpected value "
- "'%s' (should be http|https)", *transport);
+ _("Query parameter 'transport' has unexpected value "
+ "'%s' (should be http|https)"), *transport);
goto failure;
}
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
@@ -124,8 +124,8 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Query parameter 'no_verify' has unexpected value "
- "'%s' (should be 0 or 1)", queryParam->value);
+ _("Query parameter 'no_verify' has unexpected value "
+ "'%s' (should be 0 or 1)"), queryParam->value);
goto failure;
}
} else if (STRCASEEQ(queryParam->name, "auto_answer")) {
@@ -136,8 +136,8 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
if (virStrToLong_i(queryParam->value, NULL, 10, autoAnswer) < 0 ||
(*autoAnswer != 0 && *autoAnswer != 1)) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Query parameter 'auto_answer' has unexpected value "
- "'%s' (should be 0 or 1)", queryParam->value);
+ _("Query parameter 'auto_answer' has unexpected "
+ "value '%s' (should be 0 or 1)"), queryParam->value);
goto failure;
}
} else {
@@ -213,7 +213,7 @@ esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
if (datastoreName == NULL || *datastoreName != NULL ||
directoryName == NULL || *directoryName != NULL ||
fileName == NULL || *fileName != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -234,8 +234,8 @@ esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
if (sscanf(datastoreRelatedPath, "[%a[^]%]] %a[^\n]", datastoreName,
&directoryAndFileName) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Datastore related path '%s' doesn't have expected format "
- "'[<datastore>] <path>'", datastoreRelatedPath);
+ _("Datastore related path '%s' doesn't have expected format "
+ "'[<datastore>] <path>'"), datastoreRelatedPath);
goto failure;
}

@@ -250,7 +250,7 @@ esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,

if (*separator == '\0') {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Datastore related path '%s' doesn't reference a file",
+ _("Datastore related path '%s' doesn't reference a file"),
datastoreRelatedPath);
goto failure;
}
@@ -302,14 +302,14 @@ esxUtil_ResolveHostname(const char *hostname,

if (errcode != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IP address lookup for host '%s' failed: %s", hostname,
+ _("IP address lookup for host '%s' failed: %s"), hostname,
gai_strerror(errcode));
return -1;
}

if (result == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "No IP address for host '%s' found: %s", hostname,
+ _("No IP address for host '%s' found: %s"), hostname,
gai_strerror(errcode));
return -1;
}
@@ -319,7 +319,7 @@ esxUtil_ResolveHostname(const char *hostname,

if (errcode != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Formating IP address for host '%s' failed: %s", hostname,
+ _("Formating IP address for host '%s' failed: %s"), hostname,
gai_strerror(errcode));
freeaddrinfo(result);
return -1;
@@ -347,13 +347,13 @@ esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
}

ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}

if (value->type != VIR_CONF_STRING) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}

@@ -363,7 +363,7 @@ esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
}

ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}

@@ -392,14 +392,14 @@ esxUtil_GetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid,
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}

if (value->type != VIR_CONF_STRING) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}

@@ -408,14 +408,14 @@ esxUtil_GetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid,
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}

if (virUUIDParse(value->str, uuid) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse UUID from string '%s'", value->str);
+ _("Could not parse UUID from string '%s'"), value->str);
return -1;
}

@@ -438,7 +438,7 @@ esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
@@ -449,7 +449,7 @@ esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
@@ -458,13 +458,13 @@ esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
*number = -1;
} else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must represent an integer value",
+ _("Config entry '%s' must represent an integer value"),
name);
return -1;
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}

@@ -487,7 +487,7 @@ esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
@@ -498,7 +498,7 @@ esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
@@ -509,13 +509,13 @@ esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
*boolean_ = 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must represent a boolean value "
- "(true|false)", name);
+ _("Config entry '%s' must represent a boolean value "
+ "(true|false)"), name);
return -1;
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}

diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index c1fd4b4..5ed1391 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -252,7 +252,7 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)

if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_perform() returned an error: %s (%d) : %s",
+ _("curl_easy_perform() returned an error: %s (%d) : %s"),
curl_easy_strerror(errorCode), errorCode, ctx->curl_error);
return -1;
}
@@ -262,16 +262,16 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)

if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
- "error: %s (%d) : %s", curl_easy_strerror(errorCode),
+ _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
+ "error: %s (%d) : %s"), curl_easy_strerror(errorCode),
errorCode, ctx->curl_error);
return -1;
}

if (responseCode < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
- "negative response code");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
+ "negative response code"));
return -1;
}

@@ -282,17 +282,18 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)

if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
- "an error: %s (%d) : %s", curl_easy_strerror(errorCode),
+ _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
+ "an error: %s (%d) : %s"),
+ curl_easy_strerror(errorCode),
errorCode, ctx->curl_error);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "The server redirects from '%s' to '%s'", url,
+ _("The server redirects from '%s' to '%s'"), url,
redirectUrl);
}
#else
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "The server redirects from '%s'", url);
+ _("The server redirects from '%s'"), url);
#endif

return -1;
@@ -314,7 +315,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL ||
password == NULL || ctx->url != NULL || ctx->service != NULL ||
ctx->curl_handle != NULL || ctx->curl_headers != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}

@@ -326,7 +327,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->curl_handle = curl_easy_init();

if (ctx->curl_handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL"));
goto failure;
}

@@ -345,7 +347,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
"Expect: nothing");

if (ctx->curl_headers == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not build CURL header list");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not build CURL header list"));
goto failure;
}

@@ -369,7 +372,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
#endif

if (virMutexInit(&ctx->curl_lock) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL mutex");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL mutex"));
goto failure;
}

@@ -393,8 +397,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->apiVersion = esxVI_APIVersion_40;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API major/minor version '2.5' or '4.0' "
- "but found '%s'", ctx->service->about->apiVersion);
+ _("Expecting VI API major/minor version '2.5' or '4.0' "
+ "but found '%s'"), ctx->service->about->apiVersion);
goto failure;
}

@@ -403,8 +407,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->productVersion = esxVI_ProductVersion_GSX20;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting GSX major/minor version '2.0' but "
- "found '%s'", ctx->service->about->version);
+ _("Expecting GSX major/minor version '2.0' but "
+ "found '%s'"), ctx->service->about->version);
goto failure;
}
} else if (STREQ(ctx->service->about->productLineId, "esx") ||
@@ -415,8 +419,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->productVersion = esxVI_ProductVersion_ESX40;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting ESX major/minor version '3.5' or "
- "'4.0' but found '%s'",
+ _("Expecting ESX major/minor version '3.5' or "
+ "'4.0' but found '%s'"),
ctx->service->about->version);
goto failure;
}
@@ -427,21 +431,21 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->productVersion = esxVI_ProductVersion_VPX40;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VPX major/minor version '2.5' or '4.0' "
- "but found '%s'", ctx->service->about->version);
+ _("Expecting VPX major/minor version '2.5' or '4.0' "
+ "but found '%s'"), ctx->service->about->version);
goto failure;
}
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
- "or 'vpx' but found '%s'",
+ _("Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
+ "or 'vpx' but found '%s'"),
ctx->service->about->productLineId);
goto failure;
}
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API type 'HostAgent' or 'VirtualCenter' "
- "but found '%s'", ctx->service->about->apiType);
+ _("Expecting VI API type 'HostAgent' or 'VirtualCenter' "
+ "but found '%s'"), ctx->service->about->apiType);
goto failure;
}

@@ -466,9 +470,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
}

if (datacenterList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the 'datacenter' object from the VI "
- "host/center");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the 'datacenter' object from the "
+ "VI host/center"));
goto failure;
}

@@ -494,9 +498,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
}

if (ctx->vmFolder == NULL || ctx->hostFolder == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "The 'datacenter' object is missing the "
- "'vmFolder'/'hostFolder' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("The 'datacenter' object is missing the "
+ "'vmFolder'/'hostFolder' property"));
goto failure;
}

@@ -519,7 +523,7 @@ esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url, char **content)
int responseCode = 0;

if (content == NULL || *content != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}

@@ -538,7 +542,7 @@ esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url, char **content)
goto failure;
} else if (responseCode != 200) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for download from '%s'",
+ _("HTTP response code %d for download from '%s'"),
responseCode, url);
goto failure;
}
@@ -565,7 +569,7 @@ esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
int responseCode = 0;

if (content == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -584,7 +588,7 @@ esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
return -1;
} else if (responseCode != 200 && responseCode != 201) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for upload to '%s'",
+ _("HTTP response code %d for upload to '%s'"),
responseCode, url);
return -1;
}
@@ -605,7 +609,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
xmlNodePtr responseNode = NULL;

if (request == NULL || response == NULL || *response != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}

@@ -642,14 +646,14 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,

if ((*response)->document == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Response for call to '%s' could not be parsed",
+ _("Response for call to '%s' could not be parsed"),
methodName);
goto failure;
}

if (xmlDocGetRootElement((*response)->document) == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Response for call to '%s' is an empty XML document",
+ _("Response for call to '%s' is an empty XML document"),
methodName);
goto failure;
}
@@ -657,8 +661,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
xpathContext = xmlXPathNewContext((*response)->document);

if (xpathContext == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not create XPath context");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not create XPath context"));
goto failure;
}

@@ -673,23 +677,23 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,

if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'. "
- "Fault is unknown, XPath evaluation failed",
+ _("HTTP response code %d for call to '%s'. "
+ "Fault is unknown, XPath evaluation failed"),
(*response)->responseCode, methodName);
goto failure;
}

if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'. "
- "Fault is unknown, deserialization failed",
+ _("HTTP response code %d for call to '%s'. "
+ "Fault is unknown, deserialization failed"),
(*response)->responseCode, methodName);
goto failure;
}

ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'. "
- "Fault: %s - %s", (*response)->responseCode,
+ _("HTTP response code %d for call to '%s'. "
+ "Fault: %s - %s"), (*response)->responseCode,
methodName, fault->faultcode, fault->faultstring);

/* FIXME: Dump raw response until detail part gets deserialized */
@@ -710,8 +714,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,

if (responseNode == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "XPath evaluation of response for call to '%s' "
- "failed", methodName);
+ _("XPath evaluation of response for call to '%s' "
+ "failed"), methodName);
goto failure;
}

@@ -722,13 +726,13 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_RequiredItem:
if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned an empty result, "
- "expecting a non-empty result", methodName);
+ _("Call to '%s' returned an empty result, "
+ "expecting a non-empty result"), methodName);
goto failure;
} else if ((*response)->node->next != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned a list, expecting "
- "exactly one item", methodName);
+ _("Call to '%s' returned a list, expecting "
+ "exactly one item"), methodName);
goto failure;
}

@@ -737,8 +741,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_RequiredList:
if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned an empty result, "
- "expecting a non-empty result", methodName);
+ _("Call to '%s' returned an empty result, "
+ "expecting a non-empty result"), methodName);
goto failure;
}

@@ -748,8 +752,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
if ((*response)->node != NULL &&
(*response)->node->next != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned a list, expecting "
- "exactly one item", methodName);
+ _("Call to '%s' returned a list, expecting "
+ "exactly one item"), methodName);
goto failure;
}

@@ -762,22 +766,22 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_None:
if ((*response)->node != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned something, expecting "
- "an empty result", methodName);
+ _("Call to '%s' returned something, expecting "
+ "an empty result"), methodName);
goto failure;
}

break;

default:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid argument (occurrence)");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Invalid argument (occurrence)"));
goto failure;
}
}
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'",
+ _("HTTP response code %d for call to '%s'"),
(*response)->responseCode, methodName);
goto failure;
}
@@ -830,7 +834,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
int i;

if (anyType == NULL || value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -838,7 +842,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,

if (anyType->type != enumeration->type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type '%s' but found '%s'",
+ _("Expecting type '%s' but found '%s'"),
esxVI_Type_ToString(enumeration->type),
esxVI_Type_ToString(anyType->type));
return -1;
@@ -852,7 +856,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
}

ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unknown value '%s' for %s", anyType->value,
+ _("Unknown value '%s' for %s"), anyType->value,
esxVI_Type_ToString(enumeration->type));

return -1;
@@ -866,7 +870,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
const char *name = NULL;

if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -882,7 +886,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
}

if (name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -905,7 +909,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
char *name = NULL;

if (value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}

@@ -922,7 +926,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
}
}

- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unknown value '%s' for %s"),
name, esxVI_Type_ToString(enumeration->type));

cleanup:
@@ -948,7 +952,7 @@ esxVI_List_Append(esxVI_List **list, esxVI_List *item)
esxVI_List *next = NULL;

if (list == NULL || item == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -977,7 +981,7 @@ esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
esxVI_List *src = NULL;

if (destList == NULL || *destList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}

@@ -1011,7 +1015,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,

if (list == NULL || *list != NULL ||
castFromAnyTypeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1021,7 +1025,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,

if (! STRPREFIX(anyType->other, "ArrayOf")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type to begin with 'ArrayOf' but found '%s'",
+ _("Expecting type to begin with 'ArrayOf' but found '%s'"),
anyType->other);
return -1;
}
@@ -1030,7 +1034,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Wrong XML element type %d", childNode->type);
+ _("Wrong XML element type %d"), childNode->type);
goto failure;
}

@@ -1067,7 +1071,7 @@ esxVI_List_Serialize(esxVI_List *list, const char *element,
esxVI_List *item = NULL;

if (element == NULL || output == NULL || serializeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1093,7 +1097,7 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,

if (list == NULL || *list != NULL ||
deserializeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1104,7 +1108,7 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
for (; node != NULL; node = node->next) {
if (node->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Wrong XML element type %d", node->type);
+ _("Wrong XML element type %d"), node->type);
goto failure;
}

@@ -1139,7 +1143,7 @@ int
esxVI_Alloc(void **ptrptr, size_t size)
{
if (ptrptr == NULL || *ptrptr != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1163,7 +1167,7 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
const char *currentSelectSetName = NULL;

if (fullTraversalSpecList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1214,7 +1218,7 @@ int
esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList)
{
if (fullTraversalSpecList == NULL || *fullTraversalSpecList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1332,7 +1336,7 @@ esxVI_EnsureSession(esxVI_Context *ctx)
#endif

if (ctx->session == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call"));
return -1;
}

@@ -1383,9 +1387,9 @@ esxVI_EnsureSession(esxVI_Context *ctx)
goto failure;
}
} else if (STRNEQ(ctx->session->key, currentSession->key)) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Key of the current session differs from the key at "
- "last login");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Key of the current session differs from the key at "
+ "last login"));
goto failure;
}

@@ -1419,7 +1423,7 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;

if (ctx->fullTraversalSpecList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call"));
return -1;
}

@@ -1495,8 +1499,8 @@ esxVI_GetManagedEntityStatus(esxVI_ObjectContent *objectContent,
}

ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing '%s' property while looking for ManagedEntityStatus",
- propertyName);
+ _("Missing '%s' property while looking for "
+ "ManagedEntityStatus"), propertyName);

return -1;
}
@@ -1517,8 +1521,8 @@ esxVI_GetVirtualMachinePowerState(esxVI_ObjectContent *virtualMachine,
}
}

- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing 'runtime.powerState' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing 'runtime.powerState' property"));

return -1;
}
@@ -1533,7 +1537,7 @@ esxVI_GetVirtualMachineQuestionInfo
esxVI_DynamicProperty *dynamicProperty;

if (questionInfo == NULL || *questionInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1618,8 +1622,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined;

if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "ObjectContent does not reference a virtual machine");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ObjectContent does not reference a virtual machine"));
return -1;
}

@@ -1627,7 +1631,7 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
if (esxUtil_ParseVirtualMachineIDString
(virtualMachine->obj->value, id) < 0 || *id <= 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse positive integer from '%s'",
+ _("Could not parse positive integer from '%s'"),
virtualMachine->obj->value);
goto failure;
}
@@ -1635,7 +1639,7 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,

if (name != NULL) {
if (*name != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}

@@ -1660,8 +1664,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
}

if (*name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not get name of virtual machine");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get name of virtual machine"));
goto failure;
}
}
@@ -1688,14 +1692,14 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
}

if (uuid_string == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not get UUID of virtual machine");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get UUID of virtual machine"));
goto failure;
}

if (virUUIDParse(uuid_string, uuid) < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse UUID from string '%s'",
+ _("Could not parse UUID from string '%s'"),
uuid_string);
goto failure;
}
@@ -1731,7 +1735,7 @@ esxVI_LookupResourcePoolByHostSystem
esxVI_ObjectContent *computeResource = NULL;

if (resourcePool == NULL || *resourcePool != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1750,8 +1754,8 @@ esxVI_LookupResourcePoolByHostSystem
}

if (managedObjectReference == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve compute resource of host system");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve compute resource of host system"));
goto failure;
}

@@ -1764,8 +1768,8 @@ esxVI_LookupResourcePoolByHostSystem
}

if (computeResource == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve compute resource of host system");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve compute resource of host system"));
goto failure;
}

@@ -1784,8 +1788,8 @@ esxVI_LookupResourcePoolByHostSystem
}

if ((*resourcePool) == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve resource pool of compute resource");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve resource pool of compute resource"));
goto failure;
}

@@ -1813,7 +1817,7 @@ esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
esxVI_ManagedObjectReference *managedObjectReference = NULL;

if (hostSystem == NULL || *hostSystem != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1852,7 +1856,7 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";

if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1868,7 +1872,8 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
return 0;
} else {
ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
- "Could not find domain with UUID '%s'", uuid_string);
+ _("Could not find domain with UUID '%s'"),
+ uuid_string);
goto failure;
}
}
@@ -1906,7 +1911,7 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name,
char *name_candidate = NULL;

if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1945,7 +1950,7 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name,
return 0;
} else {
ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
- "Could not find domain with name '%s'", name);
+ _("Could not find domain with name '%s'"), name);
goto failure;
}
}
@@ -1998,8 +2003,8 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
}

if (pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID,
- "Other tasks are pending for this domain");
+ ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Other tasks are pending for this domain"));
goto failure;
}

@@ -2034,7 +2039,7 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
int numInaccessibleDatastores = 0;

if (datastore == NULL || *datastore != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2059,7 +2064,8 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
if (occurrence == esxVI_Occurrence_OptionalItem) {
goto cleanup;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "No datastores available");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No datastores available"));
goto failure;
}
}
@@ -2083,9 +2089,9 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
}

if (accessible == esxVI_Boolean_Undefined) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Got incomplete response while querying for the "
- "datastore 'summary.accessible' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Got incomplete response while querying for the "
+ "datastore 'summary.accessible' property"));
goto failure;
}

@@ -2129,8 +2135,8 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
if (! STRPREFIX(dynamicProperty->val->string,
"/vmfs/volumes/")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Datastore URL '%s' has unexpected prefix, "
- "expecting '/vmfs/volumes/' prefix",
+ _("Datastore URL '%s' has unexpected prefix, "
+ "expecting '/vmfs/volumes/' prefix"),
dynamicProperty->val->string);
goto failure;
}
@@ -2153,11 +2159,11 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
if (occurrence != esxVI_Occurrence_OptionalItem) {
if (numInaccessibleDatastores > 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not find datastore '%s', maybe it's "
- "inaccessible", name);
+ _("Could not find datastore '%s', maybe it's "
+ "inaccessible"), name);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not find datastore '%s'", name);
+ _("Could not find datastore '%s'"), name);
}

goto failure;
@@ -2187,7 +2193,7 @@ int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
esxVI_DynamicProperty *dynamicProperty = NULL;

if (taskInfo == NULL || *taskInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2239,7 +2245,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
esxVI_TaskInfo *taskInfo = NULL;

if (pendingTaskInfoList == NULL || *pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2377,15 +2383,15 @@ esxVI_HandleVirtualMachineQuestion
if (autoAnswer == esxVI_Boolean_True) {
if (possibleAnswers == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', no possible answers",
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', no possible answers"),
questionInfo->text);
goto failure;
} else if (answerChoice == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', possible answers are %s, but no "
- "default answer is specified", questionInfo->text,
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', possible answers are %s, but no "
+ "default answer is specified"), questionInfo->text,
possibleAnswers);
goto failure;
}
@@ -2402,13 +2408,13 @@ esxVI_HandleVirtualMachineQuestion
} else {
if (possibleAnswers != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', possible answers are %s",
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', possible answers are %s"),
questionInfo->text, possibleAnswers);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', no possible answers",
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', no possible answers"),
questionInfo->text);
}

diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index f1234ae..87b7910 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -109,7 +109,7 @@

#define ESX_VI__METHOD__CHECK_SERVICE() \
if (ctx->service == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); \
return -1; \
}

@@ -117,7 +117,7 @@

#define ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(_name) \
if (_name == NULL || *_name != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
return -1; \
}

@@ -198,7 +198,7 @@ esxVI_RetrieveServiceContent(esxVI_Context *ctx,
esxVI_Response *response = NULL;

if (serviceContent == NULL || *serviceContent != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -276,7 +276,7 @@ ESX_VI__METHOD(SessionIsActive,
ESX_VI__METHOD__CHECK_SERVICE()

if (active == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
},
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 3a30712..500f8f1 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -123,7 +123,8 @@
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
{ \
if (dest == NULL || *dest != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
@@ -213,7 +214,8 @@
esxVI_##_type **ptrptr) \
{ \
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
@@ -236,7 +238,8 @@
const char *element, virBufferPtr output) \
{ \
if (element == NULL || output == NULL ) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
@@ -274,7 +277,8 @@
xmlNodePtr childNode = NULL; \
\
if (ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
@@ -318,7 +322,8 @@
long long value; \
\
if (number == NULL || *number != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
@@ -565,7 +570,8 @@
esxVI_##__type##_DynamicCast(void *item) \
{ \
if (item == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return NULL; \
} \
\
@@ -709,7 +715,7 @@ esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
{
if (anyType->type != type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type '%s' but found '%s'",
+ _("Expecting type '%s' but found '%s'"),
esxVI_Type_ToString(type),
anyType->type != esxVI_Type_Other
? esxVI_Type_ToString(anyType->type)
@@ -724,7 +730,7 @@ int
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -740,7 +746,8 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
(*dest)->node = xmlCopyNode(src->node, 1);

if ((*dest)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy an XML node"));
goto failure;
}

@@ -790,7 +797,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
long long int number;

if (anyType == NULL || *anyType != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -801,7 +808,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->node = xmlCopyNode(node, 1);

if ((*anyType)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy an XML node"));
goto failure;
}

@@ -811,8 +819,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");

if ((*anyType)->other == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "AnyType is missing 'type' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("AnyType is missing 'type' property"));
goto failure;
}

@@ -820,7 +828,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)

if ((*anyType)->type == esxVI_Type_Undefined) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unknown value '%s' for AnyType 'type' property",
+ _("Unknown value '%s' for AnyType 'type' property"),
(*anyType)->other);
goto failure;
}
@@ -837,19 +845,19 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
}
}

-#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
+#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
do { \
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Unknown value '%s' for "_xsdType, \
- (*anyType)->value); \
+ _("Unknown value '%s' for %s"), \
+ (*anyType)->value, _xsdType); \
goto failure; \
} \
\
if (number < (_min) || number > (_max)) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Value '%s' is out of "_xsdType" range", \
- (*anyType)->value); \
+ _("Value '%s' is out of %s range"), \
+ (*anyType)->value, _xsdType); \
goto failure; \
} \
\
@@ -864,7 +872,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->boolean = esxVI_Boolean_False;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unknown value '%s' for xsd:boolean",
+ _("Unknown value '%s' for xsd:boolean"),
(*anyType)->value);
goto failure;
}
@@ -995,7 +1003,7 @@ int
esxVI_String_DeepCopyValue(char **dest, const char *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1029,7 +1037,7 @@ esxVI_String_SerializeValue(const char *value, const char *element,
virBufferPtr output)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1059,7 +1067,7 @@ int
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
{
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1184,7 +1192,7 @@ int
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
{
if (dateTime == NULL || *dateTime != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1196,9 +1204,9 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
(char *)xmlNodeListGetString(node->doc, node->children, 1);

if ((*dateTime)->value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "XML node doesn't contain text, expecting an "
- "xsd:dateTime value");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("XML node doesn't contain text, expecting an "
+ "xsd:dateTime value"));
goto failure;
}

@@ -1281,7 +1289,7 @@ esxVI_ManagedObjectReference_Serialize
const char *element, virBufferPtr output)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1311,7 +1319,7 @@ esxVI_ManagedObjectReference_Deserialize
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
{
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1323,8 +1331,8 @@ esxVI_ManagedObjectReference_Deserialize
(char *)xmlGetNoNsProp(node, BAD_CAST "type");

if ((*managedObjectReference)->type == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "ManagedObjectReference is missing 'type' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ManagedObjectReference is missing 'type' property"));
goto failure;
}

diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index c6a92bf..e4512b3 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -438,9 +438,9 @@ esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id)
int idx;

if (! STRPREFIX(name, "sd")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with 'sd'");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry "
+ "'devices/disk/target' to start with 'sd'"));
return -1;
}

@@ -448,14 +448,14 @@ esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id)

if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse valid disk index from '%s'", name);
+ _("Could not parse valid disk index from '%s'"), name);
return -1;
}

/* Each of the 4 SCSI controllers offers 15 IDs for devices */
if (idx >= (4 * 15)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI disk index (parsed from '%s') is too large", name);
+ _("SCSI disk index (parsed from '%s') is too large"), name);
return -1;
}

@@ -478,9 +478,9 @@ esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id)
int idx;

if (! STRPREFIX(name, "hd")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with 'hd'");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry "
+ "'devices/disk/target' to start with 'hd'"));
return -1;
}

@@ -488,14 +488,14 @@ esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id)

if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse valid disk index from '%s'", name);
+ _("Could not parse valid disk index from '%s'"), name);
return -1;
}

/* Each of the 2 IDE controllers offers 2 IDs for devices */
if (idx >= (2 * 2)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IDE disk index (parsed from '%s') is too large", name);
+ _("IDE disk index (parsed from '%s') is too large"), name);
return -1;
}

@@ -513,9 +513,9 @@ esxVMX_FloppyDiskNameToController(const char *name, int *controller)
int idx;

if (! STRPREFIX(name, "fd")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with 'fd'");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry "
+ "'devices/disk/target' to start with 'fd'"));
return -1;
}

@@ -523,13 +523,13 @@ esxVMX_FloppyDiskNameToController(const char *name, int *controller)

if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse valid disk index from '%s'", name);
+ _("Could not parse valid disk index from '%s'"), name);
return -1;
}

if (idx >= 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Floppy disk index (parsed from '%s') is too large", name);
+ _("Floppy disk index (parsed from '%s') is too large"), name);
return -1;
}

@@ -559,8 +559,8 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
STRCASENEQ(disk->driverName, "buslogic") &&
STRCASENEQ(disk->driverName, "lsilogic")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'devices/disk/target' to be "
- "'buslogic' or 'lsilogic' but found '%s'",
+ _("Expecting domain XML entry 'devices/disk/target' to "
+ "be 'buslogic' or 'lsilogic' but found '%s'"),
disk->driverName);
return -1;
}
@@ -576,8 +576,8 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
virtualDev[controller] = disk->driverName;
} else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Inconsistent driver usage ('%s' is not '%s') on SCSI "
- "controller index %d", virtualDev[controller],
+ _("Inconsistent driver usage ('%s' is not '%s') on SCSI "
+ "controller index %d"), virtualDev[controller],
disk->driverName, controller);
return -1;
}
@@ -602,8 +602,8 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
if (sscanf(absolutePath, "/vmfs/volumes/%a[^/]/%a[^\n]",
&preliminaryDatastoreName, &directoryAndFileName) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Absolute path '%s' doesn't have expected format "
- "'/vmfs/volumes/<datastore>/<path>'", absolutePath);
+ _("Absolute path '%s' doesn't have expected format "
+ "'/vmfs/volumes/<datastore>/<path>'"), absolutePath);
goto failure;
}

@@ -697,8 +697,8 @@ esxVMX_ParseFileName(esxVI_Context *ctx, const char *fileName,
} else if (strchr(fileName, '/') != NULL) {
/* Found relative path, this is not supported */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Found relative path '%s' in VMX file, this is not "
- "supported", fileName);
+ _("Found relative path '%s' in VMX file, this is not "
+ "supported"), fileName);
return NULL;
} else {
/* Found single file name referencing a file inside a datastore */
@@ -758,8 +758,8 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,

if (config_version != 8) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'config.version' to be 8 but found "
- "%lld", config_version);
+ _("Expecting VMX entry 'config.version' to be 8 but found "
+ "%lld"), config_version);
goto failure;
}

@@ -773,8 +773,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
case esxVI_APIVersion_25:
if (virtualHW_version != 4) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'virtualHW.version' to be 4 for "
- "VI API version 2.5 but found %lld", virtualHW_version);
+ _("Expecting VMX entry 'virtualHW.version' to be 4 for "
+ "VI API version 2.5 but found %lld"),
+ virtualHW_version);
goto failure;
}

@@ -783,8 +784,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
case esxVI_APIVersion_40:
if (virtualHW_version != 4 && virtualHW_version != 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'virtualHW.version' to be 4 or 7 for "
- "VI API version 4.0 but found %lld", virtualHW_version);
+ _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
+ "for VI API version 4.0 but found %lld"),
+ virtualHW_version);
goto failure;
}

@@ -793,16 +795,16 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
case esxVI_APIVersion_Unknown:
if (virtualHW_version != 4 && virtualHW_version != 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
- "but found %lld", virtualHW_version);
+ _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
+ "but found %lld"), virtualHW_version);
goto failure;
}

break;

default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API version 2.5 or 4.0");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting VI API version 2.5 or 4.0"));
goto failure;
}

@@ -824,8 +826,8 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,

if (memsize <= 0 || memsize % 4 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'memsize' to be an unsigned "
- "integer (multiple of 4) but found %lld", memsize);
+ _("Expecting VMX entry 'memsize' to be an unsigned "
+ "integer (multiple of 4) but found %lld"), memsize);
goto failure;
}

@@ -853,8 +855,8 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,

if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'numvcpus' to be an unsigned "
- "integer (1 or a multiple of 2) but found %lld", numvcpus);
+ _("Expecting VMX entry 'numvcpus' to be an unsigned "
+ "integer (1 or a multiple of 2) but found %lld"), numvcpus);
goto failure;
}

@@ -885,16 +887,16 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,

if (number < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'sched.cpu.affinity' to be "
- "a comma separated list of unsigned integers but "
- "found '%s'", sched_cpu_affinity);
+ _("Expecting VMX entry 'sched.cpu.affinity' to be "
+ "a comma separated list of unsigned integers but "
+ "found '%s'"), sched_cpu_affinity);
goto failure;
}

if (number >= VIR_DOMAIN_CPUMASK_LEN) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "VMX entry 'sched.cpu.affinity' contains a %d, this "
- "value is too large", number);
+ _("VMX entry 'sched.cpu.affinity' contains a %d, "
+ "this value is too large"), number);
goto failure;
}

@@ -913,9 +915,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
break;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'sched.cpu.affinity' to be "
- "a comma separated list of unsigned integers but "
- "found '%s'", sched_cpu_affinity);
+ _("Expecting VMX entry 'sched.cpu.affinity' to be "
+ "a comma separated list of unsigned integers but "
+ "found '%s'"), sched_cpu_affinity);
goto failure;
}

@@ -924,9 +926,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,

if (count < numvcpus) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'sched.cpu.affinity' to contain "
- "at least as many values as 'numvcpus' (%lld) but "
- "found only %d value(s)", numvcpus, count);
+ _("Expecting VMX entry 'sched.cpu.affinity' to contain "
+ "at least as many values as 'numvcpus' (%lld) but "
+ "found only %d value(s)"), numvcpus, count);
goto failure;
}
}
@@ -1175,7 +1177,7 @@ esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
long long port = 0;

if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1240,13 +1242,13 @@ esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
char virtualDev_name[32];

if (virtualDev == NULL || *virtualDev != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI controller index %d out of [0..3] range",
+ _("SCSI controller index %d out of [0..3] range"),
controller);
return -1;
}
@@ -1271,8 +1273,8 @@ esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
STRCASENEQ(*virtualDev, "buslogic") &&
STRCASENEQ(*virtualDev, "lsilogic")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
- "but found '%s'", virtualDev_name, *virtualDev);
+ _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
+ "but found '%s'"), virtualDev_name, *virtualDev);
goto failure;
}

@@ -1352,7 +1354,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
int writeThrough = 0;

if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -1370,14 +1372,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (bus == VIR_DOMAIN_DISK_BUS_SCSI) {
if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI controller index %d out of [0..3] range",
+ _("SCSI controller index %d out of [0..3] range"),
controller);
goto failure;
}

if (id < 0 || id > 15 || id == 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI ID %d out of [0..6,8..15] range", id);
+ _("SCSI ID %d out of [0..6,8..15] range"), id);
goto failure;
}

@@ -1405,14 +1407,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE) {
if (controller < 0 || controller > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IDE controller index %d out of [0..1] range",
+ _("IDE controller index %d out of [0..1] range"),
controller);
goto failure;
}

if (id < 0 || id > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IDE ID %d out of [0..1] range", id);
+ _("IDE ID %d out of [0..1] range"), id);
goto failure;
}

@@ -1428,7 +1430,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for device type '%s'",
+ _("Unsupported bus type '%s' for device type '%s'"),
virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device));
goto failure;
@@ -1437,7 +1439,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (controller < 0 || controller > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Floppy controller index %d out of [0..1] range",
+ _("Floppy controller index %d out of [0..1] range"),
controller);
goto failure;
}
@@ -1454,14 +1456,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for device type '%s'",
+ _("Unsupported bus type '%s' for device type '%s'"),
virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported device type '%s'",
+ _("Unsupported device type '%s'"),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
@@ -1532,14 +1534,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (bus == VIR_DOMAIN_DISK_BUS_SCSI &&
STRCASENEQ(deviceType, "scsi-hardDisk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'scsi-hardDisk' "
- "but found '%s'", deviceType_name, deviceType);
+ _("Expecting VMX entry '%s' to be 'scsi-hardDisk' "
+ "but found '%s'"), deviceType_name, deviceType);
goto failure;
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE &&
STRCASENEQ(deviceType, "ata-hardDisk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'ata-hardDisk' "
- "but found '%s'", deviceType_name, deviceType);
+ _("Expecting VMX entry '%s' to be 'ata-hardDisk' "
+ "but found '%s'"), deviceType_name, deviceType);
goto failure;
}
}
@@ -1574,8 +1576,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
goto ignore;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid or not yet handled value '%s' for VMX entry "
- "'%s'", fileName, fileName_name);
+ _("Invalid or not yet handled value '%s' for VMX entry "
+ "'%s'"), fileName, fileName_name);
goto failure;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
@@ -1583,8 +1585,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (deviceType != NULL) {
if (STRCASENEQ(deviceType, "cdrom-image")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'cdrom-image' "
- "but found '%s'", deviceType_name, deviceType);
+ _("Expecting VMX entry '%s' to be 'cdrom-image' "
+ "but found '%s'"), deviceType_name, deviceType);
goto failure;
}
}
@@ -1611,8 +1613,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
fileName = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid or not yet handled value '%s' for VMX entry "
- "'%s'", fileName, fileName_name);
+ _("Invalid or not yet handled value '%s' for VMX entry "
+ "'%s'"), fileName, fileName_name);
goto failure;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
@@ -1620,8 +1622,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (fileType != NULL) {
if (STRCASENEQ(fileType, "file")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'file' but "
- "found '%s'", fileType_name, fileType);
+ _("Expecting VMX entry '%s' to be 'file' but "
+ "found '%s'"), fileType_name, fileType);
goto failure;
}
}
@@ -1640,12 +1642,12 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
fileName = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid or not yet handled value '%s' for VMX entry "
- "'%s'", fileName, fileName_name);
+ _("Invalid or not yet handled value '%s' for VMX entry "
+ "'%s'"), fileName, fileName_name);
goto failure;
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported device type '%s'",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unsupported device type '%s'"),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
@@ -1704,13 +1706,13 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
char *networkName = NULL;

if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Ethernet controller index %d out of [0..3] range",
+ _("Ethernet controller index %d out of [0..3] range"),
controller);
return -1;
}
@@ -1767,8 +1769,8 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
if (generatedAddress != NULL) {
if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be MAC address but "
- "found '%s'", generatedAddress_name,
+ _("Expecting VMX entry '%s' to be MAC address but "
+ "found '%s'"), generatedAddress_name,
generatedAddress);
goto failure;
}
@@ -1777,15 +1779,15 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
if (address != NULL) {
if (virParseMacAddr(address, (*def)->mac) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be MAC address but "
- "found '%s'", address_name, address);
+ _("Expecting VMX entry '%s' to be MAC address but "
+ "found '%s'"), address_name, address);
goto failure;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'generated' or 'static' or "
- "'vpx' but found '%s'", addressType_name, addressType);
+ _("Expecting VMX entry '%s' to be 'generated' or 'static' or "
+ "'vpx' but found '%s'"), addressType_name, addressType);
goto failure;
}

@@ -1800,8 +1802,8 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
STRCASENEQ(virtualDev, "vmxnet3") &&
STRCASENEQ(virtualDev, "e1000")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
- "'vmxnet3' or 'e1000' but found '%s'", virtualDev_name,
+ _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
+ "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name,
virtualDev);
goto failure;
}
@@ -1831,13 +1833,13 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
} else if (STRCASEEQ(connectionType, "hostonly")) {
/* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "No yet handled value '%s' for VMX entry '%s'",
+ _("No yet handled value '%s' for VMX entry '%s'"),
connectionType, connectionType_name);
goto failure;
} else if (STRCASEEQ(connectionType, "nat")) {
/* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "No yet handled value '%s' for VMX entry '%s'",
+ _("No yet handled value '%s' for VMX entry '%s'"),
connectionType, connectionType_name);
goto failure;
} else if (STRCASEEQ(connectionType, "custom")) {
@@ -1851,7 +1853,7 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
vnet = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid value '%s' for VMX entry '%s'", connectionType,
+ _("Invalid value '%s' for VMX entry '%s'"), connectionType,
connectionType_name);
goto failure;
}
@@ -1899,13 +1901,13 @@ esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
char *fileName = NULL;

if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

if (port < 0 || port > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Serial port index %d out of [0..3] range", port);
+ _("Serial port index %d out of [0..3] range"), port);
return -1;
}

@@ -1978,8 +1980,8 @@ esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
fileName = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
- "but found '%s'", fileType_name, fileType);
+ _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
+ "but found '%s'"), fileType_name, fileType);
goto failure;
}

@@ -2022,13 +2024,13 @@ esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
char *fileName = NULL;

if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

if (port < 0 || port > 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Parallel port index %d out of [0..2] range", port);
+ _("Parallel port index %d out of [0..2] range"), port);
return -1;
}

@@ -2091,8 +2093,8 @@ esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'device' or 'file' but "
- "found '%s'", fileType_name, fileType);
+ _("Expecting VMX entry '%s' to be 'device' or 'file' but "
+ "found '%s'"), fileType_name, fileType);
goto failure;
}

@@ -2157,8 +2159,8 @@ esxVMX_FormatFileName(esxVI_Context *ctx ATTRIBUTE_UNUSED, const char *src)
} else {
/* Found relative path, this is not supported */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Found relative path '%s' in domain XML, this is not "
- "supported", src);
+ _("Found relative path '%s' in domain XML, this is not "
+ "supported"), src);
goto failure;
}

@@ -2192,7 +2194,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,

if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { /* FIXME: maybe add VIR_DOMAIN_VIRT_ESX ? */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting virt type to be '%s' but found '%s'",
+ _("Expecting virt type to be '%s' but found '%s'"),
virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE),
virDomainVirtTypeToString(def->virtType));
return NULL;
@@ -2212,8 +2214,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
break;

default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API version 2.5 or 4.0");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting VI API version 2.5 or 4.0"));
goto failure;
}

@@ -2224,8 +2226,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'arch' of entry 'os/type' "
- "to be 'i686' or 'x86_64' but found '%s'", def->os.arch);
+ _("Expecting domain XML attribute 'arch' of entry 'os/type' "
+ "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch);
goto failure;
}

@@ -2248,8 +2250,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
/* def:maxmem -> vmx:memsize */
if (def->maxmem <= 0 || def->maxmem % 4096 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'memory' to be an unsigned "
- "integer (multiple of 4096) but found %lld",
+ _("Expecting domain XML entry 'memory' to be an unsigned "
+ "integer (multiple of 4096) but found %lld"),
(unsigned long long)def->maxmem);
goto failure;
}
@@ -2262,8 +2264,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
if (def->memory < def->maxmem) {
if (def->memory <= 0 || def->memory % 1024 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'currentMemory' to be an "
- "unsigned integer (multiple of 1024) but found %lld",
+ _("Expecting domain XML entry 'currentMemory' to be an "
+ "unsigned integer (multiple of 1024) but found %lld"),
(unsigned long long)def->memory);
goto failure;
}
@@ -2276,8 +2278,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
/* def:vcpus -> vmx:numvcpus */
if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'vcpu' to be an unsigned "
- "integer (1 or a multiple of 2) but found %d",
+ _("Expecting domain XML entry 'vcpu' to be an unsigned "
+ "integer (1 or a multiple of 2) but found %d"),
(int)def->vcpus);
goto failure;
}
@@ -2298,8 +2300,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,

if (sched_cpu_affinity_length < def->vcpus) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'cpuset' of entry "
- "'vcpu' to contains at least %d CPU(s)",
+ _("Expecting domain XML attribute 'cpuset' of entry "
+ "'vcpu' to contains at least %d CPU(s)"),
(int)def->vcpus);
goto failure;
}
@@ -2331,7 +2333,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,

default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported graphics type '%s'",
+ _("Unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(def->graphics[i]->type));
goto failure;
}
@@ -2381,7 +2383,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,

default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported disk device type '%s'",
+ _("Unsupported disk device type '%s'"),
virDomainDiskDeviceTypeToString(def->disks[i]->device));
goto failure;
}
@@ -2440,7 +2442,7 @@ int
esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2490,7 +2492,7 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
char *fileName = NULL;

if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2514,14 +2516,14 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for harddisk",
+ _("Unsupported bus type '%s' for harddisk"),
virDomainDiskBusTypeToString(def->bus));
return -1;
}

if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s harddisk '%s' has unsupported type '%s', expecting '%s'",
+ _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"),
busName, def->dst, virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
return -1;
@@ -2535,8 +2537,8 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".vmdk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Image file for %s harddisk '%s' has unsupported suffix, "
- "expecting '.vmdk'", busName, def->dst);
+ _("Image file for %s harddisk '%s' has unsupported suffix, "
+ "expecting '.vmdk'"), busName, def->dst);
return -1;
}

@@ -2558,7 +2560,7 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
entryPrefix, controller, id);
} else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s harddisk '%s' has unsupported cache mode '%s'",
+ _("%s harddisk '%s' has unsupported cache mode '%s'"),
busName, def->dst,
virDomainDiskCacheTypeToString(def->cachemode));
return -1;
@@ -2580,7 +2582,7 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
char *fileName = NULL;

if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2601,7 +2603,8 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
return -1;
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported bus type '%s' for cdrom",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Unsupported bus type '%s' for cdrom"),
virDomainDiskBusTypeToString(def->bus));
return -1;
}
@@ -2616,8 +2619,8 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".iso")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Image file for %s cdrom '%s' has unsupported "
- "suffix, expecting '.iso'", busName, def->dst);
+ _("Image file for %s cdrom '%s' has unsupported "
+ "suffix, expecting '.iso'"), busName, def->dst);
return -1;
}

@@ -2642,8 +2645,8 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s cdrom '%s' has unsupported type '%s', expecting '%s' "
- "or '%s'", busName, def->dst,
+ _("%s cdrom '%s' has unsupported type '%s', expecting '%s' "
+ "or '%s'"), busName, def->dst,
virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
@@ -2663,7 +2666,7 @@ esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
char *fileName = NULL;

if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}

@@ -2680,8 +2683,8 @@ esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".flp")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Image file for floppy '%s' has unsupported suffix, "
- "expecting '.flp'", def->dst);
+ _("Image file for floppy '%s' has unsupported "
+ "suffix, expecting '.flp'"), def->dst);
return -1;
}

@@ -2706,8 +2709,8 @@ esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Floppy '%s' has unsupported type '%s', expecting '%s' "
- "or '%s'", def->dst,
+ _("Floppy '%s' has unsupported type '%s', expecting '%s' "
+ "or '%s'"), def->dst,
virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
@@ -2728,7 +2731,7 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,

if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Ethernet controller index %d out of [0..3] range",
+ _("Ethernet controller index %d out of [0..3] range"),
controller);
return -1;
}
@@ -2742,9 +2745,9 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
STRCASENEQ(def->model, "vmxnet3") &&
STRCASENEQ(def->model, "e1000")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'devices/interfase/model' "
- "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' but "
- "found '%s'", def->model);
+ _("Expecting domain XML entry 'devices/interfase/model' "
+ "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' "
+ "but found '%s'"), def->model);
return -1;
}

@@ -2771,7 +2774,7 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
break;

default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported net type '%s'",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unsupported net type '%s'"),
virDomainNetTypeToString(def->type));
return -1;
}
@@ -2821,14 +2824,15 @@ esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,

if (def->target.port < 0 || def->target.port > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Serial port index %d out of [0..3] range", def->target.port);
+ _("Serial port index %d out of [0..3] range"),
+ def->target.port);
return -1;
}

if (def->data.file.path == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'path' of entry "
- "'devices/serial/source' to be present");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'path' of entry "
+ "'devices/serial/source' to be present"));
return -1;
}

@@ -2874,7 +2878,7 @@ esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,

default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported character device type '%s'",
+ _("Unsupported character device type '%s'"),
virDomainChrTypeToString(def->type));
return -1;
}
@@ -2897,15 +2901,15 @@ esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,

if (def->target.port < 0 || def->target.port > 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Parallel port index %d out of [0..2] range",
+ _("Parallel port index %d out of [0..2] range"),
def->target.port);
return -1;
}

if (def->data.file.path == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'path' of entry "
- "'devices/parallel/source' to be present");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'path' of entry "
+ "'devices/parallel/source' to be present"));
return -1;
}

@@ -2939,7 +2943,7 @@ esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,

default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported character device type '%s'",
+ _("Unsupported character device type '%s'"),
virDomainChrTypeToString(def->type));
return -1;
}
--
1.6.3.3
Eric Blake
2010-04-05 16:09:14 UTC
Permalink
Post by Matthias Bolte
---
cfg.mk | 2 +
po/POTFILES.in | 6 +
src/esx/esx_driver.c | 211 +++++++++++++++++----------------
src/esx/esx_util.c | 58 +++++-----
src/esx/esx_vi.c | 274 +++++++++++++++++++++---------------------
src/esx/esx_vi_methods.c | 8 +-
src/esx/esx_vi_types.c | 70 ++++++-----
src/esx/esx_vmx.c | 300 +++++++++++++++++++++++-----------------------
8 files changed, 481 insertions(+), 448 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 619a8e2..8073f34 100644
--- a/cfg.mk
+++ b/cfg.mk
msg_gen_function =
msg_gen_function += ReportError
+msg_gen_function += ESX_ERROR
+msg_gen_function += ESX_VI_ERROR
ACK; the rest of the patch is mostly mechanical fallout.
Post by Matthias Bolte
@@ -837,19 +845,19 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
}
}
-#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
+#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
do { \
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Unknown value '%s' for "_xsdType, \
- (*anyType)->value); \
+ _("Unknown value '%s' for %s"), \
+ (*anyType)->value, _xsdType); \
My spot checking noticed that this one was not as trivial as most of the
conversions, but it still looks correct.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 17:37:17 UTC
Permalink
Post by Eric Blake
---
 cfg.mk                   |    2 +
 po/POTFILES.in           |    6 +
 src/esx/esx_driver.c     |  211 +++++++++++++++++----------------
 src/esx/esx_util.c       |   58 +++++-----
 src/esx/esx_vi.c         |  274 +++++++++++++++++++++---------------------
 src/esx/esx_vi_methods.c |    8 +-
 src/esx/esx_vi_types.c   |   70 ++++++-----
 src/esx/esx_vmx.c        |  300 +++++++++++++++++++++++-----------------------
 8 files changed, 481 insertions(+), 448 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 619a8e2..8073f34 100644
--- a/cfg.mk
+++ b/cfg.mk
 msg_gen_function =
 msg_gen_function += ReportError
+msg_gen_function += ESX_ERROR
+msg_gen_function += ESX_VI_ERROR
ACK; the rest of the patch is mostly mechanical fallout.
@@ -837,19 +845,19 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
         }
     }
-#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max)           \
+#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max)               \
         do {                                                                  \
             if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) {  \
                 ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
-                             "Unknown value '%s' for "_xsdType,               \
-                             (*anyType)->value);                              \
+                             _("Unknown value '%s' for %s"),                  \
+                             (*anyType)->value, _xsdType);                    \
My spot checking noticed that this one was not as trivial as most of the
conversions, but it still looks correct.
Yep, had to change this to make it translatable.

Thanks, I merged patch 21/30 into this one and pushed the result.

Matthias
Matthias Bolte
2010-04-04 17:36:27 UTC
Permalink
---
daemon/libvirtd.c | 8 ++++----
src/lxc/lxc_driver.c | 2 +-
src/node_device/node_device_linux_sysfs.c | 4 ++--
src/node_device/node_device_udev.c | 16 ++++++++--------
src/nwfilter/nwfilter_ebiptables_driver.c | 2 +-
src/nwfilter/nwfilter_gentech_driver.c | 4 ++--
src/qemu/qemu_conf.c | 2 +-
src/remote/remote_driver.c | 2 +-
src/storage/storage_backend_disk.c | 6 +++---
src/storage/storage_driver.c | 2 +-
src/xen/proxy_internal.c | 14 +++++++-------
src/xen/xen_hypervisor.c | 20 ++++++++++----------
src/xen/xs_internal.c | 2 +-
13 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 68fe95a..fd3f509 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2302,7 +2302,7 @@ static void *qemudRunLoop(void *opaque) {
virMutexUnlock(&server->lock);
if (qemudOneLoop() < 0) {
virMutexLock(&server->lock);
- DEBUG0("Loop iteration error, exiting\n");
+ DEBUG0("Loop iteration error, exiting");
break;
}
virMutexLock(&server->lock);
@@ -2475,7 +2475,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
}
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
if (pp->type != VIR_CONF_STRING) {
- VIR_ERROR("%s: %s: must be a string or list of strings\n",
+ VIR_ERROR("%s: %s: must be a string or list of strings",
filename, key);
VIR_FREE(list);
return -1;
@@ -2497,7 +2497,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
}

default:
- VIR_ERROR("%s: %s: must be a string or list of strings\n",
+ VIR_ERROR("%s: %s: must be a string or list of strings",
filename, key);
return -1;
}
@@ -2512,7 +2512,7 @@ checkType (virConfValuePtr p, const char *filename,
const char *key, virConfType required_type)
{
if (p->type != required_type) {
- VIR_ERROR("%s: %s: invalid type: got %s; expected %s\n", filename, key,
+ VIR_ERROR("%s: %s: invalid type: got %s; expected %s", filename, key,
virConfTypeName (p->type),
virConfTypeName (required_type));
return -1;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index fb9e010..b9b3784 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -634,7 +634,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {

if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
lxcError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to get cgroup for %s\n"), vm->def->name);
+ _("Unable to get cgroup for %s"), vm->def->name);
goto cleanup;
}

diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index 9ed0daa..6c64e59 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -302,7 +302,7 @@ int get_physical_function_linux(const char *sysfs_path,
char *device_link = NULL;

VIR_DEBUG("Attempting to get SR IOV physical function for device "
- "with sysfs path '%s'\n", sysfs_path);
+ "with sysfs path '%s'", sysfs_path);

if (virBuildPath(&device_link, sysfs_path, "physfn") == -1) {
virReportOOMError();
@@ -327,7 +327,7 @@ int get_virtual_functions_linux(const char *sysfs_path,
char *device_link = NULL;

VIR_DEBUG("Attempting to get SR IOV virtual functions for device"
- "with sysfs path '%s'\n", sysfs_path);
+ "with sysfs path '%s'", sysfs_path);

dir = opendir(sysfs_path);
if (dir == NULL) {
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 47f53f7..ecd09bd 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -131,7 +131,7 @@ static int udevGetDeviceProperty(struct udev_device *udev_device,
}

VIR_DEBUG("Found property key '%s' value '%s' "
- "for device with sysname '%s'\n",
+ "for device with sysname '%s'",
property_key, *property_value,
udev_device_get_sysname(udev_device));

@@ -220,7 +220,7 @@ static int udevGetDeviceSysfsAttr(struct udev_device *udev_device,
}

VIR_DEBUG("Found sysfs attribute '%s' value '%s' "
- "for device with sysname '%s'\n",
+ "for device with sysname '%s'",
attr_name, *attr_value,
udev_device_get_sysname(udev_device));

@@ -330,7 +330,7 @@ static int udevGenerateDeviceName(struct udev_device *device,
if (virBufferError(&buf)) {
virBufferFreeAndReset(&buf);
VIR_ERROR("Buffer error when generating device name for device "
- "with sysname '%s'\n", udev_device_get_sysname(device));
+ "with sysname '%s'", udev_device_get_sysname(device));
ret = -1;
}

@@ -642,7 +642,7 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,

if (!STRPREFIX(filename, "host")) {
VIR_ERROR("SCSI host found, but its udev name '%s' does "
- "not begin with 'host'\n", filename);
+ "not begin with 'host'", filename);
goto out;
}

@@ -949,7 +949,7 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
int ret = -1;

VIR_INFO("Could not find definitive storage type for device "
- "with sysfs path '%s', trying to guess it\n",
+ "with sysfs path '%s', trying to guess it",
def->sysfs_path);

if (STRPREFIX(def->caps->data.storage.block, "/dev/vd")) {
@@ -962,10 +962,10 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)

if (ret != 0) {
VIR_INFO("Could not determine storage type for device "
- "with sysfs path '%s'\n", def->sysfs_path);
+ "with sysfs path '%s'", def->sysfs_path);
} else {
VIR_DEBUG("Found storage type '%s' for device "
- "with sysfs path '%s'\n",
+ "with sysfs path '%s'",
def->caps->data.storage.drive_type,
def->sysfs_path);
}
@@ -1131,7 +1131,7 @@ static int udevGetDeviceType(struct udev_device *device,
}

VIR_INFO("Could not determine device type for device "
- "with sysfs path '%s'\n",
+ "with sysfs path '%s'",
udev_device_get_sysname(device));
ret = -1;

diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index cdfb92e..fdf1c10 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -2237,7 +2237,7 @@ ebiptablesExecCLI(virConnectPtr conn,

*status >>= 8;

- VIR_DEBUG("rc = %d, status = %d\n",rc, *status);
+ VIR_DEBUG("rc = %d, status = %d",rc, *status);

unlink(filename);

diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 6a88dff..e1a0986 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -318,7 +318,7 @@ _virNWFilterInstantiateRec(virConnectPtr conn,
(*insts)[(*nEntries)++] = inst;

} else if (inc) {
- VIR_DEBUG("Instantiating filter %s\n", inc->filterref);
+ VIR_DEBUG("Instantiating filter %s", inc->filterref);
obj = virNWFilterPoolObjFindByName(&driver->pools,
inc->filterref);
if (obj) {
@@ -523,7 +523,7 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
return 1;
}

- VIR_DEBUG("filter name: %s\n", net->filter);
+ VIR_DEBUG("filter name: %s", net->filter);

obj = virNWFilterPoolObjFindByName(&driver->pools, net->filter);
if (!obj) {
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 087bb72..b679b35 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -140,7 +140,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,

#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
qemuReportError(VIR_ERR_INTERNAL_ERROR, \
- "remoteReadConfigFile: %s: %s: expected type " #typ "\n", \
+ "remoteReadConfigFile: %s: %s: expected type " #typ, \
filename, (name)); \
virConfFree(conf); \
return -1; \
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ede00e8..215b5d9 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1286,7 +1286,7 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
}
if (len != 1 || buf[0] != '\1') {
error (conn, VIR_ERR_RPC,
- _("server verification (of our certificate or IP address) failed\n"));
+ _("server verification (of our certificate or IP address) failed"));
return NULL;
}

diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 5717cfd..836d1ca 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -455,7 +455,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
unsigned long long cylinderSize = dev->geometry.heads *
dev->geometry.sectors * SECTOR_SIZE;

- DEBUG("find free area: allocation %llu, cyl size %llu\n", allocation, cylinderSize);
+ DEBUG("find free area: allocation %llu, cyl size %llu", allocation, cylinderSize);
int partType = virStorageBackendDiskPartTypeToCreate(pool);

/* how many extra bytes we have since we allocate
@@ -508,7 +508,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
return -1;
}

- DEBUG("aligned alloc %llu\n", alignedAllocation);
+ DEBUG("aligned alloc %llu", alignedAllocation);
*start = dev->freeExtents[smallestExtent].start;

if (partType == VIR_STORAGE_VOL_DISK_TYPE_LOGICAL) {
@@ -524,7 +524,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,

/* counting in byte, we want the last byte of the current sector */
*end -= 1;
- DEBUG("final aligned start %llu, end %llu\n", *start, *end);
+ DEBUG("final aligned start %llu, end %llu", *start, *end);
return 0;
}

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 857a233..d476822 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1557,7 +1557,7 @@ storageVolumeZeroSparseFile(virStorageVolDefPtr vol,
if (ret == -1) {
virReportSystemError(errno,
_("Failed to truncate volume with "
- "path '%s' to %ju bytes\n"),
+ "path '%s' to %ju bytes"),
vol->target.path, (intmax_t)size);
}

diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index c3cade8..36058bc 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -217,7 +217,7 @@ retry:
return (-1);
}

- DEBUG("connected to unix socket %s via %d\n", path, fd);
+ DEBUG("connected to unix socket %s via %d", path, fd);

return (fd);
}
@@ -395,14 +395,14 @@ retry:
}
if (ret != sizeof(virProxyPacket)) {
virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Communication error with proxy: got %d bytes of %d\n"),
+ _("Communication error with proxy: got %d bytes of %d"),
ret, (int) sizeof(virProxyPacket));
goto error;
}
res = request;
if (res->len != sizeof(virProxyPacket)) {
virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Communication error with proxy: expected %d bytes got %d\n"),
+ _("Communication error with proxy: expected %d bytes got %d"),
(int) sizeof(virProxyPacket), res->len);
goto error;
}
@@ -418,7 +418,7 @@ retry:
}
if (ret != sizeof(virProxyPacket)) {
virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Communication error with proxy: got %d bytes of %d\n"),
+ _("Communication error with proxy: got %d bytes of %d"),
ret, (int) sizeof(virProxyPacket));
goto error;
}
@@ -426,7 +426,7 @@ retry:
if ((res->len < sizeof(virProxyPacket)) ||
(res->len > sizeof(virProxyFullPacket))) {
virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Communication error with proxy: got %d bytes packet\n"),
+ _("Communication error with proxy: got %d bytes packet"),
res->len);
goto error;
}
@@ -436,7 +436,7 @@ retry:
res->len - ret);
if (ret != (int) (res->len - sizeof(virProxyPacket))) {
virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Communication error with proxy: got %d bytes of %d\n"),
+ _("Communication error with proxy: got %d bytes of %d"),
ret, (int) sizeof(virProxyPacket));
goto error;
}
@@ -448,7 +448,7 @@ retry:
if ((res->version != PROXY_PROTO_VERSION) ||
(res->len < sizeof(virProxyPacket))) {
virProxyError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Communication error with proxy: malformed packet\n"));
+ _("Communication error with proxy: malformed packet"));
goto error;
}
if (res->serial != serial) {
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 552fbf5..4a8769f 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2009,7 +2009,7 @@ xenHypervisorInit(void)
ret = ioctl(fd, cmd, (unsigned long) &hc);

if ((ret != -1) && (ret != 0)) {
- DEBUG("Using new hypervisor call: %X\n", ret);
+ DEBUG("Using new hypervisor call: %X", ret);
hv_version = ret;
xen_ioctl_hypercall_cmd = cmd;
goto detect_v2;
@@ -2025,7 +2025,7 @@ xenHypervisorInit(void)
cmd = _IOC(_IOC_NONE, 'P', 0, sizeof(v0_hypercall_t));
ret = ioctl(fd, cmd, (unsigned long) &v0_hc);
if ((ret != -1) && (ret != 0)) {
- DEBUG("Using old hypervisor call: %X\n", ret);
+ DEBUG("Using old hypervisor call: %X", ret);
hv_version = ret;
xen_ioctl_hypercall_cmd = cmd;
hypervisor_version = 0;
@@ -2062,13 +2062,13 @@ xenHypervisorInit(void)
/* RHEL 5.0 */
dom_interface_version = 3; /* XEN_DOMCTL_INTERFACE_VERSION */
if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
- DEBUG0("Using hypervisor call v2, sys ver2 dom ver3\n");
+ DEBUG0("Using hypervisor call v2, sys ver2 dom ver3");
goto done;
}
/* Fedora 7 */
dom_interface_version = 4; /* XEN_DOMCTL_INTERFACE_VERSION */
if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
- DEBUG0("Using hypervisor call v2, sys ver2 dom ver4\n");
+ DEBUG0("Using hypervisor call v2, sys ver2 dom ver4");
goto done;
}
}
@@ -2078,7 +2078,7 @@ xenHypervisorInit(void)
/* xen-3.1 */
dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */
if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
- DEBUG0("Using hypervisor call v2, sys ver3 dom ver5\n");
+ DEBUG0("Using hypervisor call v2, sys ver3 dom ver5");
goto done;
}
}
@@ -2088,7 +2088,7 @@ xenHypervisorInit(void)
/* Fedora 8 */
dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */
if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
- DEBUG0("Using hypervisor call v2, sys ver4 dom ver5\n");
+ DEBUG0("Using hypervisor call v2, sys ver4 dom ver5");
goto done;
}
}
@@ -2098,7 +2098,7 @@ xenHypervisorInit(void)
/* Xen 3.2, Fedora 9 */
dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */
if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
- DEBUG0("Using hypervisor call v2, sys ver6 dom ver5\n");
+ DEBUG0("Using hypervisor call v2, sys ver6 dom ver5");
goto done;
}
}
@@ -2107,14 +2107,14 @@ xenHypervisorInit(void)
sys_interface_version = 7; /* XEN_SYSCTL_INTERFACE_VERSION */
if (virXen_getdomaininfo(fd, 0, &info) == 1) {
dom_interface_version = 6; /* XEN_DOMCTL_INTERFACE_VERSION */
- DEBUG0("Using hypervisor call v2, sys ver7 dom ver6\n");
+ DEBUG0("Using hypervisor call v2, sys ver7 dom ver6");
goto done;
}

hypervisor_version = 1;
sys_interface_version = -1;
if (virXen_getdomaininfo(fd, 0, &info) == 1) {
- DEBUG0("Using hypervisor call v1\n");
+ DEBUG0("Using hypervisor call v1");
goto done;
}

@@ -2122,7 +2122,7 @@ xenHypervisorInit(void)
* we failed to make the getdomaininfolist hypercall
*/

- DEBUG0("Failed to find any Xen hypervisor method\n");
+ DEBUG0("Failed to find any Xen hypervisor method");
hypervisor_version = -1;
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %lu",
(unsigned long)IOCTL_PRIVCMD_HYPERCALL);
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 613f97a..466169d 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -342,7 +342,7 @@ xenStoreOpen(virConnectPtr conn,
xenStoreWatchEvent,
conn,
NULL)) < 0)
- DEBUG0("Failed to add event handle, disabling events\n");
+ DEBUG0("Failed to add event handle, disabling events");

#endif //PROXY
return 0;
--
1.6.3.3
Eric Blake
2010-04-05 16:26:33 UTC
Permalink
On 04/04/2010 11:36 AM, Matthias Bolte wrote:

It might be nice to list the regexp you used when grepping to find these
instances. I tried git grep '\\n"' -- tools src, but that has a number
of false positives to filter through. On the other hand, a more
restrictive test may have let some offenders slip through.
Post by Matthias Bolte
+++ b/src/storage/storage_backend_disk.c
@@ -455,7 +455,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
unsigned long long cylinderSize = dev->geometry.heads *
dev->geometry.sectors * SECTOR_SIZE;
- DEBUG("find free area: allocation %llu, cyl size %llu\n", allocation, cylinderSize);
+ DEBUG("find free area: allocation %llu, cyl size %llu", allocation, cylinderSize);
Fixing more than just \n here, but it's all whitespace fixes, so no need
to split it out into a separate commit. :)

ACK.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:17:41 UTC
Permalink
Post by Eric Blake
It might be nice to list the regexp you used when grepping to find these
instances.  I tried git grep '\\n"' -- tools src, but that has a number
of false positives to filter through.  On the other hand, a more
restrictive test may have let some offenders slip through.
I basically did that simple grep for \n" and eliminated false positives by hand.
Post by Eric Blake
Post by Matthias Bolte
+++ b/src/storage/storage_backend_disk.c
@@ -455,7 +455,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
     unsigned long long cylinderSize = dev->geometry.heads *
                                       dev->geometry.sectors * SECTOR_SIZE;
-    DEBUG("find free area: allocation %llu,  cyl size %llu\n", allocation, cylinderSize);
+    DEBUG("find free area: allocation %llu, cyl size %llu", allocation, cylinderSize);
Fixing more than just \n here, but it's all whitespace fixes, so no need
to split it out into a separate commit. :)
ACK.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:28 UTC
Permalink
---
src/test/test_driver.c | 343 ++++++++++++++++++++++++------------------------
1 files changed, 169 insertions(+), 174 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 105f825..a63005d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -115,9 +115,9 @@ static const virNodeInfo defaultNodeInfo = {
};


-#define testError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+#define testError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_TEST, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)

static int testClose(virConnectPtr conn);
static void testDomainEventFlush(int timer, void *opaque);
@@ -313,8 +313,7 @@ static int testStoragePoolObjSetDefaults(virStoragePoolObjPtr pool);
static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);

static char *
-testDomainGenerateIfname(virConnectPtr conn,
- virDomainDefPtr domdef) {
+testDomainGenerateIfname(virDomainDefPtr domdef) {
int maxif = 1024;
int ifctr, i;

@@ -340,14 +339,13 @@ testDomainGenerateIfname(virConnectPtr conn,
return ifname;
}

- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Exceeded max iface limit %d"), maxif);
return NULL;
}

static int
-testDomainGenerateIfnames(virConnectPtr conn,
- virDomainDefPtr domdef)
+testDomainGenerateIfnames(virDomainDefPtr domdef)
{
int i = 0;

@@ -356,7 +354,7 @@ testDomainGenerateIfnames(virConnectPtr conn,
if (domdef->nets[i]->ifname)
continue;

- ifname = testDomainGenerateIfname(conn, domdef);
+ ifname = testDomainGenerateIfname(domdef);
if (!ifname)
return -1;

@@ -512,7 +510,7 @@ static int testOpenDefault(virConnectPtr conn) {
return VIR_DRV_OPEN_ERROR;
}
if (virMutexInit(&privconn->lock) < 0) {
- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
VIR_FREE(privconn);
return VIR_DRV_OPEN_ERROR;
@@ -551,7 +549,7 @@ static int testOpenDefault(virConnectPtr conn) {
defaultDomainXML,
VIR_DOMAIN_XML_INACTIVE)))
goto error;
- if (testDomainGenerateIfnames(conn, domdef) < 0)
+ if (testDomainGenerateIfnames(domdef) < 0)
goto error;
if (!(domobj = virDomainAssignDef(privconn->caps,
&privconn->domains, domdef, false)))
@@ -675,7 +673,7 @@ static int testOpenVolumesForPool(xmlDocPtr xml,
ret = virXPathNodeSet(vol_xpath, ctxt, &vols);
VIR_FREE(vol_xpath);
if (ret < 0) {
- testError(NULL, VIR_ERR_XML_ERROR,
+ testError(VIR_ERR_XML_ERROR,
_("node vol list for pool '%s'"), pool->def->name);
goto error;
}
@@ -686,7 +684,7 @@ static int testOpenVolumesForPool(xmlDocPtr xml,
char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile);
if (!absFile) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ testError(VIR_ERR_INTERNAL_ERROR, "%s",
_("resolving volume filename"));
goto error;
}
@@ -756,7 +754,7 @@ static int testOpenFromFile(virConnectPtr conn,
return VIR_DRV_OPEN_ERROR;
}
if (virMutexInit(&privconn->lock) < 0) {
- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
VIR_FREE(privconn);
return VIR_DRV_OPEN_ERROR;
@@ -781,7 +779,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (!(xml = xmlReadFd(fd, file, NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Invalid XML in file '%s'"), file);
goto error;
}
@@ -790,14 +788,14 @@ static int testOpenFromFile(virConnectPtr conn,

root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "node"))) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s",
+ testError(VIR_ERR_XML_ERROR, "%s",
_("Root element is not 'node'"));
goto error;
}

ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ testError(VIR_ERR_INTERNAL_ERROR, "%s",
_("creating xpath context"));
goto error;
}
@@ -805,7 +803,7 @@ static int testOpenFromFile(virConnectPtr conn,
privconn->nextDomID = 1;
privconn->numCells = 0;
if (virStrcpyStatic(privconn->path, file) == NULL) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Path %s too big for destination"), file);
goto error;
}
@@ -816,7 +814,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->nodes = l;
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu numa nodes"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node cpu numa nodes"));
goto error;
}

@@ -824,7 +822,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->sockets = l;
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu sockets"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node cpu sockets"));
goto error;
}

@@ -832,7 +830,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->cores = l;
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu cores"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node cpu cores"));
goto error;
}

@@ -840,7 +838,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->threads = l;
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu threads"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node cpu threads"));
goto error;
}

@@ -851,21 +849,21 @@ static int testOpenFromFile(virConnectPtr conn,
nodeInfo->cpus = l;
}
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node active cpu"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node active cpu"));
goto error;
}
ret = virXPathLong("string(/node/cpu/mhz[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->mhz = l;
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node cpu mhz"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node cpu mhz"));
goto error;
}

str = virXPathString("string(/node/cpu/model[1])", ctxt);
if (str != NULL) {
if (virStrcpyStatic(nodeInfo->model, str) == NULL) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Model %s too big for destination"), str);
VIR_FREE(str);
goto error;
@@ -877,13 +875,13 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->memory = l;
} else if (ret == -2) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node memory"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node memory"));
goto error;
}

ret = virXPathNodeSet("/node/domain", ctxt, &domains);
if (ret < 0) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node domain list"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node domain list"));
goto error;
}

@@ -894,7 +892,7 @@ static int testOpenFromFile(virConnectPtr conn,
char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile);
if (!absFile) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("resolving domain filename"));
+ testError(VIR_ERR_INTERNAL_ERROR, "%s", _("resolving domain filename"));
goto error;
}
def = virDomainDefParseFile(privconn->caps, absFile,
@@ -908,7 +906,7 @@ static int testOpenFromFile(virConnectPtr conn,
goto error;
}

- if (testDomainGenerateIfnames(conn, def) < 0 ||
+ if (testDomainGenerateIfnames(def) < 0 ||
!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, false))) {
virDomainDefFree(def);
@@ -927,7 +925,7 @@ static int testOpenFromFile(virConnectPtr conn,

ret = virXPathNodeSet("/node/network", ctxt, &networks);
if (ret < 0) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node network list"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node network list"));
goto error;
}
for (i = 0 ; i < ret ; i++) {
@@ -937,7 +935,7 @@ static int testOpenFromFile(virConnectPtr conn,
char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile);
if (!absFile) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("resolving network filename"));
+ testError(VIR_ERR_INTERNAL_ERROR, "%s", _("resolving network filename"));
goto error;
}

@@ -963,7 +961,7 @@ static int testOpenFromFile(virConnectPtr conn,
/* Parse interface definitions */
ret = virXPathNodeSet("/node/interface", ctxt, &ifaces);
if (ret < 0) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node interface list"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node interface list"));
goto error;
}
for (i = 0 ; i < ret ; i++) {
@@ -973,7 +971,7 @@ static int testOpenFromFile(virConnectPtr conn,
char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile);
if (!absFile) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("resolving interface filename"));
+ testError(VIR_ERR_INTERNAL_ERROR, "%s", _("resolving interface filename"));
goto error;
}

@@ -999,7 +997,7 @@ static int testOpenFromFile(virConnectPtr conn,
/* Parse Storage Pool list */
ret = virXPathNodeSet("/node/pool", ctxt, &pools);
if (ret < 0) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node pool list"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node pool list"));
goto error;
}
for (i = 0 ; i < ret ; i++) {
@@ -1010,7 +1008,7 @@ static int testOpenFromFile(virConnectPtr conn,
char *absFile = testBuildFilename(file, relFile);
VIR_FREE(relFile);
if (!absFile) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ testError(VIR_ERR_INTERNAL_ERROR, "%s",
_("resolving pool filename"));
goto error;
}
@@ -1050,7 +1048,7 @@ static int testOpenFromFile(virConnectPtr conn,

ret = virXPathNodeSet("/node/device", ctxt, &devs);
if (ret < 0) {
- testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node device list"));
+ testError(VIR_ERR_XML_ERROR, "%s", _("node device list"));
goto error;
}
for (i = 0 ; i < ret ; i++) {
@@ -1063,7 +1061,7 @@ static int testOpenFromFile(virConnectPtr conn,
VIR_FREE(relFile);

if (!absFile) {
- testError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ testError(VIR_ERR_INTERNAL_ERROR, "%s",
_("resolving device filename"));
goto error;
}
@@ -1131,8 +1129,8 @@ static virDrvOpenStatus testOpen(virConnectPtr conn,
if (!conn->uri->path
|| conn->uri->path[0] == '\0'
|| (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) {
- testError (NULL, VIR_ERR_INVALID_ARG,
- "%s", _("testOpen: supply a path or use test:///default"));
+ testError(VIR_ERR_INVALID_ARG,
+ "%s", _("testOpen: supply a path or use test:///default"));
return VIR_DRV_OPEN_ERROR;
}

@@ -1255,7 +1253,7 @@ static int testDomainIsActive(virDomainPtr dom)
obj = virDomainFindByUUID(&privconn->domains, dom->uuid);
testDriverUnlock(privconn);
if (!obj) {
- testError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
+ testError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
@@ -1276,7 +1274,7 @@ static int testDomainIsPersistent(virDomainPtr dom)
obj = virDomainFindByUUID(&privconn->domains, dom->uuid);
testDriverUnlock(privconn);
if (!obj) {
- testError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
+ testError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
@@ -1305,7 +1303,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
if (virDomainObjIsDuplicate(&privconn->domains, def, 1) < 0)
goto cleanup;

- if (testDomainGenerateIfnames(conn, def) < 0)
+ if (testDomainGenerateIfnames(def) < 0)
goto cleanup;
if (!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, false)))
@@ -1346,7 +1344,7 @@ static virDomainPtr testLookupDomainByID(virConnectPtr conn,
testDriverUnlock(privconn);

if (dom == NULL) {
- testError (conn, VIR_ERR_NO_DOMAIN, NULL);
+ testError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -1372,7 +1370,7 @@ static virDomainPtr testLookupDomainByUUID(virConnectPtr conn,
testDriverUnlock(privconn);

if (dom == NULL) {
- testError (conn, VIR_ERR_NO_DOMAIN, NULL);
+ testError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -1398,7 +1396,7 @@ static virDomainPtr testLookupDomainByName(virConnectPtr conn,
testDriverUnlock(privconn);

if (dom == NULL) {
- testError (conn, VIR_ERR_NO_DOMAIN, NULL);
+ testError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -1438,7 +1436,7 @@ static int testDestroyDomain (virDomainPtr domain)
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -1476,13 +1474,12 @@ static int testResumeDomain (virDomainPtr domain)
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (privdom->state != VIR_DOMAIN_PAUSED) {
- testError(domain->conn,
- VIR_ERR_INTERNAL_ERROR, _("domain '%s' not paused"),
+ testError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not paused"),
domain->name);
goto cleanup;
}
@@ -1517,14 +1514,13 @@ static int testPauseDomain (virDomainPtr domain)
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (privdom->state == VIR_DOMAIN_SHUTOFF ||
privdom->state == VIR_DOMAIN_PAUSED) {
- testError(domain->conn,
- VIR_ERR_INTERNAL_ERROR, _("domain '%s' not running"),
+ testError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not running"),
domain->name);
goto cleanup;
}
@@ -1559,12 +1555,12 @@ static int testShutdownDomain (virDomainPtr domain)
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (privdom->state == VIR_DOMAIN_SHUTOFF) {
- testError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("domain '%s' not running"), domain->name);
goto cleanup;
}
@@ -1604,7 +1600,7 @@ static int testRebootDomain (virDomainPtr domain,
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -1668,12 +1664,12 @@ static int testGetDomainInfo (virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (gettimeofday(&tv, NULL) < 0) {
- testError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
"%s", _("getting time of day"));
goto cleanup;
}
@@ -1709,7 +1705,7 @@ static int testDomainSave(virDomainPtr domain,
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -1814,7 +1810,7 @@ static int testDomainRestore(virConnectPtr conn,
goto cleanup;
}
if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) {
- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
"%s", _("mismatched header magic"));
goto cleanup;
}
@@ -1825,7 +1821,7 @@ static int testDomainRestore(virConnectPtr conn,
goto cleanup;
}
if (len < 1 || len > 8192) {
- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
"%s", _("length of metadata out of range"));
goto cleanup;
}
@@ -1849,7 +1845,7 @@ static int testDomainRestore(virConnectPtr conn,
if (virDomainObjIsDuplicate(&privconn->domains, def, 1) < 0)
goto cleanup;

- if (testDomainGenerateIfnames(conn, def) < 0)
+ if (testDomainGenerateIfnames(def) < 0)
goto cleanup;
if (!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, true)))
@@ -1892,7 +1888,7 @@ static int testDomainCoreDump(virDomainPtr domain,
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -1957,7 +1953,7 @@ static unsigned long testGetMaxMemory(virDomainPtr domain) {
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -1982,7 +1978,7 @@ static int testSetMaxMemory(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -2009,13 +2005,12 @@ static int testSetMemory(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (memory > privdom->def->maxmem) {
- testError(domain->conn,
- VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -2050,19 +2045,19 @@ static int testSetVcpus(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virDomainObjIsActive(privdom)) {
- testError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ testError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot hotplug vcpus for an inactive domain"));
goto cleanup;
}

/* We allow more cpus in guest than host */
if (nrCpus > maxvcpus) {
- testError(domain->conn, VIR_ERR_INVALID_ARG,
+ testError(VIR_ERR_INVALID_ARG,
"requested cpu amount exceeds maximum (%d > %d)",
nrCpus, maxvcpus);
goto cleanup;
@@ -2100,12 +2095,12 @@ static int testDomainGetVcpus(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virDomainObjIsActive(privdom)) {
- testError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ testError(VIR_ERR_OPERATION_INVALID,
"%s",_("cannot list vcpus for an inactive domain"));
goto cleanup;
}
@@ -2186,18 +2181,18 @@ static int testDomainPinVcpu(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virDomainObjIsActive(privdom)) {
- testError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ testError(VIR_ERR_OPERATION_INVALID,
"%s",_("cannot pin vcpus on an inactive domain"));
goto cleanup;
}

if (vcpu > privdom->def->vcpus) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, "%s",
+ testError(VIR_ERR_INVALID_ARG, "%s",
_("requested vcpu is higher than allocated vcpus"));
goto cleanup;
}
@@ -2239,7 +2234,7 @@ static char *testDomainDumpXML(virDomainPtr domain, int flags)
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -2298,7 +2293,7 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
if ((dupVM = virDomainObjIsDuplicate(&privconn->domains, def, 0)) < 0)
goto cleanup;

- if (testDomainGenerateIfnames(conn, def) < 0)
+ if (testDomainGenerateIfnames(def) < 0)
goto cleanup;
if (!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, false)))
@@ -2335,7 +2330,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn,

testDriverLock(privconn);
if (startCell > privconn->numCells) {
- testError(conn, VIR_ERR_INVALID_ARG,
+ testError(VIR_ERR_INVALID_ARG,
"%s", _("Range exceeds available cells"));
goto cleanup;
}
@@ -2364,12 +2359,12 @@ static int testDomainCreate(virDomainPtr domain) {
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (privdom->state != VIR_DOMAIN_SHUTOFF) {
- testError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Domain '%s' is already running"), domain->name);
goto cleanup;
}
@@ -2403,12 +2398,12 @@ static int testDomainUndefine(virDomainPtr domain) {
domain->name);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (privdom->state != VIR_DOMAIN_SHUTOFF) {
- testError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Domain '%s' is still running"), domain->name);
goto cleanup;
}
@@ -2444,7 +2439,7 @@ static int testDomainGetAutostart(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -2471,7 +2466,7 @@ static int testDomainSetAutostart(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -2511,12 +2506,12 @@ static int testDomainGetSchedulerParams(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (*nparams != 1) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, "nparams");
+ testError(VIR_ERR_INVALID_ARG, "nparams");
goto cleanup;
}
strcpy(params[0].field, "weight");
@@ -2547,20 +2542,20 @@ static int testDomainSetSchedulerParams(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (nparams != 1) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, "nparams");
+ testError(VIR_ERR_INVALID_ARG, "nparams");
goto cleanup;
}
if (STRNEQ(params[0].field, "weight")) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, "field");
+ testError(VIR_ERR_INVALID_ARG, "field");
goto cleanup;
}
if (params[0].type != VIR_DOMAIN_SCHED_FIELD_UINT) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, "type");
+ testError(VIR_ERR_INVALID_ARG, "type");
goto cleanup;
}
/* XXX */
@@ -2589,7 +2584,7 @@ static int testDomainBlockStats(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}

@@ -2601,7 +2596,7 @@ static int testDomainBlockStats(virDomainPtr domain,
}

if (!found) {
- testError(domain->conn, VIR_ERR_INVALID_ARG,
+ testError(VIR_ERR_INVALID_ARG,
_("invalid path: %s"), path);
goto error;
}
@@ -2643,7 +2638,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
testDriverUnlock(privconn);

if (privdom == NULL) {
- testError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}

@@ -2656,7 +2651,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
}

if (!found) {
- testError(domain->conn, VIR_ERR_INVALID_ARG,
+ testError(VIR_ERR_INVALID_ARG,
_("invalid path, '%s' is not a known interface"), path);
goto error;
}
@@ -2713,7 +2708,7 @@ static virNetworkPtr testLookupNetworkByUUID(virConnectPtr conn,
testDriverUnlock(privconn);

if (net == NULL) {
- testError (conn, VIR_ERR_NO_NETWORK, NULL);
+ testError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup;
}

@@ -2737,7 +2732,7 @@ static virNetworkPtr testLookupNetworkByName(virConnectPtr conn,
testDriverUnlock(privconn);

if (net == NULL) {
- testError (conn, VIR_ERR_NO_NETWORK, NULL);
+ testError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup;
}

@@ -2847,7 +2842,7 @@ static int testNetworkIsActive(virNetworkPtr net)
obj = virNetworkFindByUUID(&privconn->networks, net->uuid);
testDriverUnlock(privconn);
if (!obj) {
- testError(net->conn, VIR_ERR_NO_NETWORK, NULL);
+ testError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup;
}
ret = virNetworkObjIsActive(obj);
@@ -2868,7 +2863,7 @@ static int testNetworkIsPersistent(virNetworkPtr net)
obj = virNetworkFindByUUID(&privconn->networks, net->uuid);
testDriverUnlock(privconn);
if (!obj) {
- testError(net->conn, VIR_ERR_NO_NETWORK, NULL);
+ testError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup;
}
ret = obj->persistent;
@@ -2940,12 +2935,12 @@ static int testNetworkUndefine(virNetworkPtr network) {
network->name);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (virNetworkObjIsActive(privnet)) {
- testError(network->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Network '%s' is still running"), network->name);
goto cleanup;
}
@@ -2973,12 +2968,12 @@ static int testNetworkStart(virNetworkPtr network) {
testDriverUnlock(privconn);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (virNetworkObjIsActive(privnet)) {
- testError(network->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Network '%s' is already running"), network->name);
goto cleanup;
}
@@ -3002,7 +2997,7 @@ static int testNetworkDestroy(virNetworkPtr network) {
network->name);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -3032,7 +3027,7 @@ static char *testNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
testDriverUnlock(privconn);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -3055,12 +3050,12 @@ static char *testNetworkGetBridgeName(virNetworkPtr network) {
testDriverUnlock(privconn);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!(privnet->def->bridge)) {
- testError(network->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("network '%s' does not have a bridge name."),
privnet->def->name);
goto cleanup;
@@ -3089,7 +3084,7 @@ static int testNetworkGetAutostart(virNetworkPtr network,
testDriverUnlock(privconn);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -3114,7 +3109,7 @@ static int testNetworkSetAutostart(virNetworkPtr network,
testDriverUnlock(privconn);

if (privnet == NULL) {
- testError(network->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -3254,7 +3249,7 @@ static virInterfacePtr testLookupInterfaceByName(virConnectPtr conn,
testDriverUnlock(privconn);

if (iface == NULL) {
- testError (conn, VIR_ERR_NO_INTERFACE, NULL);
+ testError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup;
}

@@ -3279,12 +3274,12 @@ static virInterfacePtr testLookupInterfaceByMACString(virConnectPtr conn,
testDriverUnlock(privconn);

if (ifacect == 0) {
- testError (conn, VIR_ERR_NO_INTERFACE, NULL);
+ testError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup;
}

if (ifacect > 1) {
- testError (conn, VIR_ERR_MULTIPLE_INTERFACES, NULL);
+ testError(VIR_ERR_MULTIPLE_INTERFACES, NULL);
goto cleanup;
}

@@ -3306,7 +3301,7 @@ static int testInterfaceIsActive(virInterfacePtr iface)
obj = virInterfaceFindByName(&privconn->ifaces, iface->name);
testDriverUnlock(privconn);
if (!obj) {
- testError(iface->conn, VIR_ERR_NO_INTERFACE, NULL);
+ testError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup;
}
ret = virInterfaceObjIsActive(obj);
@@ -3331,7 +3326,7 @@ static char *testInterfaceGetXMLDesc(virInterfacePtr iface,
testDriverUnlock(privconn);

if (privinterface == NULL) {
- testError(iface->conn, VIR_ERR_NO_INTERFACE, __FUNCTION__);
+ testError(VIR_ERR_NO_INTERFACE, __FUNCTION__);
goto cleanup;
}

@@ -3381,7 +3376,7 @@ static int testInterfaceUndefine(virInterfacePtr iface)
iface->name);

if (privinterface == NULL) {
- testError (iface->conn, VIR_ERR_NO_INTERFACE, NULL);
+ testError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup;
}

@@ -3406,12 +3401,12 @@ static int testInterfaceCreate(virInterfacePtr iface,
iface->name);

if (privinterface == NULL) {
- testError (iface->conn, VIR_ERR_NO_INTERFACE, NULL);
+ testError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup;
}

if (privinterface->active != 0) {
- testError (iface->conn, VIR_ERR_OPERATION_INVALID, NULL);
+ testError(VIR_ERR_OPERATION_INVALID, NULL);
goto cleanup;
}

@@ -3437,12 +3432,12 @@ static int testInterfaceDestroy(virInterfacePtr iface,
iface->name);

if (privinterface == NULL) {
- testError (iface->conn, VIR_ERR_NO_INTERFACE, NULL);
+ testError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup;
}

if (privinterface->active == 0) {
- testError (iface->conn, VIR_ERR_OPERATION_INVALID, NULL);
+ testError(VIR_ERR_OPERATION_INVALID, NULL);
goto cleanup;
}

@@ -3506,7 +3501,7 @@ testStoragePoolLookupByUUID(virConnectPtr conn,
testDriverUnlock(privconn);

if (pool == NULL) {
- testError (conn, VIR_ERR_NO_STORAGE_POOL, NULL);
+ testError(VIR_ERR_NO_STORAGE_POOL, NULL);
goto cleanup;
}

@@ -3530,7 +3525,7 @@ testStoragePoolLookupByName(virConnectPtr conn,
testDriverUnlock(privconn);

if (pool == NULL) {
- testError (conn, VIR_ERR_NO_STORAGE_POOL, NULL);
+ testError(VIR_ERR_NO_STORAGE_POOL, NULL);
goto cleanup;
}

@@ -3649,7 +3644,7 @@ static int testStoragePoolIsActive(virStoragePoolPtr pool)
obj = virStoragePoolObjFindByUUID(&privconn->pools, pool->uuid);
testDriverUnlock(privconn);
if (!obj) {
- testError(pool->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
+ testError(VIR_ERR_NO_STORAGE_POOL, NULL);
goto cleanup;
}
ret = virStoragePoolObjIsActive(obj);
@@ -3670,7 +3665,7 @@ static int testStoragePoolIsPersistent(virStoragePoolPtr pool)
obj = virStoragePoolObjFindByUUID(&privconn->pools, pool->uuid);
testDriverUnlock(privconn);
if (!obj) {
- testError(pool->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
+ testError(VIR_ERR_NO_STORAGE_POOL, NULL);
goto cleanup;
}
ret = obj->configFile ? 1 : 0;
@@ -3696,12 +3691,12 @@ testStoragePoolStart(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
@@ -3716,7 +3711,7 @@ cleanup:
}

static char *
-testStorageFindPoolSources(virConnectPtr conn,
+testStorageFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
const char *type,
const char *srcSpec,
unsigned int flags ATTRIBUTE_UNUSED)
@@ -3727,7 +3722,7 @@ testStorageFindPoolSources(virConnectPtr conn,

pool_type = virStoragePoolTypeFromString(type);
if (!pool_type) {
- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("unknown storage pool type %s"), type);
goto cleanup;
}
@@ -3748,7 +3743,7 @@ testStorageFindPoolSources(virConnectPtr conn,

case VIR_STORAGE_POOL_NETFS:
if (!source || !source->host.name) {
- testError(conn, VIR_ERR_INVALID_ARG,
+ testError(VIR_ERR_INVALID_ARG,
"%s", "hostname must be specified for netfs sources");
goto cleanup;
}
@@ -3759,7 +3754,7 @@ testStorageFindPoolSources(virConnectPtr conn,
break;

default:
- testError(conn, VIR_ERR_NO_SUPPORT,
+ testError(VIR_ERR_NO_SUPPORT,
_("pool type '%s' does not support source discovery"), type);
}

@@ -3787,7 +3782,7 @@ testStoragePoolCreate(virConnectPtr conn,
if (!pool)
pool = virStoragePoolObjFindByName(&privconn->pools, def->name);
if (pool) {
- testError(conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
"%s", _("storage pool already exists"));
goto cleanup;
}
@@ -3861,12 +3856,12 @@ testStoragePoolUndefine(virStoragePoolPtr pool) {
pool->name);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
@@ -3894,12 +3889,12 @@ testStoragePoolBuild(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
@@ -3923,12 +3918,12 @@ testStoragePoolDestroy(virStoragePoolPtr pool) {
pool->name);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -3962,12 +3957,12 @@ testStoragePoolDelete(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
@@ -3994,12 +3989,12 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -4025,7 +4020,7 @@ testStoragePoolGetInfo(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -4058,7 +4053,7 @@ testStoragePoolDumpXML(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -4083,7 +4078,7 @@ testStoragePoolGetAutostart(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -4113,12 +4108,12 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!privpool->configFile) {
- testError(pool->conn, VIR_ERR_INVALID_ARG,
+ testError(VIR_ERR_INVALID_ARG,
"%s", _("pool has no config file"));
goto cleanup;
}
@@ -4146,12 +4141,12 @@ testStoragePoolNumVolumes(virStoragePoolPtr pool) {
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -4180,13 +4175,13 @@ testStoragePoolListVolumes(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}


if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -4226,13 +4221,13 @@ testStorageVolumeLookupByName(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}


if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -4240,7 +4235,7 @@ testStorageVolumeLookupByName(virStoragePoolPtr pool,
privvol = virStorageVolDefFindByName(privpool, name);

if (!privvol) {
- testError(pool->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching name '%s'"), name);
goto cleanup;
}
@@ -4283,7 +4278,7 @@ testStorageVolumeLookupByKey(virConnectPtr conn,
testDriverUnlock(privconn);

if (!ret)
- testError(conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching key '%s'"), key);

return ret;
@@ -4317,7 +4312,7 @@ testStorageVolumeLookupByPath(virConnectPtr conn,
testDriverUnlock(privconn);

if (!ret)
- testError(conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching path '%s'"), path);

return ret;
@@ -4338,12 +4333,12 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -4353,7 +4348,7 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
goto cleanup;

if (virStorageVolDefFindByName(privpool, privvol->name)) {
- testError(pool->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
"%s", _("storage vol already exists"));
goto cleanup;
}
@@ -4361,7 +4356,7 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
/* Make sure enough space */
if ((privpool->def->allocation + privvol->allocation) >
privpool->def->capacity) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Not enough free space in pool for volume '%s'"),
privvol->name);
goto cleanup;
@@ -4419,12 +4414,12 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(pool->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
@@ -4434,14 +4429,14 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
goto cleanup;

if (virStorageVolDefFindByName(privpool, privvol->name)) {
- testError(pool->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
"%s", _("storage vol already exists"));
goto cleanup;
}

origvol = virStorageVolDefFindByName(privpool, clonevol->name);
if (!origvol) {
- testError(pool->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
clonevol->name);
goto cleanup;
@@ -4450,7 +4445,7 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
/* Make sure enough space */
if ((privpool->def->allocation + privvol->allocation) >
privpool->def->capacity) {
- testError(pool->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("Not enough free space in pool for volume '%s'"),
privvol->name);
goto cleanup;
@@ -4509,7 +4504,7 @@ testStorageVolumeDelete(virStorageVolPtr vol,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

@@ -4517,14 +4512,14 @@ testStorageVolumeDelete(virStorageVolPtr vol,
privvol = virStorageVolDefFindByName(privpool, vol->name);

if (privvol == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(vol->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
@@ -4588,21 +4583,21 @@ testStorageVolumeGetInfo(virStorageVolPtr vol,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

privvol = virStorageVolDefFindByName(privpool, vol->name);

if (privvol == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(vol->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
@@ -4633,21 +4628,21 @@ testStorageVolumeGetXMLDesc(virStorageVolPtr vol,
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

privvol = virStorageVolDefFindByName(privpool, vol->name);

if (privvol == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(vol->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
@@ -4673,21 +4668,21 @@ testStorageVolumeGetPath(virStorageVolPtr vol) {
testDriverUnlock(privconn);

if (privpool == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ testError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto cleanup;
}

privvol = virStorageVolDefFindByName(privpool, vol->name);

if (privvol == NULL) {
- testError(vol->conn, VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_INVALID_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
}

if (!virStoragePoolObjIsActive(privpool)) {
- testError(vol->conn, VIR_ERR_INTERNAL_ERROR,
+ testError(VIR_ERR_INTERNAL_ERROR,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
--
1.6.3.3
Eric Blake
2010-04-05 16:29:48 UTC
Permalink
Post by Matthias Bolte
---
src/test/test_driver.c | 343 ++++++++++++++++++++++++------------------------
1 files changed, 169 insertions(+), 174 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 105f825..a63005d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -115,9 +115,9 @@ static const virNodeInfo defaultNodeInfo = {
};
-#define testError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+#define testError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_TEST, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:18:07 UTC
Permalink
Post by Eric Blake
---
 src/test/test_driver.c |  343 ++++++++++++++++++++++++------------------------
 1 files changed, 169 insertions(+), 174 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 105f825..a63005d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -115,9 +115,9 @@ static const virNodeInfo defaultNodeInfo = {
 };
-#define testError(conn, code, ...)                                \
-        virReportErrorHelper(conn, VIR_FROM_TEST, code, __FILE__, \
-                               __FUNCTION__, __LINE__, __VA_ARGS__)
+#define testError(code, ...)                                      \
+        virReportErrorHelper(NULL, VIR_FROM_TEST, code, __FILE__, \
+                             __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:30 UTC
Permalink
---
src/xen/proxy_internal.c | 92 ++++++++++++++++++++--------------------------
1 files changed, 40 insertions(+), 52 deletions(-)

diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index 36058bc..db209d1 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -93,8 +93,8 @@ struct xenUnifiedDriver xenProxyDriver = {
* *
************************************************************************/

-#define virProxyError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_PROXY, code, __FILE__, \
+#define virProxyError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_PROXY, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/************************************************************************
@@ -324,13 +324,13 @@ xenProxyClose(virConnectPtr conn)
xenUnifiedPrivatePtr priv;

if (conn == NULL) {
- virProxyError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return -1;
}

priv = (xenUnifiedPrivatePtr) conn->privateData;
if (!priv) {
- virProxyError (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+ virProxyError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
return -1;
}

@@ -350,13 +350,13 @@ xenProxyCommand(virConnectPtr conn, virProxyPacketPtr request,
xenUnifiedPrivatePtr priv;

if (conn == NULL) {
- virProxyError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return -1;
}

priv = (xenUnifiedPrivatePtr) conn->privateData;
if (!priv) {
- virProxyError (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+ virProxyError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
return -1;
}

@@ -394,14 +394,14 @@ retry:
goto error;
}
if (ret != sizeof(virProxyPacket)) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+ virProxyError(VIR_ERR_INTERNAL_ERROR,
_("Communication error with proxy: got %d bytes of %d"),
ret, (int) sizeof(virProxyPacket));
goto error;
}
res = request;
if (res->len != sizeof(virProxyPacket)) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+ virProxyError(VIR_ERR_INTERNAL_ERROR,
_("Communication error with proxy: expected %d bytes got %d"),
(int) sizeof(virProxyPacket), res->len);
goto error;
@@ -417,7 +417,7 @@ retry:
goto error;
}
if (ret != sizeof(virProxyPacket)) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+ virProxyError(VIR_ERR_INTERNAL_ERROR,
_("Communication error with proxy: got %d bytes of %d"),
ret, (int) sizeof(virProxyPacket));
goto error;
@@ -425,7 +425,7 @@ retry:
res = (virProxyPacketPtr) answer;
if ((res->len < sizeof(virProxyPacket)) ||
(res->len > sizeof(virProxyFullPacket))) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+ virProxyError(VIR_ERR_INTERNAL_ERROR,
_("Communication error with proxy: got %d bytes packet"),
res->len);
goto error;
@@ -435,7 +435,7 @@ retry:
(char *) &(answer->extra.arg[0]),
res->len - ret);
if (ret != (int) (res->len - sizeof(virProxyPacket))) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+ virProxyError(VIR_ERR_INTERNAL_ERROR,
_("Communication error with proxy: got %d bytes of %d"),
ret, (int) sizeof(virProxyPacket));
goto error;
@@ -447,7 +447,7 @@ retry:
*/
if ((res->version != PROXY_PROTO_VERSION) ||
(res->len < sizeof(virProxyPacket))) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virProxyError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Communication error with proxy: malformed packet"));
goto error;
}
@@ -494,7 +494,7 @@ xenProxyOpen(virConnectPtr conn,

fd = virProxyOpenClientSocket(PROXY_SOCKET_PATH);
if (fd < 0) {
- virProxyError(NULL, VIR_ERR_NO_XEN, PROXY_SOCKET_PATH);
+ virProxyError(VIR_ERR_NO_XEN, PROXY_SOCKET_PATH);
return(-1);
}
priv->proxy = fd;
@@ -504,7 +504,7 @@ xenProxyOpen(virConnectPtr conn,
req.len = sizeof(req);
ret = xenProxyCommand(conn, &req, NULL, 1);
if ((ret < 0) || (req.command != VIR_PROXY_NONE)) {
- virProxyError(NULL, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ virProxyError(VIR_ERR_OPERATION_FAILED, __FUNCTION__);
return(-1);
}
return(0);
@@ -534,11 +534,11 @@ xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer)
int ret;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (hvVer == NULL) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
memset(&req, 0, sizeof(req));
@@ -571,11 +571,11 @@ xenProxyListDomains(virConnectPtr conn, int *ids, int maxids)
int nb;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if ((ids == NULL) || (maxids <= 0)) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
memset(&req, 0, sizeof(req));
@@ -589,7 +589,7 @@ xenProxyListDomains(virConnectPtr conn, int *ids, int maxids)
if ((nb > 1020) || (nb <= 0) ||
(ans.len <= sizeof(virProxyPacket)) ||
(ans.len > sizeof(virProxyFullPacket))) {
- virProxyError(conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ virProxyError(VIR_ERR_OPERATION_FAILED, __FUNCTION__);
return(-1);
}
if (nb > maxids)
@@ -614,7 +614,7 @@ xenProxyNumOfDomains(virConnectPtr conn)
int ret;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
memset(&req, 0, sizeof(req));
@@ -644,7 +644,7 @@ xenProxyDomainGetDomMaxMemory(virConnectPtr conn, int id)
int ret;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (0);
}
memset(&req, 0, sizeof(req));
@@ -670,10 +670,7 @@ static unsigned long
xenProxyDomainGetMaxMemory(virDomainPtr domain)
{
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
- if (domain == NULL)
- virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
- else
- virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
return (0);
}
if (domain->id < 0)
@@ -699,16 +696,13 @@ xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
int ret;

if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
- if (domain == NULL)
- virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
- else
- virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
return (-1);
}
if (domain->id < 0)
return (-1);
if (info == NULL) {
- virProxyError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
memset(&req, 0, sizeof(req));
@@ -720,7 +714,7 @@ xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
return(-1);
}
if (ans.len != sizeof(virProxyPacket) + sizeof(virDomainInfo)) {
- virProxyError(domain->conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ virProxyError(VIR_ERR_OPERATION_FAILED, __FUNCTION__);
return (-1);
}
memmove(info, &ans.extra.dinfo, sizeof(virDomainInfo));
@@ -748,11 +742,11 @@ xenProxyLookupByID(virConnectPtr conn, int id)
virDomainPtr res;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
if (id < 0) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}
memset(&req, 0, sizeof(req));
@@ -791,11 +785,11 @@ xenProxyLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
virDomainPtr res;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
if (uuid == NULL) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}
memset(&req, 0, sizeof(virProxyPacket));
@@ -833,16 +827,16 @@ xenProxyLookupByName(virConnectPtr conn, const char *name)
virDomainPtr res;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
if (name == NULL) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}
len = strlen(name);
if (len > 1000) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}
memset(&req, 0, sizeof(virProxyPacket));
@@ -877,11 +871,11 @@ xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
int ret;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (info == NULL) {
- virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
memset(&req, 0, sizeof(req));
@@ -920,7 +914,7 @@ xenProxyGetCapabilities (virConnectPtr conn)
char *xml;

if (!VIR_IS_CONNECT(conn)) {
- virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return NULL;
}
memset(&req, 0, sizeof(req));
@@ -935,7 +929,7 @@ xenProxyGetCapabilities (virConnectPtr conn)
return NULL;
if (ans.len <= sizeof(virProxyPacket)
|| ans.len > sizeof (ans) - sizeof(virProxyPacket)) {
- virProxyError(conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ virProxyError(VIR_ERR_OPERATION_FAILED, __FUNCTION__);
return NULL;
}

@@ -969,10 +963,7 @@ xenProxyDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED)
char *xml;

if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
- if (domain == NULL)
- virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
- else
- virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
return (NULL);
}
if (domain->id < 0)
@@ -987,7 +978,7 @@ xenProxyDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED)
}
if (ans.len <= sizeof(virProxyPacket)
|| ans.len > sizeof (ans) - sizeof(virProxyPacket)) {
- virProxyError(domain->conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ virProxyError(VIR_ERR_OPERATION_FAILED, __FUNCTION__);
return (NULL);
}
xmllen = ans.len - sizeof(virProxyPacket);
@@ -1020,10 +1011,7 @@ xenProxyDomainGetOSType(virDomainPtr domain)
char *ostype;

if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
- if (domain == NULL)
- virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
- else
- virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virProxyError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
return (NULL);
}
memset(&req, 0, sizeof(req));
@@ -1043,7 +1031,7 @@ xenProxyDomainGetOSType(virDomainPtr domain)

if (ans.len <= sizeof(virProxyPacket)
|| ans.len > sizeof (ans) - sizeof(virProxyPacket)) {
- virProxyError(domain->conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ virProxyError(VIR_ERR_OPERATION_FAILED, __FUNCTION__);
return (NULL);
}
oslen = ans.len - sizeof(virProxyPacket);
--
1.6.3.3
Eric Blake
2010-04-05 16:31:40 UTC
Permalink
Post by Matthias Bolte
---
src/xen/proxy_internal.c | 92 ++++++++++++++++++++--------------------------
1 files changed, 40 insertions(+), 52 deletions(-)
diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index 36058bc..db209d1 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -93,8 +93,8 @@ struct xenUnifiedDriver xenProxyDriver = {
* *
************************************************************************/
-#define virProxyError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_PROXY, code, __FILE__, \
+#define virProxyError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_PROXY, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:18:37 UTC
Permalink
Post by Eric Blake
---
 src/xen/proxy_internal.c |   92 ++++++++++++++++++++--------------------------
 1 files changed, 40 insertions(+), 52 deletions(-)
diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index 36058bc..db209d1 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -93,8 +93,8 @@ struct xenUnifiedDriver xenProxyDriver = {
  *                                                                   *
  ************************************************************************/
-#define virProxyError(conn, code, ...)                                     \
-        virReportErrorHelper(conn, VIR_FROM_PROXY, code, __FILE__,         \
+#define virProxyError(code, ...)                                           \
+        virReportErrorHelper(NULL, VIR_FROM_PROXY, code, __FILE__,         \
                                __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:29 UTC
Permalink
---
src/vbox/vbox_driver.c | 12 ++--
src/vbox/vbox_tmpl.c | 177 +++++++++++++++++++++++------------------------
2 files changed, 93 insertions(+), 96 deletions(-)

diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 632cb76..36e7315 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -58,8 +58,8 @@ static virDriver vboxDriverDummy;

#define VIR_FROM_THIS VIR_FROM_VBOX

-#define vboxError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
+#define vboxError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_VBOX, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

int vboxRegister(void) {
@@ -136,27 +136,27 @@ static virDrvOpenStatus vboxOpenDummy(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED;

if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
_("no VirtualBox driver path specified (try vbox:///session)"));
return VIR_DRV_OPEN_ERROR;
}

if (uid != 0) {
if (STRNEQ (conn->uri->path, "/session")) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,
+ vboxError(VIR_ERR_INTERNAL_ERROR,
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else { /* root */
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,
+ vboxError(VIR_ERR_INTERNAL_ERROR,
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
}

- vboxError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unable to initialize VirtualBox driver API"));
return VIR_DRV_OPEN_ERROR;
}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 8450266..1310c1a 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -124,8 +124,8 @@ typedef IMediumAttachment IHardDiskAttachment;

#endif /* VBOX_API_VERSION >= 3001 */

-#define vboxError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
+#define vboxError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_VBOX, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define DEBUGPRUnichar(msg, strUtf16) \
@@ -664,7 +664,7 @@ no_memory:
return NULL;
}

-static int vboxInitialize(virConnectPtr conn, vboxGlobalData *data) {
+static int vboxInitialize(vboxGlobalData *data) {

/* Get the API table for out version, g_pVBoxFuncs is for the oldest
version of the API that we support so we cannot use that. */
@@ -691,7 +691,7 @@ static int vboxInitialize(virConnectPtr conn, vboxGlobalData *data) {
data->pFuncs->pfnGetEventQueue(&data->vboxQueue);

if (data->vboxQueue == NULL) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR, "nsIEventQueue object is null");
+ vboxError(VIR_ERR_INTERNAL_ERROR, "nsIEventQueue object is null");
goto cleanup;
}

@@ -699,12 +699,12 @@ static int vboxInitialize(virConnectPtr conn, vboxGlobalData *data) {
#endif /* !(VBOX_XPCOMC_VERSION == 0x00010000U) */

if (data->vboxObj == NULL) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR, "IVirtualBox object is null");
+ vboxError(VIR_ERR_INTERNAL_ERROR, "IVirtualBox object is null");
goto cleanup;
}

if (data->vboxSession == NULL) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR, "ISession object is null");
+ vboxError(VIR_ERR_INTERNAL_ERROR, "ISession object is null");
goto cleanup;
}

@@ -714,7 +714,7 @@ cleanup:
return -1;
}

-static int vboxExtractVersion(virConnectPtr conn, vboxGlobalData *data) {
+static int vboxExtractVersion(vboxGlobalData *data) {
int ret = -1;
PRUnichar *versionUtf16 = NULL;
nsresult rc;
@@ -736,7 +736,7 @@ static int vboxExtractVersion(virConnectPtr conn, vboxGlobalData *data) {
}

if (ret != 0)
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s",
"Cound not extract VirtualBox version");

return ret;
@@ -781,21 +781,21 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED;

if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
_("no VirtualBox driver path specified (try vbox:///session)"));
return VIR_DRV_OPEN_ERROR;
}

if (uid != 0) {
if (STRNEQ (conn->uri->path, "/session")) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,
+ vboxError(VIR_ERR_INTERNAL_ERROR,
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else { /* root */
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,
+ vboxError(VIR_ERR_INTERNAL_ERROR,
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
@@ -807,8 +807,8 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
}

if (!(data->caps = vboxCapsInit()) ||
- vboxInitialize(conn, data) < 0 ||
- vboxExtractVersion(conn, data) < 0) {
+ vboxInitialize(data) < 0 ||
+ vboxExtractVersion(data) < 0) {
vboxUninitialize(data);
return VIR_DRV_OPEN_ERROR;
}
@@ -908,7 +908,7 @@ static int vboxListDomains(virConnectPtr conn, int *ids, int nids) {

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get list of Domains",(unsigned)rc);
goto cleanup;
}
@@ -952,7 +952,7 @@ static int vboxNumOfDomains(virConnectPtr conn) {

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get number of Domains",(unsigned)rc);
goto cleanup;
}
@@ -1021,7 +1021,7 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
/* Internal vbox IDs start from 0, the public libvirt ID
* starts from 1, so refuse id==0, and adjust the rest*/
if (id == 0) {
- vboxError(conn, VIR_ERR_NO_DOMAIN,
+ vboxError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), id);
return NULL;
}
@@ -1029,7 +1029,7 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get list of machines",(unsigned)rc);
return NULL;
}
@@ -1090,7 +1090,7 @@ static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned ch

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get list of machines",(unsigned)rc);
return NULL;
}
@@ -1162,7 +1162,7 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name)

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get list of machines",(unsigned)rc);
return NULL;
}
@@ -1239,7 +1239,7 @@ static int vboxDomainIsActive(virDomainPtr dom) {

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get list of machines",(unsigned)rc);
return ret;
}
@@ -1318,7 +1318,7 @@ static int vboxDomainSuspend(virDomainPtr dom) {
vboxIIDFromUUID(dom->uuid, iid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
goto cleanup;
}
@@ -1339,13 +1339,13 @@ static int vboxDomainSuspend(virDomainPtr dom) {
VBOX_RELEASE(console);
ret = 0;
} else {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "error while suspend the domain");
goto cleanup;
}
data->vboxSession->vtbl->Close(data->vboxSession);
} else {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine not in running state to suspend it");
goto cleanup;
}
@@ -1377,7 +1377,7 @@ static int vboxDomainResume(virDomainPtr dom) {
vboxIIDFromUUID(dom->uuid, iid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
goto cleanup;
}
@@ -1398,13 +1398,13 @@ static int vboxDomainResume(virDomainPtr dom) {
VBOX_RELEASE(console);
ret = 0;
} else {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "error while resuming the domain");
goto cleanup;
}
data->vboxSession->vtbl->Close(data->vboxSession);
} else {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine not paused, so can't resume it");
goto cleanup;
}
@@ -1435,7 +1435,7 @@ static int vboxDomainShutdown(virDomainPtr dom) {
vboxIIDFromUUID(dom->uuid, iid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
goto cleanup;
}
@@ -1448,11 +1448,11 @@ static int vboxDomainShutdown(virDomainPtr dom) {
machine->vtbl->GetState(machine, &state);

if (state == MachineState_Paused) {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine paused, so can't power it down");
goto cleanup;
} else if (state == MachineState_PoweredOff) {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine already powered down");
goto cleanup;
}
@@ -1492,7 +1492,7 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSE
vboxIIDFromUUID(dom->uuid, iid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
goto cleanup;
}
@@ -1514,7 +1514,7 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSE
}
data->vboxSession->vtbl->Close(data->vboxSession);
} else {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine not running, so can't reboot it");
goto cleanup;
}
@@ -1545,7 +1545,7 @@ static int vboxDomainDestroy(virDomainPtr dom) {
vboxIIDFromUUID(dom->uuid, iid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
goto cleanup;
}
@@ -1558,7 +1558,7 @@ static int vboxDomainDestroy(virDomainPtr dom) {
machine->vtbl->GetState(machine, &state);

if (state == MachineState_PoweredOff) {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine already powered down");
goto cleanup;
}
@@ -1621,7 +1621,7 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) {
vboxIIDFromUUID(dom->uuid, iid);
rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
goto cleanup;
}
@@ -1634,7 +1634,7 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) {
machine->vtbl->GetState(machine, &state);

if (state != MachineState_PoweredOff) {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "memory size can't be changed unless domain is powered down");
goto cleanup;
}
@@ -1649,7 +1649,7 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) {
machine->vtbl->SaveSettings(machine);
ret = 0;
} else {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s:%lu Kb, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%lu Kb, rc=%08x",
"could not set the memory size of the domain to",
memory, (unsigned)rc);
}
@@ -1675,8 +1675,8 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) {

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(NULL, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
- "Could not get list of machines",(unsigned)rc);
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
+ "Could not get list of machines", (unsigned)rc);
goto cleanup;
}

@@ -1853,17 +1853,17 @@ static int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
machine->vtbl->SaveSettings(machine);
ret = 0;
} else {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR, "%s: %u, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s: %u, rc=%08x",
"could not set the number of cpus of the domain to",
CPUCount, (unsigned)rc);
}
VBOX_RELEASE(machine);
} else {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", dom->id);
}
} else {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ vboxError(VIR_ERR_INVALID_DOMAIN,
"can't open session to the domain with id %d", dom->id);
}
data->vboxSession->vtbl->Close(data->vboxSession);
@@ -2461,7 +2461,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
maxPortPerInst,
maxSlotPerPort);
if (!def->disks[diskCount]->dst) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ vboxError(VIR_ERR_INTERNAL_ERROR,
"%s: controller instance:%u, port:%d, slot:%d",
"Could not generate medium name for the disk at",
deviceInst, devicePort, deviceSlot);
@@ -3036,7 +3036,7 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get list of Defined Domains",(unsigned)rc);
goto cleanup;
}
@@ -3090,7 +3090,7 @@ static int vboxNumOfDefinedDomains(virConnectPtr conn) {

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
"Could not get number of Defined Domains",(unsigned)rc);
goto cleanup;
}
@@ -3137,14 +3137,14 @@ static int vboxDomainCreate(virDomainPtr dom) {
int i = 0;

if (!dom->name) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
"Error while reading the domain name");
goto cleanup;
}

rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
"Could not get list of machines",(unsigned)rc);
goto cleanup;
}
@@ -3213,7 +3213,7 @@ static int vboxDomainCreate(virDomainPtr dom) {
if (valueDisplayUtf8) {
sdlDisplay = strdup(valueDisplayUtf8);
if (sdlDisplay == NULL) {
- vboxError(dom->conn, VIR_ERR_SYSTEM_ERROR, "%s", "strdup failed");
+ virReportOOMError();
/* just don't go to cleanup yet as it is ok to have
* sdlDisplay as NULL and we check it below if it
* exist and then only use it there
@@ -3227,7 +3227,7 @@ static int vboxDomainCreate(virDomainPtr dom) {
if (valueDisplayUtf8) {
guiDisplay = strdup(valueDisplayUtf8);
if (guiDisplay == NULL) {
- vboxError(dom->conn, VIR_ERR_SYSTEM_ERROR, "%s", "strdup failed");
+ virReportOOMError();
/* just don't go to cleanup yet as it is ok to have
* guiDisplay as NULL and we check it below if it
* exist and then only use it there
@@ -3287,7 +3287,7 @@ static int vboxDomainCreate(virDomainPtr dom) {
env,
&progress );
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "openremotesession failed, domain can't be started");
ret = -1;
} else {
@@ -3319,7 +3319,7 @@ static int vboxDomainCreate(virDomainPtr dom) {
data->vboxSession->vtbl->Close(data->vboxSession);

} else {
- vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ vboxError(VIR_ERR_OPERATION_FAILED,
"%s", "machine is not in poweroff|saved|"
"aborted state, so couldn't start it");
ret = -1;
@@ -3375,21 +3375,21 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
VBOX_UTF16_FREE(machineNameUtf16);

if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
- "could not define a domain",(unsigned)rc);
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
+ "could not define a domain", (unsigned)rc);
goto cleanup;
}

rc = machine->vtbl->SetMemorySize(machine, def->memory / 1024);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%lu Kb, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%lu Kb, rc=%08x",
"could not set the memory size of the domain to",
def->memory, (unsigned)rc);
}

rc = machine->vtbl->SetCPUCount(machine, def->vcpus);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%lu, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%lu, rc=%08x",
"could not set the number of virtual CPUs to",
def->vcpus, (unsigned)rc);
}
@@ -3403,7 +3403,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
(1 << VIR_DOMAIN_FEATURE_PAE));
#endif /* VBOX_API_VERSION >= 3001 */
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not change PAE status to",
((def->features) & (1 << VIR_DOMAIN_FEATURE_PAE))
? "Enabled" : "Disabled", (unsigned)rc);
@@ -3414,7 +3414,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
rc = bios->vtbl->SetACPIEnabled(bios, (def->features) &
(1 << VIR_DOMAIN_FEATURE_ACPI));
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not change ACPI status to",
((def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI))
? "Enabled" : "Disabled", (unsigned)rc);
@@ -3422,7 +3422,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
rc = bios->vtbl->SetIOAPICEnabled(bios, (def->features) &
(1 << VIR_DOMAIN_FEATURE_APIC));
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
"could not change APIC status to",
((def->features) & (1 << VIR_DOMAIN_FEATURE_APIC))
? "Enabled" : "Disabled", (unsigned)rc);
@@ -3433,8 +3433,8 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
/* Register the machine before attaching other devices to it */
rc = data->vboxObj->vtbl->RegisterMachine(data->vboxObj, machine);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
- "could not define a domain",(unsigned)rc);
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
+ "could not define a domain", (unsigned)rc);
goto cleanup;
}

@@ -3551,13 +3551,13 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
if (dvdImage) {
rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the uuid of the file to be attached to cdrom",
def->disks[i]->src, (unsigned)rc);
} else {
rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not attach the file to cdrom",
def->disks[i]->src, (unsigned)rc);
} else {
@@ -3612,7 +3612,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
if (hardDisk) {
rc = hardDisk->vtbl->imedium.GetId((IMedium *)hardDisk, &hdduuid);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the uuid of the file to be attached as harddisk",
def->disks[i]->src, (unsigned)rc);
} else {
@@ -3655,7 +3655,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
VBOX_UTF16_FREE(hddcnameUtf16);

if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not attach the file as harddisk",
def->disks[i]->src, (unsigned)rc);
} else {
@@ -3709,13 +3709,13 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
if (floppyImage) {
rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the uuid of the file to be attached to floppy drive",
def->disks[i]->src, (unsigned)rc);
} else {
rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not attach the file to floppy drive",
def->disks[i]->src, (unsigned)rc);
} else {
@@ -3857,7 +3857,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
}

if (!medium) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"Failed to attach the following disk/dvd/floppy to the machine",
def->disks[i]->src, (unsigned)rc);
VBOX_UTF16_FREE(mediumFileUtf16);
@@ -3866,7 +3866,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {

rc = medium->vtbl->GetId(medium, &mediumUUID);
if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the uuid of the file to be attached as harddisk/dvd/floppy",
def->disks[i]->src, (unsigned)rc);
VBOX_RELEASE(medium);
@@ -3906,7 +3906,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
&deviceInst,
&devicePort,
&deviceSlot)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the port/slot number of harddisk/dvd/floppy to be attached",
def->disks[i]->src, (unsigned)rc);
VBOX_RELEASE(medium);
@@ -3924,7 +3924,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
mediumUUID);

if (NS_FAILED(rc)) {
- vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not attach the file as harddisk/dvd/floppy",
def->disks[i]->src, (unsigned)rc);
} else {
@@ -4625,7 +4625,7 @@ static int vboxDomainUndefine(virDomainPtr dom) {
machine->vtbl->DeleteSettings(machine);
ret = 0;
} else {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
"could not delete the domain", (unsigned)rc);
}

@@ -4679,7 +4679,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,

rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,"no domain with matching uuid");
+ vboxError(VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
goto cleanup;
}

@@ -4731,7 +4731,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
if (dvdImage) {
rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the uuid of the file to be attached to cdrom",
dev->data.disk->src, (unsigned)rc);
} else {
@@ -4739,7 +4739,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
dvdDrive->vtbl->Unmount(dvdDrive);
rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not attach the file to cdrom",
dev->data.disk->src, (unsigned)rc);
} else {
@@ -4793,13 +4793,13 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
if (floppyImage) {
rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"can't get the uuid of the file to be attached to floppy drive",
dev->data.disk->src, (unsigned)rc);
} else {
rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not attach the file to floppy drive",
dev->data.disk->src, (unsigned)rc);
} else {
@@ -4847,7 +4847,7 @@ static int vboxDomainAttachDevice(virDomainPtr dom, const char *xml) {
static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- vboxError(dom->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ vboxError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot modify the persistent configuration of a domain"));
return -1;
}
@@ -4858,7 +4858,7 @@ static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
static int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- vboxError(dom->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ vboxError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot modify the persistent configuration of a domain"));
return -1;
}
@@ -4905,7 +4905,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) {

rc = data->vboxObj->vtbl->GetMachine(data->vboxObj, iid, &machine);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ vboxError(VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
goto cleanup;
}

@@ -4935,7 +4935,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) {
if (dvdDrive) {
rc = dvdDrive->vtbl->Unmount(dvdDrive);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
"could not de-attach the mounted ISO",
(unsigned)rc);
} else {
@@ -4956,7 +4956,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) {
if (enabled) {
rc = floppyDrive->vtbl->Unmount(floppyDrive);
if (NS_FAILED(rc)) {
- vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s, rc=%08x",
"could not attach the file to floppy drive",
(unsigned)rc);
} else {
@@ -4999,7 +4999,7 @@ cleanup:
static int vboxDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- vboxError(dom->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ vboxError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot modify the persistent configuration of a domain"));
return -1;
}
@@ -5638,7 +5638,7 @@ static int vboxListNetworks(virConnectPtr conn, char **const names, int nnames)
DEBUG("nnames[%d]: %s", ret, nameUtf8);
names[ret] = strdup(nameUtf8);
if (names[ret] == NULL) {
- vboxError(conn, VIR_ERR_SYSTEM_ERROR, "%s", "strdup failed");
+ virReportOOMError();
} else {
ret++;
}
@@ -5719,7 +5719,7 @@ static int vboxListDefinedNetworks(virConnectPtr conn, char **const names, int n
DEBUG("nnames[%d]: %s", ret, nameUtf8);
names[ret] = strdup(nameUtf8);
if (names[ret] == NULL) {
- vboxError(conn, VIR_ERR_SYSTEM_ERROR, "%s", "strdup failed");
+ virReportOOMError();
} else {
ret++;
}
@@ -6241,9 +6241,7 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
if (def->hosts[0].name == NULL) {
VIR_FREE(def->hosts);
def->nhosts = 0;
- vboxError(network->conn,
- VIR_ERR_SYSTEM_ERROR,
- "%s", "strdup failed");
+ virReportOOMError();
} else {
PRUnichar *macAddressUtf16 = NULL;
PRUnichar *ipAddressUtf16 = NULL;
@@ -6280,8 +6278,7 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
vboxIIDUnalloc(vboxnet0IID);
VBOX_UTF16_FREE(networkNameUtf16);
} else {
- vboxError(network->conn, VIR_ERR_SYSTEM_ERROR,
- "%s", "strdup failed");
+ virReportOOMError();
}
}

@@ -6398,7 +6395,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool) {
hardDiskCount = 0;
} else {
hardDiskCount = -1;
- vboxError(pool->conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not get number of volumes in the pool",
pool->name, (unsigned)rc);
}
@@ -6454,7 +6451,7 @@ static int vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names
hardDiskCount = 0;
} else {
hardDiskCount = -1;
- vboxError(pool->conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+ vboxError(VIR_ERR_INTERNAL_ERROR, "%s:%s, rc=%08x",
"could not get the volume list in the pool",
pool->name, (unsigned)rc);
}
--
1.6.3.3
Eric Blake
2010-04-05 16:31:02 UTC
Permalink
Post by Matthias Bolte
---
src/vbox/vbox_driver.c | 12 ++--
src/vbox/vbox_tmpl.c | 177 +++++++++++++++++++++++------------------------
2 files changed, 93 insertions(+), 96 deletions(-)
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 632cb76..36e7315 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -58,8 +58,8 @@ static virDriver vboxDriverDummy;
#define VIR_FROM_THIS VIR_FROM_VBOX
-#define vboxError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
+#define vboxError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_VBOX, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:18:21 UTC
Permalink
Post by Eric Blake
---
 src/vbox/vbox_driver.c |   12 ++--
 src/vbox/vbox_tmpl.c   |  177 +++++++++++++++++++++++------------------------
 2 files changed, 93 insertions(+), 96 deletions(-)
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 632cb76..36e7315 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -58,8 +58,8 @@ static virDriver vboxDriverDummy;
 #define VIR_FROM_THIS VIR_FROM_VBOX
-#define vboxError(conn, code, ...) \
-        virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
+#define vboxError(code, ...) \
+        virReportErrorHelper(NULL, VIR_FROM_VBOX, code, __FILE__, \
                              __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:31 UTC
Permalink
---
src/xen/xend_internal.c | 528 +++++++++++++++++++++--------------------------
src/xen/xend_internal.h | 24 +--
src/xen/xm_internal.c | 16 +-
3 files changed, 254 insertions(+), 314 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 691a940..c4e73b7 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -85,8 +85,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn ATTRIBUTE_UNUSED,
int xendConfigVersion,
int isAttach);
static int
-xenDaemonFormatSxprOnePCI(virConnectPtr conn,
- virDomainHostdevDefPtr def,
+xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
virBufferPtr buf,
int detach);

@@ -98,12 +97,12 @@ virDomainXMLDevID(virDomainPtr domain,
int ref_len);
#endif

-#define virXendError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XEND, code, __FILE__, \
+#define virXendError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XEND, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

-#define virXendErrorInt(conn, code, ival) \
- virXendError(conn, code, "%d", ival)
+#define virXendErrorInt(code, ival) \
+ virXendError(code, "%d", ival)

/**
* do_connect:
@@ -123,7 +122,7 @@ do_connect(virConnectPtr xend)

s = socket(priv->addrfamily, SOCK_STREAM, priv->addrprotocol);
if (s == -1) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to create a socket"));
return -1;
}
@@ -146,7 +145,7 @@ do_connect(virConnectPtr xend)
* error
*/
if (xenHavePrivilege()) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to connect to xend"));
}
}
@@ -167,7 +166,7 @@ do_connect(virConnectPtr xend)
* Returns the number of bytes exchanged, or -1 in case of error
*/
static size_t
-wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read)
+wr_sync(int fd, void *buffer, size_t size, int do_read)
{
size_t offset = 0;

@@ -193,10 +192,10 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read)
/* unrecoverable error */
if (len == -1) {
if (do_read)
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to read from Xen Daemon"));
else
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to write to Xen Daemon"));

return (-1);
@@ -210,7 +209,6 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read)

/**
* sread:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @size: the size of the I/O
@@ -220,14 +218,13 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read)
* Returns the number of bytes read, or -1 in case of error
*/
static ssize_t
-sread(virConnectPtr xend, int fd, void *buffer, size_t size)
+sread(int fd, void *buffer, size_t size)
{
- return wr_sync(xend, fd, buffer, size, 1);
+ return wr_sync(fd, buffer, size, 1);
}

/**
* swrite:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @size: the size of the I/O
@@ -237,14 +234,13 @@ sread(virConnectPtr xend, int fd, void *buffer, size_t size)
* Returns the number of bytes written, or -1 in case of error
*/
static ssize_t
-swrite(virConnectPtr xend, int fd, const void *buffer, size_t size)
+swrite(int fd, const void *buffer, size_t size)
{
- return wr_sync(xend, fd, (void *) buffer, size, 0);
+ return wr_sync(fd, (void *) buffer, size, 0);
}

/**
* swrites:
- * @xend: the xend connection object
* @fd: the file descriptor
* @string: the string to write
*
@@ -253,14 +249,13 @@ swrite(virConnectPtr xend, int fd, const void *buffer, size_t size)
* Returns the number of bytes written, or -1 in case of error
*/
static ssize_t
-swrites(virConnectPtr xend, int fd, const char *string)
+swrites(int fd, const char *string)
{
- return swrite(xend, fd, string, strlen(string));
+ return swrite(fd, string, strlen(string));
}

/**
* sreads:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @n_buffer: the size of the I/O buffer
@@ -270,7 +265,7 @@ swrites(virConnectPtr xend, int fd, const char *string)
* Returns the number of bytes read, or -1 in case of error
*/
static ssize_t
-sreads(virConnectPtr xend, int fd, char *buffer, size_t n_buffer)
+sreads(int fd, char *buffer, size_t n_buffer)
{
size_t offset;

@@ -280,7 +275,7 @@ sreads(virConnectPtr xend, int fd, char *buffer, size_t n_buffer)
for (offset = 0; offset < (n_buffer - 1); offset++) {
ssize_t ret;

- ret = sread(xend, fd, buffer + offset, 1);
+ ret = sread(fd, buffer + offset, 1);
if (ret == 0)
break;
else if (ret == -1)
@@ -305,7 +300,6 @@ istartswith(const char *haystack, const char *needle)

/**
* xend_req:
- * @xend: the xend connection object
* @fd: the file descriptor
* @content: the buffer to store the content
* @n_content: the size of the buffer
@@ -315,13 +309,13 @@ istartswith(const char *haystack, const char *needle)
* Returns the HTTP return code.
*/
static int
-xend_req(virConnectPtr xend, int fd, char *content, size_t n_content)
+xend_req(int fd, char *content, size_t n_content)
{
char buffer[4096];
int content_length = -1;
int retcode = 0;

- while (sreads(xend, fd, buffer, sizeof(buffer)) > 0) {
+ while (sreads(fd, buffer, sizeof(buffer)) > 0) {
if (STREQ(buffer, "\r\n"))
break;

@@ -337,7 +331,7 @@ xend_req(virConnectPtr xend, int fd, char *content, size_t n_content)
if ((unsigned int) content_length > (n_content + 1))
content_length = n_content - 1;

- ret = sread(xend, fd, content, content_length);
+ ret = sread(fd, content, content_length);
if (ret < 0)
return -1;

@@ -370,21 +364,21 @@ xend_get(virConnectPtr xend, const char *path,
if (s == -1)
return s;

- swrites(xend, s, "GET ");
- swrites(xend, s, path);
- swrites(xend, s, " HTTP/1.1\r\n");
+ swrites(s, "GET ");
+ swrites(s, path);
+ swrites(s, " HTTP/1.1\r\n");

- swrites(xend, s,
+ swrites(s,
"Host: localhost:8000\r\n"
"Accept-Encoding: identity\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n" "\r\n");

- ret = xend_req(xend, s, content, n_content);
+ ret = xend_req(s, content, n_content);
close(s);

if (((ret < 0) || (ret >= 300)) &&
((ret != 404) || (!STRPREFIX(path, "/xend/domain/")))) {
- virXendError(xend, VIR_ERR_GET_FAILED,
+ virXendError(VIR_ERR_GET_FAILED,
_("%d status from xen daemon: %s:%s"),
ret, path, content);
}
@@ -417,28 +411,28 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
if (s == -1)
return s;

- swrites(xend, s, "POST ");
- swrites(xend, s, path);
- swrites(xend, s, " HTTP/1.1\r\n");
+ swrites(s, "POST ");
+ swrites(s, path);
+ swrites(s, " HTTP/1.1\r\n");

- swrites(xend, s,
+ swrites(s,
"Host: localhost:8000\r\n"
"Accept-Encoding: identity\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: ");
snprintf(buffer, sizeof(buffer), "%d", (int) strlen(ops));
- swrites(xend ,s, buffer);
- swrites(xend, s, "\r\n\r\n");
- swrites(xend, s, ops);
+ swrites(s, buffer);
+ swrites(s, "\r\n\r\n");
+ swrites(s, ops);

- ret = xend_req(xend, s, content, n_content);
+ ret = xend_req(s, content, n_content);
close(s);

if ((ret < 0) || (ret >= 300)) {
- virXendError(xend, VIR_ERR_POST_FAILED,
+ virXendError(VIR_ERR_POST_FAILED,
_("xend_post: error from xen daemon: %s"), content);
} else if ((ret == 202) && (strstr(content, "failed") != NULL)) {
- virXendError(xend, VIR_ERR_POST_FAILED,
+ virXendError(VIR_ERR_POST_FAILED,
_("xend_post: error from xen daemon: %s"), content);
ret = -1;
} else if (((ret >= 200) && (ret <= 202)) && (strstr(content, "xend.err") != NULL)) {
@@ -446,7 +440,7 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
* which returns a success code, but the word 'xend.err'
* in body to indicate error :-(
*/
- virXendError(xend, VIR_ERR_POST_FAILED,
+ virXendError(VIR_ERR_POST_FAILED,
_("xend_post: error from xen daemon: %s"), content);
ret = -1;
}
@@ -458,7 +452,6 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,

/**
* http2unix:
- * @xend: the xend connection object
* @ret: the http return code
*
* Convert the HTTP return code to 0/-1 and set errno if needed
@@ -466,7 +459,7 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
* Return -1 in case of error code 0 otherwise
*/
static int
-http2unix(virConnectPtr xend, int ret)
+http2unix(int ret)
{
switch (ret) {
case -1:
@@ -482,7 +475,7 @@ http2unix(virConnectPtr xend, int ret)
errno = EIO;
break;
default:
- virXendErrorInt(xend, VIR_ERR_HTTP_ERROR, ret);
+ virXendErrorInt(VIR_ERR_HTTP_ERROR, ret);
errno = EINVAL;
break;
}
@@ -531,7 +524,7 @@ xend_op_ext(virConnectPtr xend, const char *path, char *error,
}

content = virBufferContentAndReset(&buf);
- ret = http2unix(xend, xend_post(xend, path, content, error, n_error));
+ ret = http2unix(xend_post(xend, path, content, error, n_error));
VIR_FREE(content);

return ret;
@@ -598,7 +591,7 @@ sexpr_get(virConnectPtr xend, const char *fmt, ...)
va_end(ap);

ret = xend_get(xend, path, buffer, sizeof(buffer));
- ret = http2unix(xend ,ret);
+ ret = http2unix(ret);
if (ret == -1)
return NULL;

@@ -807,7 +800,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)

ret = getaddrinfo (host, port, &hints, &res);
if (ret != 0) {
- virXendError(NULL, VIR_ERR_UNKNOWN_HOST,
+ virXendError(VIR_ERR_UNKNOWN_HOST,
_("unable to resolve hostname '%s': %s"),
host, gai_strerror (ret));
return -1;
@@ -962,7 +955,7 @@ xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr)
ptr = urlencode(sexpr);
if (ptr == NULL) {
/* this should be caught at the interface but ... */
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to urlencode the create S-Expr"));
return (-1);
}
@@ -1003,18 +996,18 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname,

value = sexpr_node(root, "domain/domid");
if (value == NULL) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing domid"));
goto error;
}
ret = strtol(value, NULL, 0);
if ((ret == 0) && (value[0] != '0')) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incorrect domid not numeric"));
ret = -1;
} else if (uuid != NULL) {
if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing uuid"));
}
}
@@ -1053,7 +1046,7 @@ xenDaemonDomainLookupByID(virConnectPtr xend,

name = sexpr_node(root, "domain/name");
if (name == NULL) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing name"));
goto error;
}
@@ -1066,7 +1059,7 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
}

if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing uuid"));
goto error;
}
@@ -1090,7 +1083,7 @@ xend_detect_config_version(virConnectPtr conn) {
xenUnifiedPrivatePtr priv;

if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}

@@ -1123,7 +1116,6 @@ xend_detect_config_version(virConnectPtr conn) {

/**
* xenDaemonParseSxprOS
- * @xend: the xend connection object
* @node: the root of the parsed S-Expression
* @def: the domain config
* @hvm: true or 1 if no contains HVM S-Expression
@@ -1134,8 +1126,7 @@ xend_detect_config_version(virConnectPtr conn) {
* Returns 0 in case of success and -1 in case of error
*/
static int
-xenDaemonParseSxprOS(virConnectPtr xend,
- const struct sexpr *node,
+xenDaemonParseSxprOS(const struct sexpr *node,
virDomainDefPtr def,
int hvm)
{
@@ -1147,7 +1138,7 @@ xenDaemonParseSxprOS(virConnectPtr xend,
goto no_memory;

if (def->os.loader == NULL) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing HVM loader"));
return(-1);
}
@@ -1201,7 +1192,7 @@ xenDaemonParseSxprOS(virConnectPtr xend,
if (!hvm &&
!def->os.kernel &&
!def->os.bootloader) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing kernel & bootloader"));
return -1;
}
@@ -1215,8 +1206,7 @@ no_memory:


int
-xend_parse_sexp_desc_char(virConnectPtr conn,
- virBufferPtr buf,
+xend_parse_sexp_desc_char(virBufferPtr buf,
const char *devtype,
int portNum,
const char *value,
@@ -1265,7 +1255,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
type = "unix";
value += sizeof("unix:")-1;
} else {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Unknown char device type"));
return -1;
}
@@ -1299,7 +1289,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
const char *mode, *protocol;

if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1339,7 +1329,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
const char *offset2, *offset3;

if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1355,7 +1345,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,

offset3 = strchr(offset2, ':');
if (offset3 == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1435,8 +1425,7 @@ error:
}

virDomainChrDefPtr
-xenDaemonParseSxprChar(virConnectPtr conn,
- const char *value,
+xenDaemonParseSxprChar(const char *value,
const char *tty)
{
const char *prefix;
@@ -1463,7 +1452,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
} else {
if ((def->type = virDomainChrTypeFromString(prefix)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown chr device type '%s'"), prefix);
goto error;
}
@@ -1490,7 +1479,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
const char *offset2;

if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1518,7 +1507,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
const char *offset2, *offset3;

if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1534,7 +1523,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,

offset3 = strchr(offset2, ':');
if (offset3 == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1589,8 +1578,7 @@ error:
* Returns 0 if successful or -1 if failed.
*/
static int
-xenDaemonParseSxprDisks(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprDisks(virDomainDefPtr def,
const struct sexpr *root,
int hvm,
int xendConfigVersion)
@@ -1625,7 +1613,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
goto no_memory;

if (dst == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, vbd has no dev"));
goto error;
}
@@ -1636,7 +1624,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (!offset ||
!hvm ||
STRNEQ(offset, ":cdrom")) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, vbd has no src"));
goto error;
}
@@ -1645,7 +1633,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (src != NULL) {
offset = strchr(src, ':');
if (!offset) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot parse vbd filename, missing driver name"));
goto error;
}
@@ -1654,7 +1642,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
goto no_memory;
if (virStrncpy(disk->driverName, src, offset-src,
(offset-src)+1) == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Driver name %s too big for destination"),
src);
goto error;
@@ -1665,7 +1653,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (STREQ (disk->driverName, "tap")) {
offset = strchr(src, ':');
if (!offset) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot parse vbd filename, missing driver type"));
goto error;
}
@@ -1674,7 +1662,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
goto no_memory;
if (virStrncpy(disk->driverType, src, offset-src,
(offset-src)+1) == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Driver type %s too big for destination"),
src);
goto error;
@@ -1760,8 +1748,7 @@ error:


static int
-xenDaemonParseSxprNets(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprNets(virDomainDefPtr def,
const struct sexpr *root)
{
virDomainNetDefPtr net = NULL;
@@ -1820,7 +1807,7 @@ xenDaemonParseSxprNets(virConnectPtr conn,
tmp = sexpr_node(node, "device/vif/mac");
if (tmp) {
if (virParseMacAddr(tmp, net->mac) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("malformed mac address '%s'"), tmp);
goto cleanup;
}
@@ -1854,8 +1841,7 @@ cleanup:


int
-xenDaemonParseSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprSound(virDomainDefPtr def,
const char *str)
{
if (STREQ(str, "all")) {
@@ -1899,7 +1885,7 @@ xenDaemonParseSxprSound(virConnectPtr conn,
else
len = strlen(offset);
if (virStrncpy(model, offset, len, sizeof(model)) == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Sound model %s too big for destination"),
offset);
goto error;
@@ -2098,7 +2084,7 @@ xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
goto no_memory;

if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown graphics type '%s'"), tmp);
goto error;
}
@@ -2171,7 +2157,6 @@ error:

/**
* xenDaemonParseSxprPCI
- * @conn: connection
* @root: root sexpr
*
* This parses out block devices from the domain sexpr
@@ -2179,8 +2164,7 @@ error:
* Returns 0 if successful or -1 if failed.
*/
static int
-xenDaemonParseSxprPCI(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprPCI(virDomainDefPtr def,
const struct sexpr *root)
{
const struct sexpr *cur, *tmp = NULL, *node;
@@ -2225,43 +2209,43 @@ xenDaemonParseSxprPCI(virConnectPtr conn,
continue;

if (!(domain = sexpr_node(node, "dev/domain"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI domain"));
goto error;
}
if (!(bus = sexpr_node(node, "dev/bus"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI bus"));
goto error;
}
if (!(slot = sexpr_node(node, "dev/slot"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI slot"));
goto error;
}
if (!(func = sexpr_node(node, "dev/func"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI func"));
goto error;
}

if (virStrToLong_i(domain, NULL, 0, &domainID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI domain '%s'"), domain);
goto error;
}
if (virStrToLong_i(bus, NULL, 0, &busID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI bus '%s'"), bus);
goto error;
}
if (virStrToLong_i(slot, NULL, 0, &slotID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI slot '%s'"), slot);
goto error;
}
if (virStrToLong_i(func, NULL, 0, &funcID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI func '%s'"), func);
goto error;
}
@@ -2327,7 +2311,7 @@ xenDaemonParseSxpr(virConnectPtr conn,

tmp = sexpr_node(root, "domain/domid");
if (tmp == NULL && xendConfigVersion < 3) { /* Old XenD, domid was mandatory */
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing id"));
goto error;
}
@@ -2340,14 +2324,14 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (sexpr_node_copy(root, "domain/name", &def->name) < 0)
goto no_memory;
if (def->name == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing name"));
goto error;
}

tmp = sexpr_node(root, "domain/uuid");
if (tmp == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing name"));
goto error;
}
@@ -2378,7 +2362,7 @@ xenDaemonParseSxpr(virConnectPtr conn,

if (def->id != 0) {
if (sexpr_lookup(root, "domain/image")) {
- if (xenDaemonParseSxprOS(conn, root, def, hvm) < 0)
+ if (xenDaemonParseSxprOS(root, def, hvm) < 0)
goto error;
}
}
@@ -2398,7 +2382,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (virDomainCpuSetParse(&cpus,
0, def->cpumask,
def->cpumasklen) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("invalid CPU mask %s"), cpus);
goto error;
}
@@ -2409,7 +2393,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/on_poweroff");
if (tmp != NULL) {
if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp);
goto error;
}
@@ -2419,7 +2403,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/on_reboot");
if (tmp != NULL) {
if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp);
goto error;
}
@@ -2429,7 +2413,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/on_crash");
if (tmp != NULL) {
if ((def->onCrash = virDomainLifecycleTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp);
goto error;
}
@@ -2461,13 +2445,13 @@ xenDaemonParseSxpr(virConnectPtr conn,
goto no_memory;

/* append block devices */
- if (xenDaemonParseSxprDisks(conn, def, root, hvm, xendConfigVersion) < 0)
+ if (xenDaemonParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
goto error;

- if (xenDaemonParseSxprNets(conn, def, root) < 0)
+ if (xenDaemonParseSxprNets(def, root) < 0)
goto error;

- if (xenDaemonParseSxprPCI(conn, def, root) < 0)
+ if (xenDaemonParseSxprPCI(def, root) < 0)
goto error;

/* New style graphics device config */
@@ -2562,7 +2546,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/image/hvm/serial");
if (tmp && STRNEQ(tmp, "none")) {
virDomainChrDefPtr chr;
- if ((chr = xenDaemonParseSxprChar(conn, tmp, tty)) == NULL)
+ if ((chr = xenDaemonParseSxprChar(tmp, tty)) == NULL)
goto error;
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
virDomainChrDefFree(chr);
@@ -2575,7 +2559,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (tmp && STRNEQ(tmp, "none")) {
virDomainChrDefPtr chr;
/* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */
- if ((chr = xenDaemonParseSxprChar(conn, tmp, NULL)) == NULL)
+ if ((chr = xenDaemonParseSxprChar(tmp, NULL)) == NULL)
goto error;
if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
virDomainChrDefFree(chr);
@@ -2586,7 +2570,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
}
} else {
/* Fake a paravirt console, since that's not in the sexpr */
- if (!(def->console = xenDaemonParseSxprChar(conn, "pty", tty)))
+ if (!(def->console = xenDaemonParseSxprChar("pty", tty)))
goto error;
def->console->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_CONSOLE;
}
@@ -2597,7 +2581,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (hvm &&
(tmp = sexpr_node(root, "domain/image/hvm/soundhw")) != NULL &&
*tmp) {
- if (xenDaemonParseSxprSound(conn, def, tmp) < 0)
+ if (xenDaemonParseSxprSound(def, tmp) < 0)
goto error;
}

@@ -2749,8 +2733,7 @@ sexpr_to_xend_node_info(const struct sexpr *root, virNodeInfoPtr info)
* Returns 0 in case of success, -1 in case of error
*/
static int
-sexpr_to_xend_topology(virConnectPtr conn,
- const struct sexpr *root,
+sexpr_to_xend_topology(const struct sexpr *root,
virCapsPtr caps)
{
const char *nodeToCpu;
@@ -2815,7 +2798,7 @@ sexpr_to_xend_topology(virConnectPtr conn,
return (0);

parse_error:
- virXendError(conn, VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
+ virXendError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
error:
VIR_FREE(cpuNums);
VIR_FREE(cpuset);
@@ -2878,7 +2861,7 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root)
return (ret);

error:
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to parse Xend domain information"));
if (ret != NULL)
virUnrefDomain(ret);
@@ -2922,7 +2905,7 @@ xenDaemonOpen(virConnectPtr conn,
if (conn->uri->scheme == NULL) {
/* It should be a file access */
if (conn->uri->path == NULL) {
- virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__);
+ virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
goto failed;
}
if (xenDaemonOpen_unix(conn, conn->uri->path) < 0 ||
@@ -2956,7 +2939,7 @@ xenDaemonOpen(virConnectPtr conn,
xend_detect_config_version(conn) == -1)
goto failed;
} else {
- virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__);
+ virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
goto failed;
}

@@ -2998,13 +2981,12 @@ int
xenDaemonDomainSuspend(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3025,13 +3007,12 @@ int
xenDaemonDomainResume(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3053,13 +3034,12 @@ int
xenDaemonDomainShutdown(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3082,13 +3062,12 @@ int
xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3113,13 +3092,12 @@ int
xenDaemonDomainDestroy(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3144,8 +3122,7 @@ xenDaemonDomainGetOSType(virDomainPtr domain)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}

@@ -3191,13 +3168,12 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(filename == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3228,13 +3204,12 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(filename == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3262,7 +3237,7 @@ xenDaemonDomainRestore(virConnectPtr conn, const char *filename)
{
if ((conn == NULL) || (filename == NULL)) {
/* this should be caught at the interface but ... */
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
return xend_op(conn, "", "op", "restore", "file", filename, NULL);
@@ -3285,8 +3260,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -3325,8 +3299,7 @@ xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -3363,8 +3336,7 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -3395,7 +3367,7 @@ xenDaemonDomainFetch(virConnectPtr conn,
else
root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
if (root == NULL) {
- virXendError (conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonDomainFetch failed to"
" find this domain"));
return (NULL);
@@ -3436,8 +3408,7 @@ xenDaemonDomainDumpXML(virDomainPtr domain, int flags, const char *cpus)
char *xml;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
@@ -3480,8 +3451,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(info == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -3518,7 +3488,7 @@ xenDaemonLookupByName(virConnectPtr conn, const char *domname)
virDomainPtr ret = NULL;

if ((conn == NULL) || (domname == NULL)) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}

@@ -3549,11 +3519,11 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
struct sexpr *root;

if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (info == NULL) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -3582,12 +3552,12 @@ xenDaemonNodeGetTopology(virConnectPtr conn,
struct sexpr *root;

if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}

if (caps == NULL) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -3596,7 +3566,7 @@ xenDaemonNodeGetTopology(virConnectPtr conn,
return (-1);
}

- ret = sexpr_to_xend_topology(conn, root, caps);
+ ret = sexpr_to_xend_topology(root, caps);
sexpr_free(root);
return (ret);
}
@@ -3620,11 +3590,11 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
unsigned long version;

if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (hvVer == NULL) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
root = sexpr_get(conn, "/xend/node/");
@@ -3770,8 +3740,7 @@ xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (vcpus < 1)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -3811,8 +3780,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -3871,13 +3839,11 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (info == NULL) || (maxinfo < 1)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
if (cpumaps != NULL && maplen < 1) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -4102,8 +4068,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
char class[8], ref[80];

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}

@@ -4112,14 +4077,14 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
if (domain->id < 0) {
/* If xendConfigVersion < 3 only live config can be changed */
if (priv->xendConfigVersion < 3) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
}
/* Cannot modify live config if domain is inactive */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot modify live config if domain is inactive"));
return -1;
}
@@ -4128,7 +4093,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
if (priv->xendConfigVersion < 3 &&
(flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT ||
flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
@@ -4138,7 +4103,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
*/
if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend only supports modifying both live and "
"persistent config"));
return -1;
@@ -4178,19 +4143,18 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
case VIR_DOMAIN_DEVICE_HOSTDEV:
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
- if (xenDaemonFormatSxprOnePCI(domain->conn,
- dev->data.hostdev,
+ if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
&buf, 0) < 0)
goto cleanup;
} else {
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
break;

default:
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
@@ -4239,8 +4203,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
char class[8], ref[80];

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}

@@ -4249,14 +4212,14 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
if (domain->id < 0) {
/* If xendConfigVersion < 3 only live config can be changed */
if (priv->xendConfigVersion < 3) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
}
/* Cannot modify live config if domain is inactive */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot modify live config if domain is inactive"));
return -1;
}
@@ -4265,7 +4228,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
if (priv->xendConfigVersion < 3 &&
(flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT ||
flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
@@ -4275,7 +4238,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
*/
if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend only supports modifying both live and "
"persistent config"));
return -1;
@@ -4304,7 +4267,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
break;

default:
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
@@ -4312,7 +4275,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
sexpr = virBufferContentAndReset(&buf);

if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("requested device does not exist"));
goto cleanup;
} else {
@@ -4351,8 +4314,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
virBuffer buf = VIR_BUFFER_INITIALIZER;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -4361,14 +4323,14 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if (domain->id < 0) {
/* If xendConfigVersion < 3 only live config can be changed */
if (priv->xendConfigVersion < 3) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
}
/* Cannot modify live config if domain is inactive */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot modify live config if domain is inactive"));
return -1;
}
@@ -4377,7 +4339,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if (priv->xendConfigVersion < 3 &&
(flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT ||
flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
@@ -4387,7 +4349,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
*/
if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend only supports modifying both live and "
"persistent config"));
return -1;
@@ -4410,12 +4372,11 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
- if (xenDaemonFormatSxprOnePCI(domain->conn,
- dev->data.hostdev,
+ if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
&buf, 1) < 0)
goto cleanup;
} else {
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
@@ -4446,8 +4407,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -4460,7 +4420,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,

root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL) {
- virXendError (domain->conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonGetAutostart failed to find this domain"));
return (-1);
}
@@ -4486,8 +4446,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INTERNAL_ERROR,
- __FUNCTION__);
+ virXendError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
return (-1);
}

@@ -4500,7 +4459,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,

root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL) {
- virXendError (domain->conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonSetAutostart failed to find this domain"));
return (-1);
}
@@ -4510,7 +4469,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
const char *val = (autonode->u.s.car->kind == SEXPR_VALUE
? autonode->u.s.car->u.value : NULL);
if (!val || (!STREQ(val, "ignore") && !STREQ(val, "start"))) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected value from on_xend_start"));
goto error;
}
@@ -4525,17 +4484,17 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
}

if (sexpr2string(root, buf, sizeof(buf)) == 0) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("sexpr2string failed"));
goto error;
}
if (xend_op(domain->conn, "", "op", "new", "config", buf, NULL) != 0) {
- virXendError(domain->conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("Failed to redefine sexpr"));
goto error;
}
} else {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("on_xend_start not present in sexpr"));
goto error;
}
@@ -4579,7 +4538,6 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
unsigned long bandwidth)
{
/* Upper layers have already checked domain. */
- virConnectPtr conn = domain->conn;
/* NB: Passing port=0 to xend means it ignores
* the port. However this is somewhat specific to
* the internals of the xend Python code. (XXX).
@@ -4593,7 +4551,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,

/* Xen doesn't support renaming domains during migration. */
if (dname) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: Xen does not support"
" renaming domains during migration"));
return -1;
@@ -4603,7 +4561,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
* ignores it.
*/
if (bandwidth) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: Xen does not support"
" bandwidth limits during migration"));
return -1;
@@ -4631,7 +4589,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
* a nice error message.
*/
if (flags & VIR_MIGRATE_PAUSED) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: xend cannot migrate paused domains"));
return -1;
}
@@ -4639,7 +4597,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
/* XXX we could easily do tunnelled & peer2peer migration too
if we want to. support these... */
if (flags != 0) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: unsupported flag"));
return -1;
}
@@ -4652,19 +4610,19 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
if (strstr (uri, "//")) { /* Full URI. */
xmlURIPtr uriptr = xmlParseURI (uri);
if (!uriptr) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: invalid URI"));
return -1;
}
if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: only xenmigr://"
" migrations are supported by Xen"));
xmlFreeURI (uriptr);
return -1;
}
if (!uriptr->server) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: a hostname must be"
" specified in the URI"));
xmlFreeURI (uriptr);
@@ -4684,7 +4642,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
int port_nr, n;

if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: invalid port number"));
return -1;
}
@@ -4749,13 +4707,13 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {

if (!(def = virDomainDefParseString(priv->caps, xmlDesc,
VIR_DOMAIN_XML_INACTIVE))) {
- virXendError(conn, VIR_ERR_XML_ERROR,
+ virXendError(VIR_ERR_XML_ERROR,
"%s", _("failed to parse domain description"));
return (NULL);
}

if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
- virXendError(conn, VIR_ERR_XML_ERROR,
+ virXendError(VIR_ERR_XML_ERROR,
"%s", _("failed to build sexpr"));
goto error;
}
@@ -4765,7 +4723,7 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
ret = xend_op(conn, "", "op", "new", "config", sexpr, NULL);
VIR_FREE(sexpr);
if (ret != 0) {
- virXendError(conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
_("Failed to create inactive domain %s\n"), def->name);
goto error;
}
@@ -4788,8 +4746,7 @@ int xenDaemonDomainCreate(virDomainPtr domain)
virDomainPtr tmp;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -4816,8 +4773,7 @@ int xenDaemonDomainUndefine(virDomainPtr domain)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -4937,15 +4893,14 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (nparams == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return NULL;
}

/* Support only xendConfigVersion >=4 */
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) {
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("unsupported in xendConfigVersion < 4"));
return NULL;
}
@@ -4957,7 +4912,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
/* get xen_scheduler from xend/node */
ret = sexpr_node(root, "node/xen_scheduler");
if (ret == NULL){
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("node information incomplete, missing scheduler name"));
goto error;
}
@@ -4976,7 +4931,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
}
*nparams = XEN_SCHED_SEDF_NPARAM;
} else {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error;
}

@@ -5013,15 +4968,14 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (params == NULL) || (nparams == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

/* Support only xendConfigVersion >=4 */
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) {
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("unsupported in xendConfigVersion < 4"));
return (-1);
}
@@ -5034,7 +4988,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
/* get the scheduler type */
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
if (sched_type == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to get a scheduler name"));
goto error;
}
@@ -5047,18 +5001,18 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
case XEN_SCHED_CRED_NPARAM:
/* get cpu_weight/cpu_cap from xend/domain */
if (sexpr_node(root, "domain/cpu_weight") == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing cpu_weight"));
goto error;
}
if (sexpr_node(root, "domain/cpu_cap") == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing cpu_cap"));
goto error;
}

if (virStrcpyStatic(params[0].field, str_weight) == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Weight %s too big for destination"),
str_weight);
goto error;
@@ -5067,7 +5021,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
params[0].value.ui = sexpr_int(root, "domain/cpu_weight");

if (virStrcpyStatic(params[1].field, str_cap) == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Cap %s too big for destination"), str_cap);
goto error;
}
@@ -5077,7 +5031,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
ret = 0;
break;
default:
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error;
}

@@ -5110,15 +5064,14 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (params == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

/* Support only xendConfigVersion >=4 and active domains */
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) {
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("unsupported in xendConfigVersion < 4"));
return (-1);
}
@@ -5131,7 +5084,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
/* get the scheduler type */
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
if (sched_type == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to get a scheduler name"));
goto error;
}
@@ -5158,7 +5111,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
} else {
- virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
}
@@ -5167,7 +5120,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if (strlen(buf_weight) == 0) {
weight = sexpr_node(root, "domain/cpu_weight");
if (weight == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing cpu_weight"));
goto error;
}
@@ -5176,7 +5129,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if (strlen(buf_cap) == 0) {
cap = sexpr_node(root, "domain/cpu_cap");
if (cap == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing cpu_cap"));
goto error;
}
@@ -5189,7 +5142,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
break;
}
default:
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error;
}

@@ -5234,13 +5187,13 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
domain->name);
else {
/* This call always fails for dom0. */
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("domainBlockPeek is not supported for dom0"));
return -1;
}

if (!root) {
- virXendError (domain->conn, VIR_ERR_XEN_CALL, __FUNCTION__);
+ virXendError(VIR_ERR_XEN_CALL, __FUNCTION__);
return -1;
}

@@ -5255,7 +5208,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
}
}
if (!found) {
- virXendError (domain->conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("%s: invalid path"), path);
goto cleanup;
}
@@ -5352,13 +5305,12 @@ struct xenUnifiedDriver xenDaemonDriver = {
* Returns 0 in case of success, -1 in case of error
*/
static int
-xenDaemonFormatSxprGraphicsNew(virConnectPtr conn,
- virDomainGraphicsDefPtr def,
+xenDaemonFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
virBufferPtr buf)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected graphics type %d"),
def->type);
return -1;
@@ -5397,14 +5349,13 @@ xenDaemonFormatSxprGraphicsNew(virConnectPtr conn,


static int
-xenDaemonFormatSxprGraphicsOld(virConnectPtr conn,
- virDomainGraphicsDefPtr def,
+xenDaemonFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
virBufferPtr buf,
int xendConfigVersion)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected graphics type %d"),
def->type);
return -1;
@@ -5440,14 +5391,13 @@ xenDaemonFormatSxprGraphicsOld(virConnectPtr conn,
}

int
-xenDaemonFormatSxprChr(virConnectPtr conn,
- virDomainChrDefPtr def,
+xenDaemonFormatSxprChr(virDomainChrDefPtr def,
virBufferPtr buf)
{
const char *type = virDomainChrTypeToString(def->type);

if (!type) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected chr device type"));
return -1;
}
@@ -5530,7 +5480,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
if (hvm &&
def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (isAttach) {
- virXendError(conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("Cannot directly attach floppy %s"), def->src);
return -1;
}
@@ -5542,7 +5492,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
def->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
xendConfigVersion == 1) {
if (isAttach) {
- virXendError(conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("Cannot directly attach CDROM %s"), def->src);
return -1;
}
@@ -5597,7 +5547,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
else
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", def->src);
} else {
- virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virXendError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported disk type %s"),
virDomainDiskTypeToString(def->type));
return -1;
@@ -5647,7 +5597,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
def->type != VIR_DOMAIN_NET_TYPE_NETWORK &&
def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unsupported network type %d"), def->type);
return -1;
}
@@ -5680,7 +5630,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
char *bridge;

if (!network) {
- virXendError(conn, VIR_ERR_NO_NETWORK, "%s",
+ virXendError(VIR_ERR_NO_NETWORK, "%s",
def->data.network.name);
return -1;
}
@@ -5688,7 +5638,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
bridge = virNetworkGetBridgeName(network);
virNetworkFree(network);
if (!bridge) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("network %s is not active"),
def->data.network.name);
return -1;
@@ -5761,13 +5711,12 @@ xenDaemonFormatSxprPCI(virDomainHostdevDefPtr def,
}

static int
-xenDaemonFormatSxprOnePCI(virConnectPtr conn,
- virDomainHostdevDefPtr def,
+xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
virBufferPtr buf,
int detach)
{
if (def->managed) {
- virXendError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("managed PCI devices not supported with XenD"));
return -1;
}
@@ -5784,8 +5733,7 @@ xenDaemonFormatSxprOnePCI(virConnectPtr conn,
}

static int
-xenDaemonFormatSxprAllPCI(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprAllPCI(virDomainDefPtr def,
virBufferPtr buf)
{
int hasPCI = 0;
@@ -5818,7 +5766,7 @@ xenDaemonFormatSxprAllPCI(virConnectPtr conn,
if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (def->hostdevs[i]->managed) {
- virXendError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("managed PCI devices not supported with XenD"));
return -1;
}
@@ -5832,8 +5780,7 @@ xenDaemonFormatSxprAllPCI(virConnectPtr conn,
}

int
-xenDaemonFormatSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprSound(virDomainDefPtr def,
virBufferPtr buf)
{
const char *str;
@@ -5841,7 +5788,7 @@ xenDaemonFormatSxprSound(virConnectPtr conn,

for (i = 0 ; i < def->nsounds ; i++) {
if (!(str = virDomainSoundModelTypeToString(def->sounds[i]->model))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sound model %d"),
def->sounds[i]->model);
return -1;
@@ -5859,8 +5806,7 @@ xenDaemonFormatSxprSound(virConnectPtr conn,


static int
-xenDaemonFormatSxprInput(virConnectPtr conn,
- virDomainInputDefPtr input,
+xenDaemonFormatSxprInput(virDomainInputDefPtr input,
virBufferPtr buf)
{
if (input->bus != VIR_DOMAIN_INPUT_BUS_USB)
@@ -5868,7 +5814,7 @@ xenDaemonFormatSxprInput(virConnectPtr conn,

if (input->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
input->type != VIR_DOMAIN_INPUT_TYPE_TABLET) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected input type %d"), input->type);
return -1;
}
@@ -5933,21 +5879,21 @@ xenDaemonFormatSxpr(virConnectPtr conn,
}

if (!(tmp = virDomainLifecycleTypeToString(def->onPoweroff))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onPoweroff);
goto error;
}
virBufferVSprintf(&buf, "(on_poweroff '%s')", tmp);

if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onReboot);
goto error;
}
virBufferVSprintf(&buf, "(on_reboot '%s')", tmp);

if (!(tmp = virDomainLifecycleTypeToString(def->onCrash))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onCrash);
goto error;
}
@@ -5956,14 +5902,14 @@ xenDaemonFormatSxpr(virConnectPtr conn,
/* Set localtime here for current XenD (both PV & HVM) */
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) {
- virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virXendError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("configurable timezones are not supported"));
goto error;
}

virBufferAddLit(&buf, "(localtime 1)");
} else if (def->clock.offset != VIR_DOMAIN_CLOCK_OFFSET_UTC) {
- virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virXendError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset '%s'"),
virDomainClockOffsetTypeToString(def->clock.offset));
goto error;
@@ -5980,7 +5926,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,

if (hvm &&
def->os.loader == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s",_("no HVM domain loader"));
goto error;
}
@@ -6064,12 +6010,12 @@ xenDaemonFormatSxpr(virConnectPtr conn,
virBufferAddLit(&buf, "(usb 1)");

for (i = 0 ; i < def->ninputs ; i++)
- if (xenDaemonFormatSxprInput(conn, def->inputs[i], &buf) < 0)
+ if (xenDaemonFormatSxprInput(def->inputs[i], &buf) < 0)
goto error;

if (def->parallels) {
virBufferAddLit(&buf, "(parallel ");
- if (xenDaemonFormatSxprChr(conn, def->parallels[0], &buf) < 0)
+ if (xenDaemonFormatSxprChr(def->parallels[0], &buf) < 0)
goto error;
virBufferAddLit(&buf, ")");
} else {
@@ -6077,7 +6023,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
}
if (def->serials) {
virBufferAddLit(&buf, "(serial ");
- if (xenDaemonFormatSxprChr(conn, def->serials[0], &buf) < 0)
+ if (xenDaemonFormatSxprChr(def->serials[0], &buf) < 0)
goto error;
virBufferAddLit(&buf, ")");
} else {
@@ -6090,7 +6036,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,

if (def->sounds) {
virBufferAddLit(&buf, "(soundhw '");
- if (xenDaemonFormatSxprSound(conn, def, &buf) < 0)
+ if (xenDaemonFormatSxprSound(def, &buf) < 0)
goto error;
virBufferAddLit(&buf, "')");
}
@@ -6105,7 +6051,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF) ||
(hvm && xendConfigVersion < 4)) {
if ((def->ngraphics == 1) &&
- xenDaemonFormatSxprGraphicsOld(conn, def->graphics[0],
+ xenDaemonFormatSxprGraphicsOld(def->graphics[0],
&buf, xendConfigVersion) < 0)
goto error;
}
@@ -6123,7 +6069,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
&buf, hvm, xendConfigVersion, 0) < 0)
goto error;

- if (xenDaemonFormatSxprAllPCI(conn, def, &buf) < 0)
+ if (xenDaemonFormatSxprAllPCI(def, &buf) < 0)
goto error;

/* New style PV graphics config xen >= 3.0.4,
@@ -6131,7 +6077,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if ((xendConfigVersion >= XEND_CONFIG_MIN_VERS_PVFB_NEWCONF && !hvm) ||
(xendConfigVersion >= 4 && hvm)) {
if ((def->ngraphics == 1) &&
- xenDaemonFormatSxprGraphicsNew(conn, def->graphics[0], &buf) < 0)
+ xenDaemonFormatSxprGraphicsNew(def->graphics[0], &buf) < 0)
goto error;
}

@@ -6246,7 +6192,7 @@ virDomainXMLDevID(virDomainPtr domain,
if (tmp == NULL)
return -1;
} else {
- virXendError(NULL, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("hotplug of device type not supported"));
return -1;
}
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index 028a293..25a5421 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -96,12 +96,11 @@ xenDaemonDomainFetch(virConnectPtr xend,
const char *name,
const char *cpus);

- int xend_parse_sexp_desc_char(virConnectPtr conn,
- virBufferPtr buf,
- const char *devtype,
- int portNum,
- const char *value,
- const char *tty);
+int xend_parse_sexp_desc_char(virBufferPtr buf,
+ const char *devtype,
+ int portNum,
+ const char *value,
+ const char *tty);

virDomainDefPtr
xenDaemonParseSxprString(virConnectPtr conn,
@@ -109,21 +108,18 @@ xenDaemonParseSxprString(virConnectPtr conn,
int xendConfigVersion);

int
-xenDaemonParseSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprSound(virDomainDefPtr def,
const char *str);
+
virDomainChrDefPtr
-xenDaemonParseSxprChar(virConnectPtr conn,
- const char *value,
+xenDaemonParseSxprChar(const char *value,
const char *tty);

int
-xenDaemonFormatSxprChr(virConnectPtr conn,
- virDomainChrDefPtr def,
+xenDaemonFormatSxprChr(virDomainChrDefPtr def,
virBufferPtr buf);
int
-xenDaemonFormatSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprSound(virDomainDefPtr def,
virBufferPtr buf);

char *
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 0d42b01..b4a8117 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1415,7 +1415,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (xenXMConfigGetString(conn, conf, "parallel", &str, NULL) < 0)
goto cleanup;
if (str && STRNEQ(str, "none") &&
- !(chr = xenDaemonParseSxprChar(conn, str, NULL)))
+ !(chr = xenDaemonParseSxprChar(str, NULL)))
goto cleanup;

if (chr) {
@@ -1432,7 +1432,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (xenXMConfigGetString(conn, conf, "serial", &str, NULL) < 0)
goto cleanup;
if (str && STRNEQ(str, "none") &&
- !(chr = xenDaemonParseSxprChar(conn, str, NULL)))
+ !(chr = xenDaemonParseSxprChar(str, NULL)))
goto cleanup;

if (chr) {
@@ -1445,7 +1445,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
def->nserials++;
}
} else {
- if (!(def->console = xenDaemonParseSxprChar(conn, "pty", NULL)))
+ if (!(def->console = xenDaemonParseSxprChar("pty", NULL)))
goto cleanup;
def->console->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_CONSOLE;
}
@@ -1455,7 +1455,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto cleanup;

if (str &&
- xenDaemonParseSxprSound(conn, def, str) < 0)
+ xenDaemonParseSxprSound(def, str) < 0)
goto cleanup;
}

@@ -2572,7 +2572,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
char *str;
int ret;

- ret = xenDaemonFormatSxprChr(conn, def->parallels[0], &buf);
+ ret = xenDaemonFormatSxprChr(def->parallels[0], &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
ret = xenXMConfigSetString(conf, "parallel", str);
@@ -2589,7 +2589,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
char *str;
int ret;

- ret = xenDaemonFormatSxprChr(conn, def->serials[0], &buf);
+ ret = xenDaemonFormatSxprChr(def->serials[0], &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
ret = xenXMConfigSetString(conf, "serial", str);
@@ -2605,9 +2605,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
if (def->sounds) {
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *str = NULL;
- int ret = xenDaemonFormatSxprSound(conn,
- def,
- &buf);
+ int ret = xenDaemonFormatSxprSound(def, &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
ret = xenXMConfigSetString(conf, "soundhw", str);
--
1.6.3.3
Eric Blake
2010-04-05 16:33:16 UTC
Permalink
Post by Matthias Bolte
@@ -98,12 +97,12 @@ virDomainXMLDevID(virDomainPtr domain,
int ref_len);
#endif
-#define virXendError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XEND, code, __FILE__, \
+#define virXendError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XEND, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
-#define virXendErrorInt(conn, code, ival) \
- virXendError(conn, code, "%d", ival)
+#define virXendErrorInt(code, ival) \
+ virXendError(code, "%d", ival)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:18:54 UTC
Permalink
Post by Eric Blake
Post by Matthias Bolte
@@ -98,12 +97,12 @@ virDomainXMLDevID(virDomainPtr domain,
                   int ref_len);
 #endif
-#define virXendError(conn, code, ...)                                      \
-        virReportErrorHelper(conn, VIR_FROM_XEND, code, __FILE__,          \
+#define virXendError(code, ...)                                            \
+        virReportErrorHelper(NULL, VIR_FROM_XEND, code, __FILE__,          \
                              __FUNCTION__, __LINE__, __VA_ARGS__)
-#define virXendErrorInt(conn, code, ival)                                    \
-        virXendError(conn, code, "%d", ival)
+#define virXendErrorInt(code, ival)                                        \
+        virXendError(code, "%d", ival)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:34 UTC
Permalink
---
src/xen/xs_internal.c | 43 +++++++++++++++++++------------------------
1 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 466169d..9296f25 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -88,7 +88,7 @@ struct xenUnifiedDriver xenStoreDriver = {

#endif /* ! PROXY */

-#define virXenStoreError(conn, code, ...) \
+#define virXenStoreError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_XENSTORE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

@@ -297,8 +297,8 @@ xenStoreOpen(virConnectPtr conn,
* remote) mechanism.
*/
if (xenHavePrivilege()) {
- virXenStoreError(NULL, VIR_ERR_NO_XEN,
- "%s", _("failed to connect to Xen Store"));
+ virXenStoreError(VIR_ERR_NO_XEN,
+ "%s", _("failed to connect to Xen Store"));
}
return (-1);
}
@@ -322,8 +322,8 @@ xenStoreOpen(virConnectPtr conn,
if ( xenStoreAddWatch(conn, "@releaseDomain",
"releaseDomain", xenStoreDomainReleased, priv) < 0 )
{
- virXenStoreError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("adding watch @releaseDomain"));
+ virXenStoreError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("adding watch @releaseDomain"));
return -1;
}

@@ -331,8 +331,8 @@ xenStoreOpen(virConnectPtr conn,
if( xenStoreAddWatch(conn, "@introduceDomain",
"introduceDomain", xenStoreDomainIntroduced, priv) < 0 )
{
- virXenStoreError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("adding watch @introduceDomain"));
+ virXenStoreError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("adding watch @introduceDomain"));
return -1;
}

@@ -362,7 +362,7 @@ xenStoreClose(virConnectPtr conn)
xenUnifiedPrivatePtr priv;

if (conn == NULL) {
- virXenStoreError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -419,8 +419,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
return (-1);

if ((domain == NULL) || (domain->conn == NULL) || (info == NULL)) {
- virXenStoreError(domain ? domain->conn : NULL, VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -485,8 +484,7 @@ xenStoreDomainSetMemory(virDomainPtr domain, unsigned long memory)

if ((domain == NULL) || (domain->conn == NULL) ||
(memory < 1024 * MIN_XEN_GUEST_SIZE)) {
- virXenStoreError(domain ? domain->conn : NULL, VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id == -1)
@@ -550,13 +548,13 @@ xenStoreNumOfDomains(virConnectPtr conn)
xenUnifiedPrivatePtr priv;

if (conn == NULL) {
- virXenStoreError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}

priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL) {
- virXenStoreError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -638,7 +636,7 @@ xenStoreListDomains(virConnectPtr conn, int *ids, int maxids)
int ret;

if ((conn == NULL) || (ids == NULL)) {
- virXenStoreError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -673,7 +671,7 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
xenUnifiedPrivatePtr priv;

if ((conn == NULL) || (name == NULL)) {
- virXenStoreError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}

@@ -737,8 +735,7 @@ xenStoreDomainShutdown(virDomainPtr domain)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL)) {
- virXenStoreError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id == -1 || domain->id == 0)
@@ -772,8 +769,7 @@ xenStoreDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
xenUnifiedPrivatePtr priv;

if ((domain == NULL) || (domain->conn == NULL)) {
- virXenStoreError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id == -1 || domain->id == 0)
@@ -803,8 +799,7 @@ xenStoreDomainGetOSType(virDomainPtr domain) {
char *vm, *str = NULL;

if ((domain == NULL) || (domain->conn == NULL)) {
- virXenStoreError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}

@@ -1200,8 +1195,8 @@ int xenStoreAddWatch(virConnectPtr conn,
for (n=0; n < list->count; n++) {
if( STREQ(list->watches[n]->path, path) &&
STREQ(list->watches[n]->token, token)) {
- virXenStoreError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("watch already tracked"));
+ virXenStoreError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("watch already tracked"));
return -1;
}
}
--
1.6.3.3
Eric Blake
2010-04-05 16:36:54 UTC
Permalink
Post by Matthias Bolte
---
src/xen/xs_internal.c | 43 +++++++++++++++++++------------------------
1 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 466169d..9296f25 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -88,7 +88,7 @@ struct xenUnifiedDriver xenStoreDriver = {
#endif /* ! PROXY */
-#define virXenStoreError(conn, code, ...) \
+#define virXenStoreError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_XENSTORE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:19:43 UTC
Permalink
Post by Eric Blake
---
 src/xen/xs_internal.c |   43 +++++++++++++++++++------------------------
 1 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 466169d..9296f25 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -88,7 +88,7 @@ struct xenUnifiedDriver xenStoreDriver = {
 #endif /* ! PROXY */
-#define virXenStoreError(conn, code, ...)                                  \
+#define virXenStoreError(code, ...)                                  \
         virReportErrorHelper(NULL, VIR_FROM_XENSTORE, code, __FILE__,      \
                              __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:32 UTC
Permalink
---
src/xen/xm_internal.c | 257 +++++++++++++++++++++++--------------------------
1 files changed, 120 insertions(+), 137 deletions(-)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index b4a8117..d1265ba 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -121,8 +121,8 @@ struct xenUnifiedDriver xenXMDriver = {
NULL, /* domainSetSchedulerParameters */
};

-#define xenXMError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \
+#define xenXMError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XENXM, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#ifndef WITH_XEN_INOTIFY
@@ -139,8 +139,7 @@ static int xenInotifyActive(virConnectPtr conn)
#endif

/* Convenience method to grab a int from the config file object */
-static int xenXMConfigGetBool(virConnectPtr conn,
- virConfPtr conf,
+static int xenXMConfigGetBool(virConfPtr conf,
const char *name,
int *value,
int def) {
@@ -157,7 +156,7 @@ static int xenXMConfigGetBool(virConnectPtr conn,
} else if (val->type == VIR_CONF_STRING) {
*value = STREQ(val->str, "1") ? 1 : 0;
} else {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name);
return -1;
}
@@ -166,8 +165,7 @@ static int xenXMConfigGetBool(virConnectPtr conn,


/* Convenience method to grab a int from the config file object */
-static int xenXMConfigGetULong(virConnectPtr conn,
- virConfPtr conf,
+static int xenXMConfigGetULong(virConfPtr conf,
const char *name,
unsigned long *value,
int def) {
@@ -185,12 +183,12 @@ static int xenXMConfigGetULong(virConnectPtr conn,
char *ret;
*value = strtol(val->str, &ret, 10);
if (ret == val->str) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name);
return -1;
}
} else {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name);
return -1;
}
@@ -199,8 +197,7 @@ static int xenXMConfigGetULong(virConnectPtr conn,


/* Convenience method to grab a string from the config file object */
-static int xenXMConfigGetString(virConnectPtr conn,
- virConfPtr conf,
+static int xenXMConfigGetString(virConfPtr conf,
const char *name,
const char **value,
const char *def) {
@@ -213,7 +210,7 @@ static int xenXMConfigGetString(virConnectPtr conn,
}

if (val->type != VIR_CONF_STRING) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name);
return -1;
}
@@ -224,8 +221,7 @@ static int xenXMConfigGetString(virConnectPtr conn,
return 0;
}

-static int xenXMConfigCopyStringInternal(virConnectPtr conn,
- virConfPtr conf,
+static int xenXMConfigCopyStringInternal(virConfPtr conf,
const char *name,
char **value,
int allowMissing) {
@@ -235,20 +231,20 @@ static int xenXMConfigCopyStringInternal(virConnectPtr conn,
if (!(val = virConfGetValue(conf, name))) {
if (allowMissing)
return 0;
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was missing"), name);
return -1;
}

if (val->type != VIR_CONF_STRING) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was not a string"), name);
return -1;
}
if (!val->str) {
if (allowMissing)
return 0;
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was missing"), name);
return -1;
}
@@ -262,18 +258,16 @@ static int xenXMConfigCopyStringInternal(virConnectPtr conn,
}


-static int xenXMConfigCopyString(virConnectPtr conn,
- virConfPtr conf,
+static int xenXMConfigCopyString(virConfPtr conf,
const char *name,
char **value) {
- return xenXMConfigCopyStringInternal(conn, conf, name, value, 0);
+ return xenXMConfigCopyStringInternal(conf, name, value, 0);
}

-static int xenXMConfigCopyStringOpt(virConnectPtr conn,
- virConfPtr conf,
+static int xenXMConfigCopyStringOpt(virConfPtr conf,
const char *name,
char **value) {
- return xenXMConfigCopyStringInternal(conn, conf, name, value, 1);
+ return xenXMConfigCopyStringInternal(conf, name, value, 1);
}


@@ -456,7 +450,7 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
if (virHashAddEntry(priv->configCache, entry->filename, entry) < 0) {
virDomainDefFree(entry->def);
VIR_FREE(entry);
- xenXMError (conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("xenXMConfigCacheRefresh: virHashAddEntry"));
return -1;
}
@@ -633,8 +627,7 @@ int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) {
const char *filename;
xenXMConfCachePtr entry;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}

@@ -694,13 +687,13 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
def->virtType = VIR_DOMAIN_VIRT_XEN;
def->id = -1;

- if (xenXMConfigCopyString(conn, conf, "name", &def->name) < 0)
+ if (xenXMConfigCopyString(conf, "name", &def->name) < 0)
goto cleanup;
if (xenXMConfigGetUUID(conf, "uuid", def->uuid) < 0)
goto cleanup;


- if ((xenXMConfigGetString(conn, conf, "builder", &str, "linux") == 0) &&
+ if ((xenXMConfigGetString(conf, "builder", &str, "linux") == 0) &&
STREQ(str, "hvm"))
hvm = 1;

@@ -709,7 +702,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {

defaultArch = virCapabilitiesDefaultGuestArch(priv->caps, def->os.type, virDomainVirtTypeToString(def->virtType));
if (defaultArch == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("no supported architecture for os type '%s'"),
def->os.type);
goto cleanup;
@@ -728,10 +721,10 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {

if (hvm) {
const char *boot;
- if (xenXMConfigCopyString(conn, conf, "kernel", &def->os.loader) < 0)
+ if (xenXMConfigCopyString(conf, "kernel", &def->os.loader) < 0)
goto cleanup;

- if (xenXMConfigGetString(conn, conf, "boot", &boot, "c") < 0)
+ if (xenXMConfigGetString(conf, "boot", &boot, "c") < 0)
goto cleanup;

for (i = 0 ; i < VIR_DOMAIN_BOOT_LAST && boot[i] ; i++) {
@@ -753,33 +746,33 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
def->os.nBootDevs++;
}
} else {
- if (xenXMConfigCopyStringOpt(conn, conf, "bootloader", &def->os.bootloader) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conn, conf, "bootargs", &def->os.bootloaderArgs) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "bootargs", &def->os.bootloaderArgs) < 0)
goto cleanup;

- if (xenXMConfigCopyStringOpt(conn, conf, "kernel", &def->os.kernel) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conn, conf, "ramdisk", &def->os.initrd) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conn, conf, "extra", &def->os.cmdline) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "extra", &def->os.cmdline) < 0)
goto cleanup;
}

- if (xenXMConfigGetULong(conn, conf, "memory", &def->memory, MIN_XEN_GUEST_SIZE * 2) < 0)
+ if (xenXMConfigGetULong(conf, "memory", &def->memory, MIN_XEN_GUEST_SIZE * 2) < 0)
goto cleanup;

- if (xenXMConfigGetULong(conn, conf, "maxmem", &def->maxmem, def->memory) < 0)
+ if (xenXMConfigGetULong(conf, "maxmem", &def->maxmem, def->memory) < 0)
goto cleanup;

def->memory *= 1024;
def->maxmem *= 1024;


- if (xenXMConfigGetULong(conn, conf, "vcpus", &def->vcpus, 1) < 0)
+ if (xenXMConfigGetULong(conf, "vcpus", &def->vcpus, 1) < 0)
goto cleanup;

- if (xenXMConfigGetString(conn, conf, "cpus", &str, NULL) < 0)
+ if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
goto cleanup;
if (str) {
def->cpumasklen = 4096;
@@ -792,26 +785,26 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
}


- if (xenXMConfigGetString(conn, conf, "on_poweroff", &str, "destroy") < 0)
+ if (xenXMConfigGetString(conf, "on_poweroff", &str, "destroy") < 0)
goto cleanup;
if ((def->onPoweroff = virDomainLifecycleTypeFromString(str)) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unexpected value %s for on_poweroff"), str);
goto cleanup;
}

- if (xenXMConfigGetString(conn, conf, "on_reboot", &str, "restart") < 0)
+ if (xenXMConfigGetString(conf, "on_reboot", &str, "restart") < 0)
goto cleanup;
if ((def->onReboot = virDomainLifecycleTypeFromString(str)) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unexpected value %s for on_reboot"), str);
goto cleanup;
}

- if (xenXMConfigGetString(conn, conf, "on_crash", &str, "restart") < 0)
+ if (xenXMConfigGetString(conf, "on_crash", &str, "restart") < 0)
goto cleanup;
if ((def->onCrash = virDomainLifecycleTypeFromString(str)) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unexpected value %s for on_crash"), str);
goto cleanup;
}
@@ -819,27 +812,27 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {


if (hvm) {
- if (xenXMConfigGetBool(conn, conf, "pae", &val, 0) < 0)
+ if (xenXMConfigGetBool(conf, "pae", &val, 0) < 0)
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
- if (xenXMConfigGetBool(conn, conf, "acpi", &val, 0) < 0)
+ if (xenXMConfigGetBool(conf, "acpi", &val, 0) < 0)
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_ACPI);
- if (xenXMConfigGetBool(conn, conf, "apic", &val, 0) < 0)
+ if (xenXMConfigGetBool(conf, "apic", &val, 0) < 0)
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
}
- if (xenXMConfigGetBool(conn, conf, "localtime", &vmlocaltime, 0) < 0)
+ if (xenXMConfigGetBool(conf, "localtime", &vmlocaltime, 0) < 0)
goto cleanup;

def->clock.offset = vmlocaltime ?
VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME :
VIR_DOMAIN_CLOCK_OFFSET_UTC;

- if (xenXMConfigCopyStringOpt(conn, conf, "device_model", &def->emulator) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "device_model", &def->emulator) < 0)
goto cleanup;

list = virConfGetValue(conf, "disk");
@@ -878,7 +871,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto no_memory;
if (virStrncpy(disk->src, head, offset - head,
(offset - head) + 1) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Source file %s too big for destination"),
head);
goto cleanup;
@@ -897,7 +890,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto no_memory;
if (virStrncpy(disk->dst, head, offset - head,
(offset - head) + 1) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Dest file %s too big for destination"), head);
goto cleanup;
}
@@ -913,7 +906,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (virStrncpy(disk->driverName, disk->src,
(tmp - disk->src),
(tmp - disk->src) + 1) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Driver name %s too big for destination"),
disk->src);
goto cleanup;
@@ -934,7 +927,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (virStrncpy(disk->driverType, disk->src,
(tmp - disk->src),
(tmp - disk->src) + 1) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Driver type %s too big for destination"),
disk->src);
goto cleanup;
@@ -992,7 +985,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
}

if (hvm && priv->xendConfigVersion == 1) {
- if (xenXMConfigGetString(conn, conf, "cdrom", &str, NULL) < 0)
+ if (xenXMConfigGetString(conf, "cdrom", &str, NULL) < 0)
goto cleanup;
if (str) {
if (VIR_ALLOC(disk) < 0)
@@ -1052,7 +1045,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (STRPREFIX(key, "mac=")) {
int len = nextkey ? (nextkey - data) : sizeof(mac) - 1;
if (virStrncpy(mac, data, len, sizeof(mac)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("MAC address %s too big for destination"),
data);
goto skipnic;
@@ -1060,7 +1053,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
} else if (STRPREFIX(key, "bridge=")) {
int len = nextkey ? (nextkey - data) : sizeof(bridge) - 1;
if (virStrncpy(bridge, data, len, sizeof(bridge)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Bridge %s too big for destination"),
data);
goto skipnic;
@@ -1068,7 +1061,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
} else if (STRPREFIX(key, "script=")) {
int len = nextkey ? (nextkey - data) : sizeof(script) - 1;
if (virStrncpy(script, data, len, sizeof(script)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Script %s too big for destination"),
data);
goto skipnic;
@@ -1076,21 +1069,21 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
} else if (STRPREFIX(key, "model=")) {
int len = nextkey ? (nextkey - data) : sizeof(model) - 1;
if (virStrncpy(model, data, len, sizeof(model)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Model %s too big for destination"), data);
goto skipnic;
}
} else if (STRPREFIX(key, "type=")) {
int len = nextkey ? (nextkey - data) : sizeof(type) - 1;
if (virStrncpy(type, data, len, sizeof(type)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Type %s too big for destination"), data);
goto skipnic;
}
} else if (STRPREFIX(key, "vifname=")) {
int len = nextkey ? (nextkey - data) : sizeof(vifname) - 1;
if (virStrncpy(vifname, data, len, sizeof(vifname)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Vifname %s too big for destination"),
data);
goto skipnic;
@@ -1098,7 +1091,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
} else if (STRPREFIX(key, "ip=")) {
int len = nextkey ? (nextkey - data) : sizeof(ip) - 1;
if (virStrncpy(ip, data, len, sizeof(ip)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("IP %s too big for destination"), data);
goto skipnic;
}
@@ -1116,7 +1109,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {

if (mac[0]) {
if (virParseMacAddr(mac, net->mac) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("malformed mac address '%s'"), mac);
goto cleanup;
}
@@ -1198,7 +1191,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto skippci;

if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Domain %s too big for destination"), key);
goto skippci;
}
@@ -1208,7 +1201,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto skippci;

if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Bus %s too big for destination"), key);
goto skippci;
}
@@ -1218,7 +1211,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto skippci;

if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Slot %s too big for destination"), key);
goto skippci;
}
@@ -1228,7 +1221,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto skippci;

if (virStrncpy(func, key, 1, sizeof(func)) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("Function %s too big for destination"), key);
goto skippci;
}
@@ -1263,7 +1256,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
}

if (hvm) {
- if (xenXMConfigGetString(conn, conf, "usbdevice", &str, NULL) < 0)
+ if (xenXMConfigGetString(conf, "usbdevice", &str, NULL) < 0)
goto cleanup;
if (str &&
(STREQ(str, "tablet") ||
@@ -1286,28 +1279,28 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {

/* HVM guests, or old PV guests use this config format */
if (hvm || priv->xendConfigVersion < 3) {
- if (xenXMConfigGetBool(conn, conf, "vnc", &val, 0) < 0)
+ if (xenXMConfigGetBool(conf, "vnc", &val, 0) < 0)
goto cleanup;

if (val) {
if (VIR_ALLOC(graphics) < 0)
goto no_memory;
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
- if (xenXMConfigGetBool(conn, conf, "vncunused", &val, 1) < 0)
+ if (xenXMConfigGetBool(conf, "vncunused", &val, 1) < 0)
goto cleanup;
graphics->data.vnc.autoport = val ? 1 : 0;

if (!graphics->data.vnc.autoport) {
unsigned long vncdisplay;
- if (xenXMConfigGetULong(conn, conf, "vncdisplay", &vncdisplay, 0) < 0)
+ if (xenXMConfigGetULong(conf, "vncdisplay", &vncdisplay, 0) < 0)
goto cleanup;
graphics->data.vnc.port = (int)vncdisplay + 5900;
}
- if (xenXMConfigCopyStringOpt(conn, conf, "vnclisten", &graphics->data.vnc.listenAddr) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "vnclisten", &graphics->data.vnc.listenAddr) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conn, conf, "vncpasswd", &graphics->data.vnc.passwd) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "vncpasswd", &graphics->data.vnc.passwd) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conn, conf, "keymap", &graphics->data.vnc.keymap) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "keymap", &graphics->data.vnc.keymap) < 0)
goto cleanup;

if (VIR_ALLOC_N(def->graphics, 1) < 0)
@@ -1316,15 +1309,15 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
def->ngraphics = 1;
graphics = NULL;
} else {
- if (xenXMConfigGetBool(conn, conf, "sdl", &val, 0) < 0)
+ if (xenXMConfigGetBool(conf, "sdl", &val, 0) < 0)
goto cleanup;
if (val) {
if (VIR_ALLOC(graphics) < 0)
goto no_memory;
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
- if (xenXMConfigCopyStringOpt(conn, conf, "display", &graphics->data.sdl.display) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "display", &graphics->data.sdl.display) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conn, conf, "xauthority", &graphics->data.sdl.xauth) < 0)
+ if (xenXMConfigCopyStringOpt(conf, "xauthority", &graphics->data.sdl.xauth) < 0)
goto cleanup;
if (VIR_ALLOC_N(def->graphics, 1) < 0)
goto no_memory;
@@ -1344,7 +1337,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
char *key = vfb;

if (virStrcpyStatic(vfb, list->list->str) == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("VFB %s too big for destination"),
list->list->str);
goto cleanup;
@@ -1412,7 +1405,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (hvm) {
virDomainChrDefPtr chr = NULL;

- if (xenXMConfigGetString(conn, conf, "parallel", &str, NULL) < 0)
+ if (xenXMConfigGetString(conf, "parallel", &str, NULL) < 0)
goto cleanup;
if (str && STRNEQ(str, "none") &&
!(chr = xenDaemonParseSxprChar(str, NULL)))
@@ -1429,7 +1422,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
chr = NULL;
}

- if (xenXMConfigGetString(conn, conf, "serial", &str, NULL) < 0)
+ if (xenXMConfigGetString(conf, "serial", &str, NULL) < 0)
goto cleanup;
if (str && STRNEQ(str, "none") &&
!(chr = xenDaemonParseSxprChar(str, NULL)))
@@ -1451,7 +1444,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
}

if (hvm) {
- if (xenXMConfigGetString(conn, conf, "soundhw", &str, NULL) < 0)
+ if (xenXMConfigGetString(conf, "soundhw", &str, NULL) < 0)
goto cleanup;

if (str &&
@@ -1484,8 +1477,7 @@ char *xenXMDomainDumpXML(virDomainPtr domain, int flags) {
char *ret = NULL;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
if (domain->id != -1)
@@ -1518,8 +1510,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) {
int ret = -1;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
if (domain->conn->flags & VIR_CONNECT_RO)
@@ -1564,8 +1555,7 @@ int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) {
int ret = -1;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
if (domain->conn->flags & VIR_CONNECT_RO)
@@ -1608,8 +1598,7 @@ unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain) {
unsigned long ret = 0;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (0);
}
if (domain->id != -1)
@@ -1641,8 +1630,7 @@ int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
int ret = -1;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
if (domain->conn->flags & VIR_CONNECT_RO)
@@ -1700,17 +1688,16 @@ int xenXMDomainPinVcpu(virDomainPtr domain,

if (domain == NULL || domain->conn == NULL || domain->name == NULL
|| cpumap == NULL || maplen < 1 || maplen > (int)sizeof(cpumap_t)) {
- xenXMError(domain ? domain->conn : NULL, VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}
if (domain->conn->flags & VIR_CONNECT_RO) {
- xenXMError (domain->conn, VIR_ERR_INVALID_ARG,
+ xenXMError(VIR_ERR_INVALID_ARG,
"%s", _("read only connection"));
return -1;
}
if (domain->id != -1) {
- xenXMError (domain->conn, VIR_ERR_INVALID_ARG,
+ xenXMError(VIR_ERR_INVALID_ARG,
"%s", _("not inactive domain"));
return -1;
}
@@ -1719,11 +1706,11 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
xenUnifiedLock(priv);

if (!(filename = virHashLookup(priv->nameConfigMap, domain->name))) {
- xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup"));
+ xenXMError(VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup"));
goto cleanup;
}
if (!(entry = virHashLookup(priv->configCache, filename))) {
- xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("can't retrieve config file for domain"));
goto cleanup;
}
@@ -1785,11 +1772,11 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
virDomainPtr ret = NULL;

if (!VIR_IS_CONNECT(conn)) {
- xenXMError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
if (domname == NULL) {
- xenXMError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}

@@ -1841,11 +1828,11 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
virDomainPtr ret = NULL;

if (!VIR_IS_CONNECT(conn)) {
- xenXMError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
if (uuid == NULL) {
- xenXMError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}

@@ -1964,8 +1951,7 @@ int xenXMConfigSetString(virConfPtr conf, const char *setting, const char *str)
}


-static int xenXMDomainConfigFormatDisk(virConnectPtr conn,
- virConfValuePtr list,
+static int xenXMDomainConfigFormatDisk(virConfValuePtr list,
virDomainDiskDefPtr disk,
int hvm,
int xendConfigVersion)
@@ -1987,7 +1973,7 @@ static int xenXMDomainConfigFormatDisk(virConnectPtr conn,
virBufferAddLit(&buf, "phy:");
break;
default:
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type %s"),
virDomainDiskTypeToString(disk->type));
goto cleanup;
@@ -2071,14 +2057,14 @@ static int xenXMDomainConfigFormatNet(virConnectPtr conn,
virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name);
char *bridge;
if (!network) {
- xenXMError(conn, VIR_ERR_NO_NETWORK, "%s",
+ xenXMError(VIR_ERR_NO_NETWORK, "%s",
net->data.network.name);
return -1;
}
bridge = virNetworkGetBridgeName(network);
virNetworkFree(network);
if (!bridge) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("network %s is not active"),
net->data.network.name);
return -1;
@@ -2090,7 +2076,7 @@ static int xenXMDomainConfigFormatNet(virConnectPtr conn,
break;

default:
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unsupported network type %d"),
net->type);
goto cleanup;
@@ -2321,7 +2307,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,

if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) {
- xenXMError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ xenXMError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("configurable timezones are not supported"));
goto cleanup;
}
@@ -2333,7 +2319,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
goto no_memory;
} else {
/* XXX We could support Xen's rtc clock offset */
- xenXMError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ xenXMError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset '%s'"),
virDomainClockOffsetTypeToString(def->clock.offset));
goto cleanup;
@@ -2374,7 +2360,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
}

if (!(lifecycle = virDomainLifecycleTypeToString(def->onPoweroff))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle action %d"), def->onPoweroff);
goto cleanup;
}
@@ -2383,7 +2369,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,


if (!(lifecycle = virDomainLifecycleTypeToString(def->onReboot))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle action %d"), def->onReboot);
goto cleanup;
}
@@ -2392,7 +2378,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,


if (!(lifecycle = virDomainLifecycleTypeToString(def->onCrash))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle action %d"), def->onCrash);
goto cleanup;
}
@@ -2532,7 +2518,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
continue;

- if (xenXMDomainConfigFormatDisk(conn, diskVal, def->disks[i],
+ if (xenXMDomainConfigFormatDisk(diskVal, def->disks[i],
hvm, priv->xendConfigVersion) < 0)
goto cleanup;
}
@@ -2644,11 +2630,11 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;

if (!VIR_IS_CONNECT(conn)) {
- xenXMError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
if (xml == NULL) {
- xenXMError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}
if (conn->flags & VIR_CONNECT_RO)
@@ -2678,7 +2664,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
char uuidstr[VIR_UUID_STRING_BUFLEN];

virUUIDFormat(entry->def->uuid, uuidstr);
- xenXMError(conn, VIR_ERR_OPERATION_FAILED,
+ xenXMError(VIR_ERR_OPERATION_FAILED,
_("domain '%s' is already defined with uuid %s"),
entry->def->name, uuidstr);
entry = NULL;
@@ -2691,13 +2677,13 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
/* domain exists, we will overwrite it */

if (!(oldfilename = (char *)virHashLookup(priv->nameConfigMap, def->name))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("can't retrieve config filename for domain to overwrite"));
goto error;
}

if (!(entry = virHashLookup(priv->configCache, oldfilename))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("can't retrieve config entry for domain to overwrite"));
goto error;
}
@@ -2708,14 +2694,14 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {

/* Remove the name -> filename mapping */
if (virHashRemoveEntry(priv->nameConfigMap, def->name, NULL) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to remove old domain from config map"));
goto error;
}

/* Remove the config record itself */
if (virHashRemoveEntry(priv->configCache, oldfilename, xenXMConfigFree) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to remove old domain from config map"));
goto error;
}
@@ -2724,7 +2710,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
}

if ((strlen(priv->configDir) + 1 + strlen(def->name) + 1) > PATH_MAX) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("config file name is too long"));
goto error;
}
@@ -2742,7 +2728,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
}

if ((entry->refreshedAt = time(NULL)) == ((time_t)-1)) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unable to get current time"));
goto error;
}
@@ -2751,14 +2737,14 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
entry->def = def;

if (virHashAddEntry(priv->configCache, filename, entry) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unable to store config file handle"));
goto error;
}

if (virHashAddEntry(priv->nameConfigMap, def->name, entry->filename) < 0) {
virHashRemoveEntry(priv->configCache, filename, NULL);
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ xenXMError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unable to store config file handle"));
goto error;
}
@@ -2784,8 +2770,7 @@ int xenXMDomainUndefine(virDomainPtr domain) {
int ret = -1;

if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}

@@ -2861,7 +2846,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
int i, ret = -1;

if (!VIR_IS_CONNECT(conn)) {
- xenXMError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}

@@ -2906,7 +2891,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
int ret = -1;

if (!VIR_IS_CONNECT(conn)) {
- xenXMError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}

@@ -2948,8 +2933,7 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
xenUnifiedPrivatePtr priv;

if ((!domain) || (!domain->conn) || (!domain->name) || (!xml)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}

@@ -2995,7 +2979,7 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
}

default:
- xenXMError(domain->conn, VIR_ERR_XML_ERROR,
+ xenXMError(VIR_ERR_XML_ERROR,
"%s", _("unknown device"));
goto cleanup;
}
@@ -3039,8 +3023,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
xenUnifiedPrivatePtr priv;

if ((!domain) || (!domain->conn) || (!domain->name) || (!xml)) {
- xenXMError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}

@@ -3101,7 +3084,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
break;
}
default:
- xenXMError(domain->conn, VIR_ERR_XML_ERROR,
+ xenXMError(VIR_ERR_XML_ERROR,
"%s", _("unknown device"));
goto cleanup;
}
@@ -3121,13 +3104,13 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
}

int
-xenXMDomainBlockPeek (virDomainPtr dom,
+xenXMDomainBlockPeek (virDomainPtr dom ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
unsigned long long offset ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED,
void *buffer ATTRIBUTE_UNUSED)
{
- xenXMError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenXMError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
--
1.6.3.3
Eric Blake
2010-04-05 16:34:34 UTC
Permalink
Post by Matthias Bolte
---
src/xen/xm_internal.c | 257 +++++++++++++++++++++++--------------------------
1 files changed, 120 insertions(+), 137 deletions(-)
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index b4a8117..d1265ba 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -121,8 +121,8 @@ struct xenUnifiedDriver xenXMDriver = {
NULL, /* domainSetSchedulerParameters */
};
-#define xenXMError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \
+#define xenXMError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XENXM, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:19:17 UTC
Permalink
Post by Eric Blake
---
 src/xen/xm_internal.c |  257 +++++++++++++++++++++++--------------------------
 1 files changed, 120 insertions(+), 137 deletions(-)
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index b4a8117..d1265ba 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -121,8 +121,8 @@ struct xenUnifiedDriver xenXMDriver = {
     NULL, /* domainSetSchedulerParameters */
 };
-#define xenXMError(conn, code, ...)                                        \
-        virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__,         \
+#define xenXMError(code, ...)                                              \
+        virReportErrorHelper(NULL, VIR_FROM_XENXM, code, __FILE__,         \
                              __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:33 UTC
Permalink
---
src/xen/xen_hypervisor.c | 160 +++++++++++++++++++++++-----------------------
1 files changed, 79 insertions(+), 81 deletions(-)

diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 4a8769f..ae17c60 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -804,16 +804,15 @@ struct xenUnifiedDriver xenHypervisorDriver = {
};
#endif /* !PROXY */

-#define virXenError(conn, code, ...) \
+#define virXenError(code, ...) \
if (in_init == 0) \
- virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
+ virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#ifndef PROXY

/**
* virXenErrorFunc:
- * @conn: connection, if known
* @error: the error number
* @func: the function failing
* @info: extra information string
@@ -822,8 +821,7 @@ struct xenUnifiedDriver xenHypervisorDriver = {
* Handle an error at the xend daemon interface
*/
static void
-virXenErrorFunc(virConnectPtr conn,
- virErrorNumber error, const char *func, const char *info,
+virXenErrorFunc(virErrorNumber error, const char *func, const char *info,
int value)
{
char fullinfo[1000];
@@ -837,11 +835,11 @@ virXenErrorFunc(virConnectPtr conn,
if (func != NULL) {
snprintf(fullinfo, 999, "%s: %s", func, info);
fullinfo[999] = 0;
- virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
+ virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
errmsg, fullinfo, NULL, value, 0, errmsg, fullinfo,
value);
} else {
- virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
+ virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
errmsg, info, NULL, value, 0, errmsg, info,
value);
}
@@ -871,18 +869,18 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op)
hc.arg[0] = (unsigned long) op;

if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}

ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
if (ret < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %d",
+ virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
xen_ioctl_hypercall_cmd);
}

if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
+ virXenError(VIR_ERR_XEN_CALL, " releasing");
ret = -1;
}

@@ -913,18 +911,18 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op)
hc.arg[0] = (unsigned long) op;

if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}

ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
if (ret < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %d",
+ virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
xen_ioctl_hypercall_cmd);
}

if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
+ virXenError(VIR_ERR_XEN_CALL, " releasing");
ret = -1;
}

@@ -956,18 +954,18 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op)
hc.arg[0] = (unsigned long) op;

if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}

ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
if (ret < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " sys ioctl %d",
+ virXenError(VIR_ERR_XEN_CALL, " sys ioctl %d",
xen_ioctl_hypercall_cmd);
}

if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
+ virXenError(VIR_ERR_XEN_CALL, " releasing");
ret = -1;
}

@@ -999,18 +997,18 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op)
hc.arg[0] = (unsigned long) op;

if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}

ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
if (ret < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %d",
+ virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
xen_ioctl_hypercall_cmd);
}

if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
+ virXenError(VIR_ERR_XEN_CALL, " releasing");
ret = -1;
}

@@ -1039,7 +1037,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,

if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
XEN_GETDOMAININFO_SIZE * maxids) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}
if (hypervisor_version > 1) {
@@ -1094,7 +1092,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
}
if (unlock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
XEN_GETDOMAININFO_SIZE * maxids) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " release");
+ virXenError(VIR_ERR_XEN_CALL, " release");
ret = -1;
}
return(ret);
@@ -1132,19 +1130,19 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
xenUnifiedPrivatePtr priv;

if (domain->conn == NULL) {
- virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"domain or conn is NULL", 0);
return NULL;
}

priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"priv->handle invalid", 0);
return NULL;
}
if (domain->id < 0) {
- virXenError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXenError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
return NULL;
}
@@ -1155,7 +1153,7 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
* TODO: check on Xen 3.0.3
*/
if (dom_interface_version < 5) {
- virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
"unsupported in dom interface < 5", 0);
return NULL;
}
@@ -1216,19 +1214,19 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
xenUnifiedPrivatePtr priv;

if (domain->conn == NULL) {
- virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"domain or conn is NULL", 0);
return -1;
}

priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"priv->handle invalid", 0);
return -1;
}
if (domain->id < 0) {
- virXenError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXenError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
return -1;
}
@@ -1239,7 +1237,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
* TODO: check on Xen 3.0.3
*/
if (dom_interface_version < 5) {
- virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
"unsupported in dom interface < 5", 0);
return -1;
}
@@ -1273,16 +1271,16 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
return(-1);

if (virStrcpyStatic(params[0].field, str_weight) == NULL) {
- virXenError (domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Weight %s too big for destination", str_weight);
+ virXenError(VIR_ERR_INTERNAL_ERROR,
+ "Weight %s too big for destination", str_weight);
return -1;
}
params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT;
params[0].value.ui = op_dom.u.getschedinfo.u.credit.weight;

if (virStrcpyStatic(params[1].field, str_cap) == NULL) {
- virXenError (domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Cap %s too big for destination", str_cap);
+ virXenError(VIR_ERR_INTERNAL_ERROR,
+ "Cap %s too big for destination", str_cap);
return -1;
}
params[1].type = VIR_DOMAIN_SCHED_FIELD_UINT;
@@ -1291,7 +1289,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
*nparams = 2;
break;
default:
- virXenErrorFunc(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
"Unknown scheduler", op_sys.u.getschedulerid.sched_id);
return -1;
}
@@ -1319,25 +1317,25 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
char buf[256];

if (domain->conn == NULL) {
- virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
- "domain or conn is NULL", 0);
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "domain or conn is NULL", 0);
return -1;
}

if ((nparams == 0) || (params == NULL)) {
- virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
- "Noparameters given", 0);
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
+ "Noparameters given", 0);
return(-1);
}

priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"priv->handle invalid", 0);
return -1;
}
if (domain->id < 0) {
- virXenError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXenError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
return -1;
}
@@ -1348,7 +1346,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
* TODO: check on Xen 3.0.3
*/
if (dom_interface_version < 5) {
- virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
"unsupported in dom interface < 5", 0);
return -1;
}
@@ -1389,7 +1387,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
val = params[i].value.ui;
if ((val < 1) || (val > USHRT_MAX)) {
snprintf(buf, sizeof(buf), _("Credit scheduler weight parameter (%d) is out of range (1-65535)"), val);
- virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
return(-1);
}
op_dom.u.getschedinfo.u.credit.weight = val;
@@ -1398,14 +1396,14 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
val = params[i].value.ui;
if (val > USHRT_MAX) {
snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65535)"), val);
- virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
return(-1);
}
op_dom.u.getschedinfo.u.credit.cap = val;
} else {
- virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
- "Credit scheduler accepts 'cap' and 'weight' integer parameters",
- 0);
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
+ "Credit scheduler accepts 'cap' and 'weight' integer parameters",
+ 0);
return(-1);
}
}
@@ -1416,7 +1414,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
break;
}
default:
- virXenErrorFunc(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
"Unknown scheduler", op_sys.u.getschedulerid.sched_id);
return -1;
}
@@ -1442,9 +1440,9 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
xenUnifiedUnlock(priv);
return ret;
# else
- virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
- "block statistics not supported on this platform",
- dom->id);
+ virXenErrorFunc(VIR_ERR_NO_SUPPORT, __FUNCTION__,
+ "block statistics not supported on this platform",
+ dom->id);
return -1;
# endif
}
@@ -1468,20 +1466,20 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
* domain.
*/
if (sscanf (path, "vif%d.%d", &rqdomid, &device) != 2) {
- virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
- "invalid path, should be vif<domid>.<n>.", 0);
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
+ "invalid path, should be vif<domid>.<n>.", 0);
return -1;
}
if (rqdomid != dom->id) {
- virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
- "invalid path, vif<domid> should match this domain ID", 0);
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
+ "invalid path, vif<domid> should match this domain ID", 0);
return -1;
}

return linuxDomainInterfaceStats(path, stats);
# else
- virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
- "/proc/net/dev: Interface not found", 0);
+ virXenErrorFunc(VIR_ERR_NO_SUPPORT, __FUNCTION__,
+ "/proc/net/dev: Interface not found", 0);
return -1;
# endif
}
@@ -1717,7 +1715,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
xen_op_v2_dom op;

if (lock_pages(cpumap, maplen) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}
memset(&op, 0, sizeof(op));
@@ -1752,7 +1750,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
VIR_FREE(new);

if (unlock_pages(cpumap, maplen) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " release");
+ virXenError(VIR_ERR_XEN_CALL, " release");
ret = -1;
}
} else {
@@ -1849,7 +1847,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
}
if ((cpumap != NULL) && (maplen > 0)) {
if (lock_pages(cpumap, maplen) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
+ virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
}
memset(cpumap, 0, maplen);
@@ -1867,7 +1865,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
}
ret = xenHypervisorDoV2Dom(handle, &op);
if (unlock_pages(cpumap, maplen) < 0) {
- virXenError(NULL, VIR_ERR_XEN_CALL, " release");
+ virXenError(VIR_ERR_XEN_CALL, " release");
ret = -1;
}
}
@@ -1963,7 +1961,7 @@ xenHypervisorInit(void)
char error[100];
regerror (errcode, &flags_hvm_rec, error, sizeof error);
regfree (&flags_hvm_rec);
- virXenError (NULL, VIR_ERR_INTERNAL_ERROR, "%s", error);
+ virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
in_init = 0;
return -1;
}
@@ -1973,7 +1971,7 @@ xenHypervisorInit(void)
regerror (errcode, &flags_pae_rec, error, sizeof error);
regfree (&flags_pae_rec);
regfree (&flags_hvm_rec);
- virXenError (NULL, VIR_ERR_INTERNAL_ERROR, "%s", error);
+ virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
in_init = 0;
return -1;
}
@@ -1984,7 +1982,7 @@ xenHypervisorInit(void)
regfree (&xen_cap_rec);
regfree (&flags_pae_rec);
regfree (&flags_hvm_rec);
- virXenError (NULL, VIR_ERR_INTERNAL_ERROR, "%s", error);
+ virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
in_init = 0;
return -1;
}
@@ -2038,7 +2036,7 @@ xenHypervisorInit(void)
*/

hypervisor_version = -1;
- virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %lu",
+ virXenError(VIR_ERR_XEN_CALL, " ioctl %lu",
(unsigned long) IOCTL_PRIVCMD_HYPERCALL);
close(fd);
in_init = 0;
@@ -2124,7 +2122,7 @@ xenHypervisorInit(void)

DEBUG0("Failed to find any Xen hypervisor method");
hypervisor_version = -1;
- virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %lu",
+ virXenError(VIR_ERR_XEN_CALL, " ioctl %lu",
(unsigned long)IOCTL_PRIVCMD_HYPERCALL);
close(fd);
in_init = 0;
@@ -2164,7 +2162,7 @@ xenHypervisorOpen(virConnectPtr conn,

ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
if (ret < 0) {
- virXenError(conn, VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
+ virXenError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
return (-1);
}

@@ -2830,7 +2828,7 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)

priv = (xenUnifiedPrivatePtr) dom->conn->privateData;
if (priv->handle < 0) {
- virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("domain shut off or invalid"), 0);
return (NULL);
}
@@ -2838,7 +2836,7 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
/* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/
if (hypervisor_version < 2 ||
dom_interface_version < 4) {
- virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("unsupported in dom interface < 4"), 0);
return (NULL);
}
@@ -2846,13 +2844,13 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
XEN_GETDOMAININFO_CLEAR(dominfo);

if (virXen_getdomaininfo(priv->handle, dom->id, &dominfo) < 0) {
- virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("cannot get domain details"), 0);
return (NULL);
}

if (XEN_GETDOMAININFO_DOMAIN(dominfo) != dom->id) {
- virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("cannot get domain details"), 0);
return (NULL);
}
@@ -3218,7 +3216,7 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
xenUnifiedPrivatePtr priv;

if (conn == NULL) {
- virXenErrorFunc (conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
"invalid argument", 0);
return -1;
}
@@ -3226,13 +3224,13 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
priv = conn->privateData;

if (priv->nbNodeCells < 0) {
- virXenErrorFunc (conn, VIR_ERR_XEN_CALL, __FUNCTION__,
- "cannot determine actual number of cells",0);
+ virXenErrorFunc(VIR_ERR_XEN_CALL, __FUNCTION__,
+ "cannot determine actual number of cells",0);
return(-1);
}

if ((maxCells < 1) || (startCell >= priv->nbNodeCells)) {
- virXenErrorFunc (conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
"invalid argument", 0);
return -1;
}
@@ -3241,13 +3239,13 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
* Support only sys_interface_version >=4
*/
if (sys_interface_version < SYS_IFACE_MIN_VERS_NUMA) {
- virXenErrorFunc (conn, VIR_ERR_XEN_CALL, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_XEN_CALL, __FUNCTION__,
"unsupported in sys interface < 4", 0);
return -1;
}

if (priv->handle < 0) {
- virXenErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"priv->handle invalid", 0);
return -1;
}
@@ -3485,12 +3483,12 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if (priv->handle < 0 || (domain->id < 0) ||
(info == NULL) || (maxinfo < 1) ||
(sizeof(cpumap_t) & 7)) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("domain shut off or invalid"), 0);
return (-1);
}
if ((cpumaps != NULL) && (maplen < 1)) {
- virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
"invalid argument", 0);
return -1;
}
@@ -3500,7 +3498,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
&dominfo);

if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("cannot get domain details"), 0);
return (-1);
}
@@ -3517,7 +3515,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
(unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i),
maplen);
if (ret < 0) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("cannot get VCPUs info"), 0);
return(-1);
}
@@ -3525,7 +3523,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
ret = virXen_getvcpusinfo(priv->handle, domain->id, i,
ipt, NULL, 0);
if (ret < 0) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
_("cannot get VCPUs info"), 0);
return(-1);
}
--
1.6.3.3
Eric Blake
2010-04-05 16:35:27 UTC
Permalink
Post by Matthias Bolte
---
src/xen/xen_hypervisor.c | 160 +++++++++++++++++++++++-----------------------
1 files changed, 79 insertions(+), 81 deletions(-)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 4a8769f..ae17c60 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -804,16 +804,15 @@ struct xenUnifiedDriver xenHypervisorDriver = {
};
#endif /* !PROXY */
-#define virXenError(conn, code, ...) \
+#define virXenError(code, ...) \
if (in_init == 0) \
- virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
+ virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:19:29 UTC
Permalink
Post by Eric Blake
---
 src/xen/xen_hypervisor.c |  160 +++++++++++++++++++++++-----------------------
 1 files changed, 79 insertions(+), 81 deletions(-)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 4a8769f..ae17c60 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -804,16 +804,15 @@ struct xenUnifiedDriver xenHypervisorDriver = {
 };
 #endif /* !PROXY */
-#define virXenError(conn, code, ...)                                       \
+#define virXenError(code, ...)                                             \
         if (in_init == 0)                                                  \
-            virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__,       \
+            virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__,       \
                                  __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:35 UTC
Permalink
---
src/xen/xen_inotify.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 8ff3256..d24b20f 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -44,7 +44,7 @@

#define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY

-#define virXenInotifyError(conn, code, ...) \
+#define virXenInotifyError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_XEN_INOTIFY, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

@@ -129,7 +129,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
uuid_str = filename + strlen(XEND_DOMAINS_DIR) + 1;

if (virUUIDParse(uuid_str, rawuuid) < 0) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
_("parsing uuid %s"), uuid_str);
return -1;
}
@@ -154,7 +154,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
return 0;
}
}
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("finding dom on config list"));
return -1;
}
@@ -205,7 +205,7 @@ xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn,
int i;

if (virUUIDParse(uuidstr, uuid) < 0) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
_("parsing uuid %s"), uuidstr);
return -1;
}
@@ -241,14 +241,14 @@ xenInotifyXendDomainsDirAddEntry(virConnectPtr conn,
xenUnifiedPrivatePtr priv = conn->privateData;

if (xenInotifyDomainLookup(conn, fname, &name, uuid) < 0) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error looking up domain"));
return -1;
}

if (xenUnifiedAddDomainInfo(priv->configInfoList,
-1, name, uuid) < 0) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error adding file to config cache"));
VIR_FREE(name);
return -1;
@@ -294,7 +294,7 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED,
if( conn && conn->privateData ) {
priv = conn->privateData;
} else {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("conn, or private data is NULL"));
return;
}
@@ -337,18 +337,18 @@ reread:
if (event)
xenUnifiedDomainEventDispatch(conn->privateData, event);
else
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("looking up dom"));

if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0 ) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error adding file to config cache"));
goto cleanup;
}
} else if (e->mask & ( IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO) ) {
virDomainEventPtr event;
if (xenInotifyAddDomainConfigInfo(conn, fname) < 0 ) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error adding file to config cache"));
goto cleanup;
}
@@ -360,7 +360,7 @@ reread:
if (event)
xenUnifiedDomainEventDispatch(conn->privateData, event);
else
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("looking up dom"));

}
@@ -423,7 +423,7 @@ xenInotifyOpen(virConnectPtr conn,
strcat(path, ent->d_name);

if (xenInotifyAddDomainConfigInfo(conn, path) < 0 ) {
- virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error adding file to config list"));
closedir(dh);
return -1;
--
1.6.3.3
Eric Blake
2010-04-05 16:37:38 UTC
Permalink
Post by Matthias Bolte
---
src/xen/xen_inotify.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 8ff3256..d24b20f 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -44,7 +44,7 @@
#define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY
-#define virXenInotifyError(conn, code, ...) \
+#define virXenInotifyError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_XEN_INOTIFY, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:20:08 UTC
Permalink
Post by Eric Blake
---
 src/xen/xen_inotify.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 8ff3256..d24b20f 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -44,7 +44,7 @@
 #define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY
-#define virXenInotifyError(conn, code, ...)                                   \
+#define virXenInotifyError(code, ...)                                   \
         virReportErrorHelper(NULL, VIR_FROM_XEN_INOTIFY, code, __FILE__,      \
                              __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:36 UTC
Permalink
---
src/interface/netcf_driver.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index e44156e..708f1f8 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -33,8 +33,8 @@

#define VIR_FROM_THIS VIR_FROM_INTERFACE

-#define interfaceReportError(conn, dom, net, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+#define interfaceReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/* Main driver state */
@@ -101,11 +101,11 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfac
const char *errmsg, *details;
int errcode = ncf_error(ncf, &errmsg, &details);
if (errcode != NETCF_NOERROR) {
- interfaceReportError(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"couldn't find interface named '%s' (netcf: %s - %s)",
ifinfo->name, errmsg, details ? details : "");
} else {
- interfaceReportError(ifinfo->conn, NULL, ifinfo, VIR_ERR_NO_INTERFACE,
+ interfaceReportError(VIR_ERR_NO_INTERFACE,
"couldn't find interface named '%s'", ifinfo->name);
}
}
@@ -181,7 +181,7 @@ static int interfaceNumOfInterfaces(virConnectPtr conn)
if (count < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"%s (netcf: %s - %s)",
_("failed to get number of interfaces on host"),
errmsg, details ? details : "");
@@ -202,7 +202,7 @@ static int interfaceListInterfaces(virConnectPtr conn, char **const names, int n
if (count < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"%s (netcf: %s - %s)",
_("failed to list host interfaces"),
errmsg, details ? details : "");
@@ -223,7 +223,7 @@ static int interfaceNumOfDefinedInterfaces(virConnectPtr conn)
if (count < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"%s (netcf: %s - %s)",
_("failed to get number of defined interfaces on host"),
errmsg, details ? details : "");
@@ -244,7 +244,7 @@ static int interfaceListDefinedInterfaces(virConnectPtr conn, char **const names
if (count < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"%s (netcf: %s - %s)",
_("failed to list host defined interfaces"),
errmsg, details ? details : "");
@@ -268,11 +268,11 @@ static virInterfacePtr interfaceLookupByName(virConnectPtr conn,
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
if (errcode != NETCF_NOERROR) {
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"couldn't find interface named '%s' (netcf: %s - %s)",
name, errmsg, details ? details : "");
} else {
- interfaceReportError(conn, NULL, NULL, VIR_ERR_NO_INTERFACE,
+ interfaceReportError(VIR_ERR_NO_INTERFACE,
"couldn't find interface named '%s'", name);
}
goto cleanup;
@@ -300,19 +300,19 @@ static virInterfacePtr interfaceLookupByMACString(virConnectPtr conn,
if (niface < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"couldn't find interface with MAC address '%s' (netcf: %s - %s)",
macstr, errmsg, details ? details : "");
goto cleanup;
}
if (niface == 0) {
- interfaceReportError(conn, NULL, NULL, VIR_ERR_NO_INTERFACE,
+ interfaceReportError(VIR_ERR_NO_INTERFACE,
"couldn't find interface with MAC address '%s'",
macstr);
goto cleanup;
}
if (niface > 1) {
- interfaceReportError(conn, NULL, NULL, VIR_ERR_MULTIPLE_INTERFACES,
+ interfaceReportError(VIR_ERR_MULTIPLE_INTERFACES,
"%s", _("multiple interfaces with matching MAC address"));
goto cleanup;
}
@@ -350,7 +350,7 @@ static char *interfaceGetXMLDesc(virInterfacePtr ifinfo,
if (!xmlstr) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"could not get interface XML description (netcf: %s - %s)",
errmsg, details ? details : "");
goto cleanup;
@@ -404,7 +404,7 @@ static virInterfacePtr interfaceDefineXML(virConnectPtr conn,
if (!iface) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(conn, NULL, NULL, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"could not get interface XML description (netcf: %s - %s)",
errmsg, details ? details : "");
goto cleanup;
@@ -437,7 +437,7 @@ static int interfaceUndefine(virInterfacePtr ifinfo) {
if (ret < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"failed to undefine interface %s (netcf: %s - %s)",
ifinfo->name, errmsg, details ? details : "");
goto cleanup;
@@ -468,7 +468,7 @@ static int interfaceCreate(virInterfacePtr ifinfo,
if (ret < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"failed to create (start) interface %s (netcf: %s - %s)",
ifinfo->name, errmsg, details ? details : "");
goto cleanup;
@@ -499,7 +499,7 @@ static int interfaceDestroy(virInterfacePtr ifinfo,
if (ret < 0) {
const char *errmsg, *details;
int errcode = ncf_error(driver->netcf, &errmsg, &details);
- interfaceReportError(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
+ interfaceReportError(netcf_to_vir_err(errcode),
"failed to destroy (stop) interface %s (netcf: %s - %s)",
ifinfo->name, errmsg, details ? details : "");
goto cleanup;
--
1.6.3.3
Eric Blake
2010-04-05 16:38:54 UTC
Permalink
Post by Matthias Bolte
---
src/interface/netcf_driver.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index e44156e..708f1f8 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -33,8 +33,8 @@
#define VIR_FROM_THIS VIR_FROM_INTERFACE
-#define interfaceReportError(conn, dom, net, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+#define interfaceReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:20:22 UTC
Permalink
Post by Eric Blake
---
 src/interface/netcf_driver.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index e44156e..708f1f8 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -33,8 +33,8 @@
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
-#define interfaceReportError(conn, dom, net, code, ...)               \
-    virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__,         \
+#define interfaceReportError(code, ...)                               \
+    virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__,         \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:38 UTC
Permalink
---
src/xen/xen_driver.c | 62 +++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index a5d58d0..fb2f7c7 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -72,9 +72,9 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {

static int inside_daemon;

-#define xenUnifiedError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+#define xenUnifiedError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)

/**
* xenNumaInit:
@@ -261,7 +261,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
if (conn->uri->path &&
STRNEQ(conn->uri->path, "") &&
STRNEQ(conn->uri->path, "/")) {
- xenUnifiedError(NULL, VIR_ERR_INTERNAL_ERROR,
+ xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
_("unexpected Xen URI path '%s', try xen:///"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
@@ -279,7 +279,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
* error unless path is absolute
*/
if (!conn->uri->path || conn->uri->path[0] != '/') {
- xenUnifiedError(NULL, VIR_ERR_INTERNAL_ERROR,
+ xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
_("unexpected Xen URI path '%s', try ///var/lib/xen/xend-socket"),
NULLSTR(conn->uri->path));
return VIR_DRV_OPEN_ERROR;
@@ -296,8 +296,8 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
return VIR_DRV_OPEN_ERROR;
}
if (virMutexInit(&priv->lock) < 0) {
- xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot initialise mutex"));
+ xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot initialise mutex"));
VIR_FREE(priv);
return VIR_DRV_OPEN_ERROR;
}
@@ -512,14 +512,14 @@ xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
GET_PRIVATE(conn);

if (type && STRCASENEQ (type, "Xen")) {
- xenUnifiedError (conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}

if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
return xenHypervisorGetMaxVcpus (conn, type);
else {
- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
}
@@ -672,7 +672,7 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id)
}

/* Not found. */
- xenUnifiedError (conn, VIR_ERR_NO_DOMAIN, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
return NULL;
}

@@ -717,7 +717,7 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn,
}

/* Not found. */
- xenUnifiedError (conn, VIR_ERR_NO_DOMAIN, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
return NULL;
}

@@ -762,7 +762,7 @@ xenUnifiedDomainLookupByName (virConnectPtr conn,
}

/* Not found. */
- xenUnifiedError (conn, VIR_ERR_NO_DOMAIN, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
return NULL;
}

@@ -1160,7 +1160,7 @@ xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
return xenProxyDomainDumpXML(dom, flags);
}

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return NULL;
}

@@ -1178,7 +1178,7 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn,

if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) &&
STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
- xenUnifiedError(conn, VIR_ERR_INVALID_ARG,
+ xenUnifiedError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), format);
return NULL;
}
@@ -1219,7 +1219,7 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn,

if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) &&
STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
- xenUnifiedError(conn, VIR_ERR_INVALID_ARG,
+ xenUnifiedError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), format);
goto cleanup;
}
@@ -1273,7 +1273,7 @@ xenUnifiedDomainMigratePrepare (virConnectPtr dconn,
uri_in, uri_out,
flags, dname, resource);

- xenUnifiedError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1292,7 +1292,7 @@ xenUnifiedDomainMigratePerform (virDomainPtr dom,
return xenDaemonDomainMigratePerform (dom, cookie, cookielen, uri,
flags, dname, resource);

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1316,14 +1316,14 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn,
if (flags & VIR_MIGRATE_PERSIST_DEST) {
domain_xml = xenDaemonDomainDumpXML (dom, 0, NULL);
if (! domain_xml) {
- xenUnifiedError(dconn, VIR_ERR_MIGRATE_PERSIST_FAILED,
+ xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED,
"%s", _("failed to get XML representation of migrated domain"));
goto failure;
}

dom_new = xenDaemonDomainDefineXML (dconn, domain_xml);
if (! dom_new) {
- xenUnifiedError(dconn, VIR_ERR_MIGRATE_PERSIST_FAILED,
+ xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED,
"%s", _("failed to define domain on destination host"));
goto failure;
}
@@ -1516,7 +1516,7 @@ xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart)
return xenDaemonDomainGetAutostart(dom, autostart);
}

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1533,7 +1533,7 @@ xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart)
return xenDaemonDomainSetAutostart(dom, autostart);
}

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1598,7 +1598,7 @@ xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path,
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
return xenHypervisorDomainBlockStats (dom, path, stats);

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1611,7 +1611,7 @@ xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path,
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
return xenHypervisorDomainInterfaceStats (dom, path, stats);

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1634,7 +1634,7 @@ xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path,
return 0;
}

- xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1648,7 +1648,7 @@ xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMe
return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems,
startCell, maxCells);

- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}

@@ -1667,7 +1667,7 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn)
return(freeMem);
}

- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return(0);
}

@@ -1684,7 +1684,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn,
xenUnifiedLock(priv);

if (priv->xsWatch == -1) {
- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv);
return -1;
}
@@ -1706,7 +1706,7 @@ xenUnifiedDomainEventDeregister(virConnectPtr conn,
xenUnifiedLock(priv);

if (priv->xsWatch == -1) {
- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv);
return -1;
}
@@ -1737,7 +1737,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn,
xenUnifiedLock(priv);

if (priv->xsWatch == -1) {
- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv);
return -1;
}
@@ -1759,7 +1759,7 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn,
xenUnifiedLock(priv);

if (priv->xsWatch == -1) {
- xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv);
return -1;
}
@@ -1810,7 +1810,7 @@ xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev,
}

if (!cap) {
- xenUnifiedError(dev->conn, VIR_ERR_INVALID_ARG,
+ xenUnifiedError(VIR_ERR_INVALID_ARG,
_("device %s is not a PCI device"), dev->name);
goto out;
}
--
1.6.3.3
Eric Blake
2010-04-05 16:46:33 UTC
Permalink
Post by Matthias Bolte
---
src/xen/xen_driver.c | 62 +++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index a5d58d0..fb2f7c7 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -72,9 +72,9 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
static int inside_daemon;
-#define xenUnifiedError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+#define xenUnifiedError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Post by Matthias Bolte
@@ -296,8 +296,8 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
return VIR_DRV_OPEN_ERROR;
}
if (virMutexInit(&priv->lock) < 0) {
- xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot initialise mutex"));
+ xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot initialise mutex"));
Independent question - is there any preference for American vs. British
spellings, or are both acceptable? My understanding is that the whole
point of translations is to provide en_US and en_UK translations, at
which point it becomes easier for the translators if they always start
from a consistent spelling in the .pot file (in case the same message
occurs more than once in the source). Therefore, should this be
"initialize"?
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:20:52 UTC
Permalink
Post by Eric Blake
---
 src/xen/xen_driver.c |   62 +++++++++++++++++++++++++-------------------------
 1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index a5d58d0..fb2f7c7 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -72,9 +72,9 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
 static int inside_daemon;
-#define xenUnifiedError(conn, code, ...)                                   \
-        virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__,           \
-                               __FUNCTION__, __LINE__, __VA_ARGS__)
+#define xenUnifiedError(code, ...)                                         \
+        virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__,           \
+                             __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.
Post by Eric Blake
@@ -296,8 +296,8 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
         return VIR_DRV_OPEN_ERROR;
     }
     if (virMutexInit(&priv->lock) < 0) {
-        xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot initialise mutex"));
+        xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot initialise mutex"));
Independent question - is there any preference for American vs. British
spellings, or are both acceptable?  My understanding is that the whole
point of translations is to provide en_US and en_UK translations, at
which point it becomes easier for the translators if they always start
from a consistent spelling in the .pot file (in case the same message
occurs more than once in the source).  Therefore, should this be
"initialize"?
If you grep the code for initialize and initialise you'll find both in
code and comments. IMHO this should be unified to AE, because there is
already way more AE then BE in the codebase, but that's worth a
separate patch.

Matthias
Matthias Bolte
2010-04-04 17:36:37 UTC
Permalink
---
src/nodeinfo.c | 47 +++++++++++++++++++++++------------------------
tests/nodeinfotest.c | 4 ++--
2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 4858e71..402a6b7 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -51,8 +51,8 @@

#define VIR_FROM_THIS VIR_FROM_NONE

-#define nodeReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \
+#define nodeReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#ifdef __linux__
@@ -60,7 +60,7 @@
# define CPU_SYS_PATH "/sys/devices/system/cpu"

/* NB, this is not static as we need to call it from the testsuite */
-int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
+int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
virNodeInfoPtr nodeinfo);

static unsigned long count_thread_siblings(unsigned int cpu)
@@ -133,7 +133,7 @@ static int parse_socket(unsigned int cpu)
goto cleanup;
}
if (virStrToLong_i(socket_str, &tmp, 10, &socket) < 0) {
- nodeReportError(NULL, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
_("could not convert '%s' to an integer"),
socket_str);
goto cleanup;
@@ -146,7 +146,7 @@ cleanup:
return socket;
}

-int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
+int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
virNodeInfoPtr nodeinfo)
{
char line[1024];
@@ -178,7 +178,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
while (*buf && c_isspace(*buf))
buf++;
if (*buf != ':') {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("parsing cpuinfo processor"));
return -1;
}
@@ -190,7 +190,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
while (*buf && c_isspace(*buf))
buf++;
if (*buf != ':' || !buf[1]) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("parsing cpuinfo cpu MHz"));
return -1;
}
@@ -205,7 +205,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
while (*buf && c_isspace(*buf))
buf++;
if (*buf != ':' || !buf[1]) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"parsing cpuinfo cpu cores %c", *buf);
return -1;
}
@@ -217,7 +217,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
}

if (!nodeinfo->cpus) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("no cpus found"));
return -1;
}
@@ -257,12 +257,12 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,

/* there should always be at least one socket and one thread */
if (nodeinfo->sockets == 0) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("no sockets found"));
return -1;
}
if (nodeinfo->threads == 0) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("no threads found"));
return -1;
}
@@ -272,8 +272,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,

#endif

-int nodeGetInfo(virConnectPtr conn,
- virNodeInfoPtr nodeinfo) {
+int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
memset(nodeinfo, 0, sizeof(*nodeinfo));

#ifdef HAVE_UNAME
@@ -296,7 +295,7 @@ int nodeGetInfo(virConnectPtr conn,
_("cannot open %s"), CPUINFO_PATH);
return -1;
}
- ret = linuxNodeInfoCPUPopulate(conn, cpuinfo, nodeinfo);
+ ret = linuxNodeInfoCPUPopulate(cpuinfo, nodeinfo);
fclose(cpuinfo);
if (ret < 0)
return -1;
@@ -308,7 +307,7 @@ int nodeGetInfo(virConnectPtr conn,
}
#else
/* XXX Solaris will need an impl later if they port QEMU driver */
- nodeReportError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
_("node info not implemented on this platform"));
return -1;
#endif
@@ -380,7 +379,7 @@ cleanup:


int
-nodeGetCellsFreeMemory(virConnectPtr conn,
+nodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
unsigned long long *freeMems,
int startCell,
int maxCells)
@@ -390,13 +389,13 @@ nodeGetCellsFreeMemory(virConnectPtr conn,
int maxCell;

if (numa_available() < 0) {
- nodeReportError(conn, VIR_ERR_NO_SUPPORT,
+ nodeReportError(VIR_ERR_NO_SUPPORT,
"%s", _("NUMA not supported on this host"));
goto cleanup;
}
maxCell = numa_max_node();
if (startCell > maxCell) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
_("start cell %d out of range (0-%d)"),
startCell, maxCell);
goto cleanup;
@@ -408,7 +407,7 @@ nodeGetCellsFreeMemory(virConnectPtr conn,
for (numCells = 0, n = startCell ; n <= lastCell ; n++) {
long long mem;
if (numa_node_size64(n, &mem) < 0) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to query NUMA free memory"));
goto cleanup;
}
@@ -421,13 +420,13 @@ cleanup:
}

unsigned long long
-nodeGetFreeMemory(virConnectPtr conn)
+nodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
{
unsigned long long freeMem = 0;
int n;

if (numa_available() < 0) {
- nodeReportError(conn, VIR_ERR_NO_SUPPORT,
+ nodeReportError(VIR_ERR_NO_SUPPORT,
"%s", _("NUMA not supported on this host"));
goto cleanup;
}
@@ -435,7 +434,7 @@ nodeGetFreeMemory(virConnectPtr conn)
for (n = 0 ; n <= numa_max_node() ; n++) {
long long mem;
if (numa_node_size64(n, &mem) < 0) {
- nodeReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to query NUMA free memory"));
goto cleanup;
}
@@ -456,14 +455,14 @@ int nodeGetCellsFreeMemory(virConnectPtr conn,
int startCell ATTRIBUTE_UNUSED,
int maxCells ATTRIBUTE_UNUSED)
{
- nodeReportError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
_("NUMA memory information not available on this platform"));
return -1;
}

unsigned long long nodeGetFreeMemory(virConnectPtr conn)
{
- nodeReportError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
_("NUMA memory information not available on this platform"));
return 0;
}
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index a6b9b7e..768fd4d 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -25,7 +25,7 @@ static char *abs_srcdir;

# define MAX_FILE 4096

-extern int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo);
+extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, virNodeInfoPtr nodeinfo);

static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile) {
char actualData[MAX_FILE];
@@ -40,7 +40,7 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile
cpuinfo = fopen(cpuinfofile, "r");
if (!cpuinfo)
return -1;
- if (linuxNodeInfoCPUPopulate(NULL, cpuinfo, &nodeinfo) < 0) {
+ if (linuxNodeInfoCPUPopulate(cpuinfo, &nodeinfo) < 0) {
fclose(cpuinfo);
return -1;
}
--
1.6.3.3
Eric Blake
2010-04-05 16:42:03 UTC
Permalink
Post by Matthias Bolte
---
src/nodeinfo.c | 47 +++++++++++++++++++++++------------------------
tests/nodeinfotest.c | 4 ++--
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 4858e71..402a6b7 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -51,8 +51,8 @@
#define VIR_FROM_THIS VIR_FROM_NONE
-#define nodeReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \
+#define nodeReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Post by Matthias Bolte
#ifdef __linux__
@@ -60,7 +60,7 @@
# define CPU_SYS_PATH "/sys/devices/system/cpu"
/* NB, this is not static as we need to call it from the testsuite */
-int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
+int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
virNodeInfoPtr nodeinfo);
...
Post by Matthias Bolte
+++ b/tests/nodeinfotest.c
@@ -25,7 +25,7 @@ static char *abs_srcdir;
# define MAX_FILE 4096
-extern int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo);
+extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, virNodeInfoPtr nodeinfo);
Independent question: is it worth putting this declaration in a .h, to
enforce the consistency via the compiler, rather than just relying on
the comment?
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:20:38 UTC
Permalink
Post by Eric Blake
---
 src/nodeinfo.c       |   47 +++++++++++++++++++++++------------------------
 tests/nodeinfotest.c |    4 ++--
 2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 4858e71..402a6b7 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -51,8 +51,8 @@
 #define VIR_FROM_THIS VIR_FROM_NONE
-#define nodeReportError(conn, code, ...)                                \
-    virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__,           \
+#define nodeReportError(code, ...)                                      \
+    virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__,           \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:39 UTC
Permalink
---
src/phyp/phyp_driver.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 365fb08..57ab00a 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -63,8 +63,8 @@

#define VIR_FROM_THIS VIR_FROM_PHYP

-#define PHYP_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
+#define PHYP_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)

/*
@@ -92,13 +92,13 @@ phypOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED;

if (conn->uri->server == NULL) {
- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing server name in phyp:// URI"));
return VIR_DRV_OPEN_ERROR;
}

if (conn->uri->path == NULL) {
- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing managed system name in phyp:// URI"));
return VIR_DRV_OPEN_ERROR;
}
@@ -145,13 +145,13 @@ phypOpen(virConnectPtr conn,
*char_ptr = '\0';

if (escape_specialcharacters(conn->uri->path, string, len) == -1) {
- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error parsing 'path'. Invalid characters."));
goto failure;
}

if ((session = openSSHSession(conn, auth, &internal_socket)) == NULL) {
- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error while opening SSH session."));
goto failure;
}
@@ -273,7 +273,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
}
} else {
if (auth == NULL || auth->cb == NULL) {
- PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,
+ PHYP_ERROR(VIR_ERR_AUTH_FAILED,
"%s", _("No authentication callback provided."));
goto err;
}
@@ -281,7 +281,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
username = virRequestUsername(auth, NULL, conn->uri->server);

if (username == NULL) {
- PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED, "Username request failed");
+ PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto err;
}
}
@@ -293,7 +293,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,

ret = getaddrinfo(hostname, "22", &hints, &ai);
if (ret != 0) {
- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Error while getting %s address info"), hostname);
goto err;
}
@@ -310,7 +310,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
cur = cur->ai_next;
}

- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Failed to connect to %s"), hostname);
freeaddrinfo(ai);
goto err;
@@ -330,7 +330,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
while ((rc = libssh2_session_startup(session, sock)) ==
LIBSSH2_ERROR_EAGAIN) ;
if (rc) {
- PHYP_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failure establishing SSH session."));
goto disconnect;
}
@@ -353,7 +353,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) {
if (auth == NULL || auth->cb == NULL) {
- PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,
+ PHYP_ERROR(VIR_ERR_AUTH_FAILED,
"%s", _("No authentication callback provided."));
goto disconnect;
}
@@ -361,7 +361,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
password = virRequestPassword(auth, username, conn->uri->server);

if (password == NULL) {
- PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED, "Password request failed");
+ PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto disconnect;
}

@@ -371,7 +371,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
LIBSSH2_ERROR_EAGAIN) ;

if (rc) {
- PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,
+ PHYP_ERROR(VIR_ERR_AUTH_FAILED,
"%s", _("Authentication failed"));
goto disconnect;
} else
--
1.6.3.3
Eric Blake
2010-04-05 16:47:24 UTC
Permalink
Post by Matthias Bolte
---
src/phyp/phyp_driver.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 365fb08..57ab00a 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -63,8 +63,8 @@
#define VIR_FROM_THIS VIR_FROM_PHYP
-#define PHYP_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
+#define PHYP_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)
ACK, and the rest of this patch is mechanical fallout

(are my replies getting boring yet?) :)
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 17:50:08 UTC
Permalink
Post by Eric Blake
---
 src/phyp/phyp_driver.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 365fb08..57ab00a 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -63,8 +63,8 @@
 #define VIR_FROM_THIS VIR_FROM_PHYP
-#define PHYP_ERROR(conn, code, ...)                                           \
-    virReportErrorHelper(conn, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__,   \
+#define PHYP_ERROR(code, ...)                                                 \
+    virReportErrorHelper(NULL, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__,   \
                          __LINE__, __VA_ARGS__)
ACK, and the rest of this patch is mechanical fallout
(are my replies getting boring yet?) :)
Nope, ACKs are always welcome :)

Thanks, pushed this one too.

Mathias
Matthias Bolte
2010-04-04 17:36:40 UTC
Permalink
Also unify error/errorf to remoteError and update cfg.mk accordingly.
---
cfg.mk | 2 +-
src/remote/remote_driver.c | 698 ++++++++++++++++++++------------------------
2 files changed, 319 insertions(+), 381 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 8073f34..b87f261 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -171,7 +171,7 @@ msg_gen_function =
msg_gen_function += ReportError
msg_gen_function += ESX_ERROR
msg_gen_function += ESX_VI_ERROR
-msg_gen_function += errorf
+msg_gen_function += remoteError
msg_gen_function += lxcError
msg_gen_function += networkReportError
msg_gen_function += oneError
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 215b5d9..ea96deb 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -239,11 +239,9 @@ static int remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in
static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
virConnectAuthPtr auth);
#endif /* HAVE_POLKIT */
-#define error(conn, code, info) \
- virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
- __FUNCTION__, __LINE__, "%s", info)
-#define errorf(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
+
+#define remoteError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_REMOTE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
@@ -269,7 +267,7 @@ void remoteDomainEventQueueFlush(int timer, void *opaque);
static char *get_transport_from_scheme (char *scheme);

/* GnuTLS functions used by remoteOpen. */
-static int initialise_gnutls (virConnectPtr conn);
+static int initialise_gnutls(void);
static gnutls_session_t negotiate_gnutls_on_connection (virConnectPtr conn, struct private_data *priv, int no_verify);

#ifdef WITH_LIBVIRTD
@@ -322,14 +320,15 @@ remoteFindDaemonPath(void)
* Returns 0 in case of success or -1 in case of detected error.
*/
static int
-remoteForkDaemon(virConnectPtr conn)
+remoteForkDaemon(void)
{
const char *daemonPath = remoteFindDaemonPath();
const char *const daemonargs[] = { daemonPath, "--timeout=30", NULL };
pid_t pid;

if (!daemonPath) {
- error(conn, VIR_ERR_INTERNAL_ERROR, _("failed to find libvirtd binary"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to find libvirtd binary"));
return -1;
}

@@ -411,9 +410,9 @@ doRemoteOpen (virConnectPtr conn,
else if (STRCASEEQ (transport_str, "tcp"))
transport = trans_tcp;
else {
- error (conn, VIR_ERR_INVALID_ARG,
- _("remote_open: transport in URL not recognised "
- "(should be tls|unix|ssh|ext|tcp)"));
+ remoteError(VIR_ERR_INVALID_ARG, "%s",
+ _("remote_open: transport in URL not recognised "
+ "(should be tls|unix|ssh|ext|tcp)"));
return VIR_DRV_OPEN_ERROR;
}
}
@@ -569,15 +568,15 @@ doRemoteOpen (virConnectPtr conn,

/* For ext transport, command is required. */
if (transport == trans_ext && !command) {
- error (conn, VIR_ERR_INVALID_ARG,
- _("remote_open: for 'ext' transport, command is required"));
+ remoteError(VIR_ERR_INVALID_ARG, "%s",
+ _("remote_open: for 'ext' transport, command is required"));
goto failed;
}

/* Connect to the remote service. */
switch (transport) {
case trans_tls:
- if (initialise_gnutls (conn) == -1) goto failed;
+ if (initialise_gnutls() == -1) goto failed;
priv->uses_tls = 1;
priv->is_secure = 1;

@@ -592,9 +591,9 @@ doRemoteOpen (virConnectPtr conn,
hints.ai_flags = AI_ADDRCONFIG;
int e = getaddrinfo (priv->hostname, port, &hints, &res);
if (e != 0) {
- errorf (conn, VIR_ERR_SYSTEM_ERROR,
- _("unable to resolve hostname '%s': %s"),
- priv->hostname, gai_strerror (e));
+ remoteError(VIR_ERR_SYSTEM_ERROR,
+ _("unable to resolve hostname '%s': %s"),
+ priv->hostname, gai_strerror (e));
goto failed;
}

@@ -689,8 +688,8 @@ doRemoteOpen (virConnectPtr conn,
memset (&addr, 0, sizeof addr);
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, sockname) == NULL) {
- errorf(conn, VIR_ERR_INTERNAL_ERROR,
- _("Socket %s too big for destination"), sockname);
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("Socket %s too big for destination"), sockname);
goto failed;
}
if (addr.sun_path[0] == '@')
@@ -718,7 +717,7 @@ doRemoteOpen (virConnectPtr conn,
close(priv->sock);
priv->sock = -1;
if (trials > 0 ||
- remoteForkDaemon(conn) == 0) {
+ remoteForkDaemon() == 0) {
trials++;
usleep(1000 * 100 * trials);
goto autostart_retry;
@@ -825,8 +824,9 @@ doRemoteOpen (virConnectPtr conn,
case trans_unix:
case trans_ssh:
case trans_ext:
- error (conn, VIR_ERR_INVALID_ARG,
- _("transport methods unix, ssh and ext are not supported under Windows"));
+ remoteError(VIR_ERR_INVALID_ARG, "%s",
+ _("transport methods unix, ssh and ext are not supported "
+ "under Windows"));
goto failed;

#endif /* WIN32 */
@@ -881,7 +881,8 @@ doRemoteOpen (virConnectPtr conn,
& the library should always match the daemon. Only case is post
RPM upgrade where an old daemon instance is still running with
new client. Too bad. It is not worth the hassle to fix this */
- error (conn, VIR_ERR_INTERNAL_ERROR, _("unable to auto-detect URI"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unable to auto-detect URI"));
goto failed;
}
if (urierr == -1) {
@@ -989,7 +990,7 @@ retry:
}

static struct private_data *
-remoteAllocPrivateData(virConnectPtr conn)
+remoteAllocPrivateData(void)
{
struct private_data *priv;
if (VIR_ALLOC(priv) < 0) {
@@ -998,8 +999,8 @@ remoteAllocPrivateData(virConnectPtr conn)
}

if (virMutexInit(&priv->lock) < 0) {
- error(conn, VIR_ERR_INTERNAL_ERROR,
- _("cannot initialize mutex"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
VIR_FREE(priv);
return NULL;
}
@@ -1021,7 +1022,7 @@ remoteOpenSecondaryDriver(virConnectPtr conn,
int ret;
int rflags = 0;

- if (!((*priv) = remoteAllocPrivateData(conn)))
+ if (!((*priv) = remoteAllocPrivateData()))
return VIR_DRV_OPEN_ERROR;

if (flags & VIR_CONNECT_RO)
@@ -1051,7 +1052,7 @@ remoteOpen (virConnectPtr conn,
if (inside_daemon && (!conn->uri || (conn->uri && !conn->uri->server)))
return VIR_DRV_OPEN_DECLINED;

- if (!(priv = remoteAllocPrivateData(conn)))
+ if (!(priv = remoteAllocPrivateData()))
return VIR_DRV_OPEN_ERROR;

if (flags & VIR_CONNECT_RO)
@@ -1138,7 +1139,7 @@ check_cert_file(const char *type, const char *file)


static int
-initialise_gnutls (virConnectPtr conn)
+initialise_gnutls(void)
{
static int initialised = 0;
int err;
@@ -1150,9 +1151,9 @@ initialise_gnutls (virConnectPtr conn)
/* X509 stuff */
err = gnutls_certificate_allocate_credentials (&x509_cred);
if (err) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to allocate TLS credentials: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to allocate TLS credentials: %s"),
+ gnutls_strerror (err));
return -1;
}

@@ -1170,9 +1171,9 @@ initialise_gnutls (virConnectPtr conn)
gnutls_certificate_set_x509_trust_file (x509_cred, LIBVIRT_CACERT,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to load CA certificate: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to load CA certificate: %s"),
+ gnutls_strerror (err));
return -1;
}

@@ -1185,9 +1186,9 @@ initialise_gnutls (virConnectPtr conn)
LIBVIRT_CLIENTKEY,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to load private key/certificate: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to load private key/certificate: %s"),
+ gnutls_strerror (err));
return -1;
}

@@ -1214,27 +1215,27 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
*/
err = gnutls_init (&session, GNUTLS_CLIENT);
if (err) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to initialize TLS client: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to initialize TLS client: %s"),
+ gnutls_strerror (err));
return NULL;
}

/* Use default priorities */
err = gnutls_set_default_priority (session);
if (err) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to set TLS algorithm priority: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to set TLS algorithm priority: %s"),
+ gnutls_strerror (err));
return NULL;
}
err =
gnutls_certificate_type_set_priority (session,
cert_type_priority);
if (err) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to set certificate priority: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to set certificate priority: %s"),
+ gnutls_strerror (err));
return NULL;
}

@@ -1242,9 +1243,9 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
*/
err = gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, x509_cred);
if (err) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to set session credentials: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to set session credentials: %s"),
+ gnutls_strerror (err));
return NULL;
}

@@ -1257,9 +1258,9 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
if (err < 0) {
if (err == GNUTLS_E_AGAIN || err == GNUTLS_E_INTERRUPTED)
goto again;
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to complete TLS handshake: %s"),
- gnutls_strerror (err));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to complete TLS handshake: %s"),
+ gnutls_strerror (err));
return NULL;
}

@@ -1279,14 +1280,15 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
if (len < 0 && len != GNUTLS_E_UNEXPECTED_PACKET_LENGTH) {
if (len == GNUTLS_E_AGAIN || len == GNUTLS_E_INTERRUPTED)
goto again_2;
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to complete TLS initialization: %s"),
- gnutls_strerror (len));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to complete TLS initialization: %s"),
+ gnutls_strerror (len));
return NULL;
}
if (len != 1 || buf[0] != '\1') {
- error (conn, VIR_ERR_RPC,
- _("server verification (of our certificate or IP address) failed"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("server verification (of our certificate or IP "
+ "address) failed"));
return NULL;
}

@@ -1310,9 +1312,9 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
time_t now;

if ((ret = gnutls_certificate_verify_peers2 (session, &status)) < 0) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to verify server certificate: %s"),
- gnutls_strerror (ret));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to verify server certificate: %s"),
+ gnutls_strerror (ret));
return -1;
}

@@ -1339,19 +1341,19 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
reason = _("The certificate uses an insecure algorithm");
#endif

- errorf (conn, VIR_ERR_RPC,
- _("server certificate failed validation: %s"),
- reason);
+ remoteError(VIR_ERR_RPC,
+ _("server certificate failed validation: %s"),
+ reason);
return -1;
}

if (gnutls_certificate_type_get(session) != GNUTLS_CRT_X509) {
- error (conn, VIR_ERR_RPC, _("Certificate type is not X.509"));
+ remoteError(VIR_ERR_RPC, "%s",_("Certificate type is not X.509"));
return -1;
}

if (!(certs = gnutls_certificate_get_peers(session, &nCerts))) {
- error (conn, VIR_ERR_RPC, _("gnutls_certificate_get_peers failed"));
+ remoteError(VIR_ERR_RPC, "%s",_("gnutls_certificate_get_peers failed"));
return -1;
}

@@ -1360,38 +1362,39 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,

ret = gnutls_x509_crt_init (&cert);
if (ret < 0) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to initialize certificate: %s"),
- gnutls_strerror (ret));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to initialize certificate: %s"),
+ gnutls_strerror (ret));
return -1;
}

ret = gnutls_x509_crt_import (cert, &certs[i], GNUTLS_X509_FMT_DER);
if (ret < 0) {
- errorf (conn, VIR_ERR_GNUTLS_ERROR,
- _("unable to import certificate: %s"),
- gnutls_strerror (ret));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("unable to import certificate: %s"),
+ gnutls_strerror (ret));
gnutls_x509_crt_deinit (cert);
return -1;
}

if (gnutls_x509_crt_get_expiration_time (cert) < now) {
- error (conn, VIR_ERR_RPC, _("The certificate has expired"));
+ remoteError(VIR_ERR_RPC, "%s", _("The certificate has expired"));
gnutls_x509_crt_deinit (cert);
return -1;
}

if (gnutls_x509_crt_get_activation_time (cert) > now) {
- error (conn, VIR_ERR_RPC, _("The certificate is not yet activated"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("The certificate is not yet activated"));
gnutls_x509_crt_deinit (cert);
return -1;
}

if (i == 0) {
if (!gnutls_x509_crt_check_hostname (cert, priv->hostname)) {
- errorf(conn, VIR_ERR_RPC,
- _("Certificate's owner does not match the hostname (%s)"),
- priv->hostname);
+ remoteError(VIR_ERR_RPC,
+ _("Certificate's owner does not match the hostname (%s)"),
+ priv->hostname);
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -1782,10 +1785,9 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn,
remoteDriverLock(priv);

if (maxCells > REMOTE_NODE_MAX_CELLS) {
- errorf (conn, VIR_ERR_RPC,
- _("too many NUMA cells: %d > %d"),
- maxCells,
- REMOTE_NODE_MAX_CELLS);
+ remoteError(VIR_ERR_RPC,
+ _("too many NUMA cells: %d > %d"),
+ maxCells, REMOTE_NODE_MAX_CELLS);
goto done;
}

@@ -1845,9 +1847,9 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids)
remoteDriverLock(priv);

if (maxids > REMOTE_DOMAIN_ID_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote domain IDs: %d > %d"),
- maxids, REMOTE_DOMAIN_ID_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote domain IDs: %d > %d"),
+ maxids, REMOTE_DOMAIN_ID_LIST_MAX);
goto done;
}
args.maxids = maxids;
@@ -1859,9 +1861,9 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids)
goto done;

if (ret.ids.ids_len > maxids) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote domain IDs: %d > %d"),
- ret.ids.ids_len, maxids);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote domain IDs: %d > %d"),
+ ret.ids.ids_len, maxids);
goto cleanup;
}

@@ -2411,9 +2413,9 @@ remoteDomainPinVcpu (virDomainPtr domain,
remoteDriverLock(priv);

if (maplen > REMOTE_CPUMAP_MAX) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("map length greater than maximum: %d > %d"),
- maplen, REMOTE_CPUMAP_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("map length greater than maximum: %d > %d"),
+ maplen, REMOTE_CPUMAP_MAX);
goto done;
}

@@ -2450,15 +2452,15 @@ remoteDomainGetVcpus (virDomainPtr domain,
remoteDriverLock(priv);

if (maxinfo > REMOTE_VCPUINFO_MAX) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("vCPU count exceeds maximum: %d > %d"),
- maxinfo, REMOTE_VCPUINFO_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("vCPU count exceeds maximum: %d > %d"),
+ maxinfo, REMOTE_VCPUINFO_MAX);
goto done;
}
if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("vCPU map buffer length exceeds maximum: %d > %d"),
- maxinfo * maplen, REMOTE_CPUMAPS_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("vCPU map buffer length exceeds maximum: %d > %d"),
+ maxinfo * maplen, REMOTE_CPUMAPS_MAX);
goto done;
}

@@ -2473,15 +2475,15 @@ remoteDomainGetVcpus (virDomainPtr domain,
goto done;

if (ret.info.info_len > maxinfo) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("host reports too many vCPUs: %d > %d"),
- ret.info.info_len, maxinfo);
+ remoteError(VIR_ERR_RPC,
+ _("host reports too many vCPUs: %d > %d"),
+ ret.info.info_len, maxinfo);
goto cleanup;
}
if (ret.cpumaps.cpumaps_len > maxinfo * maplen) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("host reports map buffer length exceeds maximum: %d > %d"),
- ret.cpumaps.cpumaps_len, maxinfo * maplen);
+ remoteError(VIR_ERR_RPC,
+ _("host reports map buffer length exceeds maximum: %d > %d"),
+ ret.cpumaps.cpumaps_len, maxinfo * maplen);
goto cleanup;
}

@@ -2555,8 +2557,8 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)

if (ret.label.label_val != NULL) {
if (strlen (ret.label.label_val) >= sizeof seclabel->label) {
- errorf (domain->conn, VIR_ERR_RPC, _("security label exceeds maximum: %zd"),
- sizeof seclabel->label - 1);
+ remoteError(VIR_ERR_RPC, _("security label exceeds maximum: %zd"),
+ sizeof seclabel->label - 1);
goto done;
}
strcpy (seclabel->label, ret.label.label_val);
@@ -2590,8 +2592,8 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)

if (ret.model.model_val != NULL) {
if (strlen (ret.model.model_val) >= sizeof secmodel->model) {
- errorf (conn, VIR_ERR_RPC, _("security model exceeds maximum: %zd"),
- sizeof secmodel->model - 1);
+ remoteError(VIR_ERR_RPC, _("security model exceeds maximum: %zd"),
+ sizeof secmodel->model - 1);
goto done;
}
strcpy (secmodel->model, ret.model.model_val);
@@ -2599,8 +2601,8 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)

if (ret.doi.doi_val != NULL) {
if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) {
- errorf (conn, VIR_ERR_RPC, _("security doi exceeds maximum: %zd"),
- sizeof secmodel->doi - 1);
+ remoteError(VIR_ERR_RPC, _("security doi exceeds maximum: %zd"),
+ sizeof secmodel->doi - 1);
goto done;
}
strcpy (secmodel->doi, ret.doi.doi_val);
@@ -2901,9 +2903,9 @@ remoteListDefinedDomains (virConnectPtr conn, char **const names, int maxnames)
remoteDriverLock(priv);

if (maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote domain names: %d > %d"),
- maxnames, REMOTE_DOMAIN_NAME_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote domain names: %d > %d"),
+ maxnames, REMOTE_DOMAIN_NAME_LIST_MAX);
goto done;
}
args.maxnames = maxnames;
@@ -2915,9 +2917,9 @@ remoteListDefinedDomains (virConnectPtr conn, char **const names, int maxnames)
goto done;

if (ret.names.names_len > maxnames) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote domain names: %d > %d"),
- ret.names.names_len, maxnames);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote domain names: %d > %d"),
+ ret.names.names_len, maxnames);
goto cleanup;
}

@@ -3286,9 +3288,9 @@ remoteDomainGetSchedulerParameters (virDomainPtr domain,
/* Check the length of the returned list carefully. */
if (ret.params.params_len > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX ||
ret.params.params_len > *nparams) {
- error (domain->conn, VIR_ERR_RPC,
- _("remoteDomainGetSchedulerParameters: "
- "returned number of parameters exceeds limit"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("remoteDomainGetSchedulerParameters: "
+ "returned number of parameters exceeds limit"));
goto cleanup;
}
*nparams = ret.params.params_len;
@@ -3296,9 +3298,9 @@ remoteDomainGetSchedulerParameters (virDomainPtr domain,
/* Deserialise the result. */
for (i = 0; i < *nparams; ++i) {
if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) == NULL) {
- errorf(domain->conn, VIR_ERR_INTERNAL_ERROR,
- _("Parameter %s too big for destination"),
- ret.params.params_val[i].field);
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("Parameter %s too big for destination"),
+ ret.params.params_val[i].field);
goto cleanup;
}
params[i].type = ret.params.params_val[i].value.type;
@@ -3316,9 +3318,9 @@ remoteDomainGetSchedulerParameters (virDomainPtr domain,
case VIR_DOMAIN_SCHED_FIELD_BOOLEAN:
params[i].value.b = ret.params.params_val[i].value.remote_sched_param_value_u.b; break;
default:
- error (domain->conn, VIR_ERR_RPC,
- _("remoteDomainGetSchedulerParameters: "
- "unknown parameter type"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("remoteDomainGetSchedulerParameters: "
+ "unknown parameter type"));
goto cleanup;
}
}
@@ -3375,7 +3377,7 @@ remoteDomainSetSchedulerParameters (virDomainPtr domain,
case VIR_DOMAIN_SCHED_FIELD_BOOLEAN:
args.params.params_val[i].value.remote_sched_param_value_u.b = params[i].value.b; break;
default:
- error (domain->conn, VIR_ERR_RPC, _("unknown parameter type"));
+ remoteError(VIR_ERR_RPC, "%s", _("unknown parameter type"));
do_error = 1;
}
}
@@ -3484,9 +3486,9 @@ remoteDomainMemoryStats (virDomainPtr domain,

make_nonnull_domain (&args.dom, domain);
if (nr_stats > REMOTE_DOMAIN_MEMORY_STATS_MAX) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("too many memory stats requested: %d > %d"), nr_stats,
- REMOTE_DOMAIN_MEMORY_STATS_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many memory stats requested: %d > %d"), nr_stats,
+ REMOTE_DOMAIN_MEMORY_STATS_MAX);
goto done;
}
args.maxStats = nr_stats;
@@ -3528,9 +3530,9 @@ remoteDomainBlockPeek (virDomainPtr domain,
remoteDriverLock(priv);

if (size > REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("block peek request too large for remote protocol, %zi > %d"),
- size, REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("block peek request too large for remote protocol, %zi > %d"),
+ size, REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX);
goto done;
}

@@ -3549,8 +3551,8 @@ remoteDomainBlockPeek (virDomainPtr domain,
goto done;

if (ret.buffer.buffer_len != size) {
- errorf (domain->conn, VIR_ERR_RPC,
- "%s", _("returned buffer is not same size as requested"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("returned buffer is not same size as requested"));
goto cleanup;
}

@@ -3580,9 +3582,9 @@ remoteDomainMemoryPeek (virDomainPtr domain,
remoteDriverLock(priv);

if (size > REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX) {
- errorf (domain->conn, VIR_ERR_RPC,
- _("memory peek request too large for remote protocol, %zi > %d"),
- size, REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("memory peek request too large for remote protocol, %zi > %d"),
+ size, REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX);
goto done;
}

@@ -3600,8 +3602,8 @@ remoteDomainMemoryPeek (virDomainPtr domain,
goto done;

if (ret.buffer.buffer_len != size) {
- errorf (domain->conn, VIR_ERR_RPC,
- "%s", _("returned buffer is not same size as requested"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("returned buffer is not same size as requested"));
goto cleanup;
}

@@ -3785,9 +3787,9 @@ remoteListNetworks (virConnectPtr conn, char **const names, int maxnames)
remoteDriverLock(priv);

if (maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote networks: %d > %d"),
- maxnames, REMOTE_NETWORK_NAME_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ maxnames, REMOTE_NETWORK_NAME_LIST_MAX);
goto done;
}
args.maxnames = maxnames;
@@ -3799,9 +3801,9 @@ remoteListNetworks (virConnectPtr conn, char **const names, int maxnames)
goto done;

if (ret.names.names_len > maxnames) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote networks: %d > %d"),
- ret.names.names_len, maxnames);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ ret.names.names_len, maxnames);
goto cleanup;
}

@@ -3867,9 +3869,9 @@ remoteListDefinedNetworks (virConnectPtr conn,
remoteDriverLock(priv);

if (maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote networks: %d > %d"),
- maxnames, REMOTE_NETWORK_NAME_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ maxnames, REMOTE_NETWORK_NAME_LIST_MAX);
goto done;
}
args.maxnames = maxnames;
@@ -3881,9 +3883,9 @@ remoteListDefinedNetworks (virConnectPtr conn,
goto done;

if (ret.names.names_len > maxnames) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote networks: %d > %d"),
- ret.names.names_len, maxnames);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ ret.names.names_len, maxnames);
goto cleanup;
}

@@ -4340,9 +4342,9 @@ remoteListInterfaces (virConnectPtr conn, char **const names, int maxnames)
remoteDriverLock(priv);

if (maxnames > REMOTE_INTERFACE_NAME_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote interfaces: %d > %d"),
- maxnames, REMOTE_INTERFACE_NAME_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote interfaces: %d > %d"),
+ maxnames, REMOTE_INTERFACE_NAME_LIST_MAX);
goto done;
}
args.maxnames = maxnames;
@@ -4354,9 +4356,9 @@ remoteListInterfaces (virConnectPtr conn, char **const names, int maxnames)
goto done;

if (ret.names.names_len > maxnames) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote interfaces: %d > %d"),
- ret.names.names_len, maxnames);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote interfaces: %d > %d"),
+ ret.names.names_len, maxnames);
goto cleanup;
}

@@ -4421,9 +4423,9 @@ remoteListDefinedInterfaces (virConnectPtr conn, char **const names, int maxname
remoteDriverLock(priv);

if (maxnames > REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote interfaces: %d > %d"),
- maxnames, REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote interfaces: %d > %d"),
+ maxnames, REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX);
goto done;
}
args.maxnames = maxnames;
@@ -4435,9 +4437,9 @@ remoteListDefinedInterfaces (virConnectPtr conn, char **const names, int maxname
goto done;

if (ret.names.names_len > maxnames) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote interfaces: %d > %d"),
- ret.names.names_len, maxnames);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote interfaces: %d > %d"),
+ ret.names.names_len, maxnames);
goto cleanup;
}

@@ -4781,7 +4783,7 @@ remoteListStoragePools (virConnectPtr conn, char **const names, int maxnames)
remoteDriverLock(priv);

if (maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("too many storage pools requested"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many storage pools requested"));
goto done;
}
args.maxnames = maxnames;
@@ -4793,7 +4795,7 @@ remoteListStoragePools (virConnectPtr conn, char **const names, int maxnames)
goto done;

if (ret.names.names_len > maxnames) {
- error (conn, VIR_ERR_RPC, _("too many storage pools received"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many storage pools received"));
goto cleanup;
}

@@ -4859,7 +4861,7 @@ remoteListDefinedStoragePools (virConnectPtr conn,
remoteDriverLock(priv);

if (maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("too many storage pools requested"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many storage pools requested"));
goto done;
}
args.maxnames = maxnames;
@@ -4871,7 +4873,7 @@ remoteListDefinedStoragePools (virConnectPtr conn,
goto done;

if (ret.names.names_len > maxnames) {
- error (conn, VIR_ERR_RPC, _("too many storage pools received"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many storage pools received"));
goto cleanup;
}

@@ -5423,7 +5425,7 @@ remoteStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int ma
remoteDriverLock(priv);

if (maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
- error (pool->conn, VIR_ERR_RPC, _("too many storage volumes requested"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many storage volumes requested"));
goto done;
}
args.maxnames = maxnames;
@@ -5436,7 +5438,7 @@ remoteStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int ma
goto done;

if (ret.names.names_len > maxnames) {
- error (pool->conn, VIR_ERR_RPC, _("too many storage volumes received"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many storage volumes received"));
goto cleanup;
}

@@ -5857,7 +5859,7 @@ static int remoteNodeListDevices(virConnectPtr conn,
remoteDriverLock(priv);

if (maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("too many device names requested"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many device names requested"));
goto done;
}
args.cap = cap ? (char **)&cap : NULL;
@@ -5871,7 +5873,7 @@ static int remoteNodeListDevices(virConnectPtr conn,
goto done;

if (ret.names.names_len > maxnames) {
- error (conn, VIR_ERR_RPC, _("too many device names received"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many device names received"));
goto cleanup;
}

@@ -6020,7 +6022,7 @@ static int remoteNodeDeviceListCaps(virNodeDevicePtr dev,
remoteDriverLock(priv);

if (maxnames > REMOTE_NODE_DEVICE_CAPS_LIST_MAX) {
- error (dev->conn, VIR_ERR_RPC, _("too many capability names requested"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many capability names requested"));
goto done;
}
args.maxnames = maxnames;
@@ -6033,7 +6035,7 @@ static int remoteNodeDeviceListCaps(virNodeDevicePtr dev,
goto done;

if (ret.names.names_len > maxnames) {
- error (dev->conn, VIR_ERR_RPC, _("too many capability names received"));
+ remoteError(VIR_ERR_RPC, "%s", _("too many capability names received"));
goto cleanup;
}

@@ -6336,9 +6338,9 @@ remoteListNWFilters (virConnectPtr conn, char **const names, int maxnames)
remoteDriverLock(priv);

if (maxnames > REMOTE_NWFILTER_NAME_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote nwfilters: %d > %d"),
- maxnames, REMOTE_NWFILTER_NAME_LIST_MAX);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote nwfilters: %d > %d"),
+ maxnames, REMOTE_NWFILTER_NAME_LIST_MAX);
goto done;
}
args.maxnames = maxnames;
@@ -6350,9 +6352,9 @@ remoteListNWFilters (virConnectPtr conn, char **const names, int maxnames)
goto done;

if (ret.names.names_len > maxnames) {
- errorf (conn, VIR_ERR_RPC,
- _("too many remote nwfilters: %d > %d"),
- ret.names.names_len, maxnames);
+ remoteError(VIR_ERR_RPC,
+ _("too many remote nwfilters: %d > %d"),
+ ret.names.names_len, maxnames);
goto cleanup;
}

@@ -6505,10 +6507,8 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
} else if (STRCASEEQ(authtype, "polkit")) {
want = REMOTE_AUTH_POLKIT;
} else {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
- NULL, NULL, NULL, 0, 0,
- _("unknown authentication type %s"), authtype);
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("unknown authentication type %s"), authtype);
return -1;
}
for (i = 0 ; i < ret.types.types_len ; i++) {
@@ -6516,10 +6516,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
type = want;
}
if (type == REMOTE_AUTH_NONE) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("requested authentication type %s rejected"),
- authtype);
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("requested authentication type %s rejected"),
+ authtype);
return -1;
}
} else {
@@ -6556,11 +6555,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
break;

default:
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
- NULL, NULL, NULL, 0, 0,
- _("unsupported authentication type %d"),
- ret.types.types_val[0]);
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("unsupported authentication type %d"),
+ ret.types.types_val[0]);
VIR_FREE(ret.types.types_val);
return -1;
}
@@ -6799,10 +6796,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
/* Sets up the SASL library as a whole */
err = sasl_client_init(NULL);
if (err != SASL_OK) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("failed to initialize SASL library: %d (%s)"),
- err, sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("failed to initialize SASL library: %d (%s)"),
+ err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}

@@ -6843,10 +6839,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
&saslconn);

if (err != SASL_OK) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("Failed to create SASL client context: %d (%s)"),
- err, sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("Failed to create SASL client context: %d (%s)"),
+ err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}

@@ -6856,9 +6851,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,

cipher = gnutls_cipher_get(priv->session);
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "%s", _("invalid cipher size for TLS session"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid cipher size for TLS session"));
goto cleanup;
}
ssf *= 8; /* key size is bytes, sasl wants bits */
@@ -6866,10 +6860,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
DEBUG("Setting external SSF %d", ssf);
err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf);
if (err != SASL_OK) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("cannot set external SSF %d (%s)"),
- err, sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot set external SSF %d (%s)"),
+ err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
}
@@ -6885,10 +6878,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,

err = sasl_setprop(saslconn, SASL_SEC_PROPS, &secprops);
if (err != SASL_OK) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("cannot set security props %d (%s)"),
- err, sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot set security props %d (%s)"),
+ err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}

@@ -6903,11 +6895,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
mechlist = iret.mechlist;
if (wantmech) {
if (strstr(mechlist, wantmech) == NULL) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
- NULL, NULL, NULL, 0, 0,
- _("SASL mechanism %s not supported by server"),
- wantmech);
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("SASL mechanism %s not supported by server"),
+ wantmech);
VIR_FREE(iret.mechlist);
goto cleanup;
}
@@ -6923,10 +6913,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
&clientoutlen,
&mech);
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("Failed to start SASL negotiation: %d (%s)"),
- err, sasl_errdetail(saslconn));
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("Failed to start SASL negotiation: %d (%s)"),
+ err, sasl_errdetail(saslconn));
VIR_FREE(iret.mechlist);
goto cleanup;
}
@@ -6938,12 +6927,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
remoteAuthFreeCredentials(cred, ncred);
cred = NULL;
}
- if ((ncred =
- remoteAuthMakeCredentials(interact, &cred)) < 0) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
- NULL, NULL, NULL, 0, 0,
- "%s", _("Failed to make auth credentials"));
+ if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
+ remoteError(VIR_ERR_AUTH_FAILED, "%s",
+ _("Failed to make auth credentials"));
VIR_FREE(iret.mechlist);
goto cleanup;
}
@@ -6957,18 +6943,15 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
} else {
msg = "No authentication callback available";
}
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL,
- 0, 0, "%s", msg);
+ remoteError(VIR_ERR_AUTH_FAILED, "%s", msg);
goto cleanup;
}
VIR_FREE(iret.mechlist);

if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("SASL negotiation data too long: %d bytes"),
- clientoutlen);
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("SASL negotiation data too long: %d bytes"),
+ clientoutlen);
goto cleanup;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
@@ -7005,10 +6988,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
&clientout,
&clientoutlen);
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("Failed SASL step: %d (%s)"),
- err, sasl_errdetail(saslconn));
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("Failed SASL step: %d (%s)"),
+ err, sasl_errdetail(saslconn));
goto cleanup;
}
/* Need to gather some credentials from the client */
@@ -7019,9 +7001,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
cred = NULL;
}
if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "%s", _("Failed to make auth credentials"));
+ remoteError(VIR_ERR_AUTH_FAILED, "%s",
+ _("Failed to make auth credentials"));
goto cleanup;
}
/* Run the authentication callback */
@@ -7030,13 +7011,11 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
remoteAuthFillInteract(cred, interact);
goto restep;
}
- msg = "Failed to collect auth credentials";
+ msg = _("Failed to collect auth credentials");
} else {
- msg = "No authentication callback available";
+ msg = _("No authentication callback available");
}
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL,
- 0, 0, "%s", msg);
+ remoteError(VIR_ERR_AUTH_FAILED, "%s", msg);
goto cleanup;
}

@@ -7080,18 +7059,16 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (!priv->uses_tls) {
err = sasl_getprop(saslconn, SASL_SSF, &val);
if (err != SASL_OK) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("cannot query SASL ssf on connection %d (%s)"),
- err, sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("cannot query SASL ssf on connection %d (%s)"),
+ err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
ssf = *(const int *)val;
DEBUG("SASL SSF value %d", ssf);
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("negotiation SSF %d was not strong enough"), ssf);
+ remoteError(VIR_ERR_AUTH_FAILED,
+ _("negotiation SSF %d was not strong enough"), ssf);
goto cleanup;
}
priv->is_secure = 1;
@@ -7165,9 +7142,8 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
DEBUG0("Client run callback for PolicyKit authentication");
/* Run the authentication callback */
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "%s", _("Failed to collect auth credentials"));
+ remoteError(VIR_ERR_AUTH_FAILED, "%s",
+ _("Failed to collect auth credentials"));
return -1;
}
} else {
@@ -7202,12 +7178,12 @@ static int remoteDomainEventRegister(virConnectPtr conn,
remoteDriverLock(priv);

if (priv->eventFlushTimer < 0) {
- error (conn, VIR_ERR_NO_SUPPORT, _("no event support"));
+ remoteError(VIR_ERR_NO_SUPPORT, "%s", _("no event support"));
goto done;
}
if (virDomainEventCallbackListAdd(conn, priv->callbackList,
callback, opaque, freecb) < 0) {
- error (conn, VIR_ERR_RPC, _("adding cb to list"));
+ remoteError(VIR_ERR_RPC, "%s", _("adding cb to list"));
goto done;
}

@@ -7237,13 +7213,13 @@ static int remoteDomainEventDeregister(virConnectPtr conn,
if (priv->domainEventDispatching) {
if (virDomainEventCallbackListMarkDelete(conn, priv->callbackList,
callback) < 0) {
- error (conn, VIR_ERR_RPC, _("marking cb for deletion"));
+ remoteError(VIR_ERR_RPC, "%s", _("marking cb for deletion"));
goto done;
}
} else {
if (virDomainEventCallbackListRemove(conn, priv->callbackList,
callback) < 0) {
- error (conn, VIR_ERR_RPC, _("removing cb from list"));
+ remoteError(VIR_ERR_RPC, "%s", _("removing cb from list"));
goto done;
}
}
@@ -7278,8 +7254,8 @@ remoteDomainReadEventLifecycle(virConnectPtr conn, XDR *xdr)

/* unmarshall parameters, and process it*/
if (! xdr_remote_domain_event_lifecycle_msg(xdr, &msg) ) {
- error (conn, VIR_ERR_RPC,
- _("unable to demarshall lifecycle event"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall lifecycle event"));
return NULL;
}

@@ -7305,8 +7281,8 @@ remoteDomainReadEventReboot(virConnectPtr conn, XDR *xdr)

/* unmarshall parameters, and process it*/
if (! xdr_remote_domain_event_reboot_msg(xdr, &msg) ) {
- error (conn, VIR_ERR_RPC,
- _("unable to demarshall reboot event"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall reboot event"));
return NULL;
}

@@ -7332,8 +7308,8 @@ remoteDomainReadEventRTCChange(virConnectPtr conn, XDR *xdr)

/* unmarshall parameters, and process it*/
if (! xdr_remote_domain_event_rtc_change_msg(xdr, &msg) ) {
- error (conn, VIR_ERR_RPC,
- _("unable to demarshall reboot event"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall reboot event"));
return NULL;
}

@@ -7359,8 +7335,8 @@ remoteDomainReadEventWatchdog(virConnectPtr conn, XDR *xdr)

/* unmarshall parameters, and process it*/
if (! xdr_remote_domain_event_watchdog_msg(xdr, &msg) ) {
- error (conn, VIR_ERR_RPC,
- _("unable to demarshall reboot event"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall reboot event"));
return NULL;
}

@@ -7386,8 +7362,8 @@ remoteDomainReadEventIOError(virConnectPtr conn, XDR *xdr)

/* unmarshall parameters, and process it*/
if (! xdr_remote_domain_event_io_error_msg(xdr, &msg) ) {
- error (conn, VIR_ERR_RPC,
- _("unable to demarshall reboot event"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall reboot event"));
return NULL;
}

@@ -7421,8 +7397,8 @@ remoteDomainReadEventGraphics(virConnectPtr conn, XDR *xdr)

/* unmarshall parameters, and process it*/
if (! xdr_remote_domain_event_graphics_msg(xdr, &msg) ) {
- error (conn, VIR_ERR_RPC,
- _("unable to demarshall reboot event"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("unable to demarshall reboot event"));
return NULL;
}

@@ -7595,8 +7571,8 @@ remoteSecretListSecrets (virConnectPtr conn, char **uuids, int maxuuids)
remoteDriverLock(priv);

if (maxuuids > REMOTE_SECRET_UUID_LIST_MAX) {
- errorf (conn, VIR_ERR_RPC, _("too many remote secret UUIDs: %d > %d"),
- maxuuids, REMOTE_SECRET_UUID_LIST_MAX);
+ remoteError(VIR_ERR_RPC, _("too many remote secret UUIDs: %d > %d"),
+ maxuuids, REMOTE_SECRET_UUID_LIST_MAX);
goto done;
}
args.maxuuids = maxuuids;
@@ -7608,8 +7584,8 @@ remoteSecretListSecrets (virConnectPtr conn, char **uuids, int maxuuids)
goto done;

if (ret.uuids.uuids_len > maxuuids) {
- errorf (conn, VIR_ERR_RPC, _("too many remote secret UUIDs: %d > %d"),
- ret.uuids.uuids_len, maxuuids);
+ remoteError(VIR_ERR_RPC, _("too many remote secret UUIDs: %d > %d"),
+ ret.uuids.uuids_len, maxuuids);
goto cleanup;
}

@@ -7882,8 +7858,8 @@ remoteStreamPacket(virStreamPtr st,

if (virCondInit(&thiscall->cond) < 0) {
VIR_FREE(thiscall);
- error (st->conn, VIR_ERR_INTERNAL_ERROR,
- _("cannot initialize mutex"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
return -1;
}

@@ -7908,8 +7884,7 @@ remoteStreamPacket(virStreamPtr st,
xdrmem_create (&xdr, thiscall->buffer + thiscall->bufferLength,
REMOTE_MESSAGE_MAX, XDR_ENCODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
- error (st->conn,
- VIR_ERR_RPC, _("xdr_remote_message_header failed"));
+ remoteError(VIR_ERR_RPC, "%s", _("xdr_remote_message_header failed"));
goto error;
}

@@ -7918,9 +7893,8 @@ remoteStreamPacket(virStreamPtr st,

if (status == REMOTE_CONTINUE) {
if (((4 + REMOTE_MESSAGE_MAX) - thiscall->bufferLength) < nbytes) {
- errorf(st->conn,
- VIR_ERR_RPC, _("data size %zu too large for payload %d"),
- nbytes, ((4 + REMOTE_MESSAGE_MAX) - thiscall->bufferLength));
+ remoteError(VIR_ERR_RPC, _("data size %zu too large for payload %d"),
+ nbytes, ((4 + REMOTE_MESSAGE_MAX) - thiscall->bufferLength));
goto error;
}

@@ -7931,8 +7905,7 @@ remoteStreamPacket(virStreamPtr st,
/* Go back to packet start and encode the length word. */
xdrmem_create (&xdr, thiscall->buffer, REMOTE_MESSAGE_HEADER_XDR_LEN, XDR_ENCODE);
if (!xdr_u_int (&xdr, &thiscall->bufferLength)) {
- error(st->conn, VIR_ERR_RPC,
- _("xdr_u_int (length word)"));
+ remoteError(VIR_ERR_RPC, "%s", _("xdr_u_int (length word)"));
goto error;
}
xdr_destroy (&xdr);
@@ -8061,8 +8034,8 @@ remoteStreamRecv(virStreamPtr st,

if (virCondInit(&thiscall->cond) < 0) {
VIR_FREE(thiscall);
- error (st->conn, VIR_ERR_INTERNAL_ERROR,
- _("cannot initialize mutex"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
goto cleanup;
}

@@ -8390,14 +8363,14 @@ static int remoteDomainEventRegisterAny(virConnectPtr conn,
remoteDriverLock(priv);

if (priv->eventFlushTimer < 0) {
- error (conn, VIR_ERR_NO_SUPPORT, _("no event support"));
+ remoteError(VIR_ERR_NO_SUPPORT, "%s", _("no event support"));
goto done;
}

if ((callbackID = virDomainEventCallbackListAddID(conn, priv->callbackList,
dom, eventID,
callback, opaque, freecb)) < 0) {
- error (conn, VIR_ERR_RPC, _("adding cb to list"));
+ remoteError(VIR_ERR_RPC, "%s", _("adding cb to list"));
goto done;
}

@@ -8433,20 +8406,20 @@ static int remoteDomainEventDeregisterAny(virConnectPtr conn,
remoteDriverLock(priv);

if ((eventID = virDomainEventCallbackListEventID(conn, priv->callbackList, callbackID)) < 0) {
- errorf (conn, VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID);
+ remoteError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID);
goto done;
}

if (priv->domainEventDispatching) {
if (virDomainEventCallbackListMarkDeleteID(conn, priv->callbackList,
callbackID) < 0) {
- error (conn, VIR_ERR_RPC, _("marking cb for deletion"));
+ remoteError(VIR_ERR_RPC, "%s", _("marking cb for deletion"));
goto done;
}
} else {
if (virDomainEventCallbackListRemoveID(conn, priv->callbackList,
callbackID) < 0) {
- error (conn, VIR_ERR_RPC, _("removing cb from list"));
+ remoteError(VIR_ERR_RPC, "%s", _("removing cb from list"));
goto done;
}
}
@@ -8474,9 +8447,7 @@ done:


static struct remote_thread_call *
-prepareCall(virConnectPtr conn,
- struct private_data *priv,
- int flags,
+prepareCall(struct private_data *priv,
int proc_nr,
xdrproc_t args_filter, char *args,
xdrproc_t ret_filter, char *ret)
@@ -8492,9 +8463,8 @@ prepareCall(virConnectPtr conn,

if (virCondInit(&rv->cond) < 0) {
VIR_FREE(rv);
- error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_INTERNAL_ERROR,
- _("cannot initialize mutex"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
return NULL;
}

@@ -8515,14 +8485,12 @@ prepareCall(virConnectPtr conn,
/* Serialise header followed by args. */
xdrmem_create (&xdr, rv->buffer+4, REMOTE_MESSAGE_MAX, XDR_ENCODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
- error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, _("xdr_remote_message_header failed"));
+ remoteError(VIR_ERR_RPC, "%s", _("xdr_remote_message_header failed"));
goto error;
}

if (!(*args_filter) (&xdr, args)) {
- error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC,
- _("marshalling args"));
+ remoteError(VIR_ERR_RPC, "%s", _("marshalling args"));
goto error;
}

@@ -8538,8 +8506,7 @@ prepareCall(virConnectPtr conn,
/* Encode the length word. */
xdrmem_create (&xdr, rv->buffer, REMOTE_MESSAGE_HEADER_XDR_LEN, XDR_ENCODE);
if (!xdr_u_int (&xdr, &rv->bufferLength)) {
- error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC,
- _("xdr_u_int (length word)"));
+ remoteError(VIR_ERR_RPC, "%s", _("xdr_u_int (length word)"));
goto error;
}
xdr_destroy (&xdr);
@@ -8555,9 +8522,7 @@ error:


static int
-remoteIOWriteBuffer(virConnectPtr conn,
- struct private_data *priv,
- int in_open /* if we are in virConnectOpen */,
+remoteIOWriteBuffer(struct private_data *priv,
const char *bytes, int len)
{
int ret;
@@ -8571,8 +8536,7 @@ remoteIOWriteBuffer(virConnectPtr conn,
if (ret == GNUTLS_E_AGAIN)
return 0;

- error (in_open ? NULL : conn,
- VIR_ERR_GNUTLS_ERROR, gnutls_strerror (ret));
+ remoteError(VIR_ERR_GNUTLS_ERROR, "%s", gnutls_strerror (ret));
return -1;
}
} else {
@@ -8584,8 +8548,7 @@ remoteIOWriteBuffer(virConnectPtr conn,
if (errno == EWOULDBLOCK)
return 0;

- virReportSystemError(errno,
- "%s", _("cannot send data"));
+ virReportSystemError(errno, "%s", _("cannot send data"));
return -1;

}
@@ -8596,9 +8559,7 @@ remoteIOWriteBuffer(virConnectPtr conn,


static int
-remoteIOReadBuffer(virConnectPtr conn,
- struct private_data *priv,
- int in_open /* if we are in virConnectOpen */,
+remoteIOReadBuffer(struct private_data *priv,
char *bytes, int len)
{
int ret;
@@ -8614,14 +8575,12 @@ remoteIOReadBuffer(virConnectPtr conn,
/* Treat 0 == EOF as an error */
if (ret <= 0) {
if (ret < 0)
- errorf (in_open ? NULL : conn,
- VIR_ERR_GNUTLS_ERROR,
- _("failed to read from TLS socket %s"),
- gnutls_strerror (ret));
+ remoteError(VIR_ERR_GNUTLS_ERROR,
+ _("failed to read from TLS socket %s"),
+ gnutls_strerror (ret));
else
- errorf (in_open ? NULL : conn,
- VIR_ERR_SYSTEM_ERROR,
- "%s", _("server closed connection"));
+ remoteError(VIR_ERR_SYSTEM_ERROR, "%s",
+ _("server closed connection"));
return -1;
}
} else {
@@ -8648,9 +8607,8 @@ remoteIOReadBuffer(virConnectPtr conn,
saferead(priv->errfd, errout, sizeof(errout));
}

- errorf (in_open ? NULL : conn,
- VIR_ERR_SYSTEM_ERROR,
- _("server closed connection: %s"), errout);
+ remoteError(VIR_ERR_SYSTEM_ERROR,
+ _("server closed connection: %s"), errout);
}
return -1;
}
@@ -8661,9 +8619,7 @@ remoteIOReadBuffer(virConnectPtr conn,


static int
-remoteIOWriteMessage(virConnectPtr conn,
- struct private_data *priv,
- int in_open,
+remoteIOWriteMessage(struct private_data *priv,
struct remote_thread_call *thecall)
{
#if HAVE_SASL
@@ -8678,9 +8634,9 @@ remoteIOWriteMessage(virConnectPtr conn,
thecall->bufferLength - thecall->bufferOffset,
&output, &outputlen);
if (err != SASL_OK) {
- errorf (in_open ? NULL : conn, VIR_ERR_INTERNAL_ERROR,
- _("failed to encode SASL data: %s"),
- sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to encode SASL data: %s"),
+ sasl_errstring(err, NULL, NULL));
return -1;
}
priv->saslEncoded = output;
@@ -8690,7 +8646,7 @@ remoteIOWriteMessage(virConnectPtr conn,
thecall->bufferOffset = thecall->bufferLength;
}

- ret = remoteIOWriteBuffer(conn, priv, in_open,
+ ret = remoteIOWriteBuffer(priv,
priv->saslEncoded + priv->saslEncodedOffset,
priv->saslEncodedLength - priv->saslEncodedOffset);
if (ret < 0)
@@ -8708,7 +8664,7 @@ remoteIOWriteMessage(virConnectPtr conn,
} else {
#endif
int ret;
- ret = remoteIOWriteBuffer(conn, priv, in_open,
+ ret = remoteIOWriteBuffer(priv,
thecall->buffer + thecall->bufferOffset,
thecall->bufferLength - thecall->bufferOffset);
if (ret < 0)
@@ -8730,8 +8686,7 @@ remoteIOWriteMessage(virConnectPtr conn,


static int
-remoteIOHandleOutput(virConnectPtr conn, struct private_data *priv,
- int in_open) {
+remoteIOHandleOutput(struct private_data *priv) {
struct remote_thread_call *thecall = priv->waitDispatch;

while (thecall &&
@@ -8742,7 +8697,7 @@ remoteIOHandleOutput(virConnectPtr conn, struct private_data *priv,
return -1; /* Shouldn't happen, but you never know... */

while (thecall) {
- int ret = remoteIOWriteMessage(conn, priv, in_open, thecall);
+ int ret = remoteIOWriteMessage(priv, thecall);
if (ret < 0)
return ret;

@@ -8756,8 +8711,7 @@ remoteIOHandleOutput(virConnectPtr conn, struct private_data *priv,
}

static int
-remoteIOReadMessage(virConnectPtr conn, struct private_data *priv,
- int in_open) {
+remoteIOReadMessage(struct private_data *priv) {
unsigned int wantData;

/* Start by reading length word */
@@ -8771,8 +8725,7 @@ remoteIOReadMessage(virConnectPtr conn, struct private_data *priv,
if (priv->saslDecoded == NULL) {
char encoded[8192];
int ret, err;
- ret = remoteIOReadBuffer(conn, priv, in_open,
- encoded, sizeof(encoded));
+ ret = remoteIOReadBuffer(priv, encoded, sizeof(encoded));
if (ret < 0)
return -1;
if (ret == 0)
@@ -8781,9 +8734,9 @@ remoteIOReadMessage(virConnectPtr conn, struct private_data *priv,
err = sasl_decode(priv->saslconn, encoded, ret,
&priv->saslDecoded, &priv->saslDecodedLength);
if (err != SASL_OK) {
- errorf (in_open ? NULL : conn, VIR_ERR_INTERNAL_ERROR,
- _("failed to decode SASL data: %s"),
- sasl_errstring(err, NULL, NULL));
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to decode SASL data: %s"),
+ sasl_errstring(err, NULL, NULL));
return -1;
}
priv->saslDecodedOffset = 0;
@@ -8807,7 +8760,7 @@ remoteIOReadMessage(virConnectPtr conn, struct private_data *priv,
#endif
int ret;

- ret = remoteIOReadBuffer(conn, priv, in_open,
+ ret = remoteIOReadBuffer(priv,
priv->buffer + priv->bufferOffset,
wantData);
if (ret < 0)
@@ -8825,22 +8778,20 @@ remoteIOReadMessage(virConnectPtr conn, struct private_data *priv,


static int
-remoteIODecodeMessageLength(virConnectPtr conn, struct private_data *priv,
- int in_open) {
+remoteIODecodeMessageLength(struct private_data *priv) {
XDR xdr;
unsigned int len;

xdrmem_create (&xdr, priv->buffer, priv->bufferLength, XDR_DECODE);
if (!xdr_u_int (&xdr, &len)) {
- error (in_open ? NULL : conn,
- VIR_ERR_RPC, _("xdr_u_int (length word, reply)"));
+ remoteError(VIR_ERR_RPC, "%s", _("xdr_u_int (length word, reply)"));
return -1;
}
xdr_destroy (&xdr);

if (len < REMOTE_MESSAGE_HEADER_XDR_LEN) {
- error (in_open ? NULL : conn,
- VIR_ERR_RPC, _("packet received from server too small"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("packet received from server too small"));
return -1;
}

@@ -8848,8 +8799,8 @@ remoteIODecodeMessageLength(virConnectPtr conn, struct private_data *priv,
len -= REMOTE_MESSAGE_HEADER_XDR_LEN;

if (len > REMOTE_MESSAGE_MAX) {
- error (in_open ? NULL : conn,
- VIR_ERR_RPC, _("packet received from server too large"));
+ remoteError(VIR_ERR_RPC, "%s",
+ _("packet received from server too large"));
return -1;
}

@@ -8894,8 +8845,7 @@ processCallDispatch(virConnectPtr conn, struct private_data *priv,
/* Deserialise reply header. */
xdrmem_create (&xdr, priv->buffer + priv->bufferOffset, len, XDR_DECODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
- error (in_open ? NULL : conn,
- VIR_ERR_RPC, _("invalid header in reply"));
+ remoteError(VIR_ERR_RPC, "%s", _("invalid header in reply"));
return -1;
}

@@ -8903,19 +8853,15 @@ processCallDispatch(virConnectPtr conn, struct private_data *priv,

/* Check program, version, etc. are what we expect. */
if (hdr.prog != REMOTE_PROGRAM) {
- virRaiseError (in_open ? NULL : conn,
- NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("unknown program (received %x, expected %x)"),
- hdr.prog, REMOTE_PROGRAM);
+ remoteError(VIR_ERR_RPC,
+ _("unknown program (received %x, expected %x)"),
+ hdr.prog, REMOTE_PROGRAM);
return -1;
}
if (hdr.vers != REMOTE_PROTOCOL_VERSION) {
- virRaiseError (in_open ? NULL : conn,
- NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("unknown protocol version (received %x, expected %x)"),
- hdr.vers, REMOTE_PROTOCOL_VERSION);
+ remoteError(VIR_ERR_RPC,
+ _("unknown protocol version (received %x, expected %x)"),
+ hdr.vers, REMOTE_PROTOCOL_VERSION);
return -1;
}

@@ -8990,8 +8936,7 @@ processCallDispatchReply(virConnectPtr conn, struct private_data *priv,
switch (hdr->status) {
case REMOTE_OK:
if (!(*thecall->ret_filter) (xdr, thecall->ret)) {
- error (in_open ? NULL : conn, VIR_ERR_RPC,
- _("unmarshalling ret"));
+ remoteError(VIR_ERR_RPC, "%s", _("unmarshalling ret"));
return -1;
}
thecall->mode = REMOTE_MODE_COMPLETE;
@@ -9000,18 +8945,14 @@ processCallDispatchReply(virConnectPtr conn, struct private_data *priv,
case REMOTE_ERROR:
memset (&thecall->err, 0, sizeof thecall->err);
if (!xdr_remote_error (xdr, &thecall->err)) {
- error (in_open ? NULL : conn,
- VIR_ERR_RPC, _("unmarshalling remote_error"));
+ remoteError(VIR_ERR_RPC, "%s", _("unmarshalling remote_error"));
return -1;
}
thecall->mode = REMOTE_MODE_ERROR;
return 0;

default:
- virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- _("unknown status (received %x)"),
- hdr->status);
+ remoteError(VIR_ERR_RPC, _("unknown status (received %x)"), hdr->status);
return -1;
}
}
@@ -9155,8 +9096,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Give the error straight to this call */
memset (&thecall->err, 0, sizeof thecall->err);
if (!xdr_remote_error (xdr, &thecall->err)) {
- error (in_open ? NULL : conn,
- VIR_ERR_RPC, _("unmarshalling remote_error"));
+ remoteError(VIR_ERR_RPC, "%s", _("unmarshalling remote_error"));
return -1;
}
thecall->mode = REMOTE_MODE_ERROR;
@@ -9191,7 +9131,7 @@ remoteIOHandleInput(virConnectPtr conn, struct private_data *priv,
* EAGAIN
*/
for (;;) {
- int ret = remoteIOReadMessage(conn, priv, in_open);
+ int ret = remoteIOReadMessage(priv);

if (ret < 0)
return -1;
@@ -9201,7 +9141,7 @@ remoteIOHandleInput(virConnectPtr conn, struct private_data *priv,
/* Check for completion of our goal */
if (priv->bufferOffset == priv->bufferLength) {
if (priv->bufferOffset == 4) {
- ret = remoteIODecodeMessageLength(conn, priv, in_open);
+ ret = remoteIODecodeMessageLength(priv);
if (ret < 0)
return -1;

@@ -9310,7 +9250,7 @@ remoteIOEventLoop(virConnectPtr conn,
}

if (fds[0].revents & POLLOUT) {
- if (remoteIOHandleOutput(conn, priv, in_open) < 0)
+ if (remoteIOHandleOutput(priv) < 0)
goto error;
}

@@ -9365,8 +9305,8 @@ remoteIOEventLoop(virConnectPtr conn,


if (fds[0].revents & (POLLHUP | POLLERR)) {
- errorf(in_open ? NULL : conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("received hangup / error event on socket"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("received hangup / error event on socket"));
goto error;
}
}
@@ -9458,9 +9398,8 @@ remoteIO(virConnectPtr conn,
if (tmp && tmp->next == thiscall)
tmp->next = thiscall->next;
}
- errorf(flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to wait on condition"));
+ remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to wait on condition"));
VIR_FREE(thiscall);
return -1;
}
@@ -9588,8 +9527,7 @@ call (virConnectPtr conn, struct private_data *priv,
{
struct remote_thread_call *thiscall;

- thiscall = prepareCall(conn, priv, flags, proc_nr,
- args_filter, args,
+ thiscall = prepareCall(priv, proc_nr, args_filter, args,
ret_filter, ret);

if (!thiscall) {
--
1.6.3.3
Eric Blake
2010-04-05 16:55:52 UTC
Permalink
Post by Matthias Bolte
Also unify error/errorf to remoteError and update cfg.mk accordingly.
+++ b/src/remote/remote_driver.c
@@ -239,11 +239,9 @@ static int remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in
static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
virConnectAuthPtr auth);
#endif /* HAVE_POLKIT */
-#define error(conn, code, info) \
- virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
- __FUNCTION__, __LINE__, "%s", info)
-#define errorf(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
+
+#define remoteError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_REMOTE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
I like the renaming, especially since our use of the fixed-arg
preprocessor macro error() was at odds with glibc's variadic function of
the same name.

ACK, and the rest of the patch is mechanical fallout.
Post by Matthias Bolte
@@ -825,8 +824,9 @@ doRemoteOpen (virConnectPtr conn,
- error (conn, VIR_ERR_INVALID_ARG,
- _("transport methods unix, ssh and ext are not supported under Windows"));
+ remoteError(VIR_ERR_INVALID_ARG, "%s",
+ _("transport methods unix, ssh and ext are not supported "
+ "under Windows"));
I see why you broke this line, to fit 80 columns, but that can impact
grep-ability of the original message. Is there any policy on this?
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-09 00:03:09 UTC
Permalink
Post by Eric Blake
Post by Matthias Bolte
Also unify error/errorf to remoteError and update cfg.mk accordingly.
+++ b/src/remote/remote_driver.c
@@ -239,11 +239,9 @@ static int remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in
 static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
                              virConnectAuthPtr auth);
 #endif /* HAVE_POLKIT */
-#define error(conn, code, info)                                 \
-    virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,   \
-                         __FUNCTION__, __LINE__, "%s", info)
-#define errorf(conn, code, ...)                                 \
-    virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,   \
+
+#define remoteError(code, ...)                                    \
+    virReportErrorHelper(NULL, VIR_FROM_REMOTE, code, __FILE__,   \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
I like the renaming, especially since our use of the fixed-arg
preprocessor macro error() was at odds with glibc's variadic function of
the same name.
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.
Post by Eric Blake
Post by Matthias Bolte
@@ -825,8 +824,9 @@ doRemoteOpen (virConnectPtr conn,
-        error (conn, VIR_ERR_INVALID_ARG,
-               _("transport methods unix, ssh and ext are not supported under Windows"));
+        remoteError(VIR_ERR_INVALID_ARG, "%s",
+                    _("transport methods unix, ssh and ext are not supported "
+                      "under Windows"));
I see why you broke this line, to fit 80 columns, but that can impact
grep-ability of the original message.  Is there any policy on this?
I'm not aware of any policy for this, but we have many error messages
split into multiple lines already.

Matthias
Dave Allan
2010-04-12 15:03:39 UTC
Permalink
Post by Matthias Bolte
Post by Eric Blake
Post by Matthias Bolte
Also unify error/errorf to remoteError and update cfg.mk accordingly.
+++ b/src/remote/remote_driver.c
@@ -239,11 +239,9 @@ static int remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in
 static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
                              virConnectAuthPtr auth);
 #endif /* HAVE_POLKIT */
-#define error(conn, code, info)                                 \
-    virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,   \
-                         __FUNCTION__, __LINE__, "%s", info)
-#define errorf(conn, code, ...)                                 \
-    virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,   \
+
+#define remoteError(code, ...)                                    \
+    virReportErrorHelper(NULL, VIR_FROM_REMOTE, code, __FILE__,   \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
I like the renaming, especially since our use of the fixed-arg
preprocessor macro error() was at odds with glibc's variadic function of
the same name.
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.
Post by Eric Blake
Post by Matthias Bolte
@@ -825,8 +824,9 @@ doRemoteOpen (virConnectPtr conn,
-        error (conn, VIR_ERR_INVALID_ARG,
-               _("transport methods unix, ssh and ext are not supported under Windows"));
+        remoteError(VIR_ERR_INVALID_ARG, "%s",
+                    _("transport methods unix, ssh and ext are not supported "
+                      "under Windows"));
I see why you broke this line, to fit 80 columns, but that can impact
grep-ability of the original message.  Is there any policy on this?
I'm not aware of any policy for this, but we have many error messages
split into multiple lines already.
I agree that it impacts grep-ability in the code, but very long lines
impact the readability of the code, so in general, I'm in favor of
splitting lines.

Dave
Post by Matthias Bolte
Matthias
--
libvir-list mailing list
https://www.redhat.com/mailman/listinfo/libvir-list
Eric Blake
2010-04-12 15:16:10 UTC
Permalink
Post by Dave Allan
Post by Matthias Bolte
Post by Eric Blake
Post by Matthias Bolte
+ remoteError(VIR_ERR_INVALID_ARG, "%s",
+ _("transport methods unix, ssh and ext are not supported "
+ "under Windows"));
I see why you broke this line, to fit 80 columns, but that can impact
grep-ability of the original message. Is there any policy on this?
I'm not aware of any policy for this, but we have many error messages
split into multiple lines already.
I agree that it impacts grep-ability in the code, but very long lines
impact the readability of the code, so in general, I'm in favor of
splitting lines.
Good to know; thanks for the answers.

Meanwhile, I've seen this paradigm in some other projects (glibc,
coreutils, ...), to at least reduce the number of splits due to long
messages:

remoteError(VIR_ERR_INVALID_ARG, "%s", _("\
transport methods unix, ssh and ext are not supported under Windows"));

By using the \-newline combo, and starting the message at column 1,
you've bought yourself quite a bit of line length, without any change to
the resulting message either on screen or in the .pot file.

But I'm not bothered enough by the current situation to spend any of my
time reformatting existing messages to a new format, so for now, I'm
happy leaving things as they are.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-04 17:36:41 UTC
Permalink
---
src/datatypes.c | 101 ++++++++++++++++++++++++++++---------------------------
1 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/src/datatypes.c b/src/datatypes.c
index a361da6..ca20abf 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -31,8 +31,8 @@

#define VIR_FROM_THIS VIR_FROM_NONE

-#define virLibConnError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+#define virLibConnError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/************************************************************************
@@ -255,7 +255,7 @@ virUnrefConnect(virConnectPtr conn) {
int refs;

if ((!VIR_IS_CONNECT(conn))) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
virMutexLock(&conn->lock);
@@ -311,7 +311,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
virDomainPtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
virMutexLock(&conn->lock);
@@ -340,8 +340,8 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {

if (virHashAddEntry(conn->domains, name, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to add domain to connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to add domain to connection hash table"));
goto error;
}
conn->refs++;
@@ -381,8 +381,8 @@ virReleaseDomain(virDomainPtr domain) {
/* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->domains, domain->name, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("domain missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domain missing from connection hash table"));
conn = NULL;
}

@@ -418,7 +418,7 @@ virUnrefDomain(virDomainPtr domain) {
int refs;

if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
virMutexLock(&domain->conn->lock);
@@ -453,7 +453,7 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
virNetworkPtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
virMutexLock(&conn->lock);
@@ -481,8 +481,8 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {

if (virHashAddEntry(conn->networks, name, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to add network to connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to add network to connection hash table"));
goto error;
}
conn->refs++;
@@ -519,8 +519,8 @@ virReleaseNetwork(virNetworkPtr network) {
/* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->networks, network->name, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("network missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("network missing from connection hash table"));
conn = NULL;
}

@@ -555,7 +555,7 @@ virUnrefNetwork(virNetworkPtr network) {
int refs;

if (!VIR_IS_CONNECTED_NETWORK(network)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
virMutexLock(&network->conn->lock);
@@ -592,7 +592,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
virInterfacePtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}

@@ -628,8 +628,9 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
* interface, and that is unlikely to change.
*/
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-_("Failed to change interface mac address from %s to %s due to differing lengths."),
+ virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to change interface mac address "
+ "from %s to %s due to differing lengths."),
ret->mac, mac);
ret = NULL;
goto error;
@@ -659,8 +660,8 @@ _("Failed to change interface mac address from %s to %s due to differing lengths

if (virHashAddEntry(conn->interfaces, name, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to add interface to connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to add interface to connection hash table"));
goto error;
}
conn->refs++;
@@ -698,8 +699,8 @@ virReleaseInterface(virInterfacePtr iface) {
if (virHashRemoveEntry(conn->interfaces, iface->name, NULL) < 0) {
/* unlock before reporting error because error report grabs lock */
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("interface missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("interface missing from connection hash table"));
/* don't decr the conn refct if we weren't connected to it */
conn = NULL;
}
@@ -736,7 +737,7 @@ virUnrefInterface(virInterfacePtr iface) {
int refs;

if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
virMutexLock(&iface->conn->lock);
@@ -772,7 +773,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uui
virStoragePoolPtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
virMutexLock(&conn->lock);
@@ -800,7 +801,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uui

if (virHashAddEntry(conn->storagePools, name, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to add storage pool to connection hash table"));
goto error;
}
@@ -839,8 +840,8 @@ virReleaseStoragePool(virStoragePoolPtr pool) {
/* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->storagePools, pool->name, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("pool missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("pool missing from connection hash table"));
conn = NULL;
}

@@ -875,7 +876,7 @@ virUnrefStoragePool(virStoragePoolPtr pool) {
int refs;

if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
virMutexLock(&pool->conn->lock);
@@ -912,7 +913,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
virStorageVolPtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (key == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
virMutexLock(&conn->lock);
@@ -938,7 +939,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
}
if (virStrcpyStatic(ret->key, key) == NULL) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR,
_("Volume key %s too large for destination"), key);
goto error;
}
@@ -947,8 +948,8 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c

if (virHashAddEntry(conn->storageVols, key, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to add storage vol to connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to add storage vol to connection hash table"));
goto error;
}
conn->refs++;
@@ -987,8 +988,8 @@ virReleaseStorageVol(virStorageVolPtr vol) {
/* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->storageVols, vol->key, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("vol missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("vol missing from connection hash table"));
conn = NULL;
}

@@ -1024,7 +1025,7 @@ virUnrefStorageVol(virStorageVolPtr vol) {
int refs;

if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
virMutexLock(&vol->conn->lock);
@@ -1060,7 +1061,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
virNodeDevicePtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
virMutexLock(&conn->lock);
@@ -1083,7 +1084,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)

if (virHashAddEntry(conn->nodeDevices, name, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to add node dev to conn hash table"));
goto error;
}
@@ -1121,7 +1122,7 @@ virReleaseNodeDevice(virNodeDevicePtr dev) {

if (virHashRemoveEntry(conn->nodeDevices, dev->name, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR,
"%s", _("dev missing from connection hash table"));
conn = NULL;
}
@@ -1192,7 +1193,7 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
char uuidstr[VIR_UUID_STRING_BUFLEN];

if (!VIR_IS_CONNECT(conn) || uuid == NULL || usageID == NULL) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return NULL;
}
virMutexLock(&conn->lock);
@@ -1217,8 +1218,8 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
}
if (virHashAddEntry(conn->secrets, uuidstr, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to add secret to conn hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to add secret to conn hash table"));
goto error;
}
conn->refs++;
@@ -1256,8 +1257,8 @@ virReleaseSecret(virSecretPtr secret) {
virUUIDFormat(secret->uuid, uuidstr);
if (virHashRemoveEntry(conn->secrets, uuidstr, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("secret missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("secret missing from connection hash table"));
conn = NULL;
}

@@ -1291,7 +1292,7 @@ virUnrefSecret(virSecretPtr secret) {
int refs;

if (!VIR_IS_CONNECTED_SECRET(secret)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}
virMutexLock(&secret->conn->lock);
@@ -1385,7 +1386,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
virNWFilterPtr ret = NULL;

if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
virMutexLock(&conn->lock);
@@ -1413,8 +1414,8 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)

if (virHashAddEntry(conn->nwfilterPools, name, ret) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to add network filter pool to connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to add network filter pool to connection hash table"));
goto error;
}
conn->refs++;
@@ -1452,8 +1453,8 @@ virReleaseNWFilterPool(virNWFilterPtr pool) {
/* TODO search by UUID first as they are better differenciators */
if (virHashRemoveEntry(conn->nwfilterPools, pool->name, NULL) < 0) {
virMutexUnlock(&conn->lock);
- virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("pool missing from connection hash table"));
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("pool missing from connection hash table"));
conn = NULL;
}

@@ -1488,7 +1489,7 @@ virUnrefNWFilter(virNWFilterPtr pool) {
int refs;

if (!VIR_IS_CONNECTED_NWFILTER(pool)) {
- virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}
virMutexLock(&pool->conn->lock);
--
1.6.3.3
Eric Blake
2010-04-05 16:57:53 UTC
Permalink
Post by Matthias Bolte
---
src/datatypes.c | 101 ++++++++++++++++++++++++++++---------------------------
1 files changed, 51 insertions(+), 50 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c
index a361da6..ca20abf 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -31,8 +31,8 @@
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virLibConnError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+#define virLibConnError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:21:11 UTC
Permalink
Post by Eric Blake
---
 src/datatypes.c |  101 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 51 insertions(+), 50 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c
index a361da6..ca20abf 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -31,8 +31,8 @@
 #define VIR_FROM_THIS VIR_FROM_NONE
-#define virLibConnError(conn, code, ...)                          \
-    virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__,     \
+#define virLibConnError(code, ...)                                \
+    virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__,     \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:42 UTC
Permalink
---
src/conf/nwfilter_conf.c | 120 ++++++-------
src/conf/nwfilter_conf.h | 16 +-
src/conf/nwfilter_params.c | 2 +-
src/nwfilter/nwfilter_driver.c | 25 ++--
src/nwfilter/nwfilter_ebiptables_driver.c | 285 +++++++++++------------------
src/nwfilter/nwfilter_gentech_driver.c | 39 ++--
src/nwfilter/nwfilter_gentech_driver.h | 3 +-
tests/nwfilterxml2xmltest.c | 2 +-
8 files changed, 202 insertions(+), 290 deletions(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index c8dda04..7759c18 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -1325,7 +1325,7 @@ virNWFilterRuleDetailsParse(virConnectPtr conn ATTRIBUTE_UNUSED,
}

if (!found || rc) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("%s has illegal value %s"),
att[idx].name, prop);
rc = -1;
@@ -1348,8 +1348,7 @@ virNWFilterRuleDetailsParse(virConnectPtr conn ATTRIBUTE_UNUSED,


static virNWFilterIncludeDefPtr
-virNWFilterIncludeParse(virConnectPtr conn,
- xmlNodePtr cur)
+virNWFilterIncludeParse(xmlNodePtr cur)
{
virNWFilterIncludeDefPtr ret;

@@ -1360,8 +1359,7 @@ virNWFilterIncludeParse(virConnectPtr conn,

ret->filterref = virXMLPropString(cur, "filter");
if (!ret->filterref) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("rule node requires action attribute"));
goto err_exit;
}
@@ -1571,29 +1569,25 @@ virNWFilterRuleParse(virConnectPtr conn,
prio = virXMLPropString(node, "priority");

if (!action) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("rule node requires action attribute"));
goto err_exit;
}

if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unknown rule action attribute value"));
goto err_exit;
}

if (!direction) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("rule node requires direction attribute"));
goto err_exit;
}

if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unknown rule direction attribute value"));
goto err_exit;
}
@@ -1678,8 +1672,8 @@ virNWFilterDefParseXML(virConnectPtr conn,

ret->name = virXPathString("string(./@name)", ctxt);
if (!ret->name) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("filter has no name"));
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("filter has no name"));
goto cleanup;
}

@@ -1688,7 +1682,7 @@ virNWFilterDefParseXML(virConnectPtr conn,
if (chain) {
if ((ret->chainsuffix =
virNWFilterChainSuffixTypeFromString(chain)) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown chain suffix '%s'"), chain);
goto cleanup;
}
@@ -1697,14 +1691,14 @@ virNWFilterDefParseXML(virConnectPtr conn,
uuid = virXPathString("string(./uuid)", ctxt);
if (uuid == NULL) {
if (virUUIDGenerate(ret->uuid) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("unable to generate uuid"));
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unable to generate uuid"));
goto cleanup;
}
} else {
if (virUUIDParse(uuid, ret->uuid) < 0) {
- virNWFilterReportError(conn, VIR_ERR_XML_ERROR,
- "%s", _("malformed uuid element"));
+ virNWFilterReportError(VIR_ERR_XML_ERROR, "%s",
+ _("malformed uuid element"));
goto cleanup;
}
VIR_FREE(uuid);
@@ -1723,7 +1717,7 @@ virNWFilterDefParseXML(virConnectPtr conn,
if (xmlStrEqual(curr->name, BAD_CAST "rule"))
entry->rule = virNWFilterRuleParse(conn, curr);
else if (xmlStrEqual(curr->name, BAD_CAST "filterref"))
- entry->include = virNWFilterIncludeParse(conn, curr);
+ entry->include = virNWFilterIncludeParse(curr);

if (entry->rule || entry->include) {
if (VIR_REALLOC_N(ret->filterEntries, ret->nentries+1) < 0) {
@@ -1762,7 +1756,7 @@ catchXMLError (void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
conn->err.code == VIR_ERR_NONE &&
ctxt->lastError.level == XML_ERR_FATAL &&
ctxt->lastError.message != NULL) {
- virNWFilterReportError(conn, VIR_ERR_XML_DETAIL,
+ virNWFilterReportError(VIR_ERR_XML_DETAIL,
_("at line %d: %s"),
ctxt->lastError.line,
ctxt->lastError.message);
@@ -1779,8 +1773,7 @@ virNWFilterDefParseNode(virConnectPtr conn,
virNWFilterDefPtr def = NULL;

if (STRNEQ((const char *)root->name, "filter")) {
- virNWFilterReportError(conn, VIR_ERR_XML_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_XML_ERROR, "%s",
_("unknown root element for nw filter pool"));
goto cleanup;
}
@@ -1830,15 +1823,15 @@ virNWFilterDefParse(virConnectPtr conn,

if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE)
- virNWFilterReportError(conn, VIR_ERR_XML_ERROR,
- "%s",_("failed to parse xml document"));
+ virNWFilterReportError(VIR_ERR_XML_ERROR, "%s",
+ _("failed to parse xml document"));
goto cleanup;
}

node = xmlDocGetRootElement(xml);
if (node == NULL) {
- virNWFilterReportError(conn, VIR_ERR_XML_ERROR,
- "%s", _("missing root element"));
+ virNWFilterReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing root element"));
goto cleanup;
}

@@ -1969,7 +1962,7 @@ int virNWFilterSaveConfig(virConnectPtr conn,
int ret = -1;
char *xml;

- if (!(xml = virNWFilterDefFormat(conn, def)))
+ if (!(xml = virNWFilterDefFormat(def)))
goto cleanup;

if (virNWFilterSaveXML(conn, configDir, def, xml))
@@ -2125,8 +2118,8 @@ virNWFilterPoolObjAssignDef(virConnectPtr conn,
virNWFilterPoolObjPtr pool;

if (virNWFilterDefLoopDetect(conn, pools, def)) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
- "%s", _("filter would introduce a loop"));
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ _("filter would introduce a loop"));
return NULL;
}

@@ -2154,8 +2147,8 @@ virNWFilterPoolObjAssignDef(virConnectPtr conn,
}

if (virMutexInitRecursive(&pool->lock) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot initialize mutex"));
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
VIR_FREE(pool);
return NULL;
}
@@ -2190,9 +2183,10 @@ virNWFilterPoolObjLoad(virConnectPtr conn,
}

if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
- _("network filter pool config filename '%s' does not match pool name '%s'"),
- path, def->name);
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ _("network filter pool config filename '%s' "
+ "does not match pool name '%s'"),
+ path, def->name);
virNWFilterDefFree(def);
return NULL;
}
@@ -2242,7 +2236,7 @@ virNWFilterPoolLoadAllConfigs(virConnectPtr conn,

if (virFileBuildPath(configDir, entry->d_name,
NULL, path, PATH_MAX) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("config filename '%s/%s' is too long"),
configDir, entry->d_name);
continue;
@@ -2260,10 +2254,9 @@ virNWFilterPoolLoadAllConfigs(virConnectPtr conn,


int
-virNWFilterPoolObjSaveDef(virConnectPtr conn,
- virNWFilterDriverStatePtr driver,
- virNWFilterPoolObjPtr pool,
- virNWFilterDefPtr def)
+virNWFilterPoolObjSaveDef(virNWFilterDriverStatePtr driver,
+ virNWFilterPoolObjPtr pool,
+ virNWFilterDefPtr def)
{
char *xml;
int fd = -1, ret = -1;
@@ -2282,8 +2275,8 @@ virNWFilterPoolObjSaveDef(virConnectPtr conn,

if (virFileBuildPath(driver->configDir, def->name, ".xml",
path, sizeof(path)) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot construct config file path"));
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot construct config file path"));
return -1;
}
if (!(pool->configFile = strdup(path))) {
@@ -2292,9 +2285,9 @@ virNWFilterPoolObjSaveDef(virConnectPtr conn,
}
}

- if (!(xml = virNWFilterDefFormat(conn, def))) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to generate XML"));
+ if (!(xml = virNWFilterDefFormat(def))) {
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("failed to generate XML"));
return -1;
}

@@ -2335,19 +2328,18 @@ virNWFilterPoolObjSaveDef(virConnectPtr conn,


int
-virNWFilterPoolObjDeleteDef(virConnectPtr conn,
- virNWFilterPoolObjPtr pool)
+virNWFilterPoolObjDeleteDef(virNWFilterPoolObjPtr pool)
{
if (!pool->configFile) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("no config file for %s"), pool->def->name);
return -1;
}

if (unlink(pool->configFile) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- _("cannot remove config for %s"),
- pool->def->name);
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot remove config for %s"),
+ pool->def->name);
return -1;
}

@@ -2369,8 +2361,7 @@ virNWIPAddressFormat(virBufferPtr buf, nwIPAddressPtr ipaddr)


static void
-virNWFilterRuleDefDetailsFormat(virConnectPtr conn,
- virBufferPtr buf,
+virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
const char *type,
const virXMLAttr2Struct *att,
virNWFilterRuleDefPtr def)
@@ -2420,10 +2411,9 @@ virNWFilterRuleDefDetailsFormat(virConnectPtr conn,
att[i].name);
if (att[i].formatter) {
if (!att[i].formatter(buf, def)) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("formatter for %s %s reported error"),
- type,
- att[i].name);
+ type, att[i].name);
goto err_exit;
}
} else if ((flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) {
@@ -2484,8 +2474,7 @@ err_exit:


static char *
-virNWFilterRuleDefFormat(virConnectPtr conn,
- virNWFilterRuleDefPtr def)
+virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def)
{
int i;
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -2500,8 +2489,7 @@ virNWFilterRuleDefFormat(virConnectPtr conn,
i = 0;
while (virAttr[i].id) {
if (virAttr[i].prtclType == def->prtclType) {
- virNWFilterRuleDefDetailsFormat(conn,
- &buf2,
+ virNWFilterRuleDefDetailsFormat(&buf2,
virAttr[i].id,
virAttr[i].att,
def);
@@ -2563,18 +2551,16 @@ virNWFilterIncludeDefFormat(virNWFilterIncludeDefPtr inc)


static char *
-virNWFilterEntryFormat(virConnectPtr conn,
- virNWFilterEntryPtr entry)
+virNWFilterEntryFormat(virNWFilterEntryPtr entry)
{
if (entry->rule)
- return virNWFilterRuleDefFormat(conn, entry->rule);
+ return virNWFilterRuleDefFormat(entry->rule);
return virNWFilterIncludeDefFormat(entry->include);
}


char *
-virNWFilterDefFormat(virConnectPtr conn,
- virNWFilterDefPtr def)
+virNWFilterDefFormat(virNWFilterDefPtr def)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char uuid[VIR_UUID_STRING_BUFLEN];
@@ -2590,7 +2576,7 @@ virNWFilterDefFormat(virConnectPtr conn,
virBufferVSprintf(&buf," <uuid>%s</uuid>\n", uuid);

for (i = 0; i < def->nentries; i++) {
- xml = virNWFilterEntryFormat(conn, def->filterEntries[i]);
+ xml = virNWFilterEntryFormat(def->filterEntries[i]);
if (!xml)
goto err_exit;
virBufferVSprintf(&buf, "%s", xml);
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 8ab0b89..6c9dd4e 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -518,13 +518,11 @@ virNWFilterPoolObjPtr
const char *name);


-int virNWFilterPoolObjSaveDef(virConnectPtr conn,
- virNWFilterDriverStatePtr driver,
+int virNWFilterPoolObjSaveDef(virNWFilterDriverStatePtr driver,
virNWFilterPoolObjPtr pool,
virNWFilterDefPtr def);

-int virNWFilterPoolObjDeleteDef(virConnectPtr conn,
- virNWFilterPoolObjPtr pool);
+int virNWFilterPoolObjDeleteDef(virNWFilterPoolObjPtr pool);

virNWFilterPoolObjPtr virNWFilterPoolObjAssignDef(virConnectPtr conn,
virNWFilterPoolObjListPtr pools,
@@ -537,8 +535,7 @@ virNWFilterDefPtr virNWFilterDefParseNode(virConnectPtr conn,
xmlDocPtr xml,
xmlNodePtr root);

-char *virNWFilterDefFormat(virConnectPtr conn,
- virNWFilterDefPtr def);
+char *virNWFilterDefFormat(virNWFilterDefPtr def);

int virNWFilterSaveXML(virConnectPtr conn,
const char *configDir,
@@ -568,10 +565,9 @@ void virNWFilterPoolObjUnlock(virNWFilterPoolObjPtr obj);
int virNWFilterConfLayerInit(virHashIterator domUpdateCB);
void virNWFilterConfLayerShutdown(void);

-# define virNWFilterReportError(conn, code, fmt...) \
- (void)conn; \
- virReportErrorHelper(NULL, VIR_FROM_NWFILTER, code, __FILE__, \
- __FUNCTION__, __LINE__, fmt)
+# define virNWFilterReportError(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_NWFILTER, code, __FILE__, \
+ __FUNCTION__, __LINE__, fmt)


typedef int (*virNWFilterRebuild)(virConnectPtr conn,
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index a1c30bb..93f97d7 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -174,7 +174,7 @@ addToTable(void *payload, const char *name, void *data)
}

if (virNWFilterHashTablePut(atts->target, name, val, 1) != 0) {
- virNWFilterReportError(atts->conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not put variable '%s' into hashmap"),
name);
atts->errOccurred = 1;
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index c659793..0f3e9aa 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -194,8 +194,8 @@ nwfilterLookupByUUID(virConnectPtr conn,
nwfilterDriverUnlock(driver);

if (!pool) {
- virNWFilterReportError(conn, VIR_ERR_NO_NWFILTER,
- "%s", _("no pool with matching uuid"));
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER, "%s",
+ _("no pool with matching uuid"));
goto cleanup;
}

@@ -220,8 +220,8 @@ nwfilterLookupByName(virConnectPtr conn,
nwfilterDriverUnlock(driver);

if (!pool) {
- virNWFilterReportError(conn, VIR_ERR_NO_NWFILTER,
- _("no pool with matching name '%s'"), name);
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER,
+ _("no pool with matching name '%s'"), name);
goto cleanup;
}

@@ -306,7 +306,7 @@ nwfilterDefine(virConnectPtr conn,
if (!(pool = virNWFilterPoolObjAssignDef(conn, &driver->pools, def)))
goto cleanup;

- if (virNWFilterPoolObjSaveDef(conn, driver, pool, def) < 0) {
+ if (virNWFilterPoolObjSaveDef(driver, pool, def) < 0) {
virNWFilterPoolObjRemove(&driver->pools, pool);
def = NULL;
goto cleanup;
@@ -333,19 +333,18 @@ nwfilterUndefine(virNWFilterPtr obj) {
nwfilterDriverLock(driver);
pool = virNWFilterPoolObjFindByUUID(&driver->pools, obj->uuid);
if (!pool) {
- virNWFilterReportError(obj->conn, VIR_ERR_INVALID_NWFILTER,
- "%s", _("no nwfilter pool with matching uuid"));
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ _("no nwfilter pool with matching uuid"));
goto cleanup;
}

if (virNWFilterTestUnassignDef(obj->conn, pool)) {
- virNWFilterReportError(obj->conn, VIR_ERR_INVALID_NWFILTER,
- "%s",
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
_("nwfilter is in use"));
goto cleanup;
}

- if (virNWFilterPoolObjDeleteDef(obj->conn, pool) < 0)
+ if (virNWFilterPoolObjDeleteDef(pool) < 0)
goto cleanup;

VIR_FREE(pool->configFile);
@@ -374,12 +373,12 @@ nwfilterDumpXML(virNWFilterPtr obj,
nwfilterDriverUnlock(driver);

if (!pool) {
- virNWFilterReportError(obj->conn, VIR_ERR_INVALID_NWFILTER,
- "%s", _("no nwfilter pool with matching uuid"));
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ _("no nwfilter pool with matching uuid"));
goto cleanup;
}

- ret = virNWFilterDefFormat(obj->conn, pool->def);
+ ret = virNWFilterDefFormat(pool->def);

cleanup:
if (pool)
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index fdf1c10..963588a 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -106,8 +106,7 @@ static const char *supported_protocols[] = {


static int
-printVar(virConnectPtr conn,
- virNWFilterHashTablePtr vars,
+printVar(virNWFilterHashTablePtr vars,
char *buf, int bufsize,
nwItemDescPtr item,
int *done)
@@ -117,16 +116,16 @@ printVar(virConnectPtr conn,
if ((item->flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) {
char *val = (char *)virHashLookup(vars->hashTable, item->var);
if (!val) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
_("cannot find value for '%s'"),
item->var);
return 1;
}

if (!virStrcpy(buf, val, bufsize)) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
_("Buffer to small to print MAC address "
- "'%s' into"),
+ "'%s' into"),
item->var);
return 1;
}
@@ -138,8 +137,7 @@ printVar(virConnectPtr conn,


static int
-_printDataType(virConnectPtr conn,
- virNWFilterHashTablePtr vars,
+_printDataType(virNWFilterHashTablePtr vars,
char *buf, int bufsize,
nwItemDescPtr item,
bool asHex)
@@ -147,7 +145,7 @@ _printDataType(virConnectPtr conn,
int done;
char *data;

- if (printVar(conn, vars, buf, bufsize, item, &done))
+ if (printVar(vars, buf, bufsize, item, &done))
return 1;

if (done)
@@ -157,13 +155,13 @@ _printDataType(virConnectPtr conn,
case DATATYPE_IPADDR:
data = virSocketFormatAddr(&item->u.ipaddr.addr);
if (!data) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal IPv4 address representation "
"is bad"));
return 1;
}
if (snprintf(buf, bufsize, "%s", data) >= bufsize) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("buffer too small for IP address"));
VIR_FREE(data);
return 1;
@@ -174,14 +172,14 @@ _printDataType(virConnectPtr conn,
case DATATYPE_IPV6ADDR:
data = virSocketFormatAddr(&item->u.ipaddr.addr);
if (!data) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal IPv6 address representation "
"is bad"));
return 1;
}

if (snprintf(buf, bufsize, "%s", data) >= bufsize) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("buffer too small for IPv6 address"));
VIR_FREE(data);
return 1;
@@ -192,7 +190,7 @@ _printDataType(virConnectPtr conn,
case DATATYPE_MACADDR:
case DATATYPE_MACMASK:
if (bufsize < VIR_MAC_STRING_BUFLEN) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
_("Buffer too small for MAC address"));
return 1;
}
@@ -204,7 +202,7 @@ _printDataType(virConnectPtr conn,
case DATATYPE_IPMASK:
if (snprintf(buf, bufsize, "%d",
item->u.u8) >= bufsize) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
_("Buffer too small for uint8 type"));
return 1;
}
@@ -213,7 +211,7 @@ _printDataType(virConnectPtr conn,
case DATATYPE_UINT16:
if (snprintf(buf, bufsize, asHex ? "0x%x" : "%d",
item->u.u16) >= bufsize) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
_("Buffer too small for uint16 type"));
return 1;
}
@@ -222,14 +220,14 @@ _printDataType(virConnectPtr conn,
case DATATYPE_UINT8:
if (snprintf(buf, bufsize, asHex ? "0x%x" : "%d",
item->u.u8) >= bufsize) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
_("Buffer too small for uint8 type"));
return 1;
}
break;

default:
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
_("Unhandled datatype %x"), item->datatype);
return 1;
break;
@@ -240,22 +238,20 @@ _printDataType(virConnectPtr conn,


static int
-printDataType(virConnectPtr conn,
- virNWFilterHashTablePtr vars,
+printDataType(virNWFilterHashTablePtr vars,
char *buf, int bufsize,
nwItemDescPtr item)
{
- return _printDataType(conn, vars, buf, bufsize, item, 0);
+ return _printDataType(vars, buf, bufsize, item, 0);
}


static int
-printDataTypeAsHex(virConnectPtr conn,
- virNWFilterHashTablePtr vars,
+printDataTypeAsHex(virNWFilterHashTablePtr vars,
char *buf, int bufsize,
nwItemDescPtr item)
{
- return _printDataType(conn, vars, buf, bufsize, item, 1);
+ return _printDataType(vars, buf, bufsize, item, 1);
}


@@ -297,16 +293,14 @@ ebiptablesAddRuleInst(virConnectPtr conn,


static int
-ebtablesHandleEthHdr(virConnectPtr conn,
- virBufferPtr buf,
+ebtablesHandleEthHdr(virBufferPtr buf,
virNWFilterHashTablePtr vars,
ethHdrDataDefPtr ethHdr)
{
char macaddr[VIR_MAC_STRING_BUFLEN];

if (HAS_ENTRY_ITEM(&ethHdr->dataSrcMACAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
&ethHdr->dataSrcMACAddr))
goto err_exit;
@@ -317,8 +311,7 @@ ebtablesHandleEthHdr(virConnectPtr conn,
macaddr);

if (HAS_ENTRY_ITEM(&ethHdr->dataSrcMACMask)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
&ethHdr->dataSrcMACMask))
goto err_exit;
@@ -330,8 +323,7 @@ ebtablesHandleEthHdr(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&ethHdr->dataDstMACAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
&ethHdr->dataDstMACAddr))
goto err_exit;
@@ -342,8 +334,7 @@ ebtablesHandleEthHdr(virConnectPtr conn,
macaddr);

if (HAS_ENTRY_ITEM(&ethHdr->dataDstMACMask)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
&ethHdr->dataDstMACMask))
goto err_exit;
@@ -806,8 +797,7 @@ iptablesHandleSrcMacAddr(virConnectPtr conn ATTRIBUTE_UNUSED,
char macaddr[VIR_MAC_STRING_BUFLEN];

if (HAS_ENTRY_ITEM(srcMacAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
srcMacAddr))
goto err_exit;
@@ -849,8 +839,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataSrcIPAddr)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&ipHdr->dataSrcIPAddr))
goto err_exit;
@@ -863,8 +852,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataSrcIPMask)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&ipHdr->dataSrcIPMask))
goto err_exit;
@@ -875,8 +863,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,
}
} else if (HAS_ENTRY_ITEM(&ipHdr->dataSrcIPFrom)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&ipHdr->dataSrcIPFrom))
goto err_exit;
@@ -889,8 +876,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataSrcIPTo)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&ipHdr->dataSrcIPTo))
goto err_exit;
@@ -903,8 +889,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataDstIPAddr)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&ipHdr->dataDstIPAddr))
goto err_exit;
@@ -917,8 +902,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataDstIPMask)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&ipHdr->dataDstIPMask))
goto err_exit;
@@ -930,8 +914,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,
}
} else if (HAS_ENTRY_ITEM(&ipHdr->dataDstIPFrom)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&ipHdr->dataDstIPFrom))
goto err_exit;
@@ -944,8 +927,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataDstIPTo)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&ipHdr->dataDstIPTo))
goto err_exit;
@@ -958,8 +940,7 @@ iptablesHandleIpHdr(virConnectPtr conn ATTRIBUTE_UNUSED,

if (HAS_ENTRY_ITEM(&ipHdr->dataDSCP)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&ipHdr->dataDSCP))
goto err_exit;
@@ -995,8 +976,7 @@ iptablesHandlePortData(virConnectPtr conn ATTRIBUTE_UNUSED,
}

if (HAS_ENTRY_ITEM(&portData->dataSrcPortStart)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
portstr, sizeof(portstr),
&portData->dataSrcPortStart))
goto err_exit;
@@ -1008,8 +988,7 @@ iptablesHandlePortData(virConnectPtr conn ATTRIBUTE_UNUSED,
portstr);

if (HAS_ENTRY_ITEM(&portData->dataSrcPortEnd)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
portstr, sizeof(portstr),
&portData->dataSrcPortEnd))
goto err_exit;
@@ -1021,8 +1000,7 @@ iptablesHandlePortData(virConnectPtr conn ATTRIBUTE_UNUSED,
}

if (HAS_ENTRY_ITEM(&portData->dataDstPortStart)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
portstr, sizeof(portstr),
&portData->dataDstPortStart))
goto err_exit;
@@ -1034,8 +1012,7 @@ iptablesHandlePortData(virConnectPtr conn ATTRIBUTE_UNUSED,
portstr);

if (HAS_ENTRY_ITEM(&portData->dataDstPortEnd)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
portstr, sizeof(portstr),
&portData->dataDstPortEnd))
goto err_exit;
@@ -1121,8 +1098,7 @@ _iptablesCreateRuleInstance(virConnectPtr conn,
goto err_exit;

if (HAS_ENTRY_ITEM(&rule->p.tcpHdrFilter.dataTCPOption)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.tcpHdrFilter.dataTCPOption))
goto err_exit;
@@ -1305,8 +1281,7 @@ _iptablesCreateRuleInstance(virConnectPtr conn,
else
parm = "--icmpv6-type";

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.icmpHdrFilter.dataICMPType))
goto err_exit;
@@ -1318,8 +1293,7 @@ _iptablesCreateRuleInstance(virConnectPtr conn,
number);

if (HAS_ENTRY_ITEM(&rule->p.icmpHdrFilter.dataICMPCode)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.icmpHdrFilter.dataICMPCode))
goto err_exit;
@@ -1543,15 +1517,13 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
EBTABLES_DEFAULT_TABLE, chain);


- if (ebtablesHandleEthHdr(conn,
- &buf,
+ if (ebtablesHandleEthHdr(&buf,
vars,
&rule->p.ethHdrFilter.ethHdr))
goto err_exit;

if (HAS_ENTRY_ITEM(&rule->p.ethHdrFilter.dataProtocolID)) {
- if (printDataTypeAsHex(conn,
- vars,
+ if (printDataTypeAsHex(vars,
number, sizeof(number),
&rule->p.ethHdrFilter.dataProtocolID))
goto err_exit;
@@ -1568,8 +1540,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
CMD_DEF_PRE EBTABLES_CMD " -t %s -%%c %s %%s",
EBTABLES_DEFAULT_TABLE, chain);

- if (ebtablesHandleEthHdr(conn,
- &buf,
+ if (ebtablesHandleEthHdr(&buf,
vars,
&rule->p.arpHdrFilter.ethHdr))
goto err_exit;
@@ -1577,10 +1548,9 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
virBufferAddLit(&buf, " -p arp");

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataHWType)) {
- if (printDataType(conn,
- vars,
- number, sizeof(number),
- &rule->p.arpHdrFilter.dataHWType))
+ if (printDataType(vars,
+ number, sizeof(number),
+ &rule->p.arpHdrFilter.dataHWType))
goto err_exit;
virBufferVSprintf(&buf,
" --arp-htype %s %s",
@@ -1589,8 +1559,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataOpcode)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.arpHdrFilter.dataOpcode))
goto err_exit;
@@ -1601,8 +1570,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataProtocolType)) {
- if (printDataTypeAsHex(conn,
- vars,
+ if (printDataTypeAsHex(vars,
number, sizeof(number),
&rule->p.arpHdrFilter.dataProtocolType))
goto err_exit;
@@ -1613,8 +1581,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataARPSrcIPAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&rule->p.arpHdrFilter.dataARPSrcIPAddr))
goto err_exit;
@@ -1626,8 +1593,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataARPDstIPAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&rule->p.arpHdrFilter.dataARPDstIPAddr))
goto err_exit;
@@ -1639,8 +1605,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataARPSrcMACAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
&rule->p.arpHdrFilter.dataARPSrcMACAddr))
goto err_exit;
@@ -1652,8 +1617,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.arpHdrFilter.dataARPDstMACAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
macaddr, sizeof(macaddr),
&rule->p.arpHdrFilter.dataARPDstMACAddr))
goto err_exit;
@@ -1670,8 +1634,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
CMD_DEF_PRE EBTABLES_CMD " -t %s -%%c %s %%s",
EBTABLES_DEFAULT_TABLE, chain);

- if (ebtablesHandleEthHdr(conn,
- &buf,
+ if (ebtablesHandleEthHdr(&buf,
vars,
&rule->p.ipHdrFilter.ethHdr))
goto err_exit;
@@ -1680,8 +1643,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
" -p ipv4");

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataSrcIPAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&rule->p.ipHdrFilter.ipHdr.dataSrcIPAddr))
goto err_exit;
@@ -1692,8 +1654,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
ipaddr);

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataSrcIPMask)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.ipHdr.dataSrcIPMask))
goto err_exit;
@@ -1705,8 +1666,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataDstIPAddr)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipaddr, sizeof(ipaddr),
&rule->p.ipHdrFilter.ipHdr.dataDstIPAddr))
goto err_exit;
@@ -1717,8 +1677,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
ipaddr);

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataDstIPMask)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.ipHdr.dataDstIPMask))
goto err_exit;
@@ -1729,8 +1688,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataProtocolID)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.ipHdr.dataProtocolID))
goto err_exit;
@@ -1743,8 +1701,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.portData.dataSrcPortStart)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.portData.dataSrcPortStart))
goto err_exit;
@@ -1755,8 +1712,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
number);

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.portData.dataSrcPortEnd)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.portData.dataSrcPortEnd))
goto err_exit;
@@ -1769,8 +1725,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.portData.dataDstPortStart)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.portData.dataDstPortStart))
goto err_exit;
@@ -1781,10 +1736,9 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
number);

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.portData.dataDstPortEnd)) {
- if (printDataType(conn,
- vars,
- number, sizeof(number),
- &rule->p.ipHdrFilter.portData.dataDstPortEnd))
+ if (printDataType(vars,
+ number, sizeof(number),
+ &rule->p.ipHdrFilter.portData.dataDstPortEnd))
goto err_exit;

virBufferVSprintf(&buf,
@@ -1794,8 +1748,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataDSCP)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipHdrFilter.ipHdr.dataDSCP))
goto err_exit;
@@ -1812,8 +1765,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
CMD_DEF_PRE EBTABLES_CMD " -t %s -%%c %s %%s",
EBTABLES_DEFAULT_TABLE, chain);

- if (ebtablesHandleEthHdr(conn,
- &buf,
+ if (ebtablesHandleEthHdr(&buf,
vars,
&rule->p.ipv6HdrFilter.ethHdr))
goto err_exit;
@@ -1822,8 +1774,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
" -p ipv6");

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.ipHdr.dataSrcIPAddr)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipv6addr, sizeof(ipv6addr),
&rule->p.ipv6HdrFilter.ipHdr.dataSrcIPAddr))
goto err_exit;
@@ -1834,8 +1785,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
ipv6addr);

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.ipHdr.dataSrcIPMask)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipv6HdrFilter.ipHdr.dataSrcIPMask))
goto err_exit;
@@ -1847,8 +1797,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.ipHdr.dataDstIPAddr)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
ipv6addr, sizeof(ipv6addr),
&rule->p.ipv6HdrFilter.ipHdr.dataDstIPAddr))
goto err_exit;
@@ -1859,8 +1808,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
ipv6addr);

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.ipHdr.dataDstIPMask)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipv6HdrFilter.ipHdr.dataDstIPMask))
goto err_exit;
@@ -1871,8 +1819,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
}

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.ipHdr.dataProtocolID)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipv6HdrFilter.ipHdr.dataProtocolID))
goto err_exit;
@@ -1885,8 +1832,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.portData.dataSrcPortStart)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipv6HdrFilter.portData.dataSrcPortStart))
goto err_exit;
@@ -1897,8 +1843,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
number);

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.portData.dataSrcPortEnd)) {
- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipv6HdrFilter.portData.dataSrcPortEnd))
goto err_exit;
@@ -1911,8 +1856,7 @@ ebtablesCreateRuleInstance(virConnectPtr conn,

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.portData.dataDstPortStart)) {

- if (printDataType(conn,
- vars,
+ if (printDataType(vars,
number, sizeof(number),
&rule->p.ipv6HdrFilter.portData.dataDstPortStart))
goto err_exit;
@@ -1923,10 +1867,9 @@ ebtablesCreateRuleInstance(virConnectPtr conn,
number);

if (HAS_ENTRY_ITEM(&rule->p.ipv6HdrFilter.portData.dataDstPortEnd)) {
- if (printDataType(conn,
- vars,
- number, sizeof(number),
- &rule->p.ipv6HdrFilter.portData.dataDstPortEnd))
+ if (printDataType(vars,
+ number, sizeof(number),
+ &rule->p.ipv6HdrFilter.portData.dataDstPortEnd))
goto err_exit;

virBufferVSprintf(&buf,
@@ -2041,7 +1984,7 @@ ebiptablesCreateRuleInstance(virConnectPtr conn,
case VIR_NWFILTER_RULE_PROTOCOL_IGMP:
case VIR_NWFILTER_RULE_PROTOCOL_ALL:
if (nettype == VIR_DOMAIN_NET_TYPE_DIRECT) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
_("'%s' protocol not support for net type '%s'"),
virNWFilterRuleProtocolTypeToString(rule->prtclType),
virDomainNetTypeToString(nettype));
@@ -2066,7 +2009,7 @@ ebiptablesCreateRuleInstance(virConnectPtr conn,
case VIR_NWFILTER_RULE_PROTOCOL_ICMPV6:
case VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6:
if (nettype == VIR_DOMAIN_NET_TYPE_DIRECT) {
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
_("'%s' protocol not support for net type '%s'"),
virNWFilterRuleProtocolTypeToString(rule->prtclType),
virDomainNetTypeToString(nettype));
@@ -2083,8 +2026,8 @@ ebiptablesCreateRuleInstance(virConnectPtr conn,
break;

case VIR_NWFILTER_RULE_PROTOCOL_LAST:
- virNWFilterReportError(conn, VIR_ERR_INVALID_NWFILTER,
- "%s", _("illegal protocol type"));
+ virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ _("illegal protocol type"));
rc = 1;
break;
}
@@ -2128,8 +2071,7 @@ ebiptablesDisplayRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
* set so that the file can be run as an executable script.
*/
static char *
-ebiptablesWriteToTempFile(virConnectPtr conn,
- const char *string) {
+ebiptablesWriteToTempFile(const char *string) {
char filename[] = "/tmp/virtdXXXXXX";
int len;
char *filnam;
@@ -2139,15 +2081,13 @@ ebiptablesWriteToTempFile(virConnectPtr conn,
int fd = mkstemp(filename);

if (fd < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot create temporary file"));
return NULL;
}

if (fchmod(fd, S_IXUSR| S_IRUSR | S_IWUSR) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot change permissions on temp. file"));
goto err_exit;
}
@@ -2155,8 +2095,7 @@ ebiptablesWriteToTempFile(virConnectPtr conn,
len = strlen(header);
written = safewrite(fd, header, len);
if (written != len) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot write string to file"));
goto err_exit;
}
@@ -2164,8 +2103,7 @@ ebiptablesWriteToTempFile(virConnectPtr conn,
len = strlen(string);
written = safewrite(fd, string, len);
if (written != len) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot write string to file"));
goto err_exit;
}
@@ -2202,8 +2140,7 @@ err_exit:
* script and return the status of the execution.
*/
static int
-ebiptablesExecCLI(virConnectPtr conn,
- virBufferPtr buf,
+ebiptablesExecCLI(virBufferPtr buf,
int *status)
{
char *cmds;
@@ -2226,7 +2163,7 @@ ebiptablesExecCLI(virConnectPtr conn,
if (!cmds)
return 0;

- filename = ebiptablesWriteToTempFile(conn, cmds);
+ filename = ebiptablesWriteToTempFile(cmds);
VIR_FREE(cmds);

if (!filename)
@@ -2635,7 +2572,7 @@ ebiptablesApplyNewRules(virConnectPtr conn,
ebtablesRemoveTmpSubChains(conn, &buf, ifname);
ebtablesRemoveTmpRootChain(conn, &buf, 1, ifname);
ebtablesRemoveTmpRootChain(conn, &buf, 0, ifname);
- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

if (chains_in != 0)
ebtablesCreateTmpRootChain(conn, &buf, 1, ifname, 1);
@@ -2658,7 +2595,7 @@ ebiptablesApplyNewRules(virConnectPtr conn,
if (chains_out & (1 << VIR_NWFILTER_CHAINSUFFIX_ARP))
ebtablesCreateTmpSubChain(conn, &buf, 0, ifname, "arp", 1);

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpebchains;

for (i = 0; i < nruleInstances; i++)
@@ -2676,7 +2613,7 @@ ebiptablesApplyNewRules(virConnectPtr conn,
break;
}

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpebchains;

// FIXME: establishment of iptables user define table tree goes here
@@ -2687,17 +2624,17 @@ ebiptablesApplyNewRules(virConnectPtr conn,

iptablesCreateBaseChains(conn, IPTABLES_CMD, &buf);

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpebchains;

iptablesCreateTmpRootChains(conn, IPTABLES_CMD, &buf, ifname);

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpiptchains;

iptablesLinkTmpRootChains(conn, IPTABLES_CMD, &buf, ifname);
iptablesSetupVirtInPost(conn, IPTABLES_CMD, &buf, ifname);
- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpiptchains;

for (i = 0; i < nruleInstances; i++) {
@@ -2707,7 +2644,7 @@ ebiptablesApplyNewRules(virConnectPtr conn,
'A', -1, 1);
}

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpiptchains;
}

@@ -2717,17 +2654,17 @@ ebiptablesApplyNewRules(virConnectPtr conn,

iptablesCreateBaseChains(conn, IP6TABLES_CMD, &buf);

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpiptchains;

iptablesCreateTmpRootChains(conn, IP6TABLES_CMD, &buf, ifname);

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpip6tchains;

iptablesLinkTmpRootChains(conn, IP6TABLES_CMD, &buf, ifname);
iptablesSetupVirtInPost(conn, IP6TABLES_CMD, &buf, ifname);
- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpip6tchains;

for (i = 0; i < nruleInstances; i++) {
@@ -2737,7 +2674,7 @@ ebiptablesApplyNewRules(virConnectPtr conn,
'A', -1, 1);
}

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_tmpip6tchains;
}

@@ -2749,7 +2686,7 @@ ebiptablesApplyNewRules(virConnectPtr conn,
if (chains_out != 0)
ebtablesLinkTmpRootChain(conn, &buf, 0, ifname, 1);

- if (ebiptablesExecCLI(conn, &buf, &cli_status) || cli_status != 0)
+ if (ebiptablesExecCLI(&buf, &cli_status) || cli_status != 0)
goto tear_down_ebsubchains_and_unlink;

return 0;
@@ -2775,10 +2712,9 @@ tear_down_tmpebchains:
ebtablesRemoveTmpRootChain(conn, &buf, 1, ifname);
ebtablesRemoveTmpRootChain(conn, &buf, 0, ifname);

- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

- virNWFilterReportError(conn, VIR_ERR_BUILD_FIREWALL,
- "%s",
+ virNWFilterReportError(VIR_ERR_BUILD_FIREWALL, "%s",
_("Some rules could not be created."));

return 1;
@@ -2805,7 +2741,7 @@ ebiptablesTearNewRules(virConnectPtr conn,
ebtablesRemoveTmpRootChain(conn, &buf, 1, ifname);
ebtablesRemoveTmpRootChain(conn, &buf, 0, ifname);

- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

return 0;
}
@@ -2823,13 +2759,13 @@ ebiptablesTearOldRules(virConnectPtr conn,
iptablesRemoveRootChains(conn, IPTABLES_CMD, &buf, ifname);

iptablesRenameTmpRootChains(conn, IPTABLES_CMD, &buf, ifname);
- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

iptablesUnlinkRootChains(conn, IP6TABLES_CMD, &buf, ifname);
iptablesRemoveRootChains(conn, IP6TABLES_CMD, &buf, ifname);

iptablesRenameTmpRootChains(conn, IP6TABLES_CMD, &buf, ifname);
- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

ebtablesUnlinkRootChain(conn, &buf, 1, ifname);
ebtablesUnlinkRootChain(conn, &buf, 0, ifname);
@@ -2843,7 +2779,7 @@ ebiptablesTearOldRules(virConnectPtr conn,
ebtablesRenameTmpRootChain(conn, &buf, 1, ifname);
ebtablesRenameTmpRootChain(conn, &buf, 0, ifname);

- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

return 0;
}
@@ -2879,12 +2815,11 @@ ebiptablesRemoveRules(virConnectPtr conn,
'D', -1,
0);

- if (ebiptablesExecCLI(conn, &buf, &cli_status))
+ if (ebiptablesExecCLI(&buf, &cli_status))
goto err_exit;

if (cli_status) {
- virNWFilterReportError(conn, VIR_ERR_BUILD_FIREWALL,
- "%s",
+ virNWFilterReportError(VIR_ERR_BUILD_FIREWALL, "%s",
_("error while executing CLI commands"));
rc = 1;
}
@@ -2926,7 +2861,7 @@ ebiptablesAllTeardown(const char *ifname)

ebtablesRemoveSubChains(conn, &buf, ifname);

- ebiptablesExecCLI(conn, &buf, &cli_status);
+ ebiptablesExecCLI(&buf, &cli_status);

return 0;
}
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index e1a0986..0ece679 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -118,16 +118,15 @@ virNWFilterRuleInstFree(virNWFilterRuleInstPtr inst)
* Adds a couple of standard keys (MAC, IP) to the hash table.
*/
static int
-virNWFilterVarHashmapAddStdValues(virConnectPtr conn,
- virNWFilterHashTablePtr table,
+virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
char *macaddr)
{
if (macaddr) {
if (virHashAddEntry(table->hashTable,
NWFILTER_STD_VAR_MAC,
macaddr) < 0) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not add variable 'MAC' to hashmap"));
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not add variable 'MAC' to hashmap"));
return 1;
}
}
@@ -148,15 +147,14 @@ virNWFilterVarHashmapAddStdValues(virConnectPtr conn,
* is attached to the virConnect object.
*/
virNWFilterHashTablePtr
-virNWFilterCreateVarHashmap(virConnectPtr conn,
- char *macaddr) {
+virNWFilterCreateVarHashmap(char *macaddr) {
virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
if (!table) {
virReportOOMError();
return NULL;
}

- if (virNWFilterVarHashmapAddStdValues(conn, table, macaddr)) {
+ if (virNWFilterVarHashmapAddStdValues(table, macaddr)) {
virNWFilterHashTableFree(table);
return NULL;
}
@@ -324,7 +322,7 @@ _virNWFilterInstantiateRec(virConnectPtr conn,
if (obj) {

if (obj->wantRemoved) {
- virNWFilterReportError(conn, VIR_ERR_NO_NWFILTER,
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER,
_("Filter '%s' is in use."),
inc->filterref);
rc = 1;
@@ -373,7 +371,7 @@ _virNWFilterInstantiateRec(virConnectPtr conn,
if (rc)
break;
} else {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("referenced filter '%s' is missing"),
inc->filterref);
rc = 1;
@@ -516,9 +514,9 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
techdriver = virNWFilterTechDriverForName(drvname);

if (!techdriver) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not get access to ACL tech "
- "driver '%s'"),
+ "driver '%s'"),
drvname);
return 1;
}
@@ -527,14 +525,14 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,

obj = virNWFilterPoolObjFindByName(&driver->pools, net->filter);
if (!obj) {
- virNWFilterReportError(conn, VIR_ERR_NO_NWFILTER,
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER,
_("Could not find filter '%s'"),
net->filter);
return 1;
}

if (obj->wantRemoved) {
- virNWFilterReportError(conn, VIR_ERR_NO_NWFILTER,
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER,
_("Filter '%s' is in use."),
net->filter);
rc = 1;
@@ -549,8 +547,7 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
goto err_exit;
}

- vars1 = virNWFilterCreateVarHashmap(conn,
- str_macaddr);
+ vars1 = virNWFilterCreateVarHashmap(str_macaddr);
if (!vars1) {
rc = 1;
goto err_exit;
@@ -630,9 +627,9 @@ int virNWFilterRollbackUpdateFilter(virConnectPtr conn,
virNWFilterTechDriverPtr techdriver;
techdriver = virNWFilterTechDriverForName(drvname);
if (!techdriver) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not get access to ACL tech "
- "driver '%s'"),
+ "driver '%s'"),
drvname);
return 1;
}
@@ -649,9 +646,9 @@ virNWFilterTearOldFilter(virConnectPtr conn,
virNWFilterTechDriverPtr techdriver;
techdriver = virNWFilterTechDriverForName(drvname);
if (!techdriver) {
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not get access to ACL tech "
- "driver '%s'"),
+ "driver '%s'"),
drvname);
return 1;
}
@@ -669,9 +666,9 @@ virNWFilterTeardownFilter(const virDomainNetDefPtr net)

if (!techdriver) {
#if 0
- virNWFilterReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not get access to ACL tech "
- "driver '%s'"),
+ "driver '%s'"),
drvname);
#endif
return 1;
diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
index b10480f..a68c455 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -48,8 +48,7 @@ int virNWFilterTearOldFilter(virConnectPtr conn,

int virNWFilterTeardownFilter(const virDomainNetDefPtr net);

-virNWFilterHashTablePtr virNWFilterCreateVarHashmap(virConnectPtr conn,
- char *macaddr);
+virNWFilterHashTablePtr virNWFilterCreateVarHashmap(char *macaddr);

void virNWFilterDomainFWUpdateCB(void *payload,
const char *name ATTRIBUTE_UNUSED,
diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c
index a7e6126..8a8c15a 100644
--- a/tests/nwfilterxml2xmltest.c
+++ b/tests/nwfilterxml2xmltest.c
@@ -39,7 +39,7 @@ static int testCompareXMLToXMLFiles(const char *inxml, const char *outxml) {
if (!(dev = virNWFilterDefParseString(NULL, inXmlData)))
goto fail;

- if (!(actual = virNWFilterDefFormat(NULL, dev)))
+ if (!(actual = virNWFilterDefFormat(dev)))
goto fail;

if (STRNEQ(outXmlData, actual)) {
--
1.6.3.3
Stefan Berger
2010-04-05 10:46:03 UTC
Permalink
Matthias,

I have a patch that does the same. Most of the non-search-replace work I
needed to do was in nwfilter_ebiptables_driver.c where several functions
have the virConnectPtr as parameter passing it all the way through to the
function that used to pass it to the error reporting function. If you
take out modification to that file from your patch, I could commit mine
and it would save me a lot of work again.

The summary of changes to this file in my patch look like this:

src/nwfilter/nwfilter_ebiptables_driver.c | 762
++++++++++++-----------------

Regards,
Stefan
Post by Matthias Bolte
---
src/conf/nwfilter_conf.c | 120 ++++++-------
src/conf/nwfilter_conf.h | 16 +-
src/conf/nwfilter_params.c | 2 +-
src/nwfilter/nwfilter_driver.c | 25 ++--
src/nwfilter/nwfilter_ebiptables_driver.c | 285 ++++++++++
+------------------
src/nwfilter/nwfilter_gentech_driver.c | 39 ++--
src/nwfilter/nwfilter_gentech_driver.h | 3 +-
tests/nwfilterxml2xmltest.c | 2 +-
8 files changed, 202 insertions(+), 290 deletions(-)
Matthias Bolte
2010-04-05 10:52:51 UTC
Permalink
Post by Stefan Berger
Matthias,
 I have a patch that does the same. Most of the non-search-replace work I
needed to do was in nwfilter_ebiptables_driver.c where several functions
have the virConnectPtr as parameter passing it all the way through to the
function that used to pass it to the error reporting function.  If you take
out modification to that file from your patch, I could commit mine and it
would save me a lot of work again.
 src/nwfilter/nwfilter_ebiptables_driver.c |  762
++++++++++++-----------------
  Regards,
     Stefan
---
 src/conf/nwfilter_conf.c                  |  120 ++++++-------
 src/conf/nwfilter_conf.h                  |   16 +-
 src/conf/nwfilter_params.c                |    2 +-
 src/nwfilter/nwfilter_driver.c            |   25 ++--
 src/nwfilter/nwfilter_ebiptables_driver.c |  285 ++++++++++
+------------------
 src/nwfilter/nwfilter_gentech_driver.c    |   39 ++--
 src/nwfilter/nwfilter_gentech_driver.h    |    3 +-
 tests/nwfilterxml2xmltest.c               |    2 +-
 8 files changed, 202 insertions(+), 290 deletions(-)
Sure, no problem. Go ahead with your patch, I'll rebase/change mine as
necessary.

Matthias
Daniel Veillard
2010-04-05 15:32:47 UTC
Permalink
Post by Matthias Bolte
Post by Stefan Berger
Matthias,
 I have a patch that does the same. Most of the non-search-replace work I
needed to do was in nwfilter_ebiptables_driver.c where several functions
have the virConnectPtr as parameter passing it all the way through to the
function that used to pass it to the error reporting function.  If you take
out modification to that file from your patch, I could commit mine and it
would save me a lot of work again.
 src/nwfilter/nwfilter_ebiptables_driver.c |  762
++++++++++++-----------------
  Regards,
     Stefan
---
 src/conf/nwfilter_conf.c                  |  120 ++++++-------
 src/conf/nwfilter_conf.h                  |   16 +-
 src/conf/nwfilter_params.c                |    2 +-
 src/nwfilter/nwfilter_driver.c            |   25 ++--
 src/nwfilter/nwfilter_ebiptables_driver.c |  285 ++++++++++
+------------------
 src/nwfilter/nwfilter_gentech_driver.c    |   39 ++--
 src/nwfilter/nwfilter_gentech_driver.h    |    3 +-
 tests/nwfilterxml2xmltest.c               |    2 +-
 8 files changed, 202 insertions(+), 290 deletions(-)
Sure, no problem. Go ahead with your patch, I'll rebase/change mine as
necessary.
Agreed, please push it.

Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
***@veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
Stefan Berger
2010-04-05 16:36:14 UTC
Permalink
Post by Daniel Veillard
Post by Matthias Bolte
Post by Matthias Bolte
---
src/conf/nwfilter_conf.c | 120 ++++++-------
src/conf/nwfilter_conf.h | 16 +-
src/conf/nwfilter_params.c | 2 +-
src/nwfilter/nwfilter_driver.c | 25 ++--
src/nwfilter/nwfilter_ebiptables_driver.c | 285 ++++++++++
+------------------
src/nwfilter/nwfilter_gentech_driver.c | 39 ++--
src/nwfilter/nwfilter_gentech_driver.h | 3 +-
tests/nwfilterxml2xmltest.c | 2 +-
8 files changed, 202 insertions(+), 290 deletions(-)
Sure, no problem. Go ahead with your patch, I'll rebase/change mine as
necessary.
Agreed, please push it.
Done.

Stefan
Post by Daniel Veillard
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
Post by Daniel Veillard
http://veillard.com/ | virtualization library http://libvirt.org/
Matthias Bolte
2010-04-06 00:14:50 UTC
Permalink
Post by Stefan Berger
Post by Matthias Bolte
---
 src/conf/nwfilter_conf.c                  |  120 ++++++-------
 src/conf/nwfilter_conf.h                  |   16 +-
 src/conf/nwfilter_params.c                |    2 +-
 src/nwfilter/nwfilter_driver.c            |   25 ++--
 src/nwfilter/nwfilter_ebiptables_driver.c |  285 ++++++++++
+------------------
 src/nwfilter/nwfilter_gentech_driver.c    |   39 ++--
 src/nwfilter/nwfilter_gentech_driver.h    |    3 +-
 tests/nwfilterxml2xmltest.c               |    2 +-
 8 files changed, 202 insertions(+), 290 deletions(-)
Sure, no problem. Go ahead with your patch, I'll rebase/change mine as
necessary.
  Agreed, please push it.
Done.
   Stefan
Your patch completely includes mine (I noticed this while rebasing),
so my patch is not necessary anymore.

Matthias
Matthias Bolte
2010-04-04 17:36:44 UTC
Permalink
---
src/esx/esx_device_monitor.c | 4 ++--
src/esx/esx_interface_driver.c | 4 ++--
src/esx/esx_network_driver.c | 4 ++--
src/esx/esx_secret_driver.c | 4 ++--
src/esx/esx_storage_driver.c | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 1962a11..31724f7 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -38,8 +38,8 @@

#define VIR_FROM_THIS VIR_FROM_ESX

-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index fef324d..b2fddbe 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -38,8 +38,8 @@

#define VIR_FROM_THIS VIR_FROM_ESX

-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 49492d1..e65b7eb 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -38,8 +38,8 @@

#define VIR_FROM_THIS VIR_FROM_ESX

-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index f8e030f..a29b546 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -37,8 +37,8 @@

#define VIR_FROM_THIS VIR_FROM_ESX

-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index accd001..80ba645 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -38,8 +38,8 @@

#define VIR_FROM_THIS VIR_FROM_ESX

-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)
--
1.6.3.3
Eric Blake
2010-04-05 17:05:57 UTC
Permalink
Post by Matthias Bolte
---
src/esx/esx_device_monitor.c | 4 ++--
src/esx/esx_interface_driver.c | 4 ++--
src/esx/esx_network_driver.c | 4 ++--
src/esx/esx_secret_driver.c | 4 ++--
src/esx/esx_storage_driver.c | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 1962a11..31724f7 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -38,8 +38,8 @@
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index fef324d..b2fddbe 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -38,8 +38,8 @@
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)
Odd - why define ESX_ERROR in these five files if no callers had to
change? Is this something that should be factored into a .h?

At any rate, ACK that it brings things in line with
src/esx/esx_driver.c; factoring into a common .h could be separate.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 17:30:42 UTC
Permalink
Post by Eric Blake
---
 src/esx/esx_device_monitor.c   |    4 ++--
 src/esx/esx_interface_driver.c |    4 ++--
 src/esx/esx_network_driver.c   |    4 ++--
 src/esx/esx_secret_driver.c    |    4 ++--
 src/esx/esx_storage_driver.c   |    4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 1962a11..31724f7 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -38,8 +38,8 @@
 #define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...)                                            \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+#define ESX_ERROR(code, ...)                                                  \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
                          __LINE__, __VA_ARGS__)
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index fef324d..b2fddbe 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -38,8 +38,8 @@
 #define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...)                                            \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+#define ESX_ERROR(code, ...)                                                  \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
                          __LINE__, __VA_ARGS__)
Odd - why define ESX_ERROR in these five files if no callers had to
change?  Is this something that should be factored into a .h?
At any rate, ACK that it brings things in line with
src/esx/esx_driver.c; factoring into a common .h could be separate.
I merged this patch into patch 02/30 by moving the definition of
ESX_ERROR into esx_private.h.

Matthias
Matthias Bolte
2010-04-04 17:36:43 UTC
Permalink
---
src/conf/domain_event.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 41c70fc..fac5e49 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -31,8 +31,8 @@

#define VIR_FROM_THIS VIR_FROM_NONE

-#define eventReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+#define eventReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

struct _virDomainMeta {
@@ -148,7 +148,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn,
}
}

- eventReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not find event callback for removal"));
return -1;
}
@@ -193,7 +193,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn,
}
}

- eventReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not find event callback for removal"));
return -1;
}
@@ -252,7 +252,7 @@ int virDomainEventCallbackListMarkDelete(virConnectPtr conn,
}
}

- eventReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not find event callback for deletion"));
return -1;
}
@@ -271,7 +271,7 @@ int virDomainEventCallbackListMarkDeleteID(virConnectPtr conn,
}
}

- eventReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not find event callback for deletion"));
return -1;
}
@@ -361,7 +361,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
cbList->callbacks[i]->conn == conn) {
- eventReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("event callback already tracked"));
return -1;
}
@@ -758,7 +758,7 @@ virDomainEventQueuePop(virDomainEventQueuePtr evtQueue)
virDomainEventPtr ret;

if (!evtQueue || evtQueue->count == 0 ) {
- eventReportError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("event queue is empty, nothing to pop"));
return NULL;
}
--
1.6.3.3
Eric Blake
2010-04-05 17:00:08 UTC
Permalink
Post by Matthias Bolte
---
src/conf/domain_event.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 41c70fc..fac5e49 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -31,8 +31,8 @@
#define VIR_FROM_THIS VIR_FROM_NONE
-#define eventReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
+#define eventReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of this patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:21:23 UTC
Permalink
Post by Eric Blake
---
 src/conf/domain_event.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 41c70fc..fac5e49 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -31,8 +31,8 @@
 #define VIR_FROM_THIS VIR_FROM_NONE
-#define eventReportError(conn, code, ...)                           \
-    virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__,       \
+#define eventReportError(code, ...)                                 \
+    virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__,       \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of this patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:45 UTC
Permalink
---
src/uml/uml_conf.c | 38 ++++++-------
src/uml/uml_conf.h | 4 +-
src/uml/uml_driver.c | 149 ++++++++++++++++++++++++--------------------------
3 files changed, 92 insertions(+), 99 deletions(-)

diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 17f4e2e..8e075ff 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -97,8 +97,7 @@ virCapsPtr umlCapsInit(void) {


static int
-umlConnectTapDevice(virConnectPtr conn,
- virDomainNetDefPtr net,
+umlConnectTapDevice(virDomainNetDefPtr net,
const char *bridge)
{
brControl *brctl = NULL;
@@ -126,7 +125,7 @@ umlConnectTapDevice(virConnectPtr conn,
&net->ifname, BR_TAP_PERSIST, &tapfd))) {
if (errno == ENOTSUP) {
/* In this particular case, give a better diagnostic. */
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to add tap interface to bridge. "
"%s is not a bridge device"), bridge);
} else if (template_ifname) {
@@ -176,24 +175,24 @@ umlBuildCommandLineNet(virConnectPtr conn,
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit(&buf, "tuntap");
if (def->data.ethernet.ipaddr) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet inteface"));
goto error;
}
if (def->data.ethernet.script) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("script execution not supported for ethernet inteface"));
goto error;
}
break;

case VIR_DOMAIN_NET_TYPE_SERVER:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP server networking type not supported"));
goto error;

case VIR_DOMAIN_NET_TYPE_CLIENT:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP client networking type not supported"));
goto error;

@@ -208,7 +207,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
virNetworkPtr network = virNetworkLookupByName(conn,
def->data.network.name);
if (!network) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Network '%s' not found"),
def->data.network.name);
goto error;
@@ -219,7 +218,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
goto error;
}

- if (umlConnectTapDevice(conn, def, bridge) < 0) {
+ if (umlConnectTapDevice(def, bridge) < 0) {
VIR_FREE(bridge);
goto error;
}
@@ -230,7 +229,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
}

case VIR_DOMAIN_NET_TYPE_BRIDGE:
- if (umlConnectTapDevice(conn, def, def->data.bridge.brname) < 0)
+ if (umlConnectTapDevice(def, def->data.bridge.brname) < 0)
goto error;

/* ethNNN=tuntap,tapname,macaddr,gateway */
@@ -238,12 +237,12 @@ umlBuildCommandLineNet(virConnectPtr conn,
break;

case VIR_DOMAIN_NET_TYPE_INTERNAL:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal networking type not supported"));
goto error;

case VIR_DOMAIN_NET_TYPE_DIRECT:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("direct networking type not supported"));
goto error;

@@ -274,8 +273,7 @@ error:
}

static char *
-umlBuildCommandLineChr(virConnectPtr conn,
- virDomainChrDefPtr def,
+umlBuildCommandLineChr(virDomainChrDefPtr def,
const char *dev)
{
char *ret = NULL;
@@ -312,8 +310,8 @@ umlBuildCommandLineChr(virConnectPtr conn,

case VIR_DOMAIN_CHR_TYPE_TCP:
if (def->data.tcp.listen != 1) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("only TCP listen is supported for chr device"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only TCP listen is supported for chr device"));
return NULL;
}

@@ -332,7 +330,7 @@ umlBuildCommandLineChr(virConnectPtr conn,
case VIR_DOMAIN_CHR_TYPE_UDP:
case VIR_DOMAIN_CHR_TYPE_UNIX:
default:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported chr device type %d"), def->type);
break;
}
@@ -476,7 +474,7 @@ int umlBuildCommandLine(virConnectPtr conn,
virDomainDiskDefPtr disk = vm->def->disks[i];

if (!STRPREFIX(disk->dst, "ubd")) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type '%s'"), disk->dst);
goto error;
}
@@ -494,7 +492,7 @@ int umlBuildCommandLine(virConnectPtr conn,
for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
char *ret;
if (i == 0 && vm->def->console)
- ret = umlBuildCommandLineChr(conn, vm->def->console, "con");
+ ret = umlBuildCommandLineChr(vm->def->console, "con");
else
if (virAsprintf(&ret, "con%d=none", i) < 0)
goto no_memory;
@@ -508,7 +506,7 @@ int umlBuildCommandLine(virConnectPtr conn,
if (vm->def->serials[j]->target.port == i)
chr = vm->def->serials[j];
if (chr)
- ret = umlBuildCommandLineChr(conn, chr, "ssl");
+ ret = umlBuildCommandLineChr(chr, "ssl");
else
if (virAsprintf(&ret, "ssl%d=none", i) < 0)
goto no_memory;
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
index 4d434e1..b33acc8 100644
--- a/src/uml/uml_conf.h
+++ b/src/uml/uml_conf.h
@@ -62,8 +62,8 @@ struct uml_driver {
};


-# define umlReportError(conn, dom, net, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_UML, code, __FILE__, \
+# define umlReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_UML, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

virCapsPtr umlCapsInit (void);
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 58ffe68..822d398 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -106,8 +106,7 @@ static void umlDriverUnlock(struct uml_driver *driver)
}


-static int umlOpenMonitor(virConnectPtr conn,
- struct uml_driver *driver,
+static int umlOpenMonitor(struct uml_driver *driver,
virDomainObjPtr vm);
static int umlReadPidFile(struct uml_driver *driver,
virDomainObjPtr vm);
@@ -134,11 +133,10 @@ static void umlShutdownVMDaemon(virConnectPtr conn,
virDomainObjPtr vm);


-static int umlMonitorCommand (virConnectPtr conn,
- const struct uml_driver *driver,
- const virDomainObjPtr vm,
- const char *cmd,
- char **reply);
+static int umlMonitorCommand(const struct uml_driver *driver,
+ const virDomainObjPtr vm,
+ const char *cmd,
+ char **reply);

static struct uml_driver *uml_driver = NULL;

@@ -201,7 +199,7 @@ umlIdentifyOneChrPTY(struct uml_driver *driver,
return -1;
}
requery:
- if (umlMonitorCommand(NULL, driver, dom, cmd, &res) < 0)
+ if (umlMonitorCommand(driver, dom, cmd, &res) < 0)
return -1;

if (res && STRPREFIX(res, "pts:")) {
@@ -320,7 +318,7 @@ reread:
dom->def->id = driver->nextvmid++;
dom->state = VIR_DOMAIN_RUNNING;

- if (umlOpenMonitor(NULL, driver, dom) < 0) {
+ if (umlOpenMonitor(driver, dom) < 0) {
VIR_WARN0("Could not open monitor for new domain");
umlShutdownVMDaemon(NULL, driver, dom);
} else if (umlIdentifyChrPTY(driver, dom) < 0) {
@@ -601,8 +599,7 @@ reopen:
return rc;
}

-static int umlMonitorAddress(virConnectPtr conn,
- const struct uml_driver *driver,
+static int umlMonitorAddress(const struct uml_driver *driver,
virDomainObjPtr vm,
struct sockaddr_un *addr) {
char *sockname;
@@ -617,7 +614,7 @@ static int umlMonitorAddress(virConnectPtr conn,
memset(addr, 0, sizeof *addr);
addr->sun_family = AF_UNIX;
if (virStrcpyStatic(addr->sun_path, sockname) == NULL) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Unix path %s too long for destination"), sockname);
retval = -1;
}
@@ -625,15 +622,14 @@ static int umlMonitorAddress(virConnectPtr conn,
return retval;
}

-static int umlOpenMonitor(virConnectPtr conn,
- struct uml_driver *driver,
+static int umlOpenMonitor(struct uml_driver *driver,
virDomainObjPtr vm) {
struct sockaddr_un addr;
struct stat sb;
int retries = 0;
umlDomainObjPrivatePtr priv = vm->privateData;

- if (umlMonitorAddress(conn, driver, vm, &addr) < 0)
+ if (umlMonitorAddress(driver, vm, &addr) < 0)
return -1;

VIR_DEBUG("Dest address for monitor is '%s'", addr.sun_path);
@@ -687,8 +683,7 @@ struct monitor_response {
};


-static int umlMonitorCommand(virConnectPtr conn,
- const struct uml_driver *driver,
+static int umlMonitorCommand(const struct uml_driver *driver,
const virDomainObjPtr vm,
const char *cmd,
char **reply)
@@ -705,7 +700,7 @@ static int umlMonitorCommand(virConnectPtr conn,

*reply = NULL;

- if (umlMonitorAddress(conn, driver, vm, &addr) < 0)
+ if (umlMonitorAddress(driver, vm, &addr) < 0)
return -1;

memset(&req, 0, sizeof(req));
@@ -719,7 +714,7 @@ static int umlMonitorCommand(virConnectPtr conn,
return -1;
}
if (virStrcpyStatic(req.data, cmd) == NULL) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Command %s too long for destination"), cmd);
return -1;
}
@@ -826,14 +821,14 @@ static int umlStartVMDaemon(virConnectPtr conn,
FD_ZERO(&keepfd);

if (virDomainObjIsActive(vm)) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("VM is already active"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VM is already active"));
return -1;
}

if (!vm->def->os.kernel) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("no kernel specified"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("no kernel specified"));
return -1;
}
/* Make sure the binary we are about to try exec'ing exists.
@@ -999,14 +994,14 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
if (uml_driver->privileged) {
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected UML URI path '%s', try uml:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else {
if (STRNEQ (conn->uri->path, "/session")) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected UML URI path '%s', try uml:///session"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
@@ -1015,7 +1010,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,

/* URI was good, but driver isn't active */
if (uml_driver == NULL) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("uml state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
@@ -1115,7 +1110,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
umlDriverUnlock(driver);

if (!vm) {
- umlReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -1139,7 +1134,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
umlDriverUnlock(driver);

if (!vm) {
- umlReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -1163,7 +1158,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
umlDriverUnlock(driver);

if (!vm) {
- umlReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -1187,7 +1182,7 @@ static int umlDomainIsActive(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
- umlReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
@@ -1209,7 +1204,7 @@ static int umlDomainIsPersistent(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
- umlReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
@@ -1232,7 +1227,7 @@ static int umlGetVersion(virConnectPtr conn, unsigned long *version) {
uname(&ut);

if (virParseVersionString(ut.release, &driver->umlVersion) < 0) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse version %s"), ut.release);
goto cleanup;
}
@@ -1316,15 +1311,15 @@ static int umlDomainShutdown(virDomainPtr dom) {
vm = virDomainFindByID(&driver->domains, dom->id);
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}

#if 0
if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("shutdown operation failed"));
+ umlReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("shutdown operation failed"));
goto cleanup;
}
ret = 0;
@@ -1346,8 +1341,8 @@ static int umlDomainDestroy(virDomainPtr dom) {
umlDriverLock(driver);
vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}

@@ -1376,8 +1371,8 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -1404,7 +1399,7 @@ static unsigned long umlDomainGetMaxMemory(virDomainPtr dom) {
char uuidstr[VIR_UUID_STRING_BUFLEN];

virUUIDFormat(dom->uuid, uuidstr);
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
@@ -1429,14 +1424,14 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
char uuidstr[VIR_UUID_STRING_BUFLEN];

virUUIDFormat(dom->uuid, uuidstr);
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}

if (newmax < vm->def->memory) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("cannot set max memory lower than current memory"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("cannot set max memory lower than current memory"));
goto cleanup;
}

@@ -1462,20 +1457,20 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
char uuidstr[VIR_UUID_STRING_BUFLEN];

virUUIDFormat(dom->uuid, uuidstr);
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}

if (virDomainObjIsActive(vm)) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cannot set memory of an active domain"));
+ umlReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot set memory of an active domain"));
goto cleanup;
}

if (newmem > vm->def->maxmem) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("cannot set memory higher than max memory"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("cannot set memory higher than max memory"));
goto cleanup;
}

@@ -1499,8 +1494,8 @@ static int umlDomainGetInfo(virDomainPtr dom,
umlDriverUnlock(driver);

if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -1510,8 +1505,8 @@ static int umlDomainGetInfo(virDomainPtr dom,
info->cpuTime = 0;
} else {
if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot read cputime for domain"));
+ umlReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot read cputime for domain"));
goto cleanup;
}
}
@@ -1539,8 +1534,8 @@ static char *umlDomainDumpXML(virDomainPtr dom,
umlDriverUnlock(driver);

if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -1588,8 +1583,8 @@ static int umlDomainStart(virDomainPtr dom) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid);

if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -1651,20 +1646,20 @@ static int umlDomainUndefine(virDomainPtr dom) {
umlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

if (virDomainObjIsActive(vm)) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot delete active domain"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot delete active domain"));
goto cleanup;
}

if (!vm->persistent) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot undefine transient domain"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot undefine transient domain"));
goto cleanup;
}

@@ -1695,8 +1690,8 @@ static int umlDomainGetAutostart(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);

if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -1721,14 +1716,14 @@ static int umlDomainSetAutostart(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid);

if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

if (!vm->persistent) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot set autostart for transient domain"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot set autostart for transient domain"));
goto cleanup;
}

@@ -1795,14 +1790,14 @@ umlDomainBlockPeek (virDomainPtr dom,
umlDriverUnlock(driver);

if (!vm) {
- umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

if (!path || path[0] == '\0') {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("NULL or empty path"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("NULL or empty path"));
goto cleanup;
}

@@ -1838,8 +1833,8 @@ umlDomainBlockPeek (virDomainPtr dom,

ret = 0;
} else {
- umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("invalid path"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("invalid path"));
}

cleanup:
--
1.6.3.3
Eric Blake
2010-04-05 17:09:27 UTC
Permalink
Post by Matthias Bolte
---
src/uml/uml_conf.c | 38 ++++++-------
src/uml/uml_conf.h | 4 +-
src/uml/uml_driver.c | 149 ++++++++++++++++++++++++--------------------------
3 files changed, 92 insertions(+), 99 deletions(-)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.h
@@ -62,8 +62,8 @@ struct uml_driver {
};
-# define umlReportError(conn, dom, net, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_UML, code, __FILE__, \
+# define umlReportError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_UML, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:21:40 UTC
Permalink
Post by Eric Blake
---
 src/uml/uml_conf.c   |   38 ++++++-------
 src/uml/uml_conf.h   |    4 +-
 src/uml/uml_driver.c |  149 ++++++++++++++++++++++++--------------------------
 3 files changed, 92 insertions(+), 99 deletions(-)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.h
@@ -62,8 +62,8 @@ struct uml_driver {
 };
-# define umlReportError(conn, dom, net, code, ...)                       \
-    virReportErrorHelper(conn, VIR_FROM_UML, code, __FILE__,            \
+# define umlReportError(code, ...)                                      \
+    virReportErrorHelper(NULL, VIR_FROM_UML, code, __FILE__,            \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:46 UTC
Permalink
---
src/opennebula/one_conf.c | 7 ++--
src/opennebula/one_conf.h | 6 ++--
src/opennebula/one_driver.c | 66 +++++++++++++++++++++---------------------
3 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/src/opennebula/one_conf.c b/src/opennebula/one_conf.c
index a2f7073..029d475 100644
--- a/src/opennebula/one_conf.c
+++ b/src/opennebula/one_conf.c
@@ -135,8 +135,7 @@ no_memory:
* @return the OpenNebula ID for the new VM or -1 in case of error
*/

-int oneSubmitVM(virConnectPtr conn,
- one_driver_t* driver ATTRIBUTE_UNUSED,
+int oneSubmitVM(one_driver_t* driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm)
{
char* templ;
@@ -146,8 +145,8 @@ int oneSubmitVM(virConnectPtr conn,
return -1;

if ((oneid = c_oneAllocateTemplate(templ)) < 0) {
- oneError(conn, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("Error submitting virtual machine to OpenNebula"));
+ oneError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Error submitting virtual machine to OpenNebula"));
VIR_FREE(templ);
return -1;
}
diff --git a/src/opennebula/one_conf.h b/src/opennebula/one_conf.h
index 0d45bff..c53090c 100644
--- a/src/opennebula/one_conf.h
+++ b/src/opennebula/one_conf.h
@@ -43,12 +43,12 @@ typedef struct one_driver one_driver_t;

virCapsPtr oneCapsInit(void);

-int oneSubmitVM(virConnectPtr conn ,one_driver_t* driver, virDomainObjPtr vm);
+int oneSubmitVM(one_driver_t* driver, virDomainObjPtr vm);

char* xmlOneTemplate(virDomainDefPtr def);

-# define oneError(conn, dom, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ONE, code, __FILE__, \
+# define oneError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#endif /* ONE_CONF_H */
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index 91d7459..77d7d00 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -117,7 +117,7 @@ static virDomainPtr oneDomainLookupByID(virConnectPtr conn,
oneDriverUnlock(driver);

if (!vm) {
- oneError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ oneError(VIR_ERR_NO_DOMAIN, NULL);
goto return_point;
}

@@ -145,7 +145,7 @@ static virDomainPtr oneDomainLookupByUUID(virConnectPtr conn,
vm = virDomainFindByUUID(&driver->domains, uuid);
oneDriverUnlock(driver);
if (!vm) {
- oneError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ oneError(VIR_ERR_NO_DOMAIN, NULL);
goto return_point;
}

@@ -174,7 +174,7 @@ static virDomainPtr oneDomainLookupByName(virConnectPtr conn,
oneDriverUnlock(driver);

if (!vm) {
- oneError(conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ oneError(VIR_ERR_NO_DOMAIN, NULL);
goto return_point;
}

@@ -279,14 +279,14 @@ static int oneDomainUndefine(virDomainPtr dom)
oneDriverLock(driver);
vm =virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- oneError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ oneError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto return_point;
}

if (!vm->persistent) {
- oneError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot undefine transient domain"));
+ oneError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot undefine transient domain"));
goto return_point;
}
virDomainRemoveInactive(&driver->domains, vm);
@@ -310,14 +310,14 @@ static int oneDomainGetInfo(virDomainPtr dom,
oneDriverUnlock(driver);

if (!vm) {
- oneError(dom->conn,dom, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ oneError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
return -1;
}

if(gettimeofday(&tv,NULL)<0) {
- oneError(dom->conn,dom, VIR_ERR_INTERNAL_ERROR,
- "%s",_("getting time of day"));
+ oneError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("getting time of day"));
virDomainObjUnlock(vm);
return -1;
}
@@ -385,8 +385,8 @@ static char *oneGetOSType(virDomainPtr dom)
vm =virDomainFindByUUID(&driver->domains, dom->uuid);
oneDriverUnlock(driver);
if (!vm) {
- oneError(dom->conn,dom, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ oneError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -412,11 +412,11 @@ static int oneDomainStart(virDomainPtr dom)
vm = virDomainFindByName(&driver->domains, dom->name);

if (!vm) {
- oneError(conn, dom, VIR_ERR_INVALID_DOMAIN,
+ oneError(VIR_ERR_INVALID_DOMAIN,
_("no domain named %s"), dom->name);
goto return_point;
}
- if((oneid = oneSubmitVM(dom->conn,driver,vm)) < 0) {
+ if((oneid = oneSubmitVM(driver, vm)) < 0) {
goto return_point;
}
vm->pid=oneid;
@@ -449,7 +449,7 @@ oneDomainCreateAndStart(virConnectPtr conn,

vm = virDomainFindByName(&driver->domains, def->name);
if (vm) {
- oneError(conn,NULL, VIR_ERR_OPERATION_FAILED,
+ oneError(VIR_ERR_OPERATION_FAILED,
_("Already an OpenNebula VM active with the name: '%s' id: %d "),
def->name,def->id);
goto return_point;
@@ -460,7 +460,7 @@ oneDomainCreateAndStart(virConnectPtr conn,
virDomainDefFree(def);
goto return_point;
}
- if ((oneid = oneSubmitVM(conn, driver, vm)) < 0) {
+ if ((oneid = oneSubmitVM(driver, vm)) < 0) {
virDomainRemoveInactive(&driver->domains, vm);
vm=NULL;
goto return_point;
@@ -492,14 +492,14 @@ static int oneDomainShutdown(virDomainPtr dom)

oneDriverLock(driver);
if (!(vm=virDomainFindByID(&driver->domains, dom->id))) {
- oneError(dom->conn,dom, VIR_ERR_INVALID_DOMAIN,
+ oneError(VIR_ERR_INVALID_DOMAIN,
_("no domain with id %d"), dom->id);
goto return_point;
}

if (c_oneShutdown(vm->pid)) {
- oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
- "%s", _("Wrong state to perform action"));
+ oneError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Wrong state to perform action"));
goto return_point;
}
vm->state=VIR_DOMAIN_SHUTDOWN;
@@ -527,15 +527,15 @@ static int oneDomainDestroy(virDomainPtr dom)
oneDriverLock(driver);
vm= virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
- oneError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ oneError(VIR_ERR_INVALID_DOMAIN,
_("no domain with id %d"), dom->id);
goto return_point;
}
if(c_oneCancel(vm->pid)) {
/* VM not running, delete the instance at ONE DB */
if(c_oneFinalize(vm->pid)){
- oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
- "%s", _("Wrong state to perform action"));
+ oneError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Wrong state to perform action"));
goto return_point;
}
}
@@ -569,14 +569,14 @@ static int oneDomainSuspend(virDomainPtr dom)
ret=0;
goto return_point;
}
- oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
- "%s", _("Wrong state to perform action"));
+ oneError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Wrong state to perform action"));
goto return_point;
}
- oneError(dom->conn,dom, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ oneError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is not running"));
} else {
- oneError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ oneError(VIR_ERR_INVALID_DOMAIN,
_("no domain with matching id %d"), dom->id);
}

@@ -602,14 +602,14 @@ static int oneDomainResume(virDomainPtr dom)
ret=0;
goto return_point;
}
- oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
- "%s", _("Wrong state to perform action"));
+ oneError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Wrong state to perform action"));
goto return_point;
}
- oneError(dom->conn,dom, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not paused"));
+ oneError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is not paused"));
} else {
- oneError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
+ oneError(VIR_ERR_INVALID_DOMAIN,
_("no domain with matching id %d"), dom->id);
}
--
1.6.3.3
Eric Blake
2010-04-05 17:10:43 UTC
Permalink
Post by Matthias Bolte
---
src/opennebula/one_conf.c | 7 ++--
src/opennebula/one_conf.h | 6 ++--
src/opennebula/one_driver.c | 66 +++++++++++++++++++++---------------------
3 files changed, 39 insertions(+), 40 deletions(-)
-# define oneError(conn, dom, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ONE, code, __FILE__, \
+# define oneError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:21:52 UTC
Permalink
Post by Eric Blake
---
 src/opennebula/one_conf.c   |    7 ++--
 src/opennebula/one_conf.h   |    6 ++--
 src/opennebula/one_driver.c |   66 +++++++++++++++++++++---------------------
 3 files changed, 39 insertions(+), 40 deletions(-)
-# define oneError(conn, dom, code, ...)                                  \
-    virReportErrorHelper(conn, VIR_FROM_ONE, code, __FILE__,            \
+# define oneError(code, ...)                                            \
+    virReportErrorHelper(NULL, VIR_FROM_ONE, code, __FILE__,            \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout.
Thanks, pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:47 UTC
Permalink
---
src/openvz/openvz_conf.c | 83 +++++++-------
src/openvz/openvz_conf.h | 9 +-
src/openvz/openvz_driver.c | 266 ++++++++++++++++++++++----------------------
3 files changed, 177 insertions(+), 181 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index d447eb9..7521d78 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -122,15 +122,14 @@ rewait:
return ret;
}

-int openvzExtractVersion(virConnectPtr conn,
- struct openvz_driver *driver)
+int openvzExtractVersion(struct openvz_driver *driver)
{
if (driver->version > 0)
return 0;

if (openvzExtractVersionInfo(VZCTL, &driver->version) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not extract vzctl version"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not extract vzctl version"));
return -1;
}

@@ -181,8 +180,7 @@ no_memory:


static int
-openvzReadNetworkConf(virConnectPtr conn,
- virDomainDefPtr def,
+openvzReadNetworkConf(virDomainDefPtr def,
int veid) {
int ret;
virDomainNetDefPtr net = NULL;
@@ -196,9 +194,9 @@ openvzReadNetworkConf(virConnectPtr conn,
*/
ret = openvzReadVPSConfigParam(veid, "IP_ADDRESS", temp, sizeof(temp));
if (ret < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not read 'IP_ADDRESS' from config for container %d"),
- veid);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read 'IP_ADDRESS' from config for container %d"),
+ veid);
goto error;
} else if (ret > 0) {
token = strtok_r(temp, " ", &saveptr);
@@ -228,9 +226,9 @@ openvzReadNetworkConf(virConnectPtr conn,
*/
ret = openvzReadVPSConfigParam(veid, "NETIF", temp, sizeof(temp));
if (ret < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not read 'NETIF' from config for container %d"),
- veid);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not read 'NETIF' from config for container %d"),
+ veid);
goto error;
} else if (ret > 0) {
token = strtok_r(temp, ";", &saveptr);
@@ -254,8 +252,8 @@ openvzReadNetworkConf(virConnectPtr conn,
p += 12;
len = next - p;
if (len > 16) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Too long network device name"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Too long network device name"));
goto error;
}

@@ -263,7 +261,7 @@ openvzReadNetworkConf(virConnectPtr conn,
goto no_memory;

if (virStrncpy(net->ifname, p, len, len+1) == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Network ifname %s too long for destination"), p);
goto error;
}
@@ -271,8 +269,8 @@ openvzReadNetworkConf(virConnectPtr conn,
p += 7;
len = next - p;
if (len > 16) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Too long bridge device name"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Too long bridge device name"));
goto error;
}

@@ -280,7 +278,7 @@ openvzReadNetworkConf(virConnectPtr conn,
goto no_memory;

if (virStrncpy(net->data.bridge.brname, p, len, len+1) == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Bridge name %s too long for destination"), p);
goto error;
}
@@ -288,18 +286,18 @@ openvzReadNetworkConf(virConnectPtr conn,
p += 4;
len = next - p;
if (len != 17) { //should be 17
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Wrong length MAC address"));
+ openvzError( VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Wrong length MAC address"));
goto error;
}
if (virStrncpy(cpy_temp, p, len, sizeof(cpy_temp)) == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("MAC address %s too long for destination"), p);
goto error;
}
if (virParseMacAddr(cpy_temp, net->mac) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Wrong MAC address"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Wrong MAC address"));
goto error;
}
}
@@ -359,8 +357,7 @@ openvz_replace(const char* str,


static int
-openvzReadFSConf(virConnectPtr conn,
- virDomainDefPtr def,
+openvzReadFSConf(virDomainDefPtr def,
int veid) {
int ret;
virDomainFSDefPtr fs = NULL;
@@ -369,7 +366,7 @@ openvzReadFSConf(virConnectPtr conn,

ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", temp, sizeof(temp));
if (ret < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not read 'OSTEMPLATE' from config for container %d"),
veid);
goto error;
@@ -383,7 +380,7 @@ openvzReadFSConf(virConnectPtr conn,
/* OSTEMPLATE was not found, VE was booted from a private dir directly */
ret = openvzReadVPSConfigParam(veid, "VE_PRIVATE", temp, sizeof(temp));
if (ret <= 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not read 'VE_PRIVATE' from config for container %d"),
veid);
goto error;
@@ -446,7 +443,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
return -1;

if ((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed"));
return -1;
}

@@ -455,8 +452,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
if (feof(fp))
break;

- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to parse vzlist output"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to parse vzlist output"));
goto cleanup;
}

@@ -464,8 +461,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
goto no_memory;

if (virMutexInit(&dom->lock) < 0) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot initialize mutex"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot initialize mutex"));
VIR_FREE(dom);
goto cleanup;
}
@@ -493,8 +490,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
ret = virUUIDParse(uuidstr, dom->def->uuid);

if (ret == -1) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("UUID in config file malformed"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("UUID in config file malformed"));
goto cleanup;
}

@@ -505,7 +502,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {

ret = openvzReadVPSConfigParam(veid, "CPUS", temp, sizeof(temp));
if (ret < 0) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not read config for container %d"),
veid);
goto cleanup;
@@ -518,8 +515,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {

/* XXX load rest of VM config data .... */

- openvzReadNetworkConf(NULL, dom->def, veid);
- openvzReadFSConf(NULL, dom->def, veid);
+ openvzReadNetworkConf(dom->def, veid);
+ openvzReadFSConf(dom->def, veid);

virUUIDFormat(dom->def->uuid, uuidstr);
if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0)
@@ -914,8 +911,8 @@ openvzSetUUID(int vpsid){
unsigned char uuid[VIR_UUID_BUFLEN];

if (virUUIDGenerate(uuid)) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to generate UUID"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to generate UUID"));
return -1;
}

@@ -972,7 +969,7 @@ int openvzGetVEID(const char *name) {
bool ok;

if (virAsprintf(&cmd, "%s %s -ovpsid -H", VZLIST, name) < 0) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
_("virAsprintf failed"));
return -1;
}
@@ -981,7 +978,7 @@ int openvzGetVEID(const char *name) {
VIR_FREE(cmd);

if (fp == NULL) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed"));
return -1;
}

@@ -990,7 +987,7 @@ int openvzGetVEID(const char *name) {
if (ok && veid >= 0)
return veid;

- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to parse vzlist output"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to parse vzlist output"));
return -1;
}
diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h
index 8ce4fe2..50bcb5e 100644
--- a/src/openvz/openvz_conf.h
+++ b/src/openvz/openvz_conf.h
@@ -33,10 +33,8 @@
# include "domain_conf.h"
# include "threads.h"

-enum { OPENVZ_WARN, OPENVZ_ERR };
-
-# define openvzError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__, \
+# define openvzError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_OPENVZ, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)


@@ -56,8 +54,7 @@ struct openvz_driver {
};

int openvz_readline(int fd, char *ptr, int maxlen);
-int openvzExtractVersion(virConnectPtr conn,
- struct openvz_driver *driver);
+int openvzExtractVersion(struct openvz_driver *driver);
int openvzReadVPSConfigParam(int vpsid ,const char * param, char *value, int maxlen);
int openvzWriteVPSConfigParam(int vpsid, const char *param, const char *value);
int openvzCopyDefaultConfig(int vpsid);
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 32bc3c2..ab50fa6 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -68,11 +68,9 @@ static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
static int openvzDomainGetMaxVcpus(virDomainPtr dom);
static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
-static int openvzDomainSetVcpusInternal(virConnectPtr conn,
- virDomainObjPtr vm,
+static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
unsigned int nvcpus);
-static int openvzDomainSetMemoryInternal(virConnectPtr conn,
- virDomainObjPtr vm,
+static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
unsigned long memory);

static void openvzDriverLock(struct openvz_driver *driver)
@@ -101,8 +99,7 @@ static void cmdExecFree(const char *cmdExec[])
0 - OK
*/
static int
-openvzDomainDefineCmd(virConnectPtr conn,
- const char *args[],
+openvzDomainDefineCmd(const char *args[],
int maxarg, virDomainDefPtr vmdef)
{
int narg;
@@ -115,8 +112,8 @@ openvzDomainDefineCmd(virConnectPtr conn,
args[narg] = NULL;

if (vmdef == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Container is not defined"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Container is not defined"));
return -1;
}
#define ADD_ARG(thisarg) \
@@ -140,7 +137,7 @@ openvzDomainDefineCmd(virConnectPtr conn,
ADD_ARG_LIT("create");

if ((fp = popen(VZLIST " -a -ovpsid -H 2>/dev/null", "r")) == NULL) {
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
_("popen failed"));
return -1;
}
@@ -150,8 +147,8 @@ openvzDomainDefineCmd(virConnectPtr conn,
if (feof(fp))
break;

- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to parse vzlist output"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to parse vzlist output"));
goto cleanup;
}
if (veid > max_veid) {
@@ -188,7 +185,7 @@ openvzDomainDefineCmd(virConnectPtr conn,
return 0;

no_memory:
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not put argument to %s"), VZCTL);
return -1;

@@ -201,8 +198,7 @@ cleanup:
}


-static int openvzSetInitialConfig(virConnectPtr conn,
- virDomainDefPtr vmdef)
+static int openvzSetInitialConfig(virDomainDefPtr vmdef)
{
int ret = -1;
int vpsid;
@@ -211,8 +207,8 @@ static int openvzSetInitialConfig(virConnectPtr conn,
prog[0] = NULL;

if (vmdef->nfss > 1) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("only one filesystem supported"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only one filesystem supported"));
goto cleanup;
}

@@ -220,8 +216,8 @@ static int openvzSetInitialConfig(virConnectPtr conn,
vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE &&
vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_MOUNT)
{
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("filesystem is not of type 'template' or 'mount'"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("filesystem is not of type 'template' or 'mount'"));
goto cleanup;
}

@@ -231,34 +227,34 @@ static int openvzSetInitialConfig(virConnectPtr conn,
{

if(virStrToLong_i(vmdef->name, NULL, 10, &vpsid) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not convert domain name to VEID"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not convert domain name to VEID"));
goto cleanup;
}

if (openvzCopyDefaultConfig(vpsid) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not copy default config"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy default config"));
goto cleanup;
}

if (openvzWriteVPSConfigParam(vpsid, "VE_PRIVATE", vmdef->fss[0]->src) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set the source dir for the filesystem"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set the source dir for the filesystem"));
goto cleanup;
}
}
else
{
- if (openvzDomainDefineCmd(conn, prog, OPENVZ_MAX_ARG, vmdef) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Error creating command for container"));
+ if (openvzDomainDefineCmd(prog, OPENVZ_MAX_ARG, vmdef) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Error creating command for container"));
goto cleanup;
}

if (virRun(prog, NULL) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZCTL);
goto cleanup;
}
}
@@ -283,7 +279,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
+ openvzError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -316,7 +312,7 @@ static char *openvzGetOSType(virDomainPtr dom)
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
+ openvzError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -341,7 +337,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
+ openvzError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -366,7 +362,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
+ openvzError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}

@@ -391,8 +387,8 @@ static int openvzDomainGetInfo(virDomainPtr dom,
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -402,7 +398,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
info->cpuTime = 0;
} else {
if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) {
- openvzError(dom->conn, VIR_ERR_OPERATION_FAILED,
+ openvzError(VIR_ERR_OPERATION_FAILED,
_("cannot read cputime for domain %d"), dom->id);
goto cleanup;
}
@@ -430,7 +426,7 @@ static int openvzDomainIsActive(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!obj) {
- openvzError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
+ openvzError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
@@ -452,7 +448,7 @@ static int openvzDomainIsPersistent(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!obj) {
- openvzError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
+ openvzError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
@@ -474,8 +470,8 @@ static char *openvzDomainDumpXML(virDomainPtr dom, int flags) {
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

@@ -518,15 +514,15 @@ static int openvzDomainShutdown(virDomainPtr dom) {
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

openvzSetProgramSentinal(prog, vm->def->name);
if (vm->state != VIR_DOMAIN_RUNNING) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("domain is not in running state"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domain is not in running state"));
goto cleanup;
}

@@ -555,15 +551,15 @@ static int openvzDomainReboot(virDomainPtr dom,
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

openvzSetProgramSentinal(prog, vm->def->name);
if (vm->state != VIR_DOMAIN_RUNNING) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("domain is not in running state"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domain is not in running state"));
goto cleanup;
}

@@ -642,8 +638,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
if (net == NULL)
return 0;
if (vpsid == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Container ID is not specified"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Container ID is not specified"));
return -1;
}

@@ -675,8 +671,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
/* generate interface name in ve and copy it to options */
dev_name_ve = openvzGenerateContainerVethName(veid);
if (dev_name_ve == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not generate eth name for container"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not generate eth name for container"));
rc = -1;
goto exit;
}
@@ -686,8 +682,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
if (net->ifname == NULL) {
net->ifname = openvzGenerateVethName(veid, dev_name_ve);
if (net->ifname == NULL) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not generate veth name"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not generate veth name"));
rc = -1;
VIR_FREE(dev_name_ve);
goto exit;
@@ -728,8 +724,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
if (prog[0] != NULL){
ADD_ARG_LIT("--save");
if (virRun(prog, NULL) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZCTL);
rc = -1;
goto exit;
}
@@ -741,7 +737,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,

no_memory:
VIR_FREE(opt);
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not put argument to %s"), VZCTL);
cmdExecFree(prog);
return -1;
@@ -770,8 +766,8 @@ openvzDomainSetNetworkConfig(virConnectPtr conn,
}

if (openvzDomainSetNetwork(conn, def->name, def->nets[i], &buf) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not configure network"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not configure network"));
goto exit;
}
}
@@ -781,8 +777,8 @@ openvzDomainSetNetworkConfig(virConnectPtr conn,
if (param) {
if (openvzWriteVPSConfigParam(strtoI(def->name), "NETIF", param) < 0) {
VIR_FREE(param);
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot replace NETIF config"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot replace NETIF config"));
return -1;
}
VIR_FREE(param);
@@ -819,9 +815,9 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)

vm = virDomainFindByName(&driver->domains, vmdef->name);
if (vm) {
- openvzError(conn, VIR_ERR_OPERATION_FAILED,
- _("Already an OPENVZ VM active with the id '%s'"),
- vmdef->name);
+ openvzError(VIR_ERR_OPERATION_FAILED,
+ _("Already an OPENVZ VM active with the id '%s'"),
+ vmdef->name);
goto cleanup;
}
if (!(vm = virDomainAssignDef(driver->caps,
@@ -830,17 +826,17 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
vmdef = NULL;
vm->persistent = 1;

- if (openvzSetInitialConfig(conn, vm->def) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Error creating initial configuration"));
+ if (openvzSetInitialConfig(vm->def) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Error creating initial configuration"));
goto cleanup;
}

//TODO: set quota

if (openvzSetDefinedUUID(strtoI(vm->def->name), vm->def->uuid) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set UUID"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set UUID"));
goto cleanup;
}

@@ -848,17 +844,17 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
goto cleanup;

if (vm->def->vcpus > 0) {
- if (openvzDomainSetVcpusInternal(conn, vm, vm->def->vcpus) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set number of virtual cpu"));
+ if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set number of virtual cpu"));
goto cleanup;
}
}

if (vm->def->memory > 0) {
- if (openvzDomainSetMemoryInternal(conn, vm, vm->def->memory) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set memory size"));
+ if (openvzDomainSetMemoryInternal(vm, vm->def->memory) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set memory size"));
goto cleanup;
}
}
@@ -899,9 +895,9 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,

vm = virDomainFindByName(&driver->domains, vmdef->name);
if (vm) {
- openvzError(conn, VIR_ERR_OPERATION_FAILED,
- _("Already an OPENVZ VM defined with the id '%s'"),
- vmdef->name);
+ openvzError(VIR_ERR_OPERATION_FAILED,
+ _("Already an OPENVZ VM defined with the id '%s'"),
+ vmdef->name);
goto cleanup;
}
if (!(vm = virDomainAssignDef(driver->caps,
@@ -912,15 +908,15 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
* of this libvirt API which is intended for transient domain creation */
vm->persistent = 1;

- if (openvzSetInitialConfig(conn, vm->def) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Error creating initial configuration"));
+ if (openvzSetInitialConfig(vm->def) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Error creating initial configuration"));
goto cleanup;
}

if (openvzSetDefinedUUID(strtoI(vm->def->name), vm->def->uuid) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set UUID"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set UUID"));
goto cleanup;
}

@@ -930,8 +926,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
openvzSetProgramSentinal(progstart, vm->def->name);

if (virRun(progstart, NULL) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZCTL);
goto cleanup;
}

@@ -940,9 +936,9 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
vm->state = VIR_DOMAIN_RUNNING;

if (vm->def->vcpus > 0) {
- if (openvzDomainSetVcpusInternal(conn, vm, vm->def->vcpus) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set number of virtual cpu"));
+ if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not set number of virtual cpu"));
goto cleanup;
}
}
@@ -972,20 +968,20 @@ openvzDomainCreate(virDomainPtr dom)
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching id"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching id"));
goto cleanup;
}

if (vm->state != VIR_DOMAIN_SHUTOFF) {
- openvzError(dom->conn, VIR_ERR_OPERATION_DENIED,
- "%s", _("domain is not in shutoff state"));
+ openvzError(VIR_ERR_OPERATION_DENIED, "%s",
+ _("domain is not in shutoff state"));
goto cleanup;
}

openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
goto cleanup;
}
@@ -1012,18 +1008,20 @@ openvzDomainUndefine(virDomainPtr dom)
openvzDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

if (virDomainObjIsActive(vm)) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("cannot delete active domain"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot delete active domain"));
goto cleanup;
}

openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
goto cleanup;
}
@@ -1054,13 +1052,15 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN, "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, _("Could not exec %s"), VZCTL);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZCTL);
goto cleanup;
}
ret = 0;
@@ -1084,14 +1084,14 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart)
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

if (openvzReadVPSConfigParam(strtoI(vm->def->name), "ONBOOT", value, sizeof(value)) < 0) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not read container config"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not read container config"));
goto cleanup;
}

@@ -1106,23 +1106,24 @@ cleanup:
return ret;
}

-static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type)
+static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
+ const char *type)
{
if (type == NULL || STRCASEEQ(type, "openvz"))
return 1028; /* OpenVZ has no limitation */

- openvzError(conn, VIR_ERR_INVALID_ARG,
- _("unknown type '%s'"), type);
+ openvzError(VIR_ERR_INVALID_ARG,
+ _("unknown type '%s'"), type);
return -1;
}


-static int openvzDomainGetMaxVcpus(virDomainPtr dom) {
- return openvzGetMaxVCPUs(dom->conn, "openvz");
+static int openvzDomainGetMaxVcpus(virDomainPtr dom ATTRIBUTE_UNUSED) {
+ return openvzGetMaxVCPUs(NULL, "openvz");
}

-static int openvzDomainSetVcpusInternal(virConnectPtr conn, virDomainObjPtr vm,
- unsigned int nvcpus)
+static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
+ unsigned int nvcpus)
{
char str_vcpus[32];
const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINAL,
@@ -1137,8 +1138,8 @@ static int openvzDomainSetVcpusInternal(virConnectPtr conn, virDomainObjPtr vm,

openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZCTL);
return -1;
}

@@ -1157,18 +1158,18 @@ static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
openvzDriverUnlock(driver);

if (!vm) {
- openvzError(dom->conn, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ openvzError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}

if (nvcpus <= 0) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("VCPUs should be >= 1"));
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VCPUs should be >= 1"));
goto cleanup;
}

- openvzDomainSetVcpusInternal(dom->conn, vm, nvcpus);
+ openvzDomainSetVcpusInternal(vm, nvcpus);
ret = 0;

cleanup:
@@ -1208,20 +1209,20 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
/* If path isn't /system, then they typoed, so tell them correct path */
if (conn->uri->path == NULL ||
STRNEQ (conn->uri->path, "/system")) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("unexpected OpenVZ URI path '%s', try openvz:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}

if (!virFileExists("/proc/vz")) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
_("OpenVZ control file /proc/vz does not exist"));
return VIR_DRV_OPEN_ERROR;
}

if (access("/proc/vz", W_OK) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
_("OpenVZ control file /proc/vz is not accessible"));
return VIR_DRV_OPEN_ERROR;
}
@@ -1244,7 +1245,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
if (openvzLoadDomains(driver) < 0)
goto cleanup;

- if (openvzExtractVersion(conn, driver) < 0)
+ if (openvzExtractVersion(driver) < 0)
goto cleanup;

conn->privateData = driver;
@@ -1290,7 +1291,8 @@ static char *openvzGetCapabilities(virConnectPtr conn) {
return ret;
}

-static int openvzListDomains(virConnectPtr conn, int *ids, int nids) {
+static int openvzListDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
+ int *ids, int nids) {
int got = 0;
int veid;
pid_t pid;
@@ -1304,8 +1306,8 @@ static int openvzListDomains(virConnectPtr conn, int *ids, int nids) {
ret = virExec(cmd, NULL, NULL,
&pid, -1, &outfd, &errfd, VIR_EXEC_NONE);
if(ret == -1) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZLIST);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZLIST);
return -1;
}

@@ -1313,8 +1315,8 @@ static int openvzListDomains(virConnectPtr conn, int *ids, int nids) {
ret = openvz_readline(outfd, buf, 32);
if(!ret) break;
if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not parse VPS ID %s"), buf);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse VPS ID %s"), buf);
continue;
}
ids[got] = veid;
@@ -1336,7 +1338,7 @@ static int openvzNumDomains(virConnectPtr conn) {
return n;
}

-static int openvzListDefinedDomains(virConnectPtr conn,
+static int openvzListDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
char **const names, int nnames) {
int got = 0;
int veid, outfd = -1, errfd = -1, ret;
@@ -1350,8 +1352,8 @@ static int openvzListDefinedDomains(virConnectPtr conn,
ret = virExec(cmd, NULL, NULL,
&pid, -1, &outfd, &errfd, VIR_EXEC_NONE);
if(ret == -1) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZLIST);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZLIST);
return -1;
}

@@ -1359,8 +1361,8 @@ static int openvzListDefinedDomains(virConnectPtr conn,
ret = openvz_readline(outfd, buf, 32);
if(!ret) break;
if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not parse VPS ID %s"), buf);
+ openvzError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse VPS ID %s"), buf);
continue;
}
snprintf(vpsname, sizeof(vpsname), "%d", veid);
@@ -1435,7 +1437,7 @@ static int openvzNumDefinedDomains(virConnectPtr conn) {
}

static int
-openvzDomainSetMemoryInternal(virConnectPtr conn, virDomainObjPtr vm,
+openvzDomainSetMemoryInternal(virDomainObjPtr vm,
unsigned long mem)
{
char str_mem[16];
@@ -1448,7 +1450,7 @@ openvzDomainSetMemoryInternal(virConnectPtr conn, virDomainObjPtr vm,

openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
goto cleanup;
}
--
1.6.3.3
Eric Blake
2010-04-05 17:13:25 UTC
Permalink
Post by Matthias Bolte
---
src/openvz/openvz_conf.c | 83 +++++++-------
src/openvz/openvz_conf.h | 9 +-
src/openvz/openvz_driver.c | 266 ++++++++++++++++++++++----------------------
3 files changed, 177 insertions(+), 181 deletions(-)
@@ -288,18 +286,18 @@ openvzReadNetworkConf(virConnectPtr conn,
p += 4;
len = next - p;
if (len != 17) { //should be 17
- openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Wrong length MAC address"));
+ openvzError( VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Wrong length MAC address"));
Wonky spacing.
Post by Matthias Bolte
+++ b/src/openvz/openvz_conf.h
@@ -33,10 +33,8 @@
# include "domain_conf.h"
# include "threads.h"
-enum { OPENVZ_WARN, OPENVZ_ERR };
Worth mentioning in the commit log that these were unused?
Post by Matthias Bolte
-
-# define openvzError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__, \
+# define openvzError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_OPENVZ, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout, once you fix the nits.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 00:22:07 UTC
Permalink
Post by Eric Blake
---
 src/openvz/openvz_conf.c   |   83 +++++++-------
 src/openvz/openvz_conf.h   |    9 +-
 src/openvz/openvz_driver.c |  266 ++++++++++++++++++++++----------------------
 3 files changed, 177 insertions(+), 181 deletions(-)
@@ -288,18 +286,18 @@ openvzReadNetworkConf(virConnectPtr conn,
                     p += 4;
                     len = next - p;
                     if (len != 17) { //should be 17
-                        openvzError(conn, VIR_ERR_INTERNAL_ERROR,
-                              "%s", _("Wrong length MAC address"));
+                        openvzError( VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("Wrong length MAC address"));
Wonky spacing.
+++ b/src/openvz/openvz_conf.h
@@ -33,10 +33,8 @@
 # include "domain_conf.h"
 # include "threads.h"
-enum { OPENVZ_WARN, OPENVZ_ERR };
Worth mentioning in the commit log that these were unused?
-
-# define openvzError(conn, code, ...)                                       \
-        virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__,        \
+# define openvzError(code, ...)                                            \
+        virReportErrorHelper(NULL, VIR_FROM_OPENVZ, code, __FILE__,        \
                              __FUNCTION__, __LINE__, __VA_ARGS__)
ACK, and the rest of the patch is mechanical fallout, once you fix the nits.
Thanks, I folded in both changes and pushed.

Matthias
Matthias Bolte
2010-04-04 17:36:48 UTC
Permalink
Also rename ReportError to macvtapError.
---
src/qemu/qemu_conf.c | 2 +-
src/util/macvtap.c | 63 +++++++++++++++++++++++---------------------------
src/util/macvtap.h | 3 +-
3 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index b679b35..f20ee21 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1469,7 +1469,7 @@ qemudPhysIfaceConnect(virConnectPtr conn,
net->model && STREQ(net->model, "virtio"))
vnet_hdr = 1;

- rc = openMacvtapTap(conn, net->ifname, net->mac, linkdev, brmode,
+ rc = openMacvtapTap(net->ifname, net->mac, linkdev, brmode,
&res_ifname, vnet_hdr);
if (rc >= 0) {
VIR_FREE(net->ifname);
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 999e670..87c2800 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -49,9 +49,9 @@

# define VIR_FROM_THIS VIR_FROM_NET

-# define ReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+# define macvtapError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)

# define MACVTAP_NAME_PREFIX "macvtap"
# define MACVTAP_NAME_PATTERN "macvtap%d"
@@ -193,7 +193,7 @@ nlAppend(struct nlmsghdr *nlm, int totlen, const void *data, int datalen)


static int
-getIfIndex(virConnectPtr conn,
+getIfIndex(int reportError,
const char *ifname,
int *idx)
{
@@ -206,20 +206,20 @@ getIfIndex(virConnectPtr conn,

if (virStrncpy(ifreq.ifr_name, ifname, strlen(ifname),
sizeof(ifreq.ifr_name)) == NULL) {
- if (conn)
- ReportError(conn, VIR_ERR_INTERNAL_ERROR,
- _("invalid interface name %s"),
- ifname);
+ if (reportError)
+ macvtapError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid interface name %s"),
+ ifname);
rc = EINVAL;
goto err_exit;
}
if (ioctl(fd, SIOCGIFINDEX, &ifreq) >= 0)
*idx = ifreq.ifr_ifindex;
else {
- if (conn)
- ReportError(conn, VIR_ERR_INTERNAL_ERROR,
- _("interface %s does not exist"),
- ifname);
+ if (reportError)
+ macvtapError(VIR_ERR_INTERNAL_ERROR,
+ _("interface %s does not exist"),
+ ifname);
rc = ENODEV;
}

@@ -296,8 +296,7 @@ ifUp(const char *name, int up)


static int
-link_add(virConnectPtr conn,
- const char *type,
+link_add(const char *type,
const unsigned char *macaddress, int macaddrsize,
const char *ifname,
const char *srcdev,
@@ -315,7 +314,7 @@ link_add(virConnectPtr conn,
char *recvbuf = NULL;
int recvbuflen;

- if (getIfIndex(conn, srcdev, &ifindex) != 0)
+ if (getIfIndex(1, srcdev, &ifindex) != 0)
return -1;

*retry = 0;
@@ -434,14 +433,14 @@ link_add(virConnectPtr conn,
return rc;

malformed_resp:
- ReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("malformed netlink response message"));
+ macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("malformed netlink response message"));
VIR_FREE(recvbuf);
return -1;

buffer_too_small:
- ReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("internal buffer is too small"));
+ macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("internal buffer is too small"));
return -1;
}

@@ -512,21 +511,20 @@ link_del(const char *name)
return rc;

malformed_resp:
- ReportError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("malformed netlink response message"));
+ macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("malformed netlink response message"));
VIR_FREE(recvbuf);
return -1;

buffer_too_small:
- ReportError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("internal buffer is too small"));
+ macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("internal buffer is too small"));
return -1;
}


/* Open the macvtap's tap device.
- * @conn: Pointer to virConnect object
- * @name: Name of the macvtap interface
+ * @ifname: Name of the macvtap interface
* @retries : Number of retries in case udev for example may need to be
* waited for to create the tap chardev
* Returns negative value in case of error, the file descriptor otherwise.
@@ -677,7 +675,6 @@ configMacvtapTap(int tapfd, int vnet_hdr)
* openMacvtapTap:
* Create an instance of a macvtap device and open its tap character
* device.
- * @conn: Pointer to virConnect object
* @tgifname: Interface name that the macvtap is supposed to have. May
* be NULL if this function is supposed to choose a name
* @macaddress: The MAC address for the macvtap device
@@ -689,13 +686,11 @@ configMacvtapTap(int tapfd, int vnet_hdr)
* to the caller to free the string.
*
* Returns file descriptor of the tap device in case of success,
- * negative value otherwise with error message attached to the 'conn'
- * object.
+ * negative value otherwise with error reported.
*
*/
int
-openMacvtapTap(virConnectPtr conn,
- const char *tgifname,
+openMacvtapTap(const char *tgifname,
const unsigned char *macaddress,
const char *linkdev,
int mode,
@@ -713,7 +708,7 @@ openMacvtapTap(virConnectPtr conn,
*res_ifname = NULL;

if (tgifname) {
- if(getIfIndex(NULL, tgifname, &ifindex) == 0) {
+ if(getIfIndex(0, tgifname, &ifindex) == 0) {
if (STRPREFIX(tgifname,
MACVTAP_NAME_PREFIX)) {
goto create_name;
@@ -723,7 +718,7 @@ openMacvtapTap(virConnectPtr conn,
return -1;
}
cr_ifname = tgifname;
- rc = link_add(conn, type, macaddress, 6, tgifname, linkdev,
+ rc = link_add(type, macaddress, 6, tgifname, linkdev,
macvtapMode, &do_retry);
if (rc)
return -1;
@@ -732,8 +727,8 @@ create_name:
retries = 5;
for (c = 0; c < 8192; c++) {
snprintf(ifname, sizeof(ifname), MACVTAP_NAME_PATTERN, c);
- if (getIfIndex(NULL, ifname, &ifindex) == ENODEV) {
- rc = link_add(conn, type, macaddress, 6, ifname, linkdev,
+ if (getIfIndex(0, ifname, &ifindex) == ENODEV) {
+ rc = link_add(type, macaddress, 6, ifname, linkdev,
macvtapMode, &do_retry);
if (rc == 0)
break;
diff --git a/src/util/macvtap.h b/src/util/macvtap.h
index bd5f4d6..5d4ea5e 100644
--- a/src/util/macvtap.h
+++ b/src/util/macvtap.h
@@ -28,8 +28,7 @@

# include "internal.h"

-int openMacvtapTap(virConnectPtr conn,
- const char *ifname,
+int openMacvtapTap(const char *ifname,
const unsigned char *macaddress,
const char *linkdev,
int mode,
--
1.6.3.3
Eric Blake
2010-04-05 17:18:45 UTC
Permalink
Post by Matthias Bolte
Also rename ReportError to macvtapError.
---
src/qemu/qemu_conf.c | 2 +-
src/util/macvtap.c | 63 +++++++++++++++++++++++---------------------------
src/util/macvtap.h | 3 +-
3 files changed, 31 insertions(+), 37 deletions(-)
+++ b/src/util/macvtap.c
@@ -49,9 +49,9 @@
# define VIR_FROM_THIS VIR_FROM_NET
-# define ReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+# define macvtapError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)
Missing the corresponding cfg.mk change to match the rename.
Post by Matthias Bolte
static int
-getIfIndex(virConnectPtr conn,
+getIfIndex(int reportError,
This would be better as bool, not int.
Post by Matthias Bolte
@@ -713,7 +708,7 @@ openMacvtapTap(virConnectPtr conn,
*res_ifname = NULL;
if (tgifname) {
- if(getIfIndex(NULL, tgifname, &ifindex) == 0) {
+ if(getIfIndex(0, tgifname, &ifindex) == 0) {
...with uses like this using false rather than 0.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Eric Blake
2010-04-05 17:56:22 UTC
Permalink
Post by Eric Blake
Post by Matthias Bolte
Also rename ReportError to macvtapError.
---
src/qemu/qemu_conf.c | 2 +-
src/util/macvtap.c | 63 +++++++++++++++++++++++---------------------------
src/util/macvtap.h | 3 +-
3 files changed, 31 insertions(+), 37 deletions(-)
+++ b/src/util/macvtap.c
@@ -49,9 +49,9 @@
# define VIR_FROM_THIS VIR_FROM_NET
-# define ReportError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
+# define macvtapError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)
Missing the corresponding cfg.mk change to match the rename.
Serves me right for reviewing this incrementally; I now see you did it
later in 29/30. Still, it would probably be better to do the rebase,
and include the appropriate cfg.mk portion as part of this patch, in
case anyone else bisecting history uses this commit as an example for
future renaming.
--
Eric Blake ***@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Matthias Bolte
2010-04-06 18:02:08 UTC
Permalink
Post by Eric Blake
Post by Eric Blake
Post by Matthias Bolte
Also rename ReportError to macvtapError.
---
 src/qemu/qemu_conf.c |    2 +-
 src/util/macvtap.c   |   63 +++++++++++++++++++++++---------------------------
 src/util/macvtap.h   |    3 +-
 3 files changed, 31 insertions(+), 37 deletions(-)
+++ b/src/util/macvtap.c
@@ -49,9 +49,9 @@
 # define VIR_FROM_THIS VIR_FROM_NET
-# define ReportError(conn, code, ...)                                      \
-        virReportErrorHelper(conn, VIR_FROM_NET, code, __FILE__,          \
-                               __FUNCTION__, __LINE__, __VA_ARGS__)
+# define macvtapError(code, ...)                                           \
+        virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__,           \
+                             __FUNCTION__, __LINE__, __VA_ARGS__)
Missing the corresponding cfg.mk change to match the rename.
Serves me right for reviewing this incrementally; I now see you did it
later in 29/30.  Still, it would probably be better to do the rebase,
and include the appropriate cfg.mk portion as part of this patch, in
case anyone else bisecting history uses this commit as an example for
future renaming.
I added macvtapError to cfg.mk, switched from int to bool and pushed the result.

Matthias
Matthias Bolte
2010-04-04 17:36:50 UTC
Permalink
And from all related macros and functions.
---
src/conf/cpu_conf.c | 2 +-
src/conf/domain_conf.c | 2 +-
src/conf/domain_event.c | 2 +-
src/conf/interface_conf.c | 2 +-
src/conf/network_conf.c | 2 +-
src/conf/node_device_conf.h | 2 +-
src/conf/nwfilter_conf.h | 2 +-
src/conf/secret_conf.h | 2 +-
src/conf/storage_conf.h | 2 +-
src/cpu/cpu.h | 2 +-
src/datatypes.c | 2 +-
src/esx/esx_device_monitor.c | 2 +-
src/esx/esx_driver.c | 2 +-
src/esx/esx_interface_driver.c | 2 +-
src/esx/esx_network_driver.c | 2 +-
src/esx/esx_secret_driver.c | 2 +-
src/esx/esx_storage_driver.c | 2 +-
src/esx/esx_util.c | 2 +-
src/esx/esx_vi.c | 2 +-
src/esx/esx_vi_methods.c | 2 +-
src/esx/esx_vi_types.c | 2 +-
src/esx/esx_vmx.c | 2 +-
src/interface/netcf_driver.c | 2 +-
src/libvirt.c | 20 ++++++------
src/lxc/lxc_conf.h | 2 +-
src/network/bridge_driver.c | 2 +-
src/nodeinfo.c | 2 +-
src/opennebula/one_conf.h | 2 +-
src/openvz/openvz_conf.h | 2 +-
src/phyp/phyp_driver.c | 2 +-
src/qemu/qemu_conf.h | 2 +-
src/remote/remote_driver.c | 27 +++++++----------
src/security/security_driver.h | 2 +-
src/test/test_driver.c | 2 +-
src/uml/uml_conf.h | 2 +-
src/util/conf.c | 4 +-
src/util/hooks.c | 2 +-
src/util/hostusb.c | 2 +-
src/util/json.c | 2 +-
src/util/macvtap.c | 2 +-
src/util/pci.c | 2 +-
src/util/stats_linux.c | 2 +-
src/util/util.c | 2 +-
src/util/virterror.c | 15 +++------
src/util/virterror_internal.h | 22 ++++++--------
src/util/xml.c | 2 +-
src/vbox/vbox_driver.c | 2 +-
src/vbox/vbox_tmpl.c | 2 +-
src/xen/block_stats.c | 60 +++++++++++++++++++--------------------
src/xen/block_stats.h | 2 +-
src/xen/proxy_internal.c | 6 ++--
src/xen/sexpr.c | 4 +-
src/xen/xen_driver.c | 2 +-
src/xen/xen_hypervisor.c | 6 ++--
src/xen/xen_inotify.c | 2 +-
src/xen/xend_internal.c | 2 +-
src/xen/xm_internal.c | 2 +-
src/xen/xs_internal.c | 2 +-
src/xenapi/xenapi_utils.c | 4 +-
tests/statstest.c | 2 +-
60 files changed, 126 insertions(+), 142 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index c51ac4e..1b5e362 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -32,7 +32,7 @@
#define VIR_FROM_THIS VIR_FROM_CPU

#define virCPUReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_CPU, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d6ba4f6..0864de3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -271,7 +271,7 @@ VIR_ENUM_IMPL(virDomainTimerMode, VIR_DOMAIN_TIMER_MODE_LAST,
"smpsafe");

#define virDomainReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_DOMAIN, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_DOMAIN, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#ifndef PROXY
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index fac5e49..615e1af 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -32,7 +32,7 @@
#define VIR_FROM_THIS VIR_FROM_NONE

#define eventReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

struct _virDomainMeta {
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 920b090..76bd2af 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -46,7 +46,7 @@ virInterfaceDefDevFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level);

#define virInterfaceReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_INTERFACE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_INTERFACE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

static
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 1f3a44c..2b8bdc5 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -54,7 +54,7 @@ VIR_ENUM_IMPL(virNetworkForward,
"none", "nat", "route" )

#define virNetworkReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NETWORK, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NETWORK, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index fe0f2bf..975abb3 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -219,7 +219,7 @@ struct _virDeviceMonitorState {
};

# define virNodeDeviceReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NODEDEV, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap);
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 6c9dd4e..30d6c50 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -566,7 +566,7 @@ int virNWFilterConfLayerInit(virHashIterator domUpdateCB);
void virNWFilterConfLayerShutdown(void);

# define virNWFilterReportError(code, fmt...) \
- virReportErrorHelper(NULL, VIR_FROM_NWFILTER, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)


diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h
index 66294ce..4b47c52 100644
--- a/src/conf/secret_conf.h
+++ b/src/conf/secret_conf.h
@@ -27,7 +27,7 @@
# include "util.h"

# define virSecretReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

VIR_ENUM_DECL(virSecretUsageType)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 1c9ba04..38e4340 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -319,7 +319,7 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) {
}

# define virStorageReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 1494a7f..e13dcb3 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -31,7 +31,7 @@


# define virCPUReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_CPU, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)


diff --git a/src/datatypes.c b/src/datatypes.c
index ca20abf..009bab2 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -32,7 +32,7 @@
#define VIR_FROM_THIS VIR_FROM_NONE

#define virLibConnError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/************************************************************************
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 31724f7..4c013e1 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -39,7 +39,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index a5b87df..f83e468 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -49,7 +49,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)

static int esxDomainGetMaxVcpus(virDomainPtr domain);
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index b2fddbe..b369f76 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -39,7 +39,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index e65b7eb..4526468 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -39,7 +39,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index a29b546..315858c 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -38,7 +38,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 80ba645..b8d72a9 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -39,7 +39,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index e8fd261..8d0123c 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -39,7 +39,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)

/* AI_ADDRCONFIG is missing on some systems. */
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 5ed1391..54aac4e 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -40,7 +40,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)

#define ESX_VI__SOAP__REQUEST_HEADER \
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 87b7910..0313bae 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -34,7 +34,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)

#define ESX_VI__SOAP__REQUEST_HEADER \
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 500f8f1..e0b20a4 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -39,7 +39,7 @@
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index e4512b3..2a56760 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -422,7 +422,7 @@ def->parallels[0]...
#define VIR_FROM_THIS VIR_FROM_ESX

#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)


diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index 708f1f8..dd36caf 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -34,7 +34,7 @@
#define VIR_FROM_THIS VIR_FROM_INTERFACE

#define interfaceReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/* Main driver state */
diff --git a/src/libvirt.c b/src/libvirt.c
index 788b943..32da9c4 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -429,7 +429,7 @@ DllMain (HINSTANCE instance ATTRIBUTE_UNUSED,
#endif

#define virLibConnError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/**
@@ -448,40 +448,40 @@ virLibConnWarning(virErrorNumber error, const char *info)
return;

errmsg = virErrorMsg(error, info);
- virRaiseError(NULL, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_WARNING,
+ virRaiseError(VIR_FROM_NONE, error, VIR_ERR_WARNING,
errmsg, info, NULL, 0, 0, errmsg, info);
}

#define virLibDomainError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_DOM, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_DOM, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibNetworkError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibInterfaceError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_INTERFACE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_INTERFACE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibStoragePoolError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibStorageVolError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibNodeDeviceError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NODEDEV, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibSecretError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virLibNWFilterError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NWFILTER, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/**
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index e4c2c52..6ac4e7f 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -65,7 +65,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver);
virCapsPtr lxcCapsInit(void);

# define lxcError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_LXC, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_LXC, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#endif /* LXC_CONF_H */
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4eeaeed..e008135 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -64,7 +64,7 @@
#define VIR_FROM_THIS VIR_FROM_NETWORK

#define networkReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NETWORK, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NETWORK, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/* Main driver state */
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 402a6b7..4e1b69f 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -52,7 +52,7 @@
#define VIR_FROM_THIS VIR_FROM_NONE

#define nodeReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#ifdef __linux__
diff --git a/src/opennebula/one_conf.h b/src/opennebula/one_conf.h
index c53090c..dc6eeab 100644
--- a/src/opennebula/one_conf.h
+++ b/src/opennebula/one_conf.h
@@ -48,7 +48,7 @@ int oneSubmitVM(one_driver_t* driver, virDomainObjPtr vm);
char* xmlOneTemplate(virDomainDefPtr def);

# define oneError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_ONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#endif /* ONE_CONF_H */
diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h
index 50bcb5e..bd36534 100644
--- a/src/openvz/openvz_conf.h
+++ b/src/openvz/openvz_conf.h
@@ -34,7 +34,7 @@
# include "threads.h"

# define openvzError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_OPENVZ, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_OPENVZ, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)


diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 57ab00a..bc7a821 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -64,7 +64,7 @@
#define VIR_FROM_THIS VIR_FROM_PHYP

#define PHYP_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
+ virReportErrorHelper(VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)

/*
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 0b247d6..2315ad1 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -168,7 +168,7 @@ typedef qemuDomainPCIAddressSet *qemuDomainPCIAddressSetPtr;
# define QEMU_VIRTIO_SERIAL_PREFIX "virtio-serial"

# define qemuReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_QEMU, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)


diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ea96deb..19a4c03 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -241,7 +241,7 @@ static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int
#endif /* HAVE_POLKIT */

#define remoteError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_REMOTE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_REMOTE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
@@ -6583,7 +6583,7 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
host, sizeof(host),
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
- virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
+ virRaiseError (VIR_FROM_REMOTE,
VIR_ERR_UNKNOWN_HOST, VIR_ERR_ERROR,
NULL, NULL, NULL, 0, 0,
_("Cannot resolve address %d: %s"),
@@ -7930,8 +7930,7 @@ remoteStreamHasError(virStreamPtr st) {
}

VIR_WARN0("Raising async error");
- virRaiseErrorFull(st->conn,
- __FILE__, __FUNCTION__, __LINE__,
+ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,
privst->err.domain,
privst->err.code,
privst->err.level,
@@ -8883,8 +8882,7 @@ processCallDispatch(virConnectPtr conn, struct private_data *priv,
break;

default:
- virRaiseError (in_open ? NULL : conn,
- NULL, NULL, VIR_FROM_REMOTE,
+ virRaiseError (VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("got unexpected RPC call %d from server"),
hdr.proc);
@@ -8898,8 +8896,9 @@ processCallDispatch(virConnectPtr conn, struct private_data *priv,


static int
-processCallDispatchReply(virConnectPtr conn, struct private_data *priv,
- int in_open,
+processCallDispatchReply(virConnectPtr conn ATTRIBUTE_UNUSED,
+ struct private_data *priv,
+ int in_open ATTRIBUTE_UNUSED,
remote_message_header *hdr,
XDR *xdr) {
struct remote_thread_call *thecall;
@@ -8912,8 +8911,7 @@ processCallDispatchReply(virConnectPtr conn, struct private_data *priv,
thecall = thecall->next;

if (!thecall) {
- virRaiseError (in_open ? NULL : conn,
- NULL, NULL, VIR_FROM_REMOTE,
+ virRaiseError (VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("no call waiting for reply with serial %d"),
hdr->serial);
@@ -8921,8 +8919,7 @@ processCallDispatchReply(virConnectPtr conn, struct private_data *priv,
}

if (hdr->proc != thecall->proc_nr) {
- virRaiseError (in_open ? NULL : conn,
- NULL, NULL, VIR_FROM_REMOTE,
+ virRaiseError (VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
_("unknown procedure (received %x, expected %x)"),
hdr->proc, thecall->proc_nr);
@@ -9479,8 +9476,7 @@ cleanup:
* convert missing remote entry points into the unsupported
* feature error
*/
- virRaiseErrorFull(flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- __FILE__, __FUNCTION__, __LINE__,
+ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,
thiscall->err.domain,
VIR_ERR_NO_SUPPORT,
thiscall->err.level,
@@ -9492,8 +9488,7 @@ cleanup:
"%s", *thiscall->err.message);
rv = -1;
} else {
- virRaiseErrorFull(flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- __FILE__, __FUNCTION__, __LINE__,
+ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,
thiscall->err.domain,
thiscall->err.code,
thiscall->err.level,
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
index 3de234a..7fd421a 100644
--- a/src/security/security_driver.h
+++ b/src/security/security_driver.h
@@ -89,7 +89,7 @@ int
virSecurityDriverVerify(virDomainDefPtr def);

# define virSecurityReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_SECURITY, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_SECURITY, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/* Helpers */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a63005d..2ceff0e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -116,7 +116,7 @@ static const virNodeInfo defaultNodeInfo = {


#define testError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_TEST, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_TEST, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

static int testClose(virConnectPtr conn);
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
index b33acc8..748c3a8 100644
--- a/src/uml/uml_conf.h
+++ b/src/uml/uml_conf.h
@@ -63,7 +63,7 @@ struct uml_driver {


# define umlReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_UML, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_UML, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

virCapsPtr umlCapsInit (void);
diff --git a/src/util/conf.c b/src/util/conf.c
index ae0459e..d985708 100644
--- a/src/util/conf.c
+++ b/src/util/conf.c
@@ -99,13 +99,13 @@ virConfError(virConfParserCtxtPtr ctxt,

/* Construct the string 'filename:line: info' if we have that. */
if (ctxt && ctxt->filename) {
- virRaiseError(NULL, NULL, NULL, VIR_FROM_CONF, error, VIR_ERR_ERROR,
+ virRaiseError(VIR_FROM_CONF, error, VIR_ERR_ERROR,
info, ctxt->filename, NULL,
ctxt->line, 0,
"%s:%d: %s", ctxt->filename, ctxt->line, info);
} else {
format = virErrorMsg(error, info);
- virRaiseError(NULL, NULL, NULL, VIR_FROM_CONF, error, VIR_ERR_ERROR,
+ virRaiseError(VIR_FROM_CONF, error, VIR_ERR_ERROR,
info, NULL, NULL,
ctxt ? ctxt->line : 0, 0,
format, info);
diff --git a/src/util/hooks.c b/src/util/hooks.c
index 755679d..a49ece0 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -40,7 +40,7 @@
#define VIR_FROM_THIS VIR_FROM_HOOK

#define virHookReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_HOOK, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_HOOK, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define LIBVIRT_HOOK_DIR SYSCONF_DIR "/libvirt/hooks"
diff --git a/src/util/hostusb.c b/src/util/hostusb.c
index 78b601f..f436605 100644
--- a/src/util/hostusb.c
+++ b/src/util/hostusb.c
@@ -55,7 +55,7 @@ struct _usbDevice {
#define VIR_FROM_THIS VIR_FROM_NONE

#define usbReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

static int usbSysReadFile(const char *f_name, const char *d_name,
diff --git a/src/util/json.c b/src/util/json.c
index f90594c..51cc6e5 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -37,7 +37,7 @@
/* XXX fixme */
#define VIR_FROM_THIS VIR_FROM_NONE
#define virJSONError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)


diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 87c2800..4adb910 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -50,7 +50,7 @@
# define VIR_FROM_THIS VIR_FROM_NET

# define macvtapError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NET, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

# define MACVTAP_NAME_PREFIX "macvtap"
diff --git a/src/util/pci.c b/src/util/pci.c
index e8f985c..db3f344 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -76,7 +76,7 @@ struct _pciDeviceList {
#define VIR_FROM_THIS VIR_FROM_NONE

#define pciReportError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/* Specifications referenced in comments:
diff --git a/src/util/stats_linux.c b/src/util/stats_linux.c
index a12eb8c..da9649d 100644
--- a/src/util/stats_linux.c
+++ b/src/util/stats_linux.c
@@ -29,7 +29,7 @@
# define VIR_FROM_THIS VIR_FROM_STATS_LINUX

# define virStatsError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)


diff --git a/src/util/util.c b/src/util/util.c
index 28a3c7e..cddf699 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -86,7 +86,7 @@
#define VIR_FROM_THIS VIR_FROM_NONE

#define virUtilError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

/* Like read(), but restarts after EINTR */
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 2537110..173ef3f 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -641,7 +641,6 @@ virDispatchError(virConnectPtr conn)

/**
* virRaiseErrorFull:
- * @conn: the connection to the hypervisor if available
* @filename: filename where error was raised
* @funcname: function name where error was raised
* @linenr: line number where error was raised
@@ -660,8 +659,7 @@ virDispatchError(virConnectPtr conn)
* immediately if a callback is found and store it for later handling.
*/
void
-virRaiseErrorFull(virConnectPtr conn ATTRIBUTE_UNUSED,
- const char *filename ATTRIBUTE_UNUSED,
+virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED,
const char *funcname,
size_t linenr,
int domain,
@@ -1160,7 +1158,6 @@ virErrorMsg(virErrorNumber error, const char *info)
/**
* virReportErrorHelper:
*
- * @conn: the connection to the hypervisor if available
* @domcode: the virErrorDomain indicating where it's coming from
* @errcode: the virErrorNumber code for the error
* @filename: Source file error is dispatched from
@@ -1172,8 +1169,7 @@ virErrorMsg(virErrorNumber error, const char *info)
* Helper function to do most of the grunt work for individual driver
* ReportError
*/
-void virReportErrorHelper(virConnectPtr conn,
- int domcode,
+void virReportErrorHelper(int domcode,
int errcode,
const char *filename,
const char *funcname,
@@ -1193,11 +1189,10 @@ void virReportErrorHelper(virConnectPtr conn,
}

virerr = virErrorMsg(errcode, (errorMessage[0] ? errorMessage : NULL));
- virRaiseErrorFull(conn, filename, funcname, linenr,
+ virRaiseErrorFull(filename, funcname, linenr,
domcode, errcode, VIR_ERR_ERROR,
virerr, errorMessage, NULL,
-1, -1, virerr, errorMessage);
-
}

/**
@@ -1279,7 +1274,7 @@ void virReportSystemErrorFull(int domcode,
if (!msgDetail)
msgDetail = errnoDetail;

- virRaiseErrorFull(NULL, filename, funcname, linenr,
+ virRaiseErrorFull(filename, funcname, linenr,
domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR,
msg, msgDetail, NULL, -1, -1, msg, msgDetail);
}
@@ -1302,7 +1297,7 @@ void virReportOOMErrorFull(int domcode,
const char *virerr;

virerr = virErrorMsg(VIR_ERR_NO_MEMORY, NULL);
- virRaiseErrorFull(NULL, filename, funcname, linenr,
+ virRaiseErrorFull(filename, funcname, linenr,
domcode, VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
virerr, NULL, NULL, -1, -1, virerr, NULL);
}
diff --git a/src/util/virterror_internal.h b/src/util/virterror_internal.h
index 601a884..067b83b 100644
--- a/src/util/virterror_internal.h
+++ b/src/util/virterror_internal.h
@@ -33,8 +33,7 @@ extern void *virUserData;
* *
************************************************************************/
int virErrorInitialize(void);
-void virRaiseErrorFull(virConnectPtr conn,
- const char *filename,
+void virRaiseErrorFull(const char *filename,
const char *funcname,
size_t linenr,
int domain,
@@ -46,22 +45,19 @@ void virRaiseErrorFull(virConnectPtr conn,
int int1,
int int2,
const char *fmt, ...)
- ATTRIBUTE_FMT_PRINTF(13, 14);
+ ATTRIBUTE_FMT_PRINTF(12, 13);

-/* Includes 'dom' and 'net' for compatbility, but they're ignored */
-# define virRaiseError(conn, dom, net, domain, code, level, \
- str1, str2, str3, int1, int2, msg, ...) \
- virRaiseErrorFull(conn, __FILE__, __FUNCTION__, __LINE__, \
+# define virRaiseError(domain, code, level, \
+ str1, str2, str3, int1, int2, msg, ...) \
+ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
domain, code, level, str1, str2, str3, int1, int2, \
msg, __VA_ARGS__)

const char *virErrorMsg(virErrorNumber error, const char *info);
-void virReportErrorHelper(virConnectPtr conn, int domcode, int errcode,
- const char *filename ATTRIBUTE_UNUSED,
- const char *funcname ATTRIBUTE_UNUSED,
- size_t linenr ATTRIBUTE_UNUSED,
- const char *fmt, ...)
- ATTRIBUTE_FMT_PRINTF(7, 8);
+void virReportErrorHelper(int domcode, int errcode,
+ const char *filename, const char *funcname,
+ size_t linenr, const char *fmt, ...)
+ ATTRIBUTE_FMT_PRINTF(6, 7);

void virReportSystemErrorFull(int domcode,
int theerrno,
diff --git a/src/util/xml.c b/src/util/xml.c
index e2c2c6c..45cc65e 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -26,7 +26,7 @@
#define VIR_FROM_THIS VIR_FROM_XML

#define virGenericReportError(from, code, ...) \
- virReportErrorHelper(NULL, from, code, __FILE__, \
+ virReportErrorHelper(from, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define virXMLError(code, ...) \
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 36e7315..788f6f6 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -59,7 +59,7 @@ static virDriver vboxDriverDummy;
#define VIR_FROM_THIS VIR_FROM_VBOX

#define vboxError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_VBOX, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_VBOX, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

int vboxRegister(void) {
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 1310c1a..89e51f5 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -125,7 +125,7 @@ typedef IMediumAttachment IHardDiskAttachment;
#endif /* VBOX_API_VERSION >= 3001 */

#define vboxError(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_VBOX, code, __FILE__, \
+ virReportErrorHelper(VIR_FROM_VBOX, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)

#define DEBUGPRUnichar(msg, strUtf16) \
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 6e7a5c3..13f6fff 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -41,9 +41,8 @@
* Handle a stats error.
*/
static void
-statsErrorFunc (virConnectPtr conn,
- virErrorNumber error, const char *func, const char *info,
- int value)
+statsErrorFunc(virErrorNumber error, const char *func, const char *info,
+ int value)
{
char fullinfo[1000];
const char *errmsg;
@@ -54,8 +53,7 @@ statsErrorFunc (virConnectPtr conn,
fullinfo[sizeof (fullinfo) - 1] = 0;
info = fullinfo;
}
- virRaiseError(conn, NULL, NULL, VIR_FROM_STATS_LINUX, error,
- VIR_ERR_ERROR,
+ virRaiseError(VIR_FROM_STATS_LINUX, error, VIR_ERR_ERROR,
errmsg, info, NULL, value, 0, errmsg, info,
value);
}
@@ -166,8 +164,8 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
}

static int
-read_bd_stats (virConnectPtr conn, xenUnifiedPrivatePtr priv,
- int device, int domid, struct _virDomainBlockStats *stats)
+read_bd_stats(xenUnifiedPrivatePtr priv,
+ int device, int domid, struct _virDomainBlockStats *stats)
{
stats->rd_req = read_bd_stat (device, domid, "rd_req");
stats->rd_bytes = read_bd_stat (device, domid, "rd_sect");
@@ -181,8 +179,8 @@ read_bd_stats (virConnectPtr conn, xenUnifiedPrivatePtr priv,
if (stats->rd_req == -1 && stats->rd_bytes == -1 &&
stats->wr_req == -1 && stats->wr_bytes == -1 &&
stats->errs == -1) {
- statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
- "Failed to read any block statistics", domid);
+ statsErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "Failed to read any block statistics", domid);
return -1;
}

@@ -194,8 +192,8 @@ read_bd_stats (virConnectPtr conn, xenUnifiedPrivatePtr priv,
stats->wr_req == 0 && stats->wr_bytes == 0 &&
stats->errs == 0 &&
!check_bd_connected (priv, device, domid)) {
- statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
- "Frontend block device not connected", domid);
+ statsErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "Frontend block device not connected", domid);
return -1;
}

@@ -204,18 +202,18 @@ read_bd_stats (virConnectPtr conn, xenUnifiedPrivatePtr priv,
*/
if (stats->rd_bytes > 0) {
if (stats->rd_bytes >= ((unsigned long long)1)<<(63-9)) {
- statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
- "stats->rd_bytes would overflow 64 bit counter",
- domid);
+ statsErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "stats->rd_bytes would overflow 64 bit counter",
+ domid);
return -1;
}
stats->rd_bytes *= 512;
}
if (stats->wr_bytes > 0) {
if (stats->wr_bytes >= ((unsigned long long)1)<<(63-9)) {
-