[libvirt] [PATCH] makefile: Move include/Makefile.am to include/libvirt/Makefile.am
by Erik Skultety
The reason for this is to fix the automatic rebuild of libvirt-common.h.in.
All *.in files should be automatically rebuilt each time they're modified.
It works well for makefiles and pkgconfig files, since they do have a valid
dependency in the top-level Makefile. However, with libvirt-common.h.in
there is no dependency in the top-level Makefile and there's no need for it
either, so this rule
include/libvirt/libvirt-common.h: $(top_builddir)/config.status \
$(top_srcdir)/include/libvirt/libvirt-common.h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
is never hit and should be moved to include/Makefile, but that's automake's
job. According to GNU automake docs:
"Files created by AC_CONFIG_FILES, be they
Automake Makefiles or not, are all removed by ‘make distclean’. Their inputs
are automatically distributed, unless they are the output of prior
AC_CONFIG_FILES commands. Finally, rebuild rules are generated in the Automake
Makefile existing in the subdirectory of the output file, if there is one, or
in the top-level Makefile otherwise."
Which means that if we want to have the rule for libvirt-common.h automatically
generated by automake, the include/Makefile.am needs to be moved into libvirt/
subdirectory and $SUBDIRS in the top-level Makefile need to be adjusted as
well. This patch moves Makefile.am from include/ to include/libvirt, adjusting
the prefixes accordingly as well as updates the top-level Makefile $SUBDIRS to
properly hint automake to generate all rules at proper places.
Best way to see the changes, use -M with 'git show'.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
Makefile.am | 2 +-
configure.ac | 2 +-
include/{ => libvirt}/Makefile.am | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
rename include/{ => libvirt}/Makefile.am (76%)
diff --git a/Makefile.am b/Makefile.am
index ffe0517..9298082 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
LCOV = lcov
GENHTML = genhtml
-SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
+SUBDIRS = . gnulib/lib include/libvirt src daemon tools docs gnulib/tests \
tests po examples
ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 85fc6e1..1e83b8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2744,7 +2744,7 @@ AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([\
- Makefile src/Makefile include/Makefile docs/Makefile \
+ Makefile src/Makefile include/libvirt/Makefile docs/Makefile \
gnulib/lib/Makefile \
gnulib/tests/Makefile \
libvirt.pc \
diff --git a/include/Makefile.am b/include/libvirt/Makefile.am
similarity index 76%
rename from include/Makefile.am
rename to include/libvirt/Makefile.am
index dde955e..a59b8ab 100644
--- a/include/Makefile.am
+++ b/include/libvirt/Makefile.am
@@ -18,15 +18,15 @@
virincdir = $(includedir)/libvirt
-allheaders = $(wildcard $(srcdir)/libvirt/*.h)
-virinc_HEADERS = $(filter-out $(srcdir)/libvirt/libvirt-admin.h \
- $(srcdir)/libvirt/libvirt-common.h, $(allheaders))
-virinc_HEADERS += libvirt/libvirt-common.h
+allheaders = $(wildcard $(srcdir)/*.h)
+virinc_HEADERS = $(filter-out $(srcdir)/libvirt-admin.h \
+ $(srcdir)/libvirt-common.h, $(allheaders))
+virinc_HEADERS += libvirt-common.h
-EXTRA_DIST = libvirt/libvirt-common.h.in
+EXTRA_DIST = libvirt-common.h.in
# Temporarily disabled, but we need it for building
-EXTRA_DIST += libvirt/libvirt-admin.h
+EXTRA_DIST += libvirt-admin.h
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(virincdir)
--
2.4.11
8 years, 7 months
[libvirt] [PATCH] Include sysmacros.h where needed
by Martin Kletzander
So in glibc-2.23 sys/sysmacros.h is no longer included from sys/types.h
and we don't build because of the usage of major/minor/makedev macros.
Simply add sys/sysmacros.h into files that are using any of these
macros.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
I noticed this after update to glibc-2.23 and don't worry, there are
more project that fail compiling due to the same issue.
I can't find it in their repository, but I think it's safe to assume
that stuff will break sooner or later if we don't fix it. The closest
thing I've found is this thread:
https://marc.info/?l=glibc-alpha&m=144790641508520
>From that mailing list thread (actually just one mesage I've found out,
I haven't read the whole thread) there should've been some deprecation
warning for few releases, but apparently there isn't.
Technically it's a build-breaker fix, but I'm sending it for review in
case there is a system that does not have sys/sysmacros.h installed
for some reason. Then we'd have to resort to using AC_HEADER_MAJOR.
src/conf/domain_audit.c | 1 +
src/lxc/lxc_controller.c | 1 +
src/lxc/lxc_driver.c | 1 +
src/util/vircgroup.c | 1 +
src/util/virutil.c | 1 +
tests/vircgroupmock.c | 1 +
6 files changed, 6 insertions(+)
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index bd2eeb6a792d..541cf27e44f7 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -25,6 +25,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include "domain_audit.h"
#include "viraudit.h"
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 8b5ec4c840c6..43fc2479b5f0 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -28,6 +28,7 @@
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/un.h>
#include <sys/personality.h>
#include <unistd.h>
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ef488123db12..5ce3ceccc601 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -29,6 +29,7 @@
#include <sys/utsname.h>
#include <string.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index bffd88f90a44..5258526bf77a 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <signal.h>
#include <dirent.h>
#include <unistd.h>
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 82051505d258..730a24fcb0fe 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -36,6 +36,7 @@
#include <poll.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/ioctl.h>
#include <string.h>
#include <termios.h>
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
index 756ac51679b4..2ca02f360556 100644
--- a/tests/vircgroupmock.c
+++ b/tests/vircgroupmock.c
@@ -29,6 +29,7 @@
# include <unistd.h>
# include <fcntl.h>
# include <sys/stat.h>
+# include <sys/sysmacros.h>
# include <stdarg.h>
# include "testutilslxc.h"
# include "virstring.h"
--
2.8.1
8 years, 7 months
[libvirt] [PATCH] vz: make it possible to use shared drivers API with vz driver connection
by Maxim Nestratov
Since vz driver is now lives as a part of daemon we can benefit from
this fact and allow vz clients to use shared drivers API like storage,
network, nwfilter etc.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/vz/vz_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index d2bf54e..ffa6f45 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1696,10 +1696,10 @@ vzRegister(void)
parallelsHypervisorDriver.name = "Parallels";
parallelsConnectDriver = vzConnectDriver;
parallelsConnectDriver.hypervisorDriver = ¶llelsHypervisorDriver;
- if (virRegisterConnectDriver(¶llelsConnectDriver, false) < 0)
+ if (virRegisterConnectDriver(¶llelsConnectDriver, true) < 0)
return -1;
- if (virRegisterConnectDriver(&vzConnectDriver, false) < 0)
+ if (virRegisterConnectDriver(&vzConnectDriver, true) < 0)
return -1;
if (virRegisterStateDriver(&vzStateDriver) < 0)
--
2.4.3
8 years, 7 months
[libvirt] [PATCH] libxl: use LIBXL_API_VERSION 0x040200
by Jim Fehlig
To ensure the libvirt libxl driver will build with future versions
of Xen where the libxl API may change in incompatible ways,
explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
does use new libxl APIs that have been added since Xen 4.2, but
currently it does not make use of any changes made to existing
APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
The version can be bumped if/when the libxl driver consumes the
changed APIs.
Further details can be found in the following discussion thread
https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/Makefile.am | 1 +
src/libxl/libxl_conf.h | 12 ------------
src/libxl/libxl_domain.c | 15 ---------------
3 files changed, 1 insertion(+), 27 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 08ff301..259a474 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1311,6 +1311,7 @@ endif ! WITH_DRIVER_MODULES
libvirt_driver_libxl_impl_la_CFLAGS = \
$(LIBXL_CFLAGS) \
+ -DLIBXL_API_VERSION=0x040200 \
-I$(srcdir)/access \
-I$(srcdir)/conf \
-I$(srcdir)/secret \
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 3c0eafb..24e2911 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -69,18 +69,6 @@
# endif
-/* libxl interface for setting VCPU affinity changed in 4.5. In fact, a new
- * parameter has been added, representative of 'VCPU soft affinity'. If one
- * does not care about it (and that's libvirt case), passing NULL is the
- * right thing to do. To mark that change, LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
- * is defined. */
-# ifdef LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
-# define libxl_set_vcpuaffinity(ctx, domid, vcpuid, map) \
- libxl_set_vcpuaffinity((ctx), (domid), (vcpuid), (map), NULL)
-# define libxl_set_vcpuaffinity_all(ctx, domid, max_vcpus, map) \
- libxl_set_vcpuaffinity_all((ctx), (domid), (max_vcpus), (map), NULL)
-# endif
-
typedef struct _libxlDriverPrivate libxlDriverPrivate;
typedef libxlDriverPrivate *libxlDriverPrivatePtr;
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index aed904b..192a506 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -981,9 +981,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
int managed_save_fd = -1;
libxlDomainObjPrivatePtr priv = vm->privateData;
libxlDriverConfigPtr cfg;
-#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
- libxl_domain_restore_params params;
-#endif
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
libxl_asyncprogress_how aop_console_how;
@@ -1070,20 +1067,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
ret = libxl_domain_create_new(cfg->ctx, &d_config,
&domid, NULL, &aop_console_how);
} else {
-#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
- params.checkpointed_stream = 0;
- ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
- restore_fd, -1, ¶ms, NULL,
- &aop_console_how);
-#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
- params.checkpointed_stream = 0;
- ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
- restore_fd, ¶ms, NULL,
- &aop_console_how);
-#else
ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
restore_fd, NULL, &aop_console_how);
-#endif
}
virObjectLock(vm);
--
2.1.4
8 years, 7 months
[libvirt] [PATCH 0/3] Fix some Coverity issues
by John Ferlan
Patch 1 is technically a build breaker, but since I was fixing my
Coverity build I figured I could handle the two more recent memory
leaks that also showed up.
John Ferlan (3):
qemu: Fix qemuBuildCommandLine prototype
tools: Fix memory leak
Resolve a couple of memory leaks
src/qemu/qemu_command.h | 3 +--
src/qemu/qemu_parse_command.c | 3 ++-
src/xenconfig/xen_xl.c | 1 +
tools/virt-host-validate-common.c | 5 +++--
4 files changed, 7 insertions(+), 5 deletions(-)
--
2.5.5
8 years, 7 months
[libvirt] [PATCH v4] util: Add virGettextInitialize, convert the code
by Cole Robinson
Take setlocale/gettext error handling pattern from tools/virsh-*
and use it for all standalone binaries via a new shared
virGettextInitialize routine. The virsh* pattern differed slightly
from other callers. All users now consistently:
* Ignore setlocale errors. virsh has done this forever, presumably for
good reason. This has been partially responsible for some bug reports:
https://bugzilla.redhat.com/show_bug.cgi?id=1312688
https://bugzilla.redhat.com/show_bug.cgi?id=1026514
https://bugzilla.redhat.com/show_bug.cgi?id=1016158
* Report the failed function name
* Report strerror
---
v4:
sigh, forgot to squash in a cfg.mk change
cfg.mk | 13 +++++++++-
daemon/libvirtd.c | 6 ++---
src/Makefile.am | 2 ++
src/libvirt_private.syms | 4 ++++
src/locking/lock_daemon.c | 6 ++---
src/locking/sanlock_helper.c | 9 ++-----
src/logging/log_daemon.c | 6 ++---
src/lxc/lxc_controller.c | 6 ++---
src/network/leaseshelper.c | 12 +++-------
src/security/virt-aa-helper.c | 12 +++-------
src/storage/parthelper.c | 9 ++-----
src/util/iohelper.c | 13 +++-------
src/util/virgettext.c | 56 +++++++++++++++++++++++++++++++++++++++++++
src/util/virgettext.h | 25 +++++++++++++++++++
tools/virsh.c | 15 ++----------
tools/virt-admin.c | 15 ++----------
tools/virt-host-validate.c | 15 ++----------
tools/virt-login-shell.c | 14 ++---------
tools/vsh.c | 2 --
19 files changed, 128 insertions(+), 112 deletions(-)
create mode 100644 src/util/virgettext.c
create mode 100644 src/util/virgettext.h
diff --git a/cfg.mk b/cfg.mk
index 8e8586f..90bb709 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1037,6 +1037,15 @@ sc_prohibit_verbose_strcat:
halt='Use strcat(a, b) instead of strncat(a, b, strlen(b))' \
$(_sc_search_regexp)
+# Ensure that each .c file containing a "main" function also
+# calls virGettextInitialize
+sc_gettext_init:
+ @require='virGettextInitialize *\(' \
+ in_vc_files='\.c$$' \
+ containing='\<main *(' \
+ halt='the above files do not call virGettextInitialize' \
+ $(_sc_search_regexp)
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@@ -1133,7 +1142,9 @@ _test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock
exclude_file_name_regexp--sc_avoid_write = \
^(src/($(_src1))|daemon/libvirtd|tools/virsh-console|tests/($(_test1)))\.c$$
-exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
+exclude_file_name_regexp--sc_bindtextdomain = .*
+
+exclude_file_name_regexp--sc_gettext_init = ^(tests|examples)/
exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 3d38a46..5f66e8b 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -30,7 +30,6 @@
#include <getopt.h>
#include <stdlib.h>
#include <grp.h>
-#include <locale.h>
#include "libvirt_internal.h"
#include "virerror.h"
@@ -58,6 +57,7 @@
#include "locking/lock_manager.h"
#include "viraccessmanager.h"
#include "virutil.h"
+#include "virgettext.h"
#ifdef WITH_DRIVER_MODULES
# include "driver.h"
@@ -1172,9 +1172,7 @@ int main(int argc, char **argv) {
{0, 0, 0, 0}
};
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL ||
+ if (virGettextInitialize() < 0 ||
virInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
diff --git a/src/Makefile.am b/src/Makefile.am
index eda0365..38b9560 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -114,6 +114,7 @@ UTIL_SOURCES = \
util/virfile.c util/virfile.h \
util/virfirewall.c util/virfirewall.h \
util/virfirewallpriv.h \
+ util/virgettext.c util/virgettext.h \
util/virgic.c util/virgic.h \
util/virhash.c util/virhash.h \
util/virhashcode.c util/virhashcode.h \
@@ -2321,6 +2322,7 @@ libvirt_setuid_rpc_client_la_SOURCES = \
util/virevent.c \
util/vireventpoll.c \
util/virfile.c \
+ util/virgettext.c \
util/virhash.c \
util/virhashcode.c \
util/virjson.c \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 068bc00..af7de8a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1517,6 +1517,10 @@ virFirewallStartRollback;
virFirewallStartTransaction;
+# util/virgettext.h
+virGettextInitialize;
+
+
# util/virgic.h
virGICVersionTypeFromString;
virGICVersionTypeToString;
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 973e691..bfdcfc6 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -28,7 +28,6 @@
#include <sys/stat.h>
#include <getopt.h>
#include <stdlib.h>
-#include <locale.h>
#include "lock_daemon.h"
@@ -47,6 +46,7 @@
#include "virhash.h"
#include "viruuid.h"
#include "virstring.h"
+#include "virgettext.h"
#include "locking/lock_daemon_dispatch.h"
#include "locking/lock_protocol.h"
@@ -1179,9 +1179,7 @@ int main(int argc, char **argv) {
privileged = geteuid() == 0;
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL ||
+ if (virGettextInitialize() < 0 ||
virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
diff --git a/src/locking/sanlock_helper.c b/src/locking/sanlock_helper.c
index d8d294f..57e1cfb 100644
--- a/src/locking/sanlock_helper.c
+++ b/src/locking/sanlock_helper.c
@@ -1,13 +1,12 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
-#include <locale.h>
-#include "configmake.h"
#include "internal.h"
#include "virconf.h"
#include "viralloc.h"
#include "domain_conf.h"
+#include "virgettext.h"
static int
@@ -70,12 +69,8 @@ main(int argc, char **argv)
.cb = authCallback,
};
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL) {
- fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+ if (virGettextInitialize() < 0)
exit(EXIT_FAILURE);
- }
if (getArgs(argc, argv, &uri, &uuid, &action) < 0)
goto cleanup;
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index f674cbd..70339af 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -28,7 +28,6 @@
#include <sys/stat.h>
#include <getopt.h>
#include <stdlib.h>
-#include <locale.h>
#include "log_daemon.h"
@@ -46,6 +45,7 @@
#include "virhash.h"
#include "viruuid.h"
#include "virstring.h"
+#include "virgettext.h"
#include "log_daemon_dispatch.h"
#include "log_protocol.h"
@@ -936,9 +936,7 @@ int main(int argc, char **argv) {
privileged = geteuid() == 0;
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL ||
+ if (virGettextInitialize() < 0 ||
virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 8b5ec4c..73e57e3 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -36,7 +36,6 @@
#include <signal.h>
#include <getopt.h>
#include <sys/mount.h>
-#include <locale.h>
#include <grp.h>
#include <sys/stat.h>
#include <time.h>
@@ -66,6 +65,7 @@
#include "virdbus.h"
#include "rpc/virnetdaemon.h"
#include "virstring.h"
+#include "virgettext.h"
#define VIR_FROM_THIS VIR_FROM_LXC
@@ -2505,9 +2505,7 @@ int main(int argc, char *argv[])
for (i = 0; i < VIR_LXC_DOMAIN_NAMESPACE_LAST; i++)
ns_fd[i] = -1;
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL ||
+ if (virGettextInitialize() < 0 ||
virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 097cd11..16f6eb8 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -25,7 +25,6 @@
#include <config.h>
-#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
@@ -38,6 +37,7 @@
#include "virjson.h"
#include "virlease.h"
#include "configmake.h"
+#include "virgettext.h"
#define VIR_FROM_THIS VIR_FROM_NETWORK
@@ -115,14 +115,8 @@ main(int argc, char **argv)
program_name = argv[0];
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL) {
- fprintf(stderr, _("%s: initialization failed\n"), program_name);
- exit(EXIT_FAILURE);
- }
-
- if (virThreadInitialize() < 0 ||
+ if (virGettextInitialize() < 0 ||
+ virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), program_name);
exit(EXIT_FAILURE);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 50d2a08..5db9c02 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -35,7 +35,6 @@
#include <fcntl.h>
#include <getopt.h>
#include <sys/utsname.h>
-#include <locale.h>
#include "internal.h"
#include "virbuffer.h"
@@ -54,6 +53,7 @@
#include "configmake.h"
#include "virrandom.h"
#include "virstring.h"
+#include "virgettext.h"
#include "storage/storage_driver.h"
@@ -1298,14 +1298,8 @@ main(int argc, char **argv)
char *profile = NULL;
char *include_file = NULL;
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL) {
- fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
- exit(EXIT_FAILURE);
- }
-
- if (virThreadInitialize() < 0 ||
+ if (virGettextInitialize() < 0 ||
+ virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index d1df068..6695f23 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -39,13 +39,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <locale.h>
#include "virutil.h"
#include "virfile.h"
#include "c-ctype.h"
-#include "configmake.h"
#include "virstring.h"
+#include "virgettext.h"
/* we don't need to include the full internal.h just for this */
#define STREQ(a, b) (strcmp(a, b) == 0)
@@ -72,12 +71,8 @@ int main(int argc, char **argv)
const char *partsep;
bool devmap_nopartsep = false;
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL) {
- fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+ if (virGettextInitialize() < 0)
exit(EXIT_FAILURE);
- }
if (argc == 3 && STREQ(argv[2], "-g")) {
cmd = DISK_GEOMETRY;
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 8a3c377..275f993 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -27,7 +27,6 @@
#include <config.h>
-#include <locale.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
@@ -38,9 +37,9 @@
#include "virfile.h"
#include "viralloc.h"
#include "virerror.h"
-#include "configmake.h"
#include "virrandom.h"
#include "virstring.h"
+#include "virgettext.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE
@@ -230,14 +229,8 @@ main(int argc, char **argv)
program_name = argv[0];
- if (setlocale(LC_ALL, "") == NULL ||
- bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL) {
- fprintf(stderr, _("%s: initialization failed\n"), program_name);
- exit(EXIT_FAILURE);
- }
-
- if (virThreadInitialize() < 0 ||
+ if (virGettextInitialize() < 0 ||
+ virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), program_name);
exit(EXIT_FAILURE);
diff --git a/src/util/virgettext.c b/src/util/virgettext.c
new file mode 100644
index 0000000..7e32043
--- /dev/null
+++ b/src/util/virgettext.c
@@ -0,0 +1,56 @@
+/*
+ * virgettext.c: gettext helper routines
+ *
+ * Copyright (C) 2016 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include <locale.h>
+#include <stdio.h>
+
+#include "configmake.h"
+#include "internal.h"
+#include "virgettext.h"
+
+
+/**
+ * virGettextInit:
+ *
+ * Initialize standard gettext setup
+ * Returns -1 on fatal error
+ */
+int
+virGettextInitialize(void)
+{
+ if (!setlocale(LC_ALL, "")) {
+ perror("setlocale");
+ /* failure to setup locale is not fatal */
+ }
+
+ if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
+ perror("bindtextdomain");
+ return -1;
+ }
+
+ if (!textdomain(PACKAGE)) {
+ perror("textdomain");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/util/virgettext.h b/src/util/virgettext.h
new file mode 100644
index 0000000..4584d83
--- /dev/null
+++ b/src/util/virgettext.h
@@ -0,0 +1,25 @@
+/*
+ * virgettext.h: gettext helper routines
+ *
+ * Copyright (C) 2016 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+#ifndef __VIR_GETTEXT_H__
+# define __VIR_GETTEXT_H__
+
+int virGettextInitialize(void);
+
+#endif /* __VIR_GETTEXT_H__ */
diff --git a/tools/virsh.c b/tools/virsh.c
index fe33839..f632405 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -34,7 +34,6 @@
#include <getopt.h>
#include <sys/time.h>
#include <fcntl.h>
-#include <locale.h>
#include <time.h>
#include <limits.h>
#include <sys/stat.h>
@@ -53,12 +52,12 @@
#include <libvirt/libvirt-qemu.h>
#include <libvirt/libvirt-lxc.h>
#include "virfile.h"
-#include "configmake.h"
#include "virthread.h"
#include "vircommand.h"
#include "conf/domain_conf.h"
#include "virtypedparam.h"
#include "virstring.h"
+#include "virgettext.h"
#include "virsh-console.h"
#include "virsh-domain.h"
@@ -933,18 +932,8 @@ main(int argc, char **argv)
progname++;
ctl->progname = progname;
- if (!setlocale(LC_ALL, "")) {
- perror("setlocale");
- /* failure to setup locale is not fatal */
- }
- if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
- perror("bindtextdomain");
- return EXIT_FAILURE;
- }
- if (!textdomain(PACKAGE)) {
- perror("textdomain");
+ if (virGettextInitialize() < 0)
return EXIT_FAILURE;
- }
if (isatty(STDIN_FILENO)) {
ctl->istty = true;
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index f0a49a3..195088b 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -25,20 +25,19 @@
#include <errno.h>
#include <getopt.h>
-#include <locale.h>
#if WITH_READLINE
# include <readline/readline.h>
# include <readline/history.h>
#endif
-#include "configmake.h"
#include "internal.h"
#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
#include "virstring.h"
#include "virthread.h"
+#include "virgettext.h"
/* Gnulib doesn't guarantee SA_SIGINFO support. */
#ifndef SA_SIGINFO
@@ -689,18 +688,8 @@ main(int argc, char **argv)
progname++;
ctl->progname = progname;
- if (!setlocale(LC_ALL, "")) {
- perror("setlocale");
- /* failure to setup locale is not fatal */
- }
- if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
- perror("bindtextdomain");
- return EXIT_FAILURE;
- }
- if (!textdomain(PACKAGE)) {
- perror("textdomain");
+ if (virGettextInitialize() < 0)
return EXIT_FAILURE;
- }
if (isatty(STDIN_FILENO)) {
ctl->istty = true;
diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c
index a8c2075..5b7fe9b 100644
--- a/tools/virt-host-validate.c
+++ b/tools/virt-host-validate.c
@@ -25,10 +25,9 @@
#include <stdlib.h>
#include <gettext.h>
#include <getopt.h>
-#include <locale.h>
#include "internal.h"
-#include "configmake.h"
+#include "virgettext.h"
#include "virt-host-validate-common.h"
#if WITH_QEMU
@@ -80,18 +79,8 @@ main(int argc, char **argv)
bool quiet = false;
bool usedHvname = false;
- if (!setlocale(LC_ALL, "")) {
- perror("setlocale");
- /* failure to setup locale is not fatal */
- }
- if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
- perror("bindtextdomain");
- return EXIT_FAILURE;
- }
- if (!textdomain(PACKAGE)) {
- perror("textdomain");
+ if (virGettextInitialize() < 0)
return EXIT_FAILURE;
- }
while ((c = getopt_long(argc, argv, "hvq", argOptions, NULL)) != -1) {
switch (c) {
diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c
index ec759dc..8f87227 100644
--- a/tools/virt-login-shell.c
+++ b/tools/virt-login-shell.c
@@ -24,7 +24,6 @@
#include <errno.h>
#include <fnmatch.h>
#include <getopt.h>
-#include <locale.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
@@ -41,6 +40,7 @@
#include "virstring.h"
#include "viralloc.h"
#include "vircommand.h"
+#include "virgettext.h"
#define VIR_FROM_THIS VIR_FROM_NONE
static const char *conf_file = SYSCONFDIR "/libvirt/virt-login-shell.conf";
@@ -207,18 +207,8 @@ main(int argc, char **argv)
virSetErrorLogPriorityFunc(NULL);
progname = argv[0];
- if (!setlocale(LC_ALL, "")) {
- perror("setlocale");
- /* failure to setup locale is not fatal */
- }
- if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
- perror("bindtextdomain");
- return ret;
- }
- if (!textdomain(PACKAGE)) {
- perror("textdomain");
+ if (virGettextInitialize() < 0)
return ret;
- }
while ((arg = getopt_long(argc, argv, "hV", opt, &longindex)) != -1) {
switch (arg) {
diff --git a/tools/vsh.c b/tools/vsh.c
index 6bdc082..f033c05 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -35,7 +35,6 @@
#include <sys/time.h>
#include "c-ctype.h"
#include <fcntl.h>
-#include <locale.h>
#include <time.h>
#include <limits.h>
#include <sys/stat.h>
@@ -55,7 +54,6 @@
#include <libvirt/libvirt-qemu.h>
#include <libvirt/libvirt-lxc.h>
#include "virfile.h"
-#include "configmake.h"
#include "virthread.h"
#include "vircommand.h"
#include "conf/domain_conf.h"
--
2.7.3
8 years, 7 months
[libvirt] [PATCH] docs: formatdomain: document versions for video acceleration
by Cole Robinson
clarify what version initial support was added, and when libvirt
started supporting it for the qemu driver
https://bugzilla.redhat.com/show_bug.cgi?id=657931
---
docs/formatdomain.html.in | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c2955eb..63ef551 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5247,9 +5247,17 @@ qemu-kvm -net nic,model=? /dev/null
<dt><code>acceleration</code></dt>
<dd>
- If acceleration should be enabled (if supported) using the
- <code>accel3d</code> and <code>accel2d</code> attributes in the
- <code>acceleration</code> element.
+ Configure if video acceleration should be enabled.
+ <ul>
+ <li><code>accel2d</code>:
+ Enable 2D acceleration (for vbox driver only,
+ <span class="since">since 0.7.1</span>)</li>
+
+ <li><code>accel3d</code>:
+ Enable 3D acceleration (for vbox driver
+ <span class="since">since 0.7.1</span>, qemu driver
+ <span class="since">since 1.3.0</span>)</li>
+ </ul>
</dd>
<dt><code>address</code></dt>
--
2.7.3
8 years, 7 months
[libvirt] [PATCH] man: virsh: Document lxc-enter-namespace --noseclabel
by Cole Robinson
https://bugzilla.redhat.com/show_bug.cgi?id=1147737
---
tools/virsh.pod | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index d2cc5b2..d8502c7 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4170,7 +4170,7 @@ When I<--timestamp> is used, a human-readable timestamp will be printed
before the event, and the timing information provided by QEMU will be
omitted.
-=item B<lxc-enter-namespace> I<domain> -- /path/to/binary [arg1, [arg2, ...]]
+=item B<lxc-enter-namespace> I<domain> [I<--noseclabel>] -- /path/to/binary [arg1, [arg2, ...]]
Enter the namespace of I<domain> and execute the command C</path/to/binary>
passing the requested args. The binary path is relative to the container
@@ -4179,6 +4179,10 @@ environment variables / console visible to virsh. This command only works
when connected to the LXC hypervisor driver. This command succeeds only
if C</path/to/binary> has 0 exit status.
+By default the new process will run with the security label of the new
+parent container. Use the I<--noseclabel> option to instead have the
+process keep the same security label as C<virsh>.
+
=back
=head1 ENVIRONMENT
--
2.7.3
8 years, 7 months