Devel
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 27 participants
- 40367 discussions
Hi all,
I have a question about compatibility issues when submitting changes
to both Xen and libvirt.
First, some background: I'm seeing a problem with virsh detach-disk.
It'll detach a disk from a running domain, but not update the domain's
configuration, so the disk will be back when the domain is rebooted.
This seems undesirable; I think the disk should be permanently removed
by virsh detach-disk.
To fix this, patches are necessary in both Xen and Libvirt.
First, the Xen patch:
--- old/tools/python/xen/xend/server/SrvDomain.py
+++ new/tools/python/xen/xend/server/SrvDomain.py
@@ -186,7 +186,9 @@
def op_device_destroy(self, _, req):
return self.call(self.dom.destroyDevice,
[['type', 'str'],
- ['dev', 'str']],
+ ['dev', 'str'],
+ ['force', 'int'],
+ ['rm_cfg', 'int']],
req)
def op_device_configure(self, _, req):
Next, the libvirt patch:
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -3269,7 +3273,7 @@ xenDaemonDetachDevice(virDomainPtr domai
if (virDomainXMLDevID(domain, xml, class, ref, sizeof(ref)))
return (-1);
return(xend_op(domain->conn, domain->name, "op", "device_destroy",
- "type", class, "dev", ref, NULL));
+ "type", class, "dev", ref, "force", "0", "rm_cfg", "1", NULL));
}
Now, on to my question: I want to make sure I can do this without
causing too many problems. In my testing, the libvirt change without
the xen change won't cause any additional issues, but the xen change
without the libvirt change will cause all 'virsh detach-disk' calls to fail.
How should a change like this be handled? Submit the libvirt patch
now, and sit on the Xen patch for a while? Or submit both and include a
note that an upgrade will be necessary?
Thanks,
Ryan
1
0
Announcing oVirt
================
It is my pleasure to announce oVirt, the next step in open virtual
machine management.
oVirt is:
* A small OS image that runs libvirt and hosts virtual machines
* A Web-based virtual machine management console
oVirt goals:
* Empower virtual machine owners without giving up control of
hardware
* Automate virtual machine clustering, load balancing, and SLA
maintenance
* Simplify management of large numbers of machines
* Work across platforms and architectures
oVirt uses:
* A kerberos/LDAP server for authentication and authorization
(oVirt ships with FreeIPA)
* DNS/DHCP services on the local LAN -- or provides them for oVirt
hosts over a private network if desired
* Libvirt for virtual machine management, storage management, and
secure remote communication
* collectd for stats gathering and monitoring
* Rails for rapid, flexible development
oVirt mailing list: http://www.redhat.com/mailman/listinfo/ovirt-devel
oVirt IRC: irc.freenode.net/#ovirt
oVirt website: http://ovirt.org
We encourage anyone interested to download the source (git clone
git://git.et.redhat.com/ovirt) or the prebuilt appliance
(http://ovirt.org/download) Let us know what you think!
Enjoy,
--Hugh Brock
hbrock(a)redhat.com
1
0
Tiny change.
So the autobuilder runs these checks, too.
diff --git a/autobuild.sh b/autobuild.sh
index 623b33a..9e0c2ca 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -23,6 +23,7 @@ make install
set -o pipefail
make check 2>&1 | tee $RESULTS
+make syntax-check 2>&1 | tee -a $RESULTS
make cov
rm -f *.tar.gz
3
3
14 Feb '08
I added a slightly improved useless-if-before-free to gnulib, so this
patch makes bootstrap pull the script from there. It also pulls in a
vasnprintf module improvement: it works around a just-discovered bug in
HPUX 10.20's printf(3) implementation:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12505/focus=12547
Here's the patch:
Pull useless-if-before-free from gnulib, and update.
* bootstrap (gnulib_tool): Add useless-if-before-free to
the list of modules.
* build-aux/useless-if-before-free: Update from gnulib.
* gnulib/lib/vasnprintf.c: Work around a bug in HPUX 10.20.
* gnulib/m4/vasnprintf.m4: Likewise.
---
bootstrap | 1 +
build-aux/useless-if-before-free | 96 +++++++++++++++++++++++++++++--------
gnulib/lib/Makefile.am | 9 +++-
gnulib/lib/vasnprintf.c | 37 ++++++++++-----
gnulib/m4/gnulib-cache.m4 | 4 +-
gnulib/m4/gnulib-comp.m4 | 1 +
gnulib/m4/vasnprintf.m4 | 20 +++++++-
7 files changed, 130 insertions(+), 38 deletions(-)
diff --git a/bootstrap b/bootstrap
index 1627086..d8b79d9 100755
--- a/bootstrap
+++ b/bootstrap
@@ -78,6 +78,7 @@ $gnulib_tool \
--import physmem getaddrinfo \
sys_stat vasprintf strndup \
strsep poll gettext getpass \
+ useless-if-before-free \
vc-list-files
rm -f \
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 57040a3..eb18483 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,24 +1,43 @@
#!/usr/bin/perl -T
# Detect instances of "if (p) free (p);".
-# Likewise for "if (p != NULL) free (p);".
+# Likewise for "if (p != NULL) free (p);". And with braces.
-my $VERSION = '2008-02-04 22:25'; # UTC
+my $VERSION = '2008-02-11 08:08'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-# Exit status is like grep: 0 for no match. 1 for any number.
-# Note: giving line numbers isn't practical, since I've reset the
-# input record separator.
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Written by Jim Meyering
+
use strict;
use warnings;
use Getopt::Long;
(my $ME = $0) =~ s|.*/||;
-my $debug = 0;
-my $verbose = 0;
+# use File::Coda; # http://meyering.net/code/Coda/
+END {
+ defined fileno STDOUT or return;
+ close STDOUT and return;
+ warn "$ME: failed to close standard output: $!\n";
+ $? ||= 1;
+}
sub usage ($)
{
@@ -33,18 +52,32 @@ sub usage ($)
print $STREAM <<EOF;
Usage: $ME [OPTIONS] FILE...
+Detect any instance in FILE of a useless "if" test before a free call, e.g.,
+"if (p) free (p);". Any such test may be safely removed without affecting
+the semantics of the C code in FILE. Use --name=FOO --name=BAR to also
+detect free-like functions named FOO and BAR.
+
OPTIONS:
+ --list print only the name of each matching FILE (\0-terminated)
--name=N add name N to the list of `free'-like functions to detect;
may be repeated
--help display this help and exit
--version output version information and exit
- --verbose generate verbose output
+
+Exit status:
+
+ 0 no match
+ 1 one or more matches
+ 2 an error
EXAMPLE:
- git ls-files -z |xargs -0 $ME
+For example, this command prints all removable "if" tests before "free"
+and "kfree" calls in the linux kernel sources:
+
+ git ls-files -z |xargs -0 $ME --name=kfree
EOF
}
@@ -52,32 +85,40 @@ EOF
}
{
+ sub EXIT_MATCH {0}
+ sub EXIT_NO_MATCH {1}
+ sub EXIT_ERROR {2}
+ my $err = EXIT_NO_MATCH;
+
+ my $list;
my @name = qw(free);
GetOptions
(
- debug => \$debug,
- verbose => \$verbose,
help => sub { usage 0 },
version => sub { print "$ME version $VERSION\n"; exit },
+ list => \$list,
'name=s@' => \@name,
) or usage 1;
# Make sure we have the right number of non-option arguments.
# Always tell the user why we fail.
@ARGV < 1
- and (warn "$ME: missing FILE argument\n"), usage 1;
+ and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
my $or = join '|', @name;
my $regexp = qr/(?:$or)/;
# Set the input record separator.
+ # Note: this makes it impractical to print line numbers.
$/ = '"';
my $found_match = 0;
+ FILE:
foreach my $file (@ARGV)
{
open FH, '<', $file
- or die "$ME: can't open `$file' for reading: $!\n";
+ or (warn "$ME: can't open `$file' for reading: $!\n"),
+ $err = EXIT_ERROR, next;
while (defined (my $line = <FH>))
{
if ($line =~
@@ -85,27 +126,40 @@ EOF
(?: \s*$regexp\s*\(\s*\2\s*\)|
\s*\{\s*$regexp\s*\(\s*\2\s*\)\s*;\s*\}))/sx)
{
- print "$file: $1\n";
$found_match = 1;
+ $list
+ and (print "$file\0"), next FILE;
+ print "$file: $1\n";
}
}
+ }
+ continue
+ {
close FH;
}
- exit !$found_match;
+
+ $found_match && $err == EXIT_NO_MATCH
+ and $err = EXIT_MATCH;
+
+ exit $err;
}
my $foo = <<'EOF';
# The above is to *find* them.
# This adjusts them, removing the unnecessary "if (p)" part.
-# FIXME: do something like this as an option.
-git ls-files -z --exclude=$ME |xargs -0 \
-perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+((?:sexpr_)?free\s*\(\s*\1\s*\))/$2/s'
+# FIXME: do something like this as an option (doesn't do braces):
+git ls-files -z |xargs -0 \
+perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(k?free\s*\(\s*\1\s*\))/$2/s'
-When modifying files, refuse to process anything other than a regular file.
+useless-if-before-free -l $(lid -knone free) | xargs -0 \
+ perl -0x3b -pi -e \
+ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\(\s*\1\s*\))/$2/s'
-# Or this one-liner to detect them:
-git ls-files -z |xargs -0 perl -00 -ne '/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)(?:\s*(?:sexpr_)?free\s*\(\s*\2\s*\)|\s*\{\s*(?:sexpr_)?free\s*\(\s*\2\s*\)\s*;\s*\}))/sx and print "$1\n"'
+Be careful that the result of the above transformation is valid.
+If the matched string is followed by "else", then obviously, it won't be.
+
+When modifying files, refuse to process anything other than a regular file.
EOF
## Local Variables:
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
index 8f545ca..9495caf 100644
--- a/gnulib/lib/Makefile.am
+++ b/gnulib/lib/Makefile.am
@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl getaddrinfo getpass gettext physmem poll strndup strsep sys_stat vasprintf vc-list-files
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl getaddrinfo getpass gettext physmem poll strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files
AUTOMAKE_OPTIONS = 1.5 gnits
@@ -701,6 +701,13 @@ EXTRA_DIST += unistd.in.h
## end gnulib module unistd
+## begin gnulib module useless-if-before-free
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/useless-if-before-free
+
+## end gnulib module useless-if-before-free
+
## begin gnulib module vasnprintf
diff --git a/gnulib/lib/vasnprintf.c b/gnulib/lib/vasnprintf.c
index 205a9bf..ed579d3 100644
--- a/gnulib/lib/vasnprintf.c
+++ b/gnulib/lib/vasnprintf.c
@@ -3566,7 +3566,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
arg_type type = a.arg[dp->arg_index].type;
int flags = dp->flags;
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
int has_width;
size_t width;
#endif
@@ -3579,7 +3579,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#else
# define prec_ourselves 0
#endif
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if NEED_PRINTF_FLAG_LEFTADJUST
+# define pad_ourselves 1
+#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
int pad_ourselves;
#else
# define pad_ourselves 0
@@ -3593,7 +3595,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
TCHAR_T *tmp;
#endif
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 0;
width = 0;
if (dp->width_start != dp->width_end)
@@ -3883,7 +3885,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
/* Decide whether to perform the padding ourselves. */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
switch (dp->conversion)
{
# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
@@ -4008,7 +4010,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
*fbp = dp->conversion;
#if USE_SNPRINTF
-# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
+# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
@@ -4021,6 +4023,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
in format strings in writable memory may crash the program
(if compiled with _FORTIFY_SOURCE=2), so we should avoid it
in this situation. */
+ /* On native Win32 systems (such as mingw), we can avoid using
+ %n because:
+ - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
+ snprintf does not write more than the specified number
+ of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
+ '4', '5', '6' into buf, not '4', '5', '\0'.)
+ - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
+ allows us to recognize the case of an insufficient
+ buffer size: it returns -1 in this case.
+ On native Win32 systems (such as mingw) where the OS is
+ Windows Vista, the use of %n in format strings by default
+ crashes the program. See
+ <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
+ <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
+ So we should avoid %n in this situation. */
fbp[1] = '\0';
# endif
#else
@@ -4494,7 +4511,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Here count <= allocated - length. */
/* Perform padding. */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
if (pad_ourselves && has_width)
{
size_t w;
@@ -4535,15 +4552,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
# endif
DCHAR_T *p = rp + count;
DCHAR_T *end = p + pad;
-# if NEED_PRINTF_FLAG_ZERO
DCHAR_T *pad_ptr;
-# if !DCHAR_IS_TCHAR
+# if !DCHAR_IS_TCHAR
if (dp->conversion == 'c'
|| dp->conversion == 's')
/* No zero-padding for string directives. */
pad_ptr = NULL;
else
-# endif
+# endif
{
pad_ptr = (*rp == '-' ? rp + 1 : rp);
/* No zero-padding of "inf" and "nan". */
@@ -4551,7 +4567,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
|| (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
pad_ptr = NULL;
}
-# endif
/* The generated string now extends from rp to p,
with the zero padding insertion point being at
pad_ptr. */
@@ -4564,7 +4579,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
for (; pad > 0; pad--)
*p++ = ' ';
}
-# if NEED_PRINTF_FLAG_ZERO
else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
{
/* Pad with zeroes. */
@@ -4575,7 +4589,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
for (; pad > 0; pad--)
*p++ = '0';
}
-# endif
else
{
/* Pad with spaces on the left. */
diff --git a/gnulib/m4/gnulib-cache.m4 b/gnulib/m4/gnulib-cache.m4
index 357f170..50f743b 100644
--- a/gnulib/m4/gnulib-cache.m4
+++ b/gnulib/m4/gnulib-cache.m4
@@ -15,11 +15,11 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl getaddrinfo getpass gettext physmem poll strndup strsep sys_stat vasprintf vc-list-files
+# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl getaddrinfo getpass gettext physmem poll strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
-gl_MODULES([getaddrinfo getpass gettext physmem poll strndup strsep sys_stat vasprintf vc-list-files])
+gl_MODULES([getaddrinfo getpass gettext physmem poll strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files])
gl_AVOID([])
gl_SOURCE_BASE([gnulib/lib])
gl_M4_BASE([gnulib/m4])
diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4
index 8896a38..0eeee9c 100644
--- a/gnulib/m4/gnulib-comp.m4
+++ b/gnulib/m4/gnulib-comp.m4
@@ -225,6 +225,7 @@ AC_DEFUN([gltests_LIBSOURCES], [
AC_DEFUN([gl_FILE_LIST], [
build-aux/config.rpath
build-aux/link-warning.h
+ build-aux/useless-if-before-free
build-aux/vc-list-files
lib/alloca.in.h
lib/asnprintf.c
diff --git a/gnulib/m4/vasnprintf.m4 b/gnulib/m4/vasnprintf.m4
index 6449a9c..c4d3f4f 100644
--- a/gnulib/m4/vasnprintf.m4
+++ b/gnulib/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
-# vasnprintf.m4 serial 23
-dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc.
+# vasnprintf.m4 serial 24
+dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -166,6 +166,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
esac
])
+# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
+[
+ AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
+ case "$gl_cv_func_printf_flag_leftadjust" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
+ [Define if the vasnprintf implementation needs special code for the
+ '-' flag.])
+ ;;
+ esac
+])
+
# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
[
@@ -234,6 +249,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+ gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
gl_PREREQ_VASNPRINTF_PRECISION
gl_PREREQ_VASNPRINTF_ENOMEM
--
1.5.4.1.35.g55477
2
1
This one makes sure we don't use the "#ifdef HAVE_CONFIG_H" meme:
Enable another syntax-check rule.
* Makefile.cfg (local-checks-to-skip): Remove sc_no_have_config_h.
* qemud/mdns.c: Remove "#ifdef HAVE_CONFIG_H".
* Makefile.maint (sc_no_have_config_h): Tighten up regexp,
so that the above mention of "HAVE_CONFIG_H" doesn't match.
* .x-sc_no_have_config_h: New file, to exempt gnulib/ straggler.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
.x-sc_no_have_config_h | 1 +
Makefile.cfg | 1 -
Makefile.maint | 2 +-
qemud/mdns.c | 2 --
4 files changed, 2 insertions(+), 4 deletions(-)
create mode 100644 .x-sc_no_have_config_h
diff --git a/.x-sc_no_have_config_h b/.x-sc_no_have_config_h
new file mode 100644
index 0000000..f106267
--- /dev/null
+++ b/.x-sc_no_have_config_h
@@ -0,0 +1 @@
+^gnulib/lib/strsep\.c$
diff --git a/Makefile.cfg b/Makefile.cfg
index 4543ebd..7e8ddcf 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -28,7 +28,6 @@ url_dir_list = \
local-checks-to-skip = \
makefile_path_separator_check \
makefile-check \
- sc_no_have_config_h \
sc_tight_scope \
sc_GPL_version \
sc_always_defined_macros \
diff --git a/Makefile.maint b/Makefile.maint
index 8624328..4b54baf 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -96,7 +96,7 @@ sc_file_system:
exit 1; } || :
sc_no_have_config_h:
- @grep -n 'HAVE''_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
+ @grep -n '^# *if.*HAVE''_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
diff --git a/qemud/mdns.c b/qemud/mdns.c
index deebd07..d47d18e 100644
--- a/qemud/mdns.c
+++ b/qemud/mdns.c
@@ -22,9 +22,7 @@
* Author: Daniel P. Berrange <berrange(a)redhat.com>
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <time.h>
#include <stdio.h>
--
1.5.4.35.g3cfc
2
2
Hi!
I filed https://bugzilla.redhat.com/show_bug.cgi?id=431063 yesterday to
track this issue.
Quoting the bug report:
"To use the new virtio capabilites available in kvm 60, special command
line paramaters need to be passed to kvm. There should be a way to
specify that a device should use virtio in the libvirt xml.
I propose adding a "model" attribute to the interface element in the XML
to be able to specify the type of NIC to emulate, e.g. 'virtio'.
For the disk virtio I propose adding an 'interface' attribute to target
element (inside the disk element). This interface could then be set to
'virtio', 'ide', 'scsi', etc.."
Since I wrote the bug report, I noticed there's no way to specify which
graphics card, you'd like to emulate. A 'model' attribute could probably
be added to the graphics element as well.
Comments?
--
Soren Hansen
Ubuntu Server Team
http://www.ubuntu.com/
2
1
07 Feb '08
Hi,
when using "virsh dumpxml <domain> > xmlfile" on a running paravirt xen
domain that has no bootloader entry whatsoever I get:
...
<bootloader/>
<os>
<type>linux</type>
<kernel>/boot/vmlinuz-vm</kernel>
<initrd>/boot/initrd.img-vm</initrd>
<cmdline>root=/dev/sda1 ro </cmdline>
</os>
...
reimporting this via "virsh define xmlfile" and then dumping again gives
something like:
...
<bootloader/>
<os>
<type>linux</type>
</os>
...
since a bootloader tag is found the kernel and initrd entries are being
dropped. My hack is to ignore empty bootloader statements for the
moment:
diff --git a/src/xend_internal.c b/src/xend_internal.c
index fd38a61..5428cd7 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1438,9 +1438,6 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
if (tmp != NULL) {
bootloader = 1;
virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", tmp);
- } else if (sexpr_has(root, "domain/bootloader")) {
- bootloader = 1;
- virBufferVSprintf(&buf, " <bootloader/>\n");
}
tmp = sexpr_node(root, "domain/bootloader_args");
if (tmp != NULL && bootloader) {
Would that be the right place to fix this?
Cheers,
-- Guido
3
2
[Libvir] [PATCH] Fix the function that remove the element of the hash table.
by Hiroyuki Kaguchi 07 Feb '08
by Hiroyuki Kaguchi 07 Feb '08
07 Feb '08
There are two logic error and a unnecessary else-statement
in virHashRemoveSet function.
This patch fix the following.
(1/3) The logic error that use released memory area.
(2/3) The logic error that doesn't remove elements.
(3/3) Unnecessary else-statement.
(1/3) The logic error that use released memory area.
This bug causes the crash of virt-manager or virsh.
If "virsh undefine" command is executed, "Segmentation Fault" is caused.
The result of executing "valgrind virsh" command is:
virsh # list --all
==3337== Invalid read of size 4
==3337== at 0x4016A21: virHashRemoveSet (hash.c:562)
==3337== by 0x403ACF4: xenXMConfigCacheRefresh (xm_internal.c:458)
==3337== by 0x4040D58: xenXMNumOfDefinedDomains (xm_internal.c:2518)
==3337== by 0x40245C3: xenUnifiedNumOfDefinedDomains (xen_unified.c:1004)
==3337== by 0x4013730: virConnectNumOfDefinedDomains (libvirt.c:2446)
==3337== by 0x804AE81: cmdList (virsh.c:577)
==3337== by 0x8052E6E: vshCommandRun (virsh.c:4052)
==3337== by 0x8054E2D: main (virsh.c:5036)
==3337== Address 0x4282AB8 is 0 bytes inside a block of size 16 free'd
==3337== at 0x4004FDA: free (vg_replace_malloc.c:233)
==3337== by 0x40169A0: virHashRemoveSet (hash.c:545)
==3337== by 0x403ACF4: xenXMConfigCacheRefresh (xm_internal.c:458)
==3337== by 0x4040D58: xenXMNumOfDefinedDomains (xm_internal.c:2518)
==3337== by 0x40245C3: xenUnifiedNumOfDefinedDomains (xen_unified.c:1004)
==3337== by 0x4013730: virConnectNumOfDefinedDomains (libvirt.c:2446)
==3337== by 0x804AE81: cmdList (virsh.c:577)
==3337== by 0x8052E6E: vshCommandRun (virsh.c:4052)
==3337== by 0x8054E2D: main (virsh.c:5036)
The current removing logic is:
1. search for node that be removed in the hash table.
The removing cursor(pointer) point to "element-B".
+-hash table---+
| +----------+ | +----------+ +----------+
| |element-A |-|-->|element-B |-->|element-C |
| +----------+ | +----------+ +----------+
| |element-D | |
| +----------+ |
| . |
| . |
+--------------+
2. free "element-B".
The removing cursor point to invalid address
+-hash table---+
| +----------+ | +----------+
| |element-A |-|-->|element-C |
| +----------+ | +----------+
| |element-D | |
| +----------+ |
| . |
| . |
+--------------+
3. try to move the removing cursor to next node.
At this time, the error occurs.
(2/3) The logic error that doesn't remove elements.
The current removing logic is:
1. search for node that will be removed in the hash table.
The removing cursor point to "element-A".
+-hash table---+
| +----------+ | +----------+ +----------+
| |element-A |-|-->|element-B |-->|element-C |
| +----------+ | +----------+ +----------+
| |element-D | |
| +----------+ |
| . |
| . |
+--------------+
2. copy "element-B" to "element-A".
+-hash table---+
| +----------+ | +----------+ +----------+
| |element-B'|-|-->|element-B |-->|element-C |
| +----------+ | +----------+ +----------+
| |element-D | |
| +----------+ |
| . |
| . |
+--------------+
3. remove "element-B"
The removing cursor point to "element-D".
"element-C" is skipped.
+-hash table---+
| +----------+ | +----------+
| |element-B'|-|-->|element-C |
| +----------+ | +----------+
| |element-D | |
| +----------+ |
| . |
| . |
+--------------+
(3/3) Unnecessary else-statement.
There is else-statement that set NULL to the NULL pointer.
Thanks,
Hiroyuki Kaguchi
Index: hash.c
===================================================================
RCS file: /data/cvs/libvirt/src/hash.c,v
retrieving revision 1.27
diff -u -r1.27 hash.c
--- hash.c 21 Jan 2008 16:29:10 -0000 1.27
+++ hash.c 28 Jan 2008 06:48:09 -0000
@@ -543,6 +543,7 @@
if (prev) {
prev->next = entry->next;
free(entry);
+ entry = prev;
} else {
if (entry->next == NULL) {
entry->valid = 0;
@@ -553,6 +554,7 @@
sizeof(virHashEntry));
free(entry);
entry = NULL;
+ i--;
}
}
table->nbElems--;
@@ -560,8 +562,6 @@
prev = entry;
if (entry) {
entry = entry->next;
- } else {
- entry = NULL;
}
}
}
4
6
On Wed, Feb 06, 2008 at 11:07:55PM +0000, Mark McLoughlin wrote:
> Our strtol() variants are all marked "static inline"
> and with gcc 4.3 we get:
>
> internal.h:272: error: inlining failed in call to 'xstrtol_i': call is unlikely and code size would grow
>
> This patch renames them to virStrToLong() and exports
> them from the library as private symbols.
Hum, I don't like too much adding more exported symbols
> Alternative is to not build with -Winline.
That sounds a weak way to try to avoid a problem, we should
not rely on just compiler options to get the code to compile and link.
My preference would be to use the patch to make them real internal
APIs without exporting all the functions, I think only xstrtol_i is
used by external programs (virsh and qemud), and maybe we can add only
that one to the list of exported symbols.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
3
5
07 Feb '08
Subject: [PATCH] Mark all qemudLog diagnostics for translation.
* po/POTFILES.in: Add names of many new files.
* Makefile.maint (err_func_re): Add qemudLog.
Mark diagnostics with _(...). Split some long lines.
* qemud/qemud.c (remoteCheckCertFile, remoteInitializeGnuTLS):
(qemudDispatchSignalEvent, qemudSetCloseExec, qemudSetNonBlock):
(qemudWritePidFile, qemudListenUnix, remoteMakeSockets):
(remoteListenTCP, qemudInitPaths, qemudInitialize):
(qemudNetworkInit, remoteInitializeTLSSession, remoteCheckDN):
(remoteCheckCertificate, remoteCheckAccess, qemudDispatchServer):
(qemudClientReadBuf, qemudDispatchClientRead):
(qemudClientWriteBuf, qemudDispatchClientWrite, qemudOneLoop):
(remoteConfigGetStringList, checkType, GET_CONF_STR):
(remoteConfigGetAuth, remoteReadConfigFile, main):
* qemud/remote.c (remoteDispatchAuthSaslInit, remoteSASLCheckSSF):
(remoteSASLCheckAccess, remoteDispatchAuthSaslStart):
(remoteDispatchAuthSaslStep, remoteDispatchAuthSaslInit):
(remoteDispatchAuthSaslStart, remoteDispatchAuthSaslStep):
(qemudGetSocketIdentity, remoteDispatchAuthPolkit):
* src/iptables.c (notifyRulesUpdated, MAX_FILE_LEN, iptRulesSave):
(iptRulesReload):
* src/qemu_conf.c (qemudExtractVersionInfo, qemudLoadConfig):
(qemudLoadNetworkConfig, qemudScanConfigDir):
* src/qemu_driver.c (qemudSetCloseExec, qemudSetNonBlock):
(qemudAutostartConfigs, qemudStartup, qemudReload):
(qemudWaitForMonitor, qemudStartVMDaemon, qemudVMData):
(qemudShutdownVMDaemon, qemudStartNetworkDaemon):
(qemudShutdownNetworkDaemon, qemudMonitorCommand):
(qemudDomainUndefine, qemudNetworkUndefine):
* src/uuid.c (virUUIDGenerate):
* src/xm_internal.c (xenXMAttachInterface):
---
Makefile.maint | 2 +-
po/POTFILES.in | 6 ++
qemud/qemud.c | 176 +++++++++++++++++++++++++++++------------------------
qemud/remote.c | 94 +++++++++++++++++------------
src/iptables.c | 21 ++++---
src/qemu_conf.c | 40 ++++++++----
src/qemu_driver.c | 56 +++++++++--------
src/uuid.c | 7 +-
src/xm_internal.c | 10 ++--
9 files changed, 234 insertions(+), 178 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index 9d41bd2..8624328 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -289,7 +289,7 @@ sc_two_space_separator_in_usage:
1>&2; exit 1; } || :
err_func_re = \
-(DISABLE_fprintf|(xmlRpc|vir(Xend|XML|Hash|Conf|Test|LibConn))Error)
+(DISABLE_fprintf|qemudLog|(xmlRpc|vir(Xend|XML|Hash|Conf|Test|LibConn))Error)
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b4b9cd2..a1e78fa 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,12 +1,18 @@
gnulib/lib/gai_strerror.c
+qemud/remote.c
+qemud/qemud.c
src/conf.c
src/console.c
src/hash.c
+src/iptables.c
src/libvirt.c
src/proxy_internal.c
+src/qemu_conf.c
+src/qemu_driver.c
src/remote_internal.c
src/sexpr.c
src/test.c
+src/uuid.c
src/virsh.c
src/virterror.c
src/xen_internal.c
diff --git a/qemud/qemud.c b/qemud/qemud.c
index e853538..b0e2558 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1,7 +1,7 @@
/*
* qemud.c: daemon start of day, guest process & i/o management
*
- * Copyright (C) 2006, 2007 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -137,7 +137,7 @@ remoteCheckCertFile(const char *type, const char *file)
{
struct stat sb;
if (stat(file, &sb) < 0) {
- qemudLog (QEMUD_ERR, "Cannot access %s '%s': %s (%d)",
+ qemudLog (QEMUD_ERR, _("Cannot access %s '%s': %s (%d)"),
type, file, strerror(errno), errno);
return -1;
}
@@ -154,7 +154,7 @@ remoteInitializeGnuTLS (void)
err = gnutls_certificate_allocate_credentials (&x509_cred);
if (err) {
- qemudLog (QEMUD_ERR, "gnutls_certificate_allocate_credentials: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_certificate_allocate_credentials: %s"),
gnutls_strerror (err));
return -1;
}
@@ -167,7 +167,7 @@ remoteInitializeGnuTLS (void)
err = gnutls_certificate_set_x509_trust_file (x509_cred, ca_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- qemudLog (QEMUD_ERR, "gnutls_certificate_set_x509_trust_file: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_certificate_set_x509_trust_file: %s"),
gnutls_strerror (err));
return -1;
}
@@ -181,7 +181,7 @@ remoteInitializeGnuTLS (void)
err = gnutls_certificate_set_x509_crl_file (x509_cred, crl_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- qemudLog (QEMUD_ERR, "gnutls_certificate_set_x509_crl_file: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_certificate_set_x509_crl_file: %s"),
gnutls_strerror (err));
return -1;
}
@@ -199,7 +199,7 @@ remoteInitializeGnuTLS (void)
cert_file, key_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
- qemudLog (QEMUD_ERR, "gnutls_certificate_set_x509_key_file: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_certificate_set_x509_key_file: %s"),
gnutls_strerror (err));
return -1;
}
@@ -212,13 +212,13 @@ remoteInitializeGnuTLS (void)
*/
err = gnutls_dh_params_init (&dh_params);
if (err < 0) {
- qemudLog (QEMUD_ERR, "gnutls_dh_params_init: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_dh_params_init: %s"),
gnutls_strerror (err));
return -1;
}
err = gnutls_dh_params_generate2 (dh_params, DH_BITS);
if (err < 0) {
- qemudLog (QEMUD_ERR, "gnutls_dh_params_generate2: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_dh_params_generate2: %s"),
gnutls_strerror (err));
return -1;
}
@@ -236,7 +236,7 @@ static void qemudDispatchSignalEvent(int fd ATTRIBUTE_UNUSED,
int ret;
if (read(server->sigread, &sigc, 1) != 1) {
- qemudLog(QEMUD_ERR, "Failed to read from signal pipe: %s",
+ qemudLog(QEMUD_ERR, _("Failed to read from signal pipe: %s"),
strerror(errno));
return;
}
@@ -245,15 +245,15 @@ static void qemudDispatchSignalEvent(int fd ATTRIBUTE_UNUSED,
switch (sigc) {
case SIGHUP:
- qemudLog(QEMUD_INFO, "Reloading configuration on SIGHUP");
+ qemudLog(QEMUD_INFO, _("Reloading configuration on SIGHUP"));
if (virStateReload() < 0)
- qemudLog(QEMUD_WARN, "Error while reloading drivers");
+ qemudLog(QEMUD_WARN, _("Error while reloading drivers"));
break;
case SIGINT:
case SIGQUIT:
case SIGTERM:
- qemudLog(QEMUD_WARN, "Shutting down on signal %d", sigc);
+ qemudLog(QEMUD_WARN, _("Shutting down on signal %d"), sigc);
server->shutdown = 1;
break;
@@ -274,7 +274,7 @@ static int qemudSetCloseExec(int fd) {
goto error;
return 0;
error:
- qemudLog(QEMUD_ERR, "Failed to set close-on-exec file descriptor flag");
+ qemudLog(QEMUD_ERR, _("Failed to set close-on-exec file descriptor flag"));
return -1;
}
@@ -288,7 +288,7 @@ static int qemudSetNonBlock(int fd) {
goto error;
return 0;
error:
- qemudLog(QEMUD_ERR, "Failed to set non-blocking file descriptor flag");
+ qemudLog(QEMUD_ERR, _("Failed to set non-blocking file descriptor flag"));
return -1;
}
@@ -430,27 +430,27 @@ static int qemudWritePidFile(const char *pidFile) {
return 0;
if ((fd = open(pidFile, O_WRONLY|O_CREAT|O_EXCL, 0644)) < 0) {
- qemudLog(QEMUD_ERR, "Failed to open pid file '%s' : %s",
+ qemudLog(QEMUD_ERR, _("Failed to open pid file '%s' : %s"),
pidFile, strerror(errno));
return -1;
}
if (!(fh = fdopen(fd, "w"))) {
- qemudLog(QEMUD_ERR, "Failed to fdopen pid file '%s' : %s",
+ qemudLog(QEMUD_ERR, _("Failed to fdopen pid file '%s' : %s"),
pidFile, strerror(errno));
close(fd);
return -1;
}
if (fprintf(fh, "%lu\n", (unsigned long)getpid()) < 0) {
- qemudLog(QEMUD_ERR, "Failed to write to pid file '%s' : %s",
+ qemudLog(QEMUD_ERR, _("Failed to write to pid file '%s' : %s"),
pidFile, strerror(errno));
close(fd);
return -1;
}
if (fclose(fh) == EOF) {
- qemudLog(QEMUD_ERR, "Failed to close pid file '%s' : %s",
+ qemudLog(QEMUD_ERR, _("Failed to close pid file '%s' : %s"),
pidFile, strerror(errno));
return -1;
}
@@ -466,7 +466,8 @@ static int qemudListenUnix(struct qemud_server *server,
gid_t oldgrp;
if (!sock) {
- qemudLog(QEMUD_ERR, "Failed to allocate memory for struct qemud_socket");
+ qemudLog(QEMUD_ERR,
+ _("Failed to allocate memory for struct qemud_socket"));
return -1;
}
@@ -476,7 +477,7 @@ static int qemudListenUnix(struct qemud_server *server,
sock->auth = auth;
if ((sock->fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- qemudLog(QEMUD_ERR, "Failed to create socket: %s",
+ qemudLog(QEMUD_ERR, _("Failed to create socket: %s"),
strerror(errno));
goto cleanup;
}
@@ -498,7 +499,7 @@ static int qemudListenUnix(struct qemud_server *server,
setgid(unix_sock_gid);
if (bind(sock->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- qemudLog(QEMUD_ERR, "Failed to bind socket to '%s': %s",
+ qemudLog(QEMUD_ERR, _("Failed to bind socket to '%s': %s"),
path, strerror(errno));
goto cleanup;
}
@@ -507,7 +508,7 @@ static int qemudListenUnix(struct qemud_server *server,
setgid(oldgrp);
if (listen(sock->fd, 30) < 0) {
- qemudLog(QEMUD_ERR, "Failed to listen for connections on '%s': %s",
+ qemudLog(QEMUD_ERR, _("Failed to listen for connections on '%s': %s"),
path, strerror(errno));
goto cleanup;
}
@@ -516,7 +517,7 @@ static int qemudListenUnix(struct qemud_server *server,
POLLIN| POLLERR | POLLHUP,
qemudDispatchServerEvent,
server) < 0) {
- qemudLog(QEMUD_ERR, "Failed to add server event callback");
+ qemudLog(QEMUD_ERR, _("Failed to add server event callback"));
goto cleanup;
}
@@ -545,7 +546,7 @@ remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *service)
int e = getaddrinfo (NULL, service, &hints, &ai);
if (e != 0) {
- qemudLog (QEMUD_ERR, "getaddrinfo: %s\n", gai_strerror (e));
+ qemudLog (QEMUD_ERR, _("getaddrinfo: %s\n"), gai_strerror (e));
return -1;
}
@@ -554,7 +555,7 @@ remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *service)
fds[*nfds_r] = socket (runp->ai_family, runp->ai_socktype,
runp->ai_protocol);
if (fds[*nfds_r] == -1) {
- qemudLog (QEMUD_ERR, "socket: %s", strerror (errno));
+ qemudLog (QEMUD_ERR, _("socket: %s"), strerror (errno));
return -1;
}
@@ -563,14 +564,14 @@ remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *service)
if (bind (fds[*nfds_r], runp->ai_addr, runp->ai_addrlen) == -1) {
if (errno != EADDRINUSE) {
- qemudLog (QEMUD_ERR, "bind: %s", strerror (errno));
+ qemudLog (QEMUD_ERR, _("bind: %s"), strerror (errno));
return -1;
}
close (fds[*nfds_r]);
}
else {
if (listen (fds[*nfds_r], SOMAXCONN) == -1) {
- qemudLog (QEMUD_ERR, "listen: %s", strerror (errno));
+ qemudLog (QEMUD_ERR, _("listen: %s"), strerror (errno));
return -1;
}
++*nfds_r;
@@ -607,7 +608,7 @@ remoteListenTCP (struct qemud_server *server,
if (!sock) {
qemudLog (QEMUD_ERR,
- "remoteListenTCP: calloc: %s", strerror (errno));
+ _("remoteListenTCP: calloc: %s"), strerror (errno));
return -1;
}
@@ -638,7 +639,7 @@ remoteListenTCP (struct qemud_server *server,
if (listen (sock->fd, 30) < 0) {
qemudLog (QEMUD_ERR,
- "remoteListenTCP: listen: %s", strerror (errno));
+ _("remoteListenTCP: listen: %s"), strerror (errno));
return -1;
}
@@ -646,7 +647,7 @@ remoteListenTCP (struct qemud_server *server,
POLLIN| POLLERR | POLLHUP,
qemudDispatchServerEvent,
server) < 0) {
- qemudLog(QEMUD_ERR, "Failed to add server event callback");
+ qemudLog(QEMUD_ERR, _("Failed to add server event callback"));
return -1;
}
@@ -680,7 +681,7 @@ static int qemudInitPaths(struct qemud_server *server,
struct passwd *pw;
if (!(pw = getpwuid(uid))) {
- qemudLog(QEMUD_ERR, "Failed to find user record for uid '%d': %s",
+ qemudLog(QEMUD_ERR, _("Failed to find user record for uid '%d': %s"),
uid, strerror(errno));
return -1;
}
@@ -696,7 +697,8 @@ static int qemudInitPaths(struct qemud_server *server,
return 0;
snprintf_error:
- qemudLog(QEMUD_ERR, "Resulting path to long for buffer in qemudInitPaths()");
+ qemudLog(QEMUD_ERR,
+ _("Resulting path to long for buffer in qemudInitPaths()"));
return -1;
}
@@ -704,7 +706,7 @@ static struct qemud_server *qemudInitialize(int sigread) {
struct qemud_server *server;
if (!(server = calloc(1, sizeof(*server)))) {
- qemudLog(QEMUD_ERR, "Failed to allocate struct qemud_server");
+ qemudLog(QEMUD_ERR, _("Failed to allocate struct qemud_server"));
return NULL;
}
@@ -747,7 +749,8 @@ static struct qemud_server *qemudNetworkInit(struct qemud_server *server) {
auth_tcp == REMOTE_AUTH_SASL ||
auth_tls == REMOTE_AUTH_SASL) {
if ((err = sasl_server_init(NULL, "libvirt")) != SASL_OK) {
- qemudLog(QEMUD_ERR, "Failed to initialize SASL authentication %s",
+ qemudLog(QEMUD_ERR,
+ _("Failed to initialize SASL authentication %s"),
sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -761,7 +764,8 @@ static struct qemud_server *qemudNetworkInit(struct qemud_server *server) {
dbus_error_init(&derr);
server->sysbus = dbus_bus_get(DBUS_BUS_SYSTEM, &derr);
if (!(server->sysbus)) {
- qemudLog(QEMUD_ERR, "Failed to connect to system bus for PolicyKit auth: %s",
+ qemudLog(QEMUD_ERR,
+ _("Failed to connect to system bus for PolicyKit auth: %s"),
derr.message);
dbus_error_free(&derr);
goto cleanup;
@@ -872,7 +876,7 @@ remoteInitializeTLSSession (void)
return session;
failed:
- qemudLog (QEMUD_ERR, "remoteInitializeTLSSession: %s",
+ qemudLog (QEMUD_ERR, _("remoteInitializeTLSSession: %s"),
gnutls_strerror (err));
return NULL;
}
@@ -889,7 +893,7 @@ remoteCheckDN (gnutls_x509_crt_t cert)
err = gnutls_x509_crt_get_dn (cert, name, &namesize);
if (err != 0) {
qemudLog (QEMUD_ERR,
- "remoteCheckDN: gnutls_x509_cert_get_dn: %s",
+ _("remoteCheckDN: gnutls_x509_cert_get_dn: %s"),
gnutls_strerror (err));
return 0;
}
@@ -908,7 +912,7 @@ remoteCheckDN (gnutls_x509_crt_t cert)
#ifdef ENABLE_DEBUG
/* Print the client's DN. */
qemudLog (QEMUD_DEBUG,
- "remoteCheckDN: failed: client DN is %s", name);
+ _("remoteCheckDN: failed: client DN is %s"), name);
#endif
return 0; // Not found.
@@ -924,36 +928,42 @@ remoteCheckCertificate (gnutls_session_t session)
time_t now;
if ((ret = gnutls_certificate_verify_peers2 (session, &status)) < 0){
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: verify failed: %s",
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: verify failed: %s"),
gnutls_strerror (ret));
return -1;
}
if (status != 0) {
if (status & GNUTLS_CERT_INVALID)
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: the client certificate is not trusted.");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
+ "the client certificate is not trusted."));
if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: the client certificate hasn't got a known issuer.");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: the client "
+ "certificate has unknown issuer."));
if (status & GNUTLS_CERT_REVOKED)
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: the client certificate has been revoked.");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
+ "the client certificate has been revoked."));
#ifndef GNUTLS_1_0_COMPAT
if (status & GNUTLS_CERT_INSECURE_ALGORITHM)
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: the client certificate uses an insecure algorithm.");
+ qemudLog (QEMUD_ERR,
+ _("remoteCheckCertificate: the client certificate"
+ " uses an insecure algorithm."));
#endif
return -1;
}
if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) {
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: certificate is not X.509");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
+ "certificate is not X.509"));
return -1;
}
if (!(certs = gnutls_certificate_get_peers(session, &nCerts))) {
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: no peers");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: no peers"));
return -1;
}
@@ -963,7 +973,8 @@ remoteCheckCertificate (gnutls_session_t session)
gnutls_x509_crt_t cert;
if (gnutls_x509_crt_init (&cert) < 0) {
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: gnutls_x509_crt_init failed");
+ qemudLog (QEMUD_ERR,
+ _("remoteCheckCertificate: gnutls_x509_crt_init failed"));
return -1;
}
@@ -973,13 +984,15 @@ remoteCheckCertificate (gnutls_session_t session)
}
if (gnutls_x509_crt_get_expiration_time (cert) < now) {
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: the client certificate has expired");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
+ "the client certificate has expired"));
gnutls_x509_crt_deinit (cert);
return -1;
}
if (gnutls_x509_crt_get_activation_time (cert) > now) {
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: the client certificate is not yet activated");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: the client "
+ "certificate is not yet activated"));
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -987,7 +1000,7 @@ remoteCheckCertificate (gnutls_session_t session)
if (i == 0) {
if (!remoteCheckDN (cert)) {
/* This is the most common error: make it informative. */
- qemudLog (QEMUD_ERR, "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.");
+ qemudLog (QEMUD_ERR, _("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."));
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -1003,9 +1016,9 @@ remoteCheckAccess (struct qemud_client *client)
{
/* Verify client certificate. */
if (remoteCheckCertificate (client->tlssession) == -1) {
- qemudLog (QEMUD_ERR, "remoteCheckCertificate: failed to verify client's certificate");
+ qemudLog (QEMUD_ERR, _("remoteCheckCertificate: failed to verify client's certificate"));
if (!tls_no_verify_certificate) return -1;
- else qemudLog (QEMUD_INFO, "remoteCheckCertificate: tls_no_verify_certificate is set so the bad certificate is ignored");
+ else qemudLog (QEMUD_INFO, _("remoteCheckCertificate: tls_no_verify_certificate is set so the bad certificate is ignored"));
}
/* Checks have succeeded. Write a '\1' byte back to the client to
@@ -1029,7 +1042,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
if ((fd = accept(sock->fd, (struct sockaddr *)&addr, &addrlen)) < 0) {
if (errno == EAGAIN)
return 0;
- qemudLog(QEMUD_ERR, "Failed to accept connection: %s", strerror(errno));
+ qemudLog(QEMUD_ERR, _("Failed to accept connection: %s"), strerror(errno));
return -1;
}
@@ -1087,7 +1100,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
if (qemudRegisterClientEvent (server, client, 0) < 0)
goto cleanup;
} else {
- qemudLog (QEMUD_ERR, "TLS handshake failed: %s",
+ qemudLog (QEMUD_ERR, _("TLS handshake failed: %s"),
gnutls_strerror (ret));
goto cleanup;
}
@@ -1152,7 +1165,7 @@ static int qemudClientReadBuf(struct qemud_server *server,
if ((ret = read (client->fd, data, len)) <= 0) {
if (ret == 0 || errno != EAGAIN) {
if (ret != 0)
- qemudLog (QEMUD_ERR, "read: %s", strerror (errno));
+ qemudLog (QEMUD_ERR, _("read: %s"), strerror (errno));
qemudDispatchClientFailure(server, client);
}
return -1;
@@ -1165,7 +1178,7 @@ static int qemudClientReadBuf(struct qemud_server *server,
if (ret == 0 || (ret != GNUTLS_E_AGAIN &&
ret != GNUTLS_E_INTERRUPTED)) {
if (ret != 0)
- qemudLog (QEMUD_ERR, "gnutls_record_recv: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_record_recv: %s"),
gnutls_strerror (ret));
qemudDispatchClientFailure (server, client);
}
@@ -1324,7 +1337,7 @@ static void qemudDispatchClientRead(struct qemud_server *server, struct qemud_cl
else if (qemudRegisterClientEvent (server, client, 1) < 0)
qemudDispatchClientFailure (server, client);
} else if (ret != GNUTLS_E_AGAIN && ret != GNUTLS_E_INTERRUPTED) {
- qemudLog (QEMUD_ERR, "TLS handshake failed: %s",
+ qemudLog (QEMUD_ERR, _("TLS handshake failed: %s"),
gnutls_strerror (ret));
qemudDispatchClientFailure (server, client);
} else {
@@ -1349,7 +1362,7 @@ static int qemudClientWriteBuf(struct qemud_server *server,
if (!client->tlssession) {
if ((ret = write(client->fd, data, len)) == -1) {
if (errno != EAGAIN) {
- qemudLog (QEMUD_ERR, "write: %s", strerror (errno));
+ qemudLog (QEMUD_ERR, _("write: %s"), strerror (errno));
qemudDispatchClientFailure(server, client);
}
return -1;
@@ -1360,7 +1373,7 @@ static int qemudClientWriteBuf(struct qemud_server *server,
qemudDispatchClientFailure (server, client);
else if (ret < 0) {
if (ret != GNUTLS_E_INTERRUPTED && ret != GNUTLS_E_AGAIN) {
- qemudLog (QEMUD_ERR, "gnutls_record_send: %s",
+ qemudLog (QEMUD_ERR, _("gnutls_record_send: %s"),
gnutls_strerror (ret));
qemudDispatchClientFailure (server, client);
}
@@ -1464,7 +1477,7 @@ static void qemudDispatchClientWrite(struct qemud_server *server, struct qemud_c
else if (qemudRegisterClientEvent (server, client, 1))
qemudDispatchClientFailure (server, client);
} else if (ret != GNUTLS_E_AGAIN && ret != GNUTLS_E_INTERRUPTED) {
- qemudLog (QEMUD_ERR, "TLS handshake failed: %s",
+ qemudLog (QEMUD_ERR, _("TLS handshake failed: %s"),
gnutls_strerror (ret));
qemudDispatchClientFailure (server, client);
} else {
@@ -1572,7 +1585,7 @@ static int qemudOneLoop(void) {
if (errors) {
sig_errors -= errors;
qemudLog (QEMUD_ERR,
- "Signal handler reported %d errors: last error: %s",
+ _("Signal handler reported %d errors: last error: %s"),
errors, strerror (sig_lasterrno));
return -1;
}
@@ -1668,14 +1681,14 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
list = malloc (2 * sizeof (*list));
if (list == NULL) {
qemudLog (QEMUD_ERR,
- "failed to allocate memory for %s config list", key);
+ _("failed to allocate memory for %s config list"), key);
return -1;
}
list[0] = strdup (p->str);
list[1] = NULL;
if (list[0] == NULL) {
qemudLog (QEMUD_ERR,
- "failed to allocate memory for %s config list value",
+ _("failed to allocate memory for %s config list value"),
key);
free (list);
return -1;
@@ -1690,13 +1703,13 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
list = calloc (1+len, sizeof (*list));
if (list == NULL) {
qemudLog (QEMUD_ERR,
- "failed to allocate memory for %s config list", key);
+ _("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) {
- qemudLog (QEMUD_ERR, "remoteReadConfigFile: %s: %s:"
- " must be a string or list of strings\n",
+ qemudLog (QEMUD_ERR, _("remoteReadConfigFile: %s: %s:"
+ " must be a string or list of strings\n"),
filename, key);
free (list);
return -1;
@@ -1707,8 +1720,8 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
for (j = 0 ; j < i ; j++)
free (list[j]);
free (list);
- qemudLog (QEMUD_ERR, "failed to allocate memory"
- " for %s config list value", key);
+ qemudLog (QEMUD_ERR, _("failed to allocate memory"
+ " for %s config list value"), key);
return -1;
}
@@ -1718,8 +1731,8 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
}
default:
- qemudLog (QEMUD_ERR, "remoteReadConfigFile: %s: %s:"
- " must be a string or list of strings\n",
+ qemudLog (QEMUD_ERR, _("remoteReadConfigFile: %s: %s:"
+ " must be a string or list of strings\n"),
filename, key);
return -1;
}
@@ -1735,8 +1748,8 @@ checkType (virConfValuePtr p, const char *filename,
{
if (p->type != required_type) {
qemudLog (QEMUD_ERR,
- "remoteReadConfigFile: %s: %s: invalid type:"
- " got %s; expected %s\n", filename, key,
+ _("remoteReadConfigFile: %s: %s: invalid type:"
+ " got %s; expected %s\n"), filename, key,
virConfTypeName (p->type),
virConfTypeName (required_type));
return -1;
@@ -1756,7 +1769,7 @@ checkType (virConfValuePtr p, const char *filename,
goto free_and_fail; \
(var_name) = strdup (p->str); \
if ((var_name) == NULL) { \
- qemudLog (QEMUD_ERR, "remoteReadConfigFile: %s\n", \
+ qemudLog (QEMUD_ERR, _("remoteReadConfigFile: %s\n"), \
strerror (errno)); \
goto free_and_fail; \
} \
@@ -1799,7 +1812,9 @@ static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, cons
*auth = REMOTE_AUTH_POLKIT;
#endif
} else {
- qemudLog (QEMUD_ERR, "remoteReadConfigFile: %s: %s: unsupported auth %s\n", filename, key, p->str);
+ qemudLog (QEMUD_ERR,
+ _("remoteReadConfigFile: %s: %s: unsupported auth %s\n"),
+ filename, key, p->str);
return -1;
}
@@ -1873,11 +1888,12 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
GET_CONF_STR (conf, filename, unix_sock_group);
if (unix_sock_group) {
if (getuid() != 0) {
- qemudLog (QEMUD_WARN, "Cannot set group when not running as root");
+ qemudLog (QEMUD_WARN,
+ _("Cannot set group when not running as root"));
} else {
struct group *grp = getgrnam(unix_sock_group);
if (!grp) {
- qemudLog (QEMUD_ERR, "Failed to lookup group '%s'",
+ qemudLog (QEMUD_ERR, _("Failed to lookup group '%s'"),
unix_sock_group);
goto free_and_fail;
}
@@ -1890,7 +1906,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
GET_CONF_STR (conf, filename, unix_sock_ro_perms);
if (unix_sock_ro_perms) {
if (xstrtol_i (unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) {
- qemudLog (QEMUD_ERR, "Failed to parse mode '%s'",
+ qemudLog (QEMUD_ERR, _("Failed to parse mode '%s'"),
unix_sock_ro_perms);
goto free_and_fail;
}
@@ -1901,7 +1917,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
GET_CONF_STR (conf, filename, unix_sock_rw_perms);
if (unix_sock_rw_perms) {
if (xstrtol_i (unix_sock_rw_perms, NULL, 8, &unix_sock_rw_mask) != 0) {
- qemudLog (QEMUD_ERR, "Failed to parse mode '%s'",
+ qemudLog (QEMUD_ERR, _("Failed to parse mode '%s'"),
unix_sock_rw_perms);
goto free_and_fail;
}
@@ -2074,7 +2090,7 @@ int main(int argc, char **argv) {
if (pipe(sigpipe) < 0 ||
qemudSetNonBlock(sigpipe[0]) < 0 ||
qemudSetNonBlock(sigpipe[1]) < 0) {
- qemudLog(QEMUD_ERR, "Failed to create pipe: %s",
+ qemudLog(QEMUD_ERR, _("Failed to create pipe: %s"),
strerror(errno));
goto error1;
}
@@ -2094,7 +2110,7 @@ int main(int argc, char **argv) {
openlog("libvirtd", 0, 0);
pid = qemudGoDaemon();
if (pid < 0) {
- qemudLog(QEMUD_ERR, "Failed to fork as daemon: %s",
+ qemudLog(QEMUD_ERR, _("Failed to fork as daemon: %s"),
strerror(errno));
goto error1;
}
@@ -2128,7 +2144,7 @@ int main(int argc, char **argv) {
POLLIN,
qemudDispatchSignalEvent,
server) < 0) {
- qemudLog(QEMUD_ERR, "Failed to register callback for signal pipe");
+ qemudLog(QEMUD_ERR, _("Failed to register callback for signal pipe"));
ret = 3;
goto error2;
}
diff --git a/qemud/remote.c b/qemud/remote.c
index 57f8f29..f89a490 100644
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -1,7 +1,7 @@
/*
* remote.c: code handling remote requests (from remote_internal.c)
*
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2008 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -2126,7 +2126,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
REMOTE_DEBUG("Initialize SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn != NULL) {
- qemudLog(QEMUD_ERR, "client tried invalid SASL init request");
+ qemudLog(QEMUD_ERR, _("client tried invalid SASL init request"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2166,7 +2166,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
free(localAddr);
free(remoteAddr);
if (err != SASL_OK) {
- qemudLog(QEMUD_ERR, "sasl context setup failed %d (%s)",
+ qemudLog(QEMUD_ERR, _("sasl context setup failed %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
remoteDispatchFailAuth(client, req);
client->saslconn = NULL;
@@ -2180,7 +2180,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
cipher = gnutls_cipher_get(client->tlssession);
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
- qemudLog(QEMUD_ERR, "cannot TLS get cipher size");
+ qemudLog(QEMUD_ERR, _("cannot TLS get cipher size"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2190,7 +2190,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
err = sasl_setprop(client->saslconn, SASL_SSF_EXTERNAL, &ssf);
if (err != SASL_OK) {
- qemudLog(QEMUD_ERR, "cannot set SASL external SSF %d (%s)",
+ qemudLog(QEMUD_ERR, _("cannot set SASL external SSF %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
@@ -2219,7 +2219,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
err = sasl_setprop(client->saslconn, SASL_SEC_PROPS, &secprops);
if (err != SASL_OK) {
- qemudLog(QEMUD_ERR, "cannot set SASL security props %d (%s)",
+ qemudLog(QEMUD_ERR, _("cannot set SASL security props %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
@@ -2236,7 +2236,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
NULL,
NULL);
if (err != SASL_OK) {
- qemudLog(QEMUD_ERR, "cannot list SASL mechanisms %d (%s)",
+ qemudLog(QEMUD_ERR, _("cannot list SASL mechanisms %d (%s)"),
err, sasl_errdetail(client->saslconn));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
@@ -2246,7 +2246,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
REMOTE_DEBUG("Available mechanisms for client: '%s'", mechlist);
ret->mechlist = strdup(mechlist);
if (!ret->mechlist) {
- qemudLog(QEMUD_ERR, "cannot allocate mechlist");
+ qemudLog(QEMUD_ERR, _("cannot allocate mechlist"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2271,7 +2271,7 @@ remoteSASLCheckSSF (struct qemud_client *client,
err = sasl_getprop(client->saslconn, SASL_SSF, &val);
if (err != SASL_OK) {
- qemudLog(QEMUD_ERR, "cannot query SASL ssf on connection %d (%s)",
+ qemudLog(QEMUD_ERR, _("cannot query SASL ssf on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
@@ -2281,7 +2281,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 */
- qemudLog(QEMUD_ERR, "negotiated SSF %d was not strong enough", ssf);
+ qemudLog(QEMUD_ERR, _("negotiated SSF %d was not strong enough"), ssf);
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2310,7 +2310,8 @@ remoteSASLCheckAccess (struct qemud_server *server,
err = sasl_getprop(client->saslconn, SASL_USERNAME, &val);
if (err != SASL_OK) {
- qemudLog(QEMUD_ERR, "cannot query SASL username on connection %d (%s)",
+ qemudLog(QEMUD_ERR,
+ _("cannot query SASL username on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
@@ -2318,7 +2319,7 @@ remoteSASLCheckAccess (struct qemud_server *server,
return -1;
}
if (val == NULL) {
- qemudLog(QEMUD_ERR, "no client username was found");
+ qemudLog(QEMUD_ERR, _("no client username was found"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2328,7 +2329,7 @@ remoteSASLCheckAccess (struct qemud_server *server,
client->saslUsername = strdup((const char*)val);
if (client->saslUsername == NULL) {
- qemudLog(QEMUD_ERR, "out of memory copying username");
+ qemudLog(QEMUD_ERR, _("out of memory copying username"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2347,7 +2348,8 @@ remoteSASLCheckAccess (struct qemud_server *server,
}
/* Denied */
- qemudLog(QEMUD_ERR, "SASL client %s not allowed in whitelist", client->saslUsername);
+ qemudLog(QEMUD_ERR, _("SASL client %s not allowed in whitelist"),
+ client->saslUsername);
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2372,7 +2374,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
REMOTE_DEBUG("Start SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
- qemudLog(QEMUD_ERR, "client tried invalid SASL start request");
+ qemudLog(QEMUD_ERR, _("client tried invalid SASL start request"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2388,7 +2390,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
&serveroutlen);
if (err != SASL_OK &&
err != SASL_CONTINUE) {
- qemudLog(QEMUD_ERR, "sasl start failed %d (%s)",
+ qemudLog(QEMUD_ERR, _("sasl start failed %d (%s)"),
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2396,7 +2398,8 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
return -2;
}
if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) {
- qemudLog(QEMUD_ERR, "sasl start reply data too long %d", serveroutlen);
+ qemudLog(QEMUD_ERR, _("sasl start reply data too long %d"),
+ serveroutlen);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
remoteDispatchFailAuth(client, req);
@@ -2451,7 +2454,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
REMOTE_DEBUG("Step SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
- qemudLog(QEMUD_ERR, "client tried invalid SASL start request");
+ qemudLog(QEMUD_ERR, _("client tried invalid SASL start request"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2466,7 +2469,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
&serveroutlen);
if (err != SASL_OK &&
err != SASL_CONTINUE) {
- qemudLog(QEMUD_ERR, "sasl step failed %d (%s)",
+ qemudLog(QEMUD_ERR, _("sasl step failed %d (%s)"),
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2475,7 +2478,8 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
}
if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) {
- qemudLog(QEMUD_ERR, "sasl step reply data too long %d", serveroutlen);
+ qemudLog(QEMUD_ERR, _("sasl step reply data too long %d"),
+ serveroutlen);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
remoteDispatchFailAuth(client, req);
@@ -2524,7 +2528,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED)
{
- qemudLog(QEMUD_ERR, "client tried unsupported SASL init request");
+ qemudLog(QEMUD_ERR, _("client tried unsupported SASL init request"));
remoteDispatchFailAuth(client, req);
return -1;
}
@@ -2536,7 +2540,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED)
{
- qemudLog(QEMUD_ERR, "client tried unsupported SASL start request");
+ qemudLog(QEMUD_ERR, _("client tried unsupported SASL start request"));
remoteDispatchFailAuth(client, req);
return -1;
}
@@ -2548,7 +2552,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED)
{
- qemudLog(QEMUD_ERR, "client tried unsupported SASL step request");
+ qemudLog(QEMUD_ERR, _("client tried unsupported SASL step request"));
remoteDispatchFailAuth(client, req);
return -1;
}
@@ -2562,7 +2566,8 @@ static int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid) {
unsigned int cr_len = sizeof (cr);
if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) < 0) {
- qemudLog(QEMUD_ERR, "Failed to verify client credentials: %s", strerror(errno));
+ qemudLog(QEMUD_ERR, _("Failed to verify client credentials: %s"),
+ strerror(errno));
return -1;
}
@@ -2588,13 +2593,13 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
REMOTE_DEBUG("Start PolicyKit auth %d", client->fd);
if (client->auth != REMOTE_AUTH_POLKIT) {
- qemudLog(QEMUD_ERR, "client tried invalid PolicyKit init request");
+ qemudLog(QEMUD_ERR, _("client tried invalid PolicyKit init request"));
remoteDispatchFailAuth(client, req);
return -2;
}
if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) {
- qemudLog(QEMUD_ERR, "cannot get peer socket identity");
+ qemudLog(QEMUD_ERR, _("cannot get peer socket identity"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2604,7 +2609,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
change policykit policy anyway, so its pointless trying
to restrict root */
if (callerUid == 0) {
- qemudLog(QEMUD_INFO, "Allowing PID %d running as root", callerPid);
+ qemudLog(QEMUD_INFO, _("Allowing PID %d running as root"), callerPid);
ret->complete = 1;
client->auth = REMOTE_AUTH_NONE;
} else {
@@ -2618,17 +2623,21 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
"org.libvirt.unix.monitor" :
"org.libvirt.unix.manage";
- qemudLog(QEMUD_INFO, "Checking PID %d running as %d", callerPid, callerUid);
+ qemudLog(QEMUD_INFO, _("Checking PID %d running as %d"),
+ callerPid, callerUid);
dbus_error_init(&err);
- if (!(pkcaller = polkit_caller_new_from_pid(server->sysbus, callerPid, &err))) {
- qemudLog(QEMUD_ERR, "Failed to lookup policy kit caller: %s", err.message);
+ if (!(pkcaller = polkit_caller_new_from_pid(server->sysbus,
+ callerPid, &err))) {
+ qemudLog(QEMUD_ERR, _("Failed to lookup policy kit caller: %s"),
+ err.message);
dbus_error_free(&err);
remoteDispatchFailAuth(client, req);
return -2;
}
if (!(pkaction = polkit_action_new())) {
- qemudLog(QEMUD_ERR, "Failed to create polkit action %s\n", strerror(errno));
+ qemudLog(QEMUD_ERR, _("Failed to create polkit action %s\n"),
+ strerror(errno));
polkit_caller_unref(pkcaller);
remoteDispatchFailAuth(client, req);
return -2;
@@ -2637,8 +2646,9 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
if (!(pkcontext = polkit_context_new()) ||
!polkit_context_init(pkcontext, &pkerr)) {
- qemudLog(QEMUD_ERR, "Failed to create polkit context %s\n",
- pkerr ? polkit_error_get_error_message(pkerr) : strerror(errno));
+ qemudLog(QEMUD_ERR, _("Failed to create polkit context %s\n"),
+ (pkerr ? polkit_error_get_error_message(pkerr)
+ : strerror(errno));
if (pkerr)
polkit_error_free(pkerr);
polkit_caller_unref(pkcaller);
@@ -2648,18 +2658,24 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
return -2;
}
- pkresult = polkit_context_can_caller_do_action(pkcontext, pkaction, pkcaller);
+ pkresult = polkit_context_can_caller_do_action(pkcontext, pkaction,
+ pkcaller);
polkit_context_unref(pkcontext);
polkit_caller_unref(pkcaller);
polkit_action_unref(pkaction);
if (pkresult != POLKIT_RESULT_YES) {
- qemudLog(QEMUD_ERR, "Policy kit denied action %s from pid %d, uid %d, result: %s\n",
- action, callerPid, callerUid, polkit_result_to_string_representation(pkresult));
+ qemudLog(QEMUD_ERR,
+ _("Policy kit denied action %s from pid %d, uid %d,"
+ " result: %s\n"),
+ action, callerPid, callerUid,
+ polkit_result_to_string_representation(pkresult));
remoteDispatchFailAuth(client, req);
return -2;
}
- qemudLog(QEMUD_INFO, "Policy allowed action %s from pid %d, uid %d, result %s",
- action, callerPid, callerUid, polkit_result_to_string_representation(pkresult));
+ qemudLog(QEMUD_INFO,
+ _("Policy allowed action %s from pid %d, uid %d, result %s"),
+ action, callerPid, callerUid,
+ polkit_result_to_string_representation(pkresult));
ret->complete = 1;
client->auth = REMOTE_AUTH_NONE;
}
@@ -2676,7 +2692,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED)
{
- qemudLog(QEMUD_ERR, "client tried unsupported PolicyKit init request");
+ qemudLog(QEMUD_ERR, _("client tried unsupported PolicyKit init request"));
remoteDispatchFailAuth(client, req);
return -1;
}
diff --git a/src/iptables.c b/src/iptables.c
index dc2225a..1d93bcc 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2008 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -100,8 +100,8 @@ notifyRulesUpdated(const char *table,
argv[3] = NULL;
if (virRun(NULL, argv, NULL) < 0)
- qemudLog(QEMUD_WARN, "Failed to run '" LOKKIT_PATH " %s' : %s",
- arg, strerror(errno));
+ qemudLog(QEMUD_WARN, _("Failed to run '" LOKKIT_PATH
+ " %s' : %s"), arg, strerror(errno));
}
static int
@@ -148,7 +148,8 @@ notifyRulesRemoved(const char *table,
len = virFileReadAll(SYSCONF_DIR "/sysconfig/system-config-firewall",
MAX_FILE_LEN, &content);
if (len < 0) {
- qemudLog(QEMUD_WARN, "Failed to read " SYSCONF_DIR "/sysconfig/system-config-firewall");
+ qemudLog(QEMUD_WARN, _("Failed to read " SYSCONF_DIR
+ "/sysconfig/system-config-firewall"));
return;
}
@@ -175,7 +176,8 @@ notifyRulesRemoved(const char *table,
return;
write_error:
- qemudLog(QEMUD_WARN, "Failed to write to " SYSCONF_DIR "/sysconfig/system-config-firewall : %s",
+ qemudLog(QEMUD_WARN, _("Failed to write to " SYSCONF_DIR
+ "/sysconfig/system-config-firewall : %s"),
strerror(errno));
if (f)
fclose(f);
@@ -239,7 +241,7 @@ iptRulesSave(iptRules *rules)
int err;
if ((err = writeRules(rules->path, rules->rules, rules->nrules))) {
- qemudLog(QEMUD_WARN, "Failed to saves iptables rules to %s : %s",
+ qemudLog(QEMUD_WARN, _("Failed to saves iptables rules to %s : %s"),
rules->path, strerror(err));
return;
}
@@ -577,7 +579,9 @@ iptRulesReload(iptRules *rules)
rule->argv[rule->command_idx] = (char *) "--delete";
if (virRun(NULL, rule->argv, NULL) < 0)
- qemudLog(QEMUD_WARN, "Failed to remove iptables rule '%s' from chain '%s' in table '%s': %s",
+ qemudLog(QEMUD_WARN,
+ _("Failed to remove iptables rule '%s'"
+ " from chain '%s' in table '%s': %s"),
rule->rule, rules->chain, rules->table, strerror(errno));
rule->argv[rule->command_idx] = orig;
@@ -585,7 +589,8 @@ iptRulesReload(iptRules *rules)
for (i = 0; i < rules->nrules; i++)
if (virRun(NULL, rules->rules[i].argv, NULL) < 0)
- qemudLog(QEMUD_WARN, "Failed to add iptables rule '%s' to chain '%s' in table '%s': %s",
+ qemudLog(QEMUD_WARN, _("Failed to add iptables rule '%s'"
+ " to chain '%s' in table '%s': %s"),
rules->rules[i].rule, rules->chain, rules->table, strerror(errno));
}
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index aba8890..e39c7bc 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -410,14 +410,18 @@ static int qemudExtractVersionInfo(const char *qemu, int *version, int *flags) {
if (errno == EINTR) {
goto rewait;
}
- qemudLog(QEMUD_ERR, "Unexpected exit status from qemu %d pid %lu", got, (unsigned long)child);
+ qemudLog(QEMUD_ERR,
+ _("Unexpected exit status from qemu %d pid %lu"),
+ got, (unsigned long)child);
ret = -1;
}
/* Check & log unexpected exit status, but don't fail,
* as there's really no need to throw an error if we did
* actually read a valid version number above */
if (WEXITSTATUS(got) != 1) {
- qemudLog(QEMUD_WARN, "Unexpected exit status '%d', qemu probably failed", got);
+ qemudLog(QEMUD_WARN,
+ _("Unexpected exit status '%d', qemu probably failed"),
+ got);
}
return ret;
@@ -2510,21 +2514,25 @@ qemudLoadConfig(struct qemud_driver *driver,
if (!(def = qemudParseVMDef(NULL, driver, xml, file))) {
virErrorPtr err = virGetLastError();
- qemudLog(QEMUD_WARN, "Error parsing QEMU guest config '%s' : %s",
- path, err ? err->message :
- "BUG: unknown error - please report it\n");
+ qemudLog(QEMUD_WARN, _("Error parsing QEMU guest config '%s' : %s"),
+ path, (err ? err->message :
+ _("BUG: unknown error - please report it\n")));
return NULL;
}
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
- qemudLog(QEMUD_WARN, "QEMU guest config filename '%s' does not match guest name '%s'",
+ qemudLog(QEMUD_WARN,
+ _("QEMU guest config filename '%s'"
+ " does not match guest name '%s'"),
path, def->name);
qemudFreeVMDef(def);
return NULL;
}
if (!(vm = qemudAssignVMDef(NULL, driver, def))) {
- qemudLog(QEMUD_WARN, "Failed to load QEMU guest config '%s': out of memory", path);
+ qemudLog(QEMUD_WARN,
+ _("Failed to load QEMU guest config '%s': out of memory"),
+ path);
qemudFreeVMDef(def);
return NULL;
}
@@ -2551,20 +2559,23 @@ qemudLoadNetworkConfig(struct qemud_driver *driver,
if (!(def = qemudParseNetworkDef(NULL, driver, xml, file))) {
virErrorPtr err = virGetLastError();
- qemudLog(QEMUD_WARN, "Error parsing network config '%s' : %s",
+ qemudLog(QEMUD_WARN, _("Error parsing network config '%s' : %s"),
path, err->message);
return NULL;
}
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
- qemudLog(QEMUD_WARN, "Network config filename '%s' does not match network name '%s'",
+ qemudLog(QEMUD_WARN,
+ _("Network config filename '%s'"
+ " does not match network name '%s'"),
path, def->name);
qemudFreeNetworkDef(def);
return NULL;
}
if (!(network = qemudAssignNetworkDef(NULL, driver, def))) {
- qemudLog(QEMUD_WARN, "Failed to load network config '%s': out of memory", path);
+ qemudLog(QEMUD_WARN,
+ _("Failed to load network config '%s': out of memory"), path);
qemudFreeNetworkDef(def);
return NULL;
}
@@ -2591,7 +2602,7 @@ int qemudScanConfigDir(struct qemud_driver *driver,
if (!(dir = opendir(configDir))) {
if (errno == ENOENT)
return 0;
- qemudLog(QEMUD_ERR, "Failed to open dir '%s': %s",
+ qemudLog(QEMUD_ERR, _("Failed to open dir '%s': %s"),
configDir, strerror(errno));
return -1;
}
@@ -2608,13 +2619,14 @@ int qemudScanConfigDir(struct qemud_driver *driver,
continue;
if (virFileBuildPath(configDir, entry->d_name, NULL, path, PATH_MAX) < 0) {
- qemudLog(QEMUD_WARN, "Config filename '%s/%s' is too long",
+ qemudLog(QEMUD_WARN, _("Config filename '%s/%s' is too long"),
configDir, entry->d_name);
continue;
}
- if (virFileBuildPath(autostartDir, entry->d_name, NULL, autostartLink, PATH_MAX) < 0) {
- qemudLog(QEMUD_WARN, "Autostart link path '%s/%s' is too long",
+ if (virFileBuildPath(autostartDir, entry->d_name, NULL,
+ autostartLink, PATH_MAX) < 0) {
+ qemudLog(QEMUD_WARN, _("Autostart link path '%s/%s' is too long"),
autostartDir, entry->d_name);
continue;
}
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 9c24f5b..15cd52c 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -71,7 +71,7 @@ static int qemudSetCloseExec(int fd) {
goto error;
return 0;
error:
- qemudLog(QEMUD_ERR, "Failed to set close-on-exec file descriptor flag");
+ qemudLog(QEMUD_ERR, _("Failed to set close-on-exec file descriptor flag"));
return -1;
}
@@ -85,7 +85,7 @@ static int qemudSetNonBlock(int fd) {
goto error;
return 0;
error:
- qemudLog(QEMUD_ERR, "Failed to set non-blocking file descriptor flag");
+ qemudLog(QEMUD_ERR, _("Failed to set non-blocking file descriptor flag"));
return -1;
}
@@ -123,7 +123,7 @@ void qemudAutostartConfigs(struct qemud_driver *driver) {
!qemudIsActiveNetwork(network) &&
qemudStartNetworkDaemon(NULL, driver, network) < 0) {
virErrorPtr err = virGetLastError();
- qemudLog(QEMUD_ERR, "Failed to autostart network '%s': %s",
+ qemudLog(QEMUD_ERR, _("Failed to autostart network '%s': %s"),
network->def->name, err->message);
}
@@ -138,7 +138,7 @@ void qemudAutostartConfigs(struct qemud_driver *driver) {
!qemudIsActiveVM(vm) &&
qemudStartVMDaemon(NULL, driver, vm) < 0) {
virErrorPtr err = virGetLastError();
- qemudLog(QEMUD_ERR, "Failed to autostart VM '%s': %s",
+ qemudLog(QEMUD_ERR, _("Failed to autostart VM '%s': %s"),
vm->def->name, err->message);
}
@@ -173,7 +173,7 @@ qemudStartup(void) {
goto out_of_memory;
} else {
if (!(pw = getpwuid(uid))) {
- qemudLog(QEMUD_ERR, "Failed to find user record for uid '%d': %s",
+ qemudLog(QEMUD_ERR, _("Failed to find user record for uid '%d': %s"),
uid, strerror(errno));
goto out_of_memory;
}
@@ -182,7 +182,7 @@ qemudStartup(void) {
goto snprintf_error;
if (asprintf (&base, "%s/.libvirt", pw->pw_dir) == -1) {
- qemudLog (QEMUD_ERR, "out of memory in asprintf");
+ qemudLog (QEMUD_ERR, _("out of memory in asprintf"));
goto out_of_memory;
}
}
@@ -223,11 +223,12 @@ qemudStartup(void) {
return 0;
snprintf_error:
- qemudLog(QEMUD_ERR, "Resulting path to long for buffer in qemudInitPaths()");
+ qemudLog(QEMUD_ERR,
+ _("Resulting path to long for buffer in qemudInitPaths()"));
return -1;
out_of_memory:
- qemudLog (QEMUD_ERR, "qemudStartup: out of memory");
+ qemudLog (QEMUD_ERR, _("qemudStartup: out of memory"));
free (base);
free(qemu_driver);
qemu_driver = NULL;
@@ -245,7 +246,7 @@ qemudReload(void) {
qemudScanConfigs(qemu_driver);
if (qemu_driver->iptables) {
- qemudLog(QEMUD_INFO, "Reloading iptables rules");
+ qemudLog(QEMUD_INFO, _("Reloading iptables rules"));
iptablesReloadRules(qemu_driver->iptables);
}
@@ -543,7 +544,7 @@ static int qemudWaitForMonitor(virConnectPtr conn,
/* Log, but ignore failures to write logfile for VM */
if (errno == EINTR)
goto retry;
- qemudLog(QEMUD_WARN, "Unable to log VM console data: %s",
+ qemudLog(QEMUD_WARN, _("Unable to log VM console data: %s"),
strerror(errno));
}
return ret;
@@ -656,15 +657,15 @@ static int qemudStartVMDaemon(virConnectPtr conn,
tmp = argv;
while (*tmp) {
if (write(vm->logfile, *tmp, strlen(*tmp)) < 0)
- qemudLog(QEMUD_WARN, "Unable to write argv to logfile %d: %s",
+ qemudLog(QEMUD_WARN, _("Unable to write argv to logfile %d: %s"),
errno, strerror(errno));
if (write(vm->logfile, " ", 1) < 0)
- qemudLog(QEMUD_WARN, "Unable to write argv to logfile %d: %s",
+ qemudLog(QEMUD_WARN, _("Unable to write argv to logfile %d: %s"),
errno, strerror(errno));
tmp++;
}
if (write(vm->logfile, "\n", 1) < 0)
- qemudLog(QEMUD_WARN, "Unable to write argv to logfile %d: %s",
+ qemudLog(QEMUD_WARN, _("Unable to write argv to logfile %d: %s"),
errno, strerror(errno));
if (virExecNonBlock(conn, argv, &vm->pid,
@@ -737,7 +738,7 @@ static int qemudVMData(struct qemud_driver *driver ATTRIBUTE_UNUSED,
/* Log, but ignore failures to write logfile for VM */
if (errno == EINTR)
goto retry;
- qemudLog(QEMUD_WARN, "Unable to log VM console data: %s",
+ qemudLog(QEMUD_WARN, _("Unable to log VM console data: %s"),
strerror(errno));
}
}
@@ -751,7 +752,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
if (!qemudIsActiveVM(vm))
return;
- qemudLog(QEMUD_INFO, "Shutting down VM '%s'", vm->def->name);
+ qemudLog(QEMUD_INFO, _("Shutting down VM '%s'"), vm->def->name);
kill(vm->pid, SIGTERM);
@@ -762,7 +763,8 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
virEventRemoveHandle(vm->stderr);
if (close(vm->logfile) < 0)
- qemudLog(QEMUD_WARN, "Unable to close logfile %d: %s", errno, strerror(errno));
+ qemudLog(QEMUD_WARN, _("Unable to close logfile %d: %s"),
+ errno, strerror(errno));
close(vm->stdout);
close(vm->stderr);
if (vm->monitor != -1)
@@ -775,7 +777,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
if (waitpid(vm->pid, NULL, WNOHANG) != vm->pid) {
kill(vm->pid, SIGKILL);
if (waitpid(vm->pid, NULL, 0) != vm->pid) {
- qemudLog(QEMUD_WARN, "Got unexpected pid, damn");
+ qemudLog(QEMUD_WARN, _("Got unexpected pid, damn"));
}
}
@@ -1219,13 +1221,13 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
err_delbr1:
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(driver->brctl, network->bridge, 0))) {
- qemudLog(QEMUD_WARN, "Failed to bring down bridge '%s' : %s",
+ qemudLog(QEMUD_WARN, _("Failed to bring down bridge '%s' : %s"),
network->bridge, strerror(err));
}
err_delbr:
if ((err = brDeleteBridge(driver->brctl, network->bridge))) {
- qemudLog(QEMUD_WARN, "Failed to delete bridge '%s' : %s\n",
+ qemudLog(QEMUD_WARN, _("Failed to delete bridge '%s' : %s\n"),
network->bridge, strerror(err));
}
@@ -1238,7 +1240,7 @@ static int qemudShutdownNetworkDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
struct qemud_network *network) {
int err;
- qemudLog(QEMUD_INFO, "Shutting down network '%s'", network->def->name);
+ qemudLog(QEMUD_INFO, _("Shutting down network '%s'"), network->def->name);
if (!qemudIsActiveNetwork(network))
return 0;
@@ -1250,12 +1252,12 @@ static int qemudShutdownNetworkDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(driver->brctl, network->bridge, 0))) {
- qemudLog(QEMUD_WARN, "Failed to bring down bridge '%s' : %s\n",
+ qemudLog(QEMUD_WARN, _("Failed to bring down bridge '%s' : %s\n"),
network->bridge, strerror(err));
}
if ((err = brDeleteBridge(driver->brctl, network->bridge))) {
- qemudLog(QEMUD_WARN, "Failed to delete bridge '%s' : %s\n",
+ qemudLog(QEMUD_WARN, _("Failed to delete bridge '%s' : %s\n"),
network->bridge, strerror(err));
}
@@ -1263,7 +1265,7 @@ static int qemudShutdownNetworkDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
waitpid(network->dnsmasqPid, NULL, WNOHANG) != network->dnsmasqPid) {
kill(network->dnsmasqPid, SIGKILL);
if (waitpid(network->dnsmasqPid, NULL, 0) != network->dnsmasqPid)
- qemudLog(QEMUD_WARN, "Got unexpected pid for dnsmasq\n");
+ qemudLog(QEMUD_WARN, _("Got unexpected pid for dnsmasq\n"));
}
network->bridge[0] = '\0';
@@ -1367,7 +1369,7 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
/* Log, but ignore failures to write logfile for VM */
if (safewrite(vm->logfile, buf, strlen(buf)) < 0)
- qemudLog(QEMUD_WARN, "Unable to log VM console data: %s",
+ qemudLog(QEMUD_WARN, _("Unable to log VM console data: %s"),
strerror(errno));
*reply = buf;
@@ -1377,7 +1379,7 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
if (buf) {
/* Log, but ignore failures to write logfile for VM */
if (safewrite(vm->logfile, buf, strlen(buf)) < 0)
- qemudLog(QEMUD_WARN, "Unable to log VM console data: %s",
+ qemudLog(QEMUD_WARN, _("Unable to log VM console data: %s"),
strerror(errno));
free(buf);
}
@@ -2345,7 +2347,7 @@ static int qemudDomainUndefine(virDomainPtr dom) {
return -1;
if (unlink(vm->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR)
- qemudLog(QEMUD_WARN, "Failed to delete autostart link '%s': %s",
+ qemudLog(QEMUD_WARN, _("Failed to delete autostart link '%s': %s"),
vm->autostartLink, strerror(errno));
vm->configFile[0] = '\0';
@@ -2721,7 +2723,7 @@ static int qemudNetworkUndefine(virNetworkPtr net) {
return -1;
if (unlink(network->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR)
- qemudLog(QEMUD_WARN, "Failed to delete autostart link '%s': %s",
+ qemudLog(QEMUD_WARN, _("Failed to delete autostart link '%s': %s"),
network->autostartLink, strerror(errno));
network->configFile[0] = '\0';
diff --git a/src/uuid.c b/src/uuid.c
index ae30217..78b90e5 100644
--- a/src/uuid.c
+++ b/src/uuid.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2008 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -99,8 +99,8 @@ virUUIDGenerate(unsigned char *uuid)
if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN)))
qemudLog(QEMUD_WARN,
- "Falling back to pseudorandom UUID, "
- "failed to generate random bytes: %s", strerror(err));
+ _("Falling back to pseudorandom UUID,"
+ " failed to generate random bytes: %s"), strerror(err));
return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
}
@@ -197,4 +197,3 @@ void virUUIDFormat(const unsigned char *uuid, char *uuidstr)
* tab-width: 4
* End:
*/
-
diff --git a/src/xm_internal.c b/src/xm_internal.c
index fbef462..4a876a4 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -2523,10 +2523,10 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
* xenXMDomainAttachDevice:
* @domain: pointer to domain object
* @xml: pointer to XML description of device
- *
+ *
* Create a virtual device attachment to backend.
* XML description is translated into config file.
- *
+ *
* Returns 0 in case of success, -1 in case of failure.
*/
static int
@@ -2879,7 +2879,7 @@ xenXMAttachInterface(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
attr_node->children = text_node;
attr_node->last = text_node;
attr_node->parent = node_tmp;
-
+
node_cur->next = node_tmp;
}
if (!(dev = xenXMParseXMLVif(domain->conn, node, hvm)))
@@ -2925,7 +2925,7 @@ xenXMAttachInterface(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
/**
* xenXMAutoAssignMac:
* @mac: pointer to Mac String
- *
+ *
* a mac is assigned automatically.
*
* Returns 0 in case of success, -1 in case of failure.
@@ -2948,7 +2948,7 @@ xenXMAutoAssignMac() {
* xenXMDomainDetachDevice:
* @domain: pointer to domain object
* @xml: pointer to XML description of device
- *
+ *
* Destroy a virtual device attachment to backend.
*
* Returns 0 in case of success, -1 in case of failure.
--
1.5.4.30.g7dbe
1
0