[libvirt] [PATCH 0/4] Misc work on systemd/lxc
by Daniel P. Berrange
This is just a few patches working towards an eventual
goal of being ble to tell system the tap/veth devices
associated with a qemu/lxc guest.
Daniel P. Berrange (4):
Add support for systemd-machined CreateMachineWithNetwork
Add systemd/dtrace probes for DBus APIs
Log dtrace/systemd probes at INFO level instead of DEBUG
Change int to size_t in size var for tap/vhost FDs
po/POTFILES.in | 1 +
src/libvirt_probes.d | 5 ++
src/lxc/lxc_cgroup.c | 1 +
src/qemu/qemu_cgroup.c | 1 +
src/qemu/qemu_command.c | 18 +++----
src/qemu/qemu_command.h | 10 ++--
src/qemu/qemu_hotplug.c | 4 +-
src/util/vircgroup.c | 8 ++++
src/util/vircgroup.h | 2 +
src/util/virdbus.c | 26 +++++++++--
src/util/virnetdevtap.c | 8 ++--
src/util/virnetdevtap.h | 4 +-
src/util/virprobe.h | 10 ++--
src/util/virsystemd.c | 122 +++++++++++++++++++++++++++++++++++++-----------
src/util/virsystemd.h | 2 +
tests/virsystemdtest.c | 36 ++++++++++++++
16 files changed, 202 insertions(+), 56 deletions(-)
--
2.1.0
9 years, 9 months
[libvirt] [PATCH] Conditionalize use of -Wno-suggest-attribute=format pragma
by Daniel P. Berrange
Many GCC versions don't understand -Wno-suggest-attribute=format
so the pragma must only be used when supported
---
m4/virt-compile-warnings.m4 | 6 ++++++
src/internal.h | 8 +++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 532a777..b412a42 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -215,6 +215,12 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
;;
esac
+ case $WARN_CFLAGS in
+ *-Wsuggest-attribute=format*)
+ AC_DEFINE(HAVE_SUGGEST_ATTRIBUTE_FORMAT, [1], [Whether -Wsuggest-attribute=format works])
+ ;;
+ esac
+
# Silence certain warnings in gnulib, and use improved glibc headers
AC_DEFINE([lint], [1],
[Define to 1 if the compiler is checking for lint.])
diff --git a/src/internal.h b/src/internal.h
index 9855c49..4d473af 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -234,9 +234,15 @@
# define VIR_WARNINGS_NO_CAST_ALIGN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wcast-align\"")
-# define VIR_WARNINGS_NO_PRINTF \
+
+# if HAVE_SUGGEST_ATTRIBUTE_FORMAT
+# define VIR_WARNINGS_NO_PRINTF \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
+# else
+# define VIR_WARNINGS_NO_PRINTF \
+ _Pragma ("GCC diagnostic push")
+# endif
# define VIR_WARNINGS_RESET \
_Pragma ("GCC diagnostic pop")
--
2.1.0
9 years, 9 months
[libvirt] [PATCH V3] libxl: Set path to console on domain startup.
by Anthony PERARD
The path to the pty of a Xen PV console is set only in
virDomainOpenConsole. But this is done too late. A call to
virDomainGetXMLDesc done before OpenConsole will not have the path to
the pty, but a call after OpenConsole will.
e.g. of the current issue.
Starting a domain with '<console type="pty"/>'
Then:
virDomainGetXMLDesc():
<devices>
<console type='pty'>
<target type='xen' port='0'/>
</console>
</devices>
virDomainOpenConsole()
virDomainGetXMLDesc():
<devices>
<console type='pty' tty='/dev/pts/30'>
<source path='/dev/pts/30'/>
<target type='xen' port='0'/>
</console>
</devices>
The patch intend to have the TTY path on the first call of GetXMLDesc.
This is done by setting up the path at domain start up instead of in
OpenConsole.
https://bugzilla.redhat.com/show_bug.cgi?id=1170743
Signed-off-by: Anthony PERARD <anthony.perard(a)citrix.com>
---
Change in V3:
Using aop_console_how from libxl_domain_create_new()
Ignore empty string that can return libxl_console_get_tty()
Change in V2:
Adding bug report link.
Reword the last part of the patch description.
Cleanup the code.
Use VIR_FREE before VIR_STRDUP.
Remove the code from OpenConsole as it is now a duplicate.
CC: Jim Fehlig <jfehlig(a)suse.com>
CC: Ian Campbell <Ian.Campbell(a)citrix.com>
CC: Ian Jackson <Ian.Jackson(a)eu.citrix.com>
---
src/libxl/libxl_domain.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
src/libxl/libxl_driver.c | 15 ---------------
2 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 9185117..804f9b9 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1149,6 +1149,42 @@ libxlDomainFreeMem(libxlDomainObjPrivatePtr priv, libxl_domain_config *d_config)
return ret;
}
+static void
+libxlConsoleCallback(libxl_ctx *ctx, libxl_event* ev, void *for_callback)
+{
+ virDomainObjPtr vm = for_callback;
+ libxlDomainObjPrivatePtr priv = vm->privateData;
+ int i;
+
+ virObjectLock(vm);
+ for (i = 0; i < vm->def->nconsoles; i++) {
+ virDomainChrDefPtr chr = vm->def->consoles[i];
+ if (chr && chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) {
+ libxl_console_type console_type;
+ char *console = NULL;
+ int ret;
+
+ console_type =
+ (chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ?
+ LIBXL_CONSOLE_TYPE_SERIAL : LIBXL_CONSOLE_TYPE_PV);
+ ret = libxl_console_get_tty(priv->ctx, ev->domid,
+ chr->target.port, console_type,
+ &console);
+ if (!ret) {
+ VIR_FREE(chr->source.data.file.path);
+ if (console && console[0] != '\0') {
+ ignore_value(VIR_STRDUP(chr->source.data.file.path,
+ console));
+ }
+ }
+ VIR_FREE(console);
+ }
+ }
+ virObjectUnlock(vm);
+ libxl_event_free(ctx, ev);
+}
+
+
/*
* Start a domain through libxenlight.
*
@@ -1173,6 +1209,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
libxl_domain_restore_params params;
#endif
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+ libxl_asyncprogress_how aop_console_how;
libxl_domain_config_init(&d_config);
@@ -1242,17 +1279,21 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
/* Unlock virDomainObj while creating the domain */
virObjectUnlock(vm);
+
+ aop_console_how.for_callback = vm;
+ aop_console_how.callback = libxlConsoleCallback;
if (restore_fd < 0) {
ret = libxl_domain_create_new(priv->ctx, &d_config,
- &domid, NULL, NULL);
+ &domid, NULL, &aop_console_how);
} else {
#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
params.checkpointed_stream = 0;
ret = libxl_domain_create_restore(priv->ctx, &d_config, &domid,
- restore_fd, ¶ms, NULL, NULL);
+ restore_fd, ¶ms, NULL,
+ &aop_console_how);
#else
ret = libxl_domain_create_restore(priv->ctx, &d_config, &domid,
- restore_fd, NULL, NULL);
+ restore_fd, NULL, &aop_console_how);
#endif
}
virObjectLock(vm);
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index cad5101..fc0949d 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3982,10 +3982,8 @@ libxlDomainOpenConsole(virDomainPtr dom,
{
virDomainObjPtr vm = NULL;
int ret = -1;
- libxl_console_type console_type;
virDomainChrDefPtr chr = NULL;
libxlDomainObjPrivatePtr priv;
- char *console = NULL;
virCheckFlags(VIR_DOMAIN_CONSOLE_FORCE, -1);
@@ -4027,18 +4025,6 @@ libxlDomainOpenConsole(virDomainPtr dom,
goto cleanup;
}
- console_type =
- (chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ?
- LIBXL_CONSOLE_TYPE_SERIAL : LIBXL_CONSOLE_TYPE_PV);
-
- ret = libxl_console_get_tty(priv->ctx, vm->def->id, chr->target.port,
- console_type, &console);
- if (ret)
- goto cleanup;
-
- if (VIR_STRDUP(chr->source.data.file.path, console) < 0)
- goto cleanup;
-
/* handle mutually exclusive access to console devices */
ret = virChrdevOpen(priv->devs,
&chr->source,
@@ -4052,7 +4038,6 @@ libxlDomainOpenConsole(virDomainPtr dom,
}
cleanup:
- VIR_FREE(console);
if (vm)
virObjectUnlock(vm);
return ret;
--
Anthony PERARD
9 years, 9 months
[libvirt] [PATCH] Make ZFS storage pool XML tests optional
by Gary R Hook
From: Gary R Hook <grhookatwork(a)gmail.com>
Do not run ZFS tests when ZFS is unsupported in the environment.
The recent patch b4af40226d09adeaf9e33a1d6594c4e8ce7f771d adds tests
to storagepoolxml2xmltest for the optional ZFS feature. When ZFS is
not included in the configuration these tests should not / cannot be
run. Modify Makefile.am and the test source file to check for use of
the feature and compile in the tests accordingly.
Signed-off-by: Gary R Hook <gary.hook(a)nimboxx.com>
---
tests/Makefile.am | 4 ++++
tests/storagepoolxml2xmltest.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e9418ea..8f8df27 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -780,6 +780,10 @@ storagepoolxml2xmltest_SOURCES = \
storagepoolxml2xmltest.c \
testutils.c testutils.h
storagepoolxml2xmltest_LDADD = $(LDADDS)
+storagepoolxml2xmltest_CFLAGS = $(AM_CFLAGS)
+if WITH_STORAGE_ZFS
+storagepoolxml2xmltest_CFLAGS += -DWITH_STORAGE_ZFS
+endif
nodedevxml2xmltest_SOURCES = \
nodedevxml2xmltest.c \
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index 52e2193..270f75d 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -106,8 +106,10 @@ mymain(void)
DO_TEST("pool-gluster");
DO_TEST("pool-gluster-sub");
DO_TEST("pool-scsi-type-scsi-host-stable");
+#ifdef WITH_STORAGE_ZFS
DO_TEST("pool-zfs");
DO_TEST("pool-zfs-sourcedev");
+#endif
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
1.9.1
9 years, 9 months
[libvirt] [PATCHv2] Coverity fix: properly check for 0 ipv6 address.
by Cédric Bosdonnat
---
src/util/virsocketaddr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 91bcadf..67ed330 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -850,7 +850,7 @@ virSocketAddrGetIpPrefix(const virSocketAddr *address,
}
return -1;
} else if (VIR_SOCKET_ADDR_IS_FAMILY(address, AF_INET6)) {
- if (address->data.inet6.sin6_addr.s6_addr == 0)
+ if (virSocketAddrIsWildcard(address))
return 0;
return 64;
}
--
2.1.2
9 years, 9 months
[libvirt] [PATCH v3 0/3] Add schema validation for domain XML
by Daniel P. Berrange
A followup to
https://www.redhat.com/archives/libvir-list/2015-January/msg00203.html
In this posting, the 3 remaining patches only are posted:
- Catch errors parsing RNG schema
- Use virFileFindResource for findning RNG
- Don't enable validation by default in virsh define/create
- Other misc typos
Daniel P. Berrange (3):
Add virXMLValidateAgainstSchema helper method
Add support for schema validation when passing in XML
virsh: add support for domain XML validation
include/libvirt/libvirt-domain.h | 5 +++
include/libvirt/virterror.h | 1 +
src/bhyve/bhyve_driver.c | 16 ++++++--
src/conf/domain_conf.c | 11 +++++
src/conf/domain_conf.h | 1 +
src/esx/esx_driver.c | 8 +++-
src/internal.h | 4 ++
src/libvirt-domain.c | 2 +-
src/libvirt_private.syms | 1 +
src/libxl/libxl_driver.c | 17 ++++++--
src/lxc/lxc_driver.c | 18 +++++++--
src/openvz/openvz_driver.c | 16 ++++++--
src/parallels/parallels_driver.c | 8 +++-
src/phyp/phyp_driver.c | 8 +++-
src/qemu/qemu_driver.c | 16 ++++++--
src/test/test_driver.c | 16 ++++++--
src/uml/uml_driver.c | 17 ++++++--
src/util/virerror.c | 6 +++
src/util/virxml.c | 79 ++++++++++++++++++++++++++++++++++++
src/util/virxml.h | 5 +++
src/vbox/vbox_common.c | 8 +++-
src/vmware/vmware_driver.c | 16 ++++++--
src/xen/xen_driver.c | 16 ++++++--
src/xenapi/xenapi_driver.c | 17 ++++++--
tools/virsh-domain.c | 87 +++++++++++++++++++++++++++++++++++-----
25 files changed, 341 insertions(+), 58 deletions(-)
--
2.1.0
9 years, 9 months
[libvirt] [PATCHv2 0/7] Sharing code for domain and network routes
by Cédric Bosdonnat
Hi guys,
Here are a few patches to have common route definitions for domains and networks.
What has changed since v1:
* Split into several patches for backportability as suggested by Laine
* Moved the virNetworkRouteDef struct definition in the c file to make sure all
routes are created with the virNetworkRouteDefCreate (or Parse) function. This
way we can get rid of the redundant checks in the format function.
* Moved the prefix computing code into a new virNetworkRouteDefGetPrefix function.
* Applied and tweaked John's patches.
* Fix the virSocketAddrGetIpPrefix 0.0.0.0 special case as suggested by Laine.
Cédric Bosdonnat (5):
Fix ipv6 regex in RNG schemas to match '::'
Move network route definition to networkcommon.rng
Move code related to network routes to networkcommon_conf.[ch]
Use the network route definitions for domains
virSocketAddrGetIpPrefix 0.0.0.0 special case
John Ferlan (2):
domain_conf: Resolve Coverity RESOURCE_LEAK
domain_conf: Check errors from virSocketAddrFormat
docs/formatdomain.html.in | 9 +-
docs/schemas/basictypes.rng | 2 +-
docs/schemas/domaincommon.rng | 29 +-
docs/schemas/network.rng | 20 +-
docs/schemas/networkcommon.rng | 22 ++
po/POTFILES.in | 1 +
src/Makefile.am | 3 +-
src/conf/domain_conf.c | 136 ++-----
src/conf/domain_conf.h | 14 +-
src/conf/network_conf.c | 297 +---------------
src/conf/network_conf.h | 22 +-
src/conf/networkcommon_conf.c | 414 ++++++++++++++++++++++
src/conf/networkcommon_conf.h | 72 ++++
src/libvirt_private.syms | 11 +
src/lxc/lxc_container.c | 22 +-
src/lxc/lxc_native.c | 20 +-
src/network/bridge_driver.c | 44 +--
src/util/virsocketaddr.c | 6 +
tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml | 4 +-
tests/lxcconf2xmldata/lxcconf2xml-simple.xml | 4 +-
tests/lxcxml2xmldata/lxc-hostdev.xml | 4 +-
tests/lxcxml2xmldata/lxc-idmap.xml | 4 +-
22 files changed, 633 insertions(+), 527 deletions(-)
create mode 100644 src/conf/networkcommon_conf.c
create mode 100644 src/conf/networkcommon_conf.h
--
2.1.2
9 years, 9 months
[libvirt] [PATCHv3 0/3] Fix vmdef usage after ExitMonitor
by Ján Tomko
The patches 1-2, 6-8 from v2 have been pushed already
Device removal and device detach are now squashed together.
Both attach and detach skip audit when the domain crashed.
(Left to be cleaned up by a separate series)
Patches checking the return value in all other non-fatal cases
were squashed together with the patch adding ATTRIBUTE_RETURN_CHECK.
Rebased to master, added qemuProcessUpdateVideoRamSize, and fixed
numerous wrong return values and a few missing EndJobs.
Ján Tomko (3):
Fix vmdef usage after domain crash in monitor on device detach
Fix vmdef usage after domain crash in monitor on device attach
Always check return value of qemuDomainObjExitMonitor
src/qemu/qemu_domain.c | 11 +--
src/qemu/qemu_domain.h | 3 +-
src/qemu/qemu_driver.c | 166 ++++++++++++++++++++++---------------
src/qemu/qemu_hotplug.c | 202 ++++++++++++++++++++++++++++++----------------
src/qemu/qemu_hotplug.h | 6 +-
src/qemu/qemu_migration.c | 139 ++++++++++++++++---------------
src/qemu/qemu_process.c | 115 +++++++++++++-------------
7 files changed, 373 insertions(+), 269 deletions(-)
--
2.0.4
9 years, 9 months
[libvirt] [PATCH] ipv6 check for :: address
by Cédric Bosdonnat
Hi John,
Here is a possible fix for the coverity issue you mentioned. Since ipv6
addresses are too big to be converted to a single integer, I just looped
over the array... not sure that is the most elegant way to do it.
Cédric Bosdonnat (1):
Coverity fix: properly check for 0 ipv6 address.
src/util/virsocketaddr.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.1.2
9 years, 9 months