[libvirt] [PATCH] build: bump min required gcc to 4.8
by Daniel P. Berrangé
The previous bump to 4.4 was done in:
commit 24241c236e5e0b0b51a33ba539b40f5429a0df0e
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Wed Jul 5 10:35:32 2017 +0100
Require use of GCC 4.4 or CLang compilers
with 4.4 picked due to RHEL-6. Since we dropped RHEL-6, the
next oldest distros are RHEL-7 (4.8.5) or Debian Jessie (4.9.2).
Thus we pick 4.8 as the new min.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
config-post.h | 6 ++--
m4/virt-compile-warnings.m4 | 71 ++-----------------------------------
src/internal.h | 44 +++++++----------------
src/util/virbuffer.c | 3 --
src/util/virstring.c | 3 --
src/util/virsysinfo.c | 4 ---
6 files changed, 19 insertions(+), 112 deletions(-)
diff --git a/config-post.h b/config-post.h
index 093f84a7ce..f928e19273 100644
--- a/config-post.h
+++ b/config-post.h
@@ -71,7 +71,7 @@
#endif /* LIBVIRT_NSS */
#ifndef __GNUC__
-# error "Libvirt requires GCC >= 4.4, or CLang"
+# error "Libvirt requires GCC >= 4.8, or CLang"
#endif
/*
@@ -86,6 +86,6 @@
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#endif
-#if !(__GNUC_PREREQ(4, 4) || defined(__clang__))
-# error "Libvirt requires GCC >= 4.4, or CLang"
+#if !(__GNUC_PREREQ(4, 8) || defined(__clang__))
+# error "Libvirt requires GCC >= 4.8, or CLang"
#endif
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index fc185aef38..f9460e82ba 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -68,61 +68,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
# Source: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
dontwarn="$dontwarn -Wdisabled-optimization"
- # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
- # which triggers spurious warnings for our usage
- AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
- [lv_cv_gcc_wformat_null_works], [
- save_CFLAGS=$CFLAGS
- CFLAGS='-Wunknown-pragmas -Werror -Wformat'
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <stddef.h>
- static __attribute__ ((__format__ (__printf__, 1, 2))) int
- foo (const char *fmt, ...) { return !fmt; }
- ]], [[
- return foo(NULL);
- ]])],
- [lv_cv_gcc_wformat_null_works=yes],
- [lv_cv_gcc_wformat_null_works=no])
- CFLAGS=$save_CFLAGS])
-
- # Gnulib uses '#pragma GCC diagnostic push' to silence some
- # warnings, but older gcc doesn't support this.
- AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
- [lv_cv_gcc_pragma_push_works], [
- save_CFLAGS=$CFLAGS
- CFLAGS='-Wunknown-pragmas -Werror'
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #pragma GCC diagnostic push
- #pragma GCC diagnostic pop
- ]])],
- [lv_cv_gcc_pragma_push_works=yes],
- [lv_cv_gcc_pragma_push_works=no])
- CFLAGS=$save_CFLAGS])
- if test $lv_cv_gcc_pragma_push_works = no; then
- dontwarn="$dontwarn -Wmissing-prototypes"
- dontwarn="$dontwarn -Wmissing-declarations"
- dontwarn="$dontwarn -Wcast-align"
- else
- AC_DEFINE_UNQUOTED([WORKING_PRAGMA_PUSH], 1,
- [Define to 1 if gcc supports pragma push/pop])
- fi
-
- dnl Check whether strchr(s, char variable) causes a bogus compile
- dnl warning, which is the case with GCC < 4.6 on some glibc
- AC_CACHE_CHECK([whether the C compiler's -Wlogical-op gives bogus warnings],
- [lv_cv_gcc_wlogical_op_broken], [
- save_CFLAGS="$CFLAGS"
- CFLAGS="-O2 -Wlogical-op -Werror"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <string.h>
- ]], [[
- const char *haystack;
- char needle;
- return strchr(haystack, needle) == haystack;]])],
- [lv_cv_gcc_wlogical_op_broken=no],
- [lv_cv_gcc_wlogical_op_broken=yes])
- CFLAGS="$save_CFLAGS"])
-
+ # Broken in 6.0 and later
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
AC_CACHE_CHECK([whether gcc gives bogus warnings for -Wlogical-op],
[lv_cv_gcc_wlogical_op_equal_expr_broken], [
save_CFLAGS="$CFLAGS"
@@ -188,14 +135,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
wantwarn="$wantwarn -Wswitch-enum"
# GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
- # so we need to manually re-exclude it. Also, older gcc 4.2
- # added an implied ATTRIBUTE_NONNULL on any parameter marked
- # ATTRIBUTE_FMT_PRINT, which causes -Wformat failure on our
- # intentional use of virReportError(code, NULL).
+ # so we need to manually re-exclude it.
wantwarn="$wantwarn -Wno-format-nonliteral"
- if test $lv_cv_gcc_wformat_null_works = no; then
- wantwarn="$wantwarn -Wno-format"
- fi
# -Wformat enables this by default, and we should keep it,
# but need to rewrite various areas of code first
@@ -283,12 +224,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
#endif
])
- if test "$gl_cv_warn_c__Wlogical_op" = yes &&
- test "$lv_cv_gcc_wlogical_op_broken" = yes; then
- AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP_STRCHR], 1,
- [Define to 1 if gcc -Wlogical-op reports false positives on strchr])
- fi
-
if test "$gl_cv_warn_c__Wlogical_op" = yes &&
test "$lv_cv_gcc_wlogical_op_equal_expr_broken" = yes; then
AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP_EQUAL_EXPR], 1,
diff --git a/src/internal.h b/src/internal.h
index f718895460..adc1e3f496 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -185,54 +185,36 @@
# endif
#endif
-#if WORKING_PRAGMA_PUSH
-# define VIR_WARNINGS_NO_CAST_ALIGN \
+#define VIR_WARNINGS_NO_CAST_ALIGN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wcast-align\"")
-# define VIR_WARNINGS_NO_DEPRECATED \
+#define VIR_WARNINGS_NO_DEPRECATED \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-# if HAVE_SUGGEST_ATTRIBUTE_FORMAT
-# 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 \
+#else
+# define VIR_WARNINGS_NO_PRINTF \
_Pragma ("GCC diagnostic push")
-# endif
+#endif
/* Workaround bogus GCC 6.0 for logical 'or' equal expression warnings.
* (GCC bz 69602) */
-# if BROKEN_GCC_WLOGICALOP_EQUAL_EXPR
-# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
+#if BROKEN_GCC_WLOGICALOP_EQUAL_EXPR
+# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wlogical-op\"")
-# else
-# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
- _Pragma ("GCC diagnostic push")
-# endif
-
-# define VIR_WARNINGS_RESET \
- _Pragma ("GCC diagnostic pop")
#else
-# define VIR_WARNINGS_NO_CAST_ALIGN
-# define VIR_WARNINGS_NO_DEPRECATED
-# define VIR_WARNINGS_NO_PRINTF
-# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR
-# define VIR_WARNINGS_RESET
-#endif
-
-/* Workaround bogus GCC < 4.6 that produces false -Wlogical-op warnings for
- * strchr(). Those old GCCs don't support push/pop. */
-#if BROKEN_GCC_WLOGICALOP_STRCHR
-# define VIR_WARNINGS_NO_WLOGICALOP_STRCHR \
- _Pragma ("GCC diagnostic ignored \"-Wlogical-op\"")
-#else
-# define VIR_WARNINGS_NO_WLOGICALOP_STRCHR
+# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
+ _Pragma ("GCC diagnostic push")
#endif
+#define VIR_WARNINGS_RESET \
+ _Pragma ("GCC diagnostic pop")
/*
* Use this when passing possibly-NULL strings to printf-a-likes.
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index ac03b15a61..12b33f8bd6 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -421,9 +421,6 @@ virBufferVasprintf(virBufferPtr buf, const char *format, va_list argptr)
}
-VIR_WARNINGS_NO_WLOGICALOP_STRCHR
-
-
/**
* virBufferEscapeString:
* @buf: the buffer to append to
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 95bd7d225e..bd269e98fe 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -1350,9 +1350,6 @@ virStringHasControlChars(const char *str)
}
-VIR_WARNINGS_NO_WLOGICALOP_STRCHR
-
-
/**
* virStringStripControlChars:
* @str: the string to strip
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 5be5e5133d..af26e0bab9 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -478,10 +478,6 @@ virSysinfoReadARM(void)
return NULL;
}
-
-
-VIR_WARNINGS_NO_WLOGICALOP_STRCHR
-
static char *
virSysinfoParseS390Delimited(const char *base, const char *name, char **value,
char delim1, char delim2)
--
2.21.0
5 years, 4 months
[libvirt] [PATCH] test_driver: implement virDomainMemoryStats
by Ilias Stamatis
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 52 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index fcb80c9e47..55976eedf1 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -6845,6 +6845,57 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
return 0;
}
+
+static int
+testDomainMemoryStats(virDomainPtr dom,
+ virDomainMemoryStatPtr stats,
+ unsigned int nr_stats,
+ unsigned int flags)
+{
+ virDomainObjPtr vm;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ return -1;
+
+ if (virDomainObjCheckActive(vm) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+#define STATS_SET_PARAM(name, value) \
+ if (ret < nr_stats) { \
+ stats[ret].tag = name; \
+ stats[ret].val = value; \
+ ret++; \
+ }
+
+ if (virDomainDefHasMemballoon(vm->def)) {
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON, 1024000);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_SWAP_IN, 0);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_SWAP_OUT, 0);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT, 0);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT, 0);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_UNUSED, 791584);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_AVAILABLE, 977816);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_USABLE, 726244);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 627319920);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 164964);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC, 0);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, 0);
+ STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_RSS, 1131076);
+ }
+
+#undef STATS_SET_PARAM
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
+
static int
testDomainMemoryPeek(virDomainPtr dom,
unsigned long long start,
@@ -7799,6 +7850,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainManagedSave = testDomainManagedSave, /* 1.1.4 */
.domainHasManagedSaveImage = testDomainHasManagedSaveImage, /* 1.1.4 */
.domainManagedSaveRemove = testDomainManagedSaveRemove, /* 1.1.4 */
+ .domainMemoryStats = testDomainMemoryStats, /* 5.6.0 */
.domainMemoryPeek = testDomainMemoryPeek, /* 5.4.0 */
.domainSnapshotNum = testDomainSnapshotNum, /* 1.1.4 */
--
2.22.0
5 years, 4 months
[libvirt] [PATCH] cpu: Drop CPUID definition for hv-spinlocks
by Jiri Denemark
hv-spinlocks is not a CPUID feature and should not be checked as such.
While starting a domain with hv-spinlocks enabled, we would report a
warning about unsupported hyperv spinlocks feature even though it was
set properly.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu/cpu_x86.c | 3 ---
src/qemu/qemu_process.c | 5 +++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 387c365512..b58eb2c9d8 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -84,8 +84,6 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER,
0x40000003, 0x00000008);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED,
0x40000003, 0x00000020);
-KVM_FEATURE_DEF(VIR_CPU_x86_HV_SPINLOCKS,
- 0x40000003, 0x00000022);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC,
0x40000003, 0x00000030);
KVM_FEATURE_DEF(VIR_CPU_x86_HV_VPINDEX,
@@ -110,7 +108,6 @@ static virCPUx86Feature x86_kvm_features[] =
KVM_FEATURE(VIR_CPU_x86_HV_SYNIC),
KVM_FEATURE(VIR_CPU_x86_HV_STIMER),
KVM_FEATURE(VIR_CPU_x86_HV_RELAXED),
- KVM_FEATURE(VIR_CPU_x86_HV_SPINLOCKS),
KVM_FEATURE(VIR_CPU_x86_HV_VAPIC),
KVM_FEATURE(VIR_CPU_x86_HV_VPINDEX),
KVM_FEATURE(VIR_CPU_x86_HV_RESET),
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0ee97e2296..0ba04b48e6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4098,7 +4098,8 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
/* always supported string property */
- if (i == VIR_DOMAIN_HYPERV_VENDOR_ID)
+ if (i == VIR_DOMAIN_HYPERV_VENDOR_ID ||
+ i == VIR_DOMAIN_HYPERV_SPINLOCKS)
continue;
if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON)
@@ -4119,7 +4120,6 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
switch ((virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
- case VIR_DOMAIN_HYPERV_SPINLOCKS:
VIR_WARN("host doesn't support hyperv '%s' feature",
virDomainHypervTypeToString(i));
break;
@@ -4140,6 +4140,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
return -1;
/* coverity[dead_error_begin] */
+ case VIR_DOMAIN_HYPERV_SPINLOCKS:
case VIR_DOMAIN_HYPERV_VENDOR_ID:
case VIR_DOMAIN_HYPERV_LAST:
break;
--
2.22.0
5 years, 4 months
[libvirt] UID/GID during kvm/qemu migrate
by Stephan von Krawczynski
Hello,
is there some immanent code in libvirt that forces UID/GID of the libvirt
standard user to be the same on two boxes migrating qemu vms against each
other?
The migration itself uses root obviously (password is requested). But if a vm
xml does not contain any definition regarding UID/GID what else could
prevent this from working?
I believe I ran into such a problem trying to migrate and ending up in an
error, a vm still working on original host but its fs (netfs pool (nfs/raw))
being switched to read-only...
--
Regards,
Stephan
5 years, 4 months
[libvirt] [PATCH v2 0/8] Add support for Direct Mode for Hyper-V Synthetic timers
by Vitaly Kuznetsov
Changes since v1:
- Rebase
- Add Ján's R-b tags.
- Hardcode 'direct' as the only stimer feature to avoid over-engineering
[Ján Tomko]
- Split 'conf' patch into three [Ján Tomko]
- Minor fixes [Ján Tomko]
QEMU-4.1 will bring us Direct Mode for Hyper-V Synthetic timers support,
we need to support it in libvirt too. As this is not a new enlightenment
but rather an enhancement of an existing one ('stimer'), support it in
<stimer state='on'>
<direct state='on'/>
</stimer>
form. Backwards compatibility is (hopefully) preserved.
Vitaly Kuznetsov (8):
docs: formatdomain: add stimer flag to the example xml
docs: formatdomain: fix 'SynIC' spelling
docs: formatdomain: move 'msrs' out of Hyper-V Enlightenments
cpu_x86: add Edx to KVM_FEATURE_DEF()
conf: change the way how Hyper-V features are printed out
conf: add support for Direct Mode for Hyper-V Synthetic timers
qemu: add support for Direct Mode for Hyper-V Synthetic timers
news: mention Direct Mode for Hyper-V Synthetic timers support
docs/formatdomain.html.in | 13 +++--
docs/news.xml | 9 ++++
docs/schemas/domaincommon.rng | 16 +++++-
src/conf/domain_conf.c | 77 ++++++++++++++++++++++++++---
src/conf/domain_conf.h | 1 +
src/cpu/cpu_x86.c | 35 +++++++------
src/cpu/cpu_x86_data.h | 2 +
src/qemu/qemu_command.c | 12 +++--
src/qemu/qemu_process.c | 20 +++++++-
tests/qemuxml2argvdata/hyperv.args | 4 +-
tests/qemuxml2argvdata/hyperv.xml | 4 +-
tests/qemuxml2xmloutdata/hyperv.xml | 4 +-
12 files changed, 158 insertions(+), 39 deletions(-)
--
2.20.1
5 years, 4 months
[libvirt] [PATCH 00/41] Split the libvirtd daemon into per-driver daemons
by Daniel P. Berrangé
This is what all the driver refactoring I've done has been about
enabling.
We gain new daemons for each driver, for the primary virt drivers:
virtlibxld
virtlxcd
virtqemud
virtvboxd
virtvzd
And again for the secondary drivers
virtinterfaced
virtnetworkd
virtnodedevd
virtnwfilterd
virtsecretd
virtstoraged
Finally to support IP connectivity, and also the legacy lbivirtd UNIX
domain socket (for the old libvirt remote driver SSH tunnelling):
virtproxyd
The the sake of facilitating upgrades, the existing libvirtd still
exists and works the same way it always has.
You either run libvirtd, or you run the per-driver daemons, never both.
The remote driver will look to see whether libvirtd is running to figure
out whether to connect to libvirtd or the new per-driver daemons.
When auto-spawning daemons for nonroot users, we default to spawning the
per-driver daemons.
This can be controlled with a UR parameter "?mode=direct|legacy|auto",
where 'direct' means per-driver and 'legacy' means libvirtd (or indirect
via virtproxyd if that's running).
Changed in v2:
- Added systemd unit files for service & sockets, ensuring
conflicts with libvirtd
- Fixed proxy to actually handle probing of URIs (still not
quite perfect)
- Renamed virtlibxld to virtxend as "xen" is the user facing
name of the URI
- Lazy loading of secondary drivers, so connecting to virtqemud
does't auto-spawn all secondary driver daemons, until a
relevant API is actually invoked
- Actually generated config files / augeas files per daemon
- Abort daemon startup if driver fails to load
- Many other fixes
Still a few things to do....
Important:
- Tweak virtxend to not start unless on a xen host
- Identity forwarding so that when connecting to
virtproxyd the apps identity is sent onto virtqemud.
Without this, virtqemud would see the client as "root"
and so polkit would allow all access. Opps
Nice to have
- MAYBE make it possible to disable build of libvirtd, or of the per-driver
daemons so downstream vendors can decide which to ship. Alternatively
they can just not include the binary in the package file list ?
- Tuning of the daemon defaults for worker threads to better suit
the fact that we have per-driver daemons
- More work on RPM packaging to allow install of per-driver daemosn
without pulling in libvirtd too
- Hopefully not much else.
Daniel P. Berrangé (41):
build: make augeas-gentest.pl write to stdout
build: create all augeas test files in same dir as their source
build: collapse rules adding augeas tests to CLEANFILES
build: use a common rule for checking augeas test data files
build: centralize rule for handling generated config files
remote: stop trying to print help as giant blocks of text
remote: conditionalize socket names in libvirtd daemon
remote: conditionalize daemon name in libvirtd daemon
remote: conditionalize driver loading in libvirtd daemon
remote: conditionalize IP socket usage in libvirtd daemon
remote: conditionalize IP socket config in libvirtd.conf
remote: conditionalize IP socket config in augeas definitions
remote: refactor & rename variables for building libvirtd
remote: don't hardcode /etc in the systemd units
remote: reduce duplication in systemd unit file make rules into one
remote: conditionalize systemd socket unit files
remote: refactor how list of systemd unit files is built
remote: in per-driver daemons ensure that state initialize succeeds
remote: introduce virtproxyd daemon to handle IP connectivity
secret: introduce virtsecretd daemon
network: introduce virtnetworkd daemon
interface: introduce virtinterfaced daemon
storage: introduce virtstoraged daemon
nodedev: introduce virtnodedevd daemon
nwfilter: introduce virtnwfilterd daemon
libxl: introduce virtxend daemon
qemu: introduce virtqemud daemon
lxc: introduce virtlxcd daemon
vbox: introduce virtvboxd daemon
bhyve: introduce virtbhyved daemon
vz: introduce virtvzd daemon
admin: add ability to connect to the per-driver daemon sockets
remote: get rid of bogus ATTRIBUTE_UNUSED annotation client param
remote: change generated methods to not directly access connection
remote: change hand written methods to not directly access connection
remote: open secondary drivers via remote driver if needed
remote: handle autoprobing of driver within virtproxyd
remote: use enum helpers for parsing remote driver transport
remote: refactor the code for choosing the UNIX socket path
remote: switch to connect to per-driver daemons by default
libvirt: correctly print out URI returned from probing
.gitignore | 62 +-
build-aux/augeas-gentest.pl | 22 +-
libvirt.spec.in | 91 ++
m4/virt-driver-remote.m4 | 15 +
src/Makefile.am | 26 +-
src/admin/admin_server_dispatch.c | 9 +
src/bhyve/Makefile.inc.am | 55 +-
src/bhyve/bhyve_driver.c | 10 +-
src/driver-state.h | 8 +-
src/driver.h | 2 +
src/interface/Makefile.inc.am | 62 +
src/interface/interface_backend_netcf.c | 8 +-
src/interface/interface_backend_udev.c | 4 +-
src/interface/virtinterfaced.service.in | 24 +
src/libvirt-admin.c | 32 +-
src/libvirt.c | 42 +-
src/libvirt_internal.h | 1 +
src/libxl/Makefile.inc.am | 79 +-
src/libxl/libxl_driver.c | 10 +-
src/libxl/virtxend.service.in | 24 +
src/locking/Makefile.inc.am | 76 +-
src/logging/Makefile.inc.am | 22 +-
src/lxc/Makefile.inc.am | 77 +-
src/lxc/lxc_driver.c | 12 +-
src/lxc/virtlxcd.service.in | 24 +
src/network/Makefile.inc.am | 61 +
src/network/bridge_driver.c | 4 +-
src/network/virtnetworkd.service.in | 24 +
src/node_device/Makefile.inc.am | 62 +
src/node_device/node_device_hal.c | 12 +-
src/node_device/node_device_udev.c | 8 +-
src/node_device/virtnodedevd.service.in | 24 +
src/nwfilter/Makefile.inc.am | 62 +
src/nwfilter/nwfilter_driver.c | 12 +-
src/nwfilter/virtnwfilterd.service.in | 24 +
src/qemu/Makefile.inc.am | 76 +-
src/qemu/qemu_driver.c | 8 +-
src/qemu/virtqemud.service.in | 24 +
src/remote/Makefile.inc.am | 281 ++--
src/remote/libvirtd-admin.socket.in | 15 +-
src/remote/libvirtd-ro.socket.in | 15 +-
src/remote/libvirtd-tcp.socket.in | 13 +-
src/remote/libvirtd-tls.socket.in | 13 +-
src/remote/{libvirtd.aug => libvirtd.aug.in} | 26 +-
.../{libvirtd.conf => libvirtd.conf.in} | 42 +-
src/remote/libvirtd.service.in | 2 +-
src/remote/libvirtd.socket.in | 11 +-
src/remote/remote_daemon.c | 291 ++--
src/remote/remote_daemon.h | 13 +
src/remote/remote_daemon_config.c | 47 +-
src/remote/remote_daemon_config.h | 9 +-
src/remote/remote_daemon_dispatch.c | 1205 +++++++++--------
src/remote/remote_driver.c | 396 ++++--
src/remote/remote_driver.h | 4 -
src/remote/test_libvirtd.aug.in | 16 +-
src/remote/virtproxyd.service.in | 24 +
src/rpc/gendispatch.pl | 96 +-
src/secret/Makefile.inc.am | 62 +
src/secret/secret_driver.c | 8 +-
src/secret/virtsecretd.service.in | 24 +
src/storage/Makefile.inc.am | 61 +
src/storage/storage_driver.c | 8 +-
src/storage/virtstoraged.service.in | 24 +
src/vbox/Makefile.inc.am | 62 +
src/vbox/virtvboxd.service.in | 24 +
src/vz/Makefile.inc.am | 62 +
src/vz/virtvzd.service.in | 24 +
src/vz/vz_driver.c | 14 +-
68 files changed, 2832 insertions(+), 1258 deletions(-)
create mode 100644 src/interface/virtinterfaced.service.in
create mode 100644 src/libxl/virtxend.service.in
create mode 100644 src/lxc/virtlxcd.service.in
create mode 100644 src/network/virtnetworkd.service.in
create mode 100644 src/node_device/virtnodedevd.service.in
create mode 100644 src/nwfilter/virtnwfilterd.service.in
create mode 100644 src/qemu/virtqemud.service.in
rename src/remote/{libvirtd.aug => libvirtd.aug.in} (89%)
rename src/remote/{libvirtd.conf => libvirtd.conf.in} (95%)
create mode 100644 src/remote/virtproxyd.service.in
create mode 100644 src/secret/virtsecretd.service.in
create mode 100644 src/storage/virtstoraged.service.in
create mode 100644 src/vbox/virtvboxd.service.in
create mode 100644 src/vz/virtvzd.service.in
--
2.21.0
5 years, 4 months
[libvirt] [python PATCH v7] Add virDomainCheckpoint APIs
by Eric Blake
Copies heavily from existing virDomainSnapshot handling, regarding
what special cases the generator has to be taught and what overrides
need to be written.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Python counterparts to my incremental backup patches. An earlier
version was already reviewed by Dan; the main diff here is the
addition of virDomainSnapshotCreateXML2 handling.
HACKING | 2 +
MANIFEST.in | 1 +
generator.py | 37 ++++++++--
libvirt-override-api.xml | 12 ++++
libvirt-override-virDomain.py | 13 ++++
libvirt-override-virDomainCheckpoint.py | 19 +++++
libvirt-override.c | 96 +++++++++++++++++++++++++
sanitytest.py | 11 +--
typewrappers.c | 13 ++++
typewrappers.h | 10 +++
10 files changed, 206 insertions(+), 8 deletions(-)
create mode 100644 libvirt-override-virDomainCheckpoint.py
diff --git a/HACKING b/HACKING
index 6eeb9e6..39e7cd3 100644
--- a/HACKING
+++ b/HACKING
@@ -28,6 +28,8 @@ hand written source files
the virConnect class
- libvirt-override-virDomain.py - high level overrides in
the virDomain class
+ - libvirt-override-virDomainCheckpoint.py - high level overrides in
+ the virDomainCheckpoint class
- libvirt-override-virDomainSnapshot.py - high level overrides in
the virDomainSnapshot class
- libvirt-override-virStoragePool.py - high level overrides in
diff --git a/MANIFEST.in b/MANIFEST.in
index b6788f4..5d2f559 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -23,6 +23,7 @@ include libvirt-override.c
include libvirt-override.py
include libvirt-override-virConnect.py
include libvirt-override-virDomain.py
+include libvirt-override-virDomainCheckpoint.py
include libvirt-override-virDomainSnapshot.py
include libvirt-override-virStoragePool.py
include libvirt-override-virStream.py
diff --git a/generator.py b/generator.py
index ffa3ce5..a16f9b1 100755
--- a/generator.py
+++ b/generator.py
@@ -35,6 +35,7 @@ libvirt_headers = [
"libvirt",
"libvirt-common",
"libvirt-domain",
+ "libvirt-domain-checkpoint",
"libvirt-domain-snapshot",
"libvirt-event",
"libvirt-host",
@@ -364,6 +365,10 @@ py_types = {
'virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
'const virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"),
+ 'virDomainCheckpointPtr': ('O', "virDomainCheckpoint", "virDomainCheckpointPtr", "virDomainCheckpointPtr"),
+ 'virDomainCheckpoint *': ('O', "virDomainCheckpoint", "virDomainCheckpointPtr", "virDomainCheckpointPtr"),
+ 'const virDomainCheckpoint *': ('O', "virDomainCheckpoint", "virDomainCheckpointPtr", "virDomainCheckpointPtr"),
+
'virDomainSnapshotPtr': ('O', "virDomainSnapshot", "virDomainSnapshotPtr", "virDomainSnapshotPtr"),
'virDomainSnapshot *': ('O', "virDomainSnapshot", "virDomainSnapshotPtr", "virDomainSnapshotPtr"),
'const virDomainSnapshot *': ('O', "virDomainSnapshot", "virDomainSnapshotPtr", "virDomainSnapshotPtr"),
@@ -536,6 +541,8 @@ skip_function = (
'virSaveLastError', # We have our own python error wrapper
'virFreeError', # Only needed if we use virSaveLastError
'virConnectListAllDomains', # overridden in virConnect.py
+ 'virDomainListAllCheckpoints', # overridden in virDomain.py
+ 'virDomainCheckpointListAllChildren', # overridden in virDomainCheckpoint.py
'virDomainListAllSnapshots', # overridden in virDomain.py
'virDomainSnapshotListAllChildren', # overridden in virDomainSnapshot.py
'virConnectListAllStoragePools', # overridden in virConnect.py
@@ -582,6 +589,7 @@ skip_function = (
"virStoragePoolRef",
"virStorageVolRef",
"virStreamRef",
+ "virDomainCheckpointRef",
"virDomainSnapshotRef",
# This functions shouldn't be called via the bindings (and even the docs
@@ -594,6 +602,8 @@ skip_function = (
"virNWFilterGetConnect",
"virStoragePoolGetConnect",
"virStorageVolGetConnect",
+ "virDomainCheckpointGetConnect",
+ "virDomainCheckpointGetDomain",
"virDomainSnapshotGetConnect",
"virDomainSnapshotGetDomain",
@@ -1023,6 +1033,8 @@ classes_type = {
"virStream *": ("._o", "virStream(self, _obj=%s)", "virStream"),
"virConnectPtr": ("._o", "virConnect(_obj=%s)", "virConnect"),
"virConnect *": ("._o", "virConnect(_obj=%s)", "virConnect"),
+ "virDomainCheckpointPtr": ("._o", "virDomainCheckpoint(self,_obj=%s)", "virDomainCheckpoint"),
+ "virDomainCheckpoint *": ("._o", "virDomainCheckpoint(self, _obj=%s)", "virDomainCheckpoint"),
"virDomainSnapshotPtr": ("._o", "virDomainSnapshot(self,_obj=%s)", "virDomainSnapshot"),
"virDomainSnapshot *": ("._o", "virDomainSnapshot(self, _obj=%s)", "virDomainSnapshot"),
}
@@ -1031,7 +1043,7 @@ primary_classes = ["virDomain", "virNetwork", "virInterface",
"virStoragePool", "virStorageVol",
"virConnect", "virNodeDevice", "virSecret",
"virNWFilter", "virNWFilterBinding",
- "virStream", "virDomainSnapshot"]
+ "virStream", "virDomainCheckpoint", "virDomainSnapshot"]
classes_destructors = {
"virDomain": "virDomainFree",
@@ -1043,6 +1055,7 @@ classes_destructors = {
"virSecret": "virSecretFree",
"virNWFilter": "virNWFilterFree",
"virNWFilterBinding": "virNWFilterBindingFree",
+ "virDomainCheckpoint": "virDomainCheckpointFree",
"virDomainSnapshot": "virDomainSnapshotFree",
# We hand-craft __del__ for this one
#"virStream": "virStreamFree",
@@ -1053,6 +1066,7 @@ class_skip_connect_impl = {
}
class_domain_impl = {
+ "virDomainCheckpoint": True,
"virDomainSnapshot": True,
}
@@ -1171,6 +1185,18 @@ def nameFixup(name, classe, type, file):
elif name[0:12] == "virDomainGet":
func = name[12:]
func = func[0:1].lower() + func[1:]
+ elif name[0:31] == "virDomainCheckpointLookupByName":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:28] == "virDomainCheckpointCreateXML":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:26] == "virDomainCheckpointCurrent":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:19] == "virDomainCheckpoint":
+ func = name[19:]
+ func = func[0:1].lower() + func[1:]
elif name[0:29] == "virDomainSnapshotLookupByName":
func = name[9:]
func = func[0:1].lower() + func[1:]
@@ -1183,6 +1209,9 @@ def nameFixup(name, classe, type, file):
elif name[0:20] == "virDomainSnapshotNum":
func = name[9:]
func = func[0:1].lower() + func[1:]
+ elif name[0:27] == "virDomainSnapshotCreateXML2":
+ func = name[9:]
+ func = func[0:1].lower() + func[1:]
elif name[0:26] == "virDomainSnapshotCreateXML":
func = name[9:]
func = func[0:1].lower() + func[1:]
@@ -1501,7 +1530,7 @@ def buildWrappers(module):
"virStorageVol", "virNodeDevice", "virSecret","virStream",
"virNWFilter", "virNWFilterBinding" ]:
classes.write(" def __init__(self, conn, _obj=None):\n")
- elif classname in [ 'virDomainSnapshot' ]:
+ elif classname in [ "virDomainCheckpoint", "virDomainSnapshot" ]:
classes.write(" def __init__(self, dom, _obj=None):\n")
else:
classes.write(" def __init__(self, _obj=None):\n")
@@ -1513,7 +1542,7 @@ def buildWrappers(module):
classes.write(" self._conn = conn\n" + \
" if not isinstance(conn, virConnect):\n" + \
" self._conn = conn._conn\n")
- elif classname in [ "virDomainSnapshot" ]:
+ elif classname in [ "virDomainCheckpoint", "virDomainSnapshot" ]:
classes.write(" self._dom = dom\n")
classes.write(" self._conn = dom.connect()\n")
classes.write(" if type(_obj).__name__ not in [\"PyCapsule\", \"PyCObject\"]:\n")
@@ -1641,7 +1670,7 @@ def buildWrappers(module):
classes.write(
" if ret is None:raise libvirtError('%s() failed', vol=self)\n" %
(name))
- elif classname == "virDomainSnapshot":
+ elif classname in [ "virDomainCheckpoint", "virDomainSnapshot"]:
classes.write(
" if ret is None:raise libvirtError('%s() failed', dom=self._dom)\n" %
(name))
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 7f578e0..1edf0c5 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -576,6 +576,18 @@
<arg name='flags' type='unsigned int' info='flags'/>
<return type='int' info="0 on success, -1 on error"/>
</function>
+ <function name='virDomainListAllCheckpoints' file='python'>
+ <info>returns the list of checkpoints for the given domain</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
+ <arg name='flags' type='unsigned int' info='flags'/>
+ <return type='char *' info='the list of checkpoints or None in case of error'/>
+ </function>
+ <function name='virDomainCheckpointListAllChildren' file='python'>
+ <info>collect the list of child checkpoint names for the given checkpoint</info>
+ <arg name='checkpoint' type='virDomainCheckpointPtr' info='pointer to the checkpoint'/>
+ <arg name='flags' type='unsigned int' info='flags'/>
+ <return type='char *' info='the list of checkpoints or None in case of error'/>
+ </function>
<function name='virDomainGetBlockJobInfo' file='python'>
<info>Get progress information for a block job</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py
index 7c417b8..7ce34f1 100644
--- a/libvirt-override-virDomain.py
+++ b/libvirt-override-virDomain.py
@@ -11,6 +11,19 @@
return retlist
+ def listAllCheckpoints(self, flags=0):
+ """List all checkpoints and returns a list of checkpoint objects"""
+ ret = libvirtmod.virDomainListAllCheckpoints(self._o, flags)
+ if ret is None:
+ raise libvirtError("virDomainListAllCheckpoints() failed", conn=self)
+
+ retlist = list()
+ for chkptr in ret:
+ retlist.append(virDomainCheckpoint(self, _obj=chkptr))
+
+ return retlist
+
+
def createWithFiles(self, files, flags=0):
"""Launch a defined domain. If the call succeeds the domain moves from the
defined to the running domains pools.
diff --git a/libvirt-override-virDomainCheckpoint.py b/libvirt-override-virDomainCheckpoint.py
new file mode 100644
index 0000000..371b0fd
--- /dev/null
+++ b/libvirt-override-virDomainCheckpoint.py
@@ -0,0 +1,19 @@
+ def getConnect(self):
+ """Get the connection that owns the domain that a checkpoint was created for"""
+ return self.connect()
+
+ def getDomain(self):
+ """Get the domain that a checkpoint was created for"""
+ return self.domain()
+
+ def listAllChildren(self, flags=0):
+ """List all child checkpoints and returns a list of checkpoint objects"""
+ ret = libvirtmod.virDomainCheckpointListAllChildren(self._o, flags)
+ if ret is None:
+ raise libvirtError("virDomainCheckpointListAllChildren() failed", conn=self)
+
+ retlist = list()
+ for chkptr in ret:
+ retlist.append(virDomainCheckpoint(self, _obj=chkptr))
+
+ return retlist
diff --git a/libvirt-override.c b/libvirt-override.c
index c5e2908..777f533 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -2325,6 +2325,98 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
goto cleanup;
}
+#if LIBVIR_CHECK_VERSION(5, 1, 0)
+static PyObject *
+libvirt_virDomainListAllCheckpoints(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval = NULL;
+ virDomainCheckpointPtr *chks = NULL;
+ int c_retval;
+ ssize_t i;
+ virDomainPtr dom;
+ PyObject *pyobj_dom;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"OI:virDomainListAllCheckpoints",
+ &pyobj_dom, &flags))
+ return NULL;
+ dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virDomainListAllCheckpoints(dom, &chks, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!(py_retval = PyList_New(c_retval)))
+ goto cleanup;
+
+ for (i = 0; i < c_retval; i++) {
+ VIR_PY_LIST_SET_GOTO(py_retval, i,
+ libvirt_virDomainCheckpointPtrWrap(chks[i]), error);
+ chks[i] = NULL;
+ }
+
+ cleanup:
+ for (i = 0; i < c_retval; i++)
+ if (chks[i])
+ virDomainCheckpointFree(chks[i]);
+ VIR_FREE(chks);
+ return py_retval;
+
+ error:
+ Py_CLEAR(py_retval);
+ goto cleanup;
+}
+
+static PyObject *
+libvirt_virDomainCheckpointListAllChildren(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval = NULL;
+ virDomainCheckpointPtr *chks = NULL;
+ int c_retval;
+ ssize_t i;
+ virDomainCheckpointPtr parent;
+ PyObject *pyobj_parent;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"OI:virDomainCheckpointListAllChildren",
+ &pyobj_parent, &flags))
+ return NULL;
+ parent = (virDomainCheckpointPtr) PyvirDomainCheckpoint_Get(pyobj_parent);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virDomainCheckpointListAllChildren(parent, &chks, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!(py_retval = PyList_New(c_retval)))
+ goto cleanup;
+
+ for (i = 0; i < c_retval; i++) {
+ VIR_PY_LIST_SET_GOTO(py_retval, i,
+ libvirt_virDomainCheckpointPtrWrap(chks[i]), error);
+ chks[i] = NULL;
+ }
+
+ cleanup:
+ for (i = 0; i < c_retval; i++)
+ if (chks[i])
+ virDomainCheckpointFree(chks[i]);
+ VIR_FREE(chks);
+ return py_retval;
+
+ error:
+ Py_CLEAR(py_retval);
+ goto cleanup;
+}
+#endif /* LIBVIR_CHECK_VERSION(5, 1, 0) */
+
static PyObject *
libvirt_virDomainSnapshotListNames(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
@@ -10100,6 +10192,10 @@ static PyMethodDef libvirtMethods[] = {
#if LIBVIR_CHECK_VERSION(1, 0, 3)
{(char *) "virDomainGetJobStats", libvirt_virDomainGetJobStats, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(1, 0, 3) */
+#if LIBVIR_CHECK_VERSION(5, 1, 0)
+ {(char *) "virDomainListAllCheckpoints", libvirt_virDomainListAllCheckpoints, METH_VARARGS, NULL},
+ {(char *) "virDomainCheckpointListAllChildren", libvirt_virDomainCheckpointListAllChildren, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(5, 1, 0) */
{(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL},
#if LIBVIR_CHECK_VERSION(0, 9, 13)
{(char *) "virDomainListAllSnapshots", libvirt_virDomainListAllSnapshots, METH_VARARGS, NULL},
diff --git a/sanitytest.py b/sanitytest.py
index 68dde6b..b044231 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -249,13 +249,13 @@ for name in sorted(basicklassmap):
# Remove 'Get' prefix from most APIs, except those in virConnect
# and virDomainSnapshot namespaces which stupidly used a different
# convention which we now can't fix without breaking API
- if func[0:3] == "Get" and klass not in ["virConnect", "virDomainSnapshot", "libvirt"]:
+ if func[0:3] == "Get" and klass not in ["virConnect", "virDomainCheckpoint", "virDomainSnapshot", "libvirt"]:
if func not in ["GetCPUStats", "GetTime"]:
func = func[3:]
# The object creation and lookup APIs all have to get re-mapped
# into the parent class
- if func in ["CreateXML", "CreateLinux", "CreateXMLWithFiles",
+ if func in ["CreateXML", "CreateXML2", "CreateLinux", "CreateXMLWithFiles",
"DefineXML", "CreateXMLFrom", "LookupByUUID",
"LookupByUUIDString", "LookupByVolume" "LookupByName",
"LookupByID", "LookupByName", "LookupByKey", "LookupByPath",
@@ -266,7 +266,7 @@ for name in sorted(basicklassmap):
if klass != "virDomain":
func = klass[3:] + func
- if klass == "virDomainSnapshot":
+ if klass in [ "virDomainCheckpoint", "virDomainSnapshot"]:
klass = "virDomain"
func = func[6:]
elif klass == "virStorageVol" and func in ["StorageVolCreateXMLFrom", "StorageVolCreateXML"]:
@@ -297,10 +297,13 @@ for name in sorted(basicklassmap):
if func[0:6] == "Change":
klass = "virConnect"
- # Need to special case the snapshot APIs
+ # Need to special case the checkpoint and snapshot APIs
if klass == "virDomainSnapshot" and func in ["Current", "ListNames", "Num"]:
klass = "virDomain"
func = "snapshot" + func
+ elif klass == "virDomainCheckpoint" and func == "Current":
+ klass = "virDomain"
+ func = "checkpoint" + func
# Names should start with lowercase letter...
func = func[0:1].lower() + func[1:]
diff --git a/typewrappers.c b/typewrappers.c
index 9ba14b4..cd7a70b 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -568,6 +568,19 @@ libvirt_virStreamPtrWrap(virStreamPtr node)
return ret;
}
+PyObject *
+libvirt_virDomainCheckpointPtrWrap(virDomainCheckpointPtr node)
+{
+ PyObject *ret;
+
+ if (node == NULL) {
+ return VIR_PY_NONE;
+ }
+
+ ret = libvirt_buildPyObject(node, "virDomainCheckpointPtr", NULL);
+ return ret;
+}
+
PyObject *
libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node)
{
diff --git a/typewrappers.h b/typewrappers.h
index 4423774..198397b 100644
--- a/typewrappers.h
+++ b/typewrappers.h
@@ -128,6 +128,15 @@ typedef struct {
} PyvirStream_Object;
+#define PyvirDomainCheckpoint_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyvirDomainCheckpoint_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ virDomainCheckpointPtr obj;
+} PyvirDomainCheckpoint_Object;
+
+
#define PyvirDomainSnapshot_Get(v) (((v) == Py_None) ? NULL : \
(((PyvirDomainSnapshot_Object *)(v))->obj))
@@ -204,6 +213,7 @@ PyObject * libvirt_virSecretPtrWrap(virSecretPtr node);
PyObject * libvirt_virNWFilterPtrWrap(virNWFilterPtr node);
PyObject * libvirt_virNWFilterBindingPtrWrap(virNWFilterBindingPtr node);
PyObject * libvirt_virStreamPtrWrap(virStreamPtr node);
+PyObject * libvirt_virDomainCheckpointPtrWrap(virDomainCheckpointPtr node);
PyObject * libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node);
--
2.20.1
5 years, 4 months
[libvirt] [PATCH] build: Fix checkpoint_conf on mingw
by Eric Blake
CI flagged a failing mingw build, due to:
In file included from ../../src/conf/checkpoint_conf.c:24:
../gnulib/lib/configmake.h:8:17: error: expected identifier or '(' before string constant
8 | #define DATADIR "/usr/i686-w64-mingw32/sys-root/mingw/share"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As previously learned in commits bd205a90 and 976abdf6, gnulib's
configmake.h header does #define DATADIR "string...", while mingw's
<winsock2.h> expects to declare a type named DATADIR. As long as the
mingw system header is included first before configmake.h, the two
uses do not conflict, but until gnulib is patched to make configmake.h
automatically work around the issue, our immediate fix is the
workaround of rearranging our include order to insure no conflict.
Copy the paradigm used in domain_conf.c of using <unistd.h> to trigger
the indirect inclusion of <winsock2.h> on mingw.
Fixes: 1a4df34a
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule
src/conf/checkpoint_conf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index 5f4c275dd8..5ce4cc4853 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -21,6 +21,8 @@
#include <config.h>
+#include <unistd.h>
+
#include "configmake.h"
#include "internal.h"
#include "virbitmap.h"
--
2.20.1
5 years, 4 months
[libvirt] [PATCH] util: Fix comment for virGetEnvAllowSUID()
by Andrea Bolognani
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed as trivial.
src/util/virutil.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 019009be8c..84ccc1a546 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1738,7 +1738,7 @@ const char *virGetEnvBlockSUID(const char *name)
/**
- * virGetEnvBlockSUID:
+ * virGetEnvAllowSUID:
* @name: the environment variable name
*
* Obtain an environment variable which is safe to
--
2.21.0
5 years, 4 months
[libvirt] [PATCH v10 00/19] Checkpoint APIs (incremental backup saga)
by Eric Blake
This is a subset of v10 of incremental backup, fixing Peter's review
comments from v9 (and even some from v8 that I had missed earlier).
There's still a lot more rebasing churn to resolve in the backup
portion of the series before I can post a full backup-v10 label.
There's still a decision to make: do we want this series in 5.6
(possibly with the addition of just patch 2/10 at [1] to introduce the
backup API to make it possible for downstream to backport features
without bumping .so)? This series has checkpoint support for test and
qemu drivers, and I think is probably clean enough to finally satisfy
everything Peter has been pointing out; but while the backup API
itself seems reasonable, the qemu implementation will likely miss 5.6
(as that half of the v9 posting was further behind, and still has a
lot of rebase churn to resolve). Or do we delay the checkpoint API to
5.7, to only go in with backup API? There's also still an outstanding
question of whether the backup API needs a tweak to use 'const char *'
instead of 'int' for the job identifier, given that Peter has a
proposal for overhauling the representation of libvirt jobs.
[1] https://www.redhat.com/archives/libvir-list/2019-July/msg00330.html
Here's a comparison of these patches to v9:
- rebase on top of master
- use more VIR_AUTOFREE and friends (but probably still missed some
spots where it would be worthwhile)
- split several patches
- add in a new patch to ensure the node names are learned at domain
startup (but I didn't play enough with hotplug to see if that also
has problems); necessary in order to...
- get rid of detecting node names in checkpoint code
- completely got rid of the notion of a current checkpoint in the
public API (the internal code still has one, but solely to track
which checkpoint becomes the parent of a new one to maintain a linear
chain; when loading checkpoints on libvirtd restart, there should be
at most one leaf node which becomes the internal current node)
- improved code for handling partial checkpoints (the code now correctly
handles: c1: disks A, B; c2: disks B, C; c3: disks A, B)
001/19:[down] 'snapshot: Don't leak moment obj list metaroot to callers'
002/19:[down] 'snapshot: Saner error message for duplicate create'
003/19:[down] 'snapshot: Documentation and comment improvements'
004/19:[down] 'backup: qemu: Detect node names at domain startup'
005/19:[0101] [FC] 'backup: Document new XML for checkpoints'
006/19:[0031] [FC] 'backup: Introduce virDomainCheckpoint APIs'
007/19:[0051] [FC] 'backup: Document nuances between different state capture APIs'
008/19:[0189] [FC] 'backup: Parse and output checkpoint XML'
009/19:[0066] [FC] 'backup: Allow for lists of checkpoint objects'
010/19:[----] [--] 'backup: Add new domain:checkpoint access control'
011/19:[----] [--] 'backup: Implement checkpoint APIs for remote driver'
012/19:[0161] [FC] 'backup: Implement virsh support for checkpoints'
013/19:[0047] [FC] 'backup: test: Implement metadata tracking for checkpoint APIs'
014/19:[0044] [FC] 'backup: Add virsh-checkpoints test'
015/19:[down] 'backup: qemu: Add directory for tracking checkpoints'
016/19:[0193] [FC] 'backup: qemu: Implement metadata tracking for checkpoint APIs'
017/19:[down] 'backup: qemu: Add helper API for looking up node name'
018/19:[0119] [FC] 'backup: Wire up qemu checkpoint commands over QMP'
019/19:[down] 'backup: Prevent snapshots and checkpoints at same time'
Eric Blake (19):
snapshot: Don't leak moment obj list metaroot to callers
snapshot: Saner error message for duplicate create
snapshot: Documentation and comment improvements
backup: qemu: Detect node names at domain startup
backup: Document new XML for checkpoints
backup: Introduce virDomainCheckpoint APIs
backup: Document nuances between different state capture APIs
backup: Parse and output checkpoint XML
backup: Allow for lists of checkpoint objects
backup: Add new domain:checkpoint access control
backup: Implement checkpoint APIs for remote driver
backup: Implement virsh support for checkpoints
backup: test: Implement metadata tracking for checkpoint APIs
backup: Add virsh-checkpoints test
backup: qemu: Add directory for tracking checkpoints
backup: qemu: Implement metadata tracking for checkpoint APIs
backup: qemu: Add helper API for looking up node name
backup: Wire up qemu checkpoint commands over QMP
backup: Prevent snapshots and checkpoints at same time
include/libvirt/libvirt-domain-checkpoint.h | 137 ++
include/libvirt/libvirt-domain.h | 6 +
include/libvirt/libvirt.h | 5 +-
src/access/viraccessperm.h | 6 +
src/conf/checkpoint_conf.h | 91 ++
src/conf/domain_conf.h | 2 +
src/conf/virconftypes.h | 9 +
src/conf/virdomaincheckpointobjlist.h | 72 +
src/conf/virdomainmomentobjlist.h | 10 +-
src/conf/virdomainobjlist.h | 7 +-
src/conf/virdomainsnapshotobjlist.h | 2 +
src/driver-hypervisor.h | 38 +
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_domain.h | 18 +
tools/virsh-checkpoint.h | 26 +
tools/virsh-completer.h | 4 +
tools/virsh-util.h | 3 +
tools/virsh.h | 1 +
docs/Makefile.am | 3 +
docs/apibuild.py | 2 +
docs/docs.html.in | 4 +-
docs/format.html.in | 1 +
docs/formatcheckpoint.html.in | 196 +++
docs/formatsnapshot.html.in | 14 +-
docs/index.html.in | 3 +-
docs/kbase.html.in | 5 +
docs/kbase/domainstatecapture.html.in | 303 +++++
docs/schemas/domaincheckpoint.rng | 94 ++
libvirt.spec.in | 2 +
mingw-libvirt.spec.in | 4 +
po/POTFILES | 3 +
src/Makefile.am | 2 +
src/access/viraccessperm.c | 3 +-
src/conf/Makefile.inc.am | 4 +
src/conf/checkpoint_conf.c | 597 +++++++++
src/conf/domain_conf.c | 6 +
src/conf/virdomaincheckpointobjlist.c | 243 ++++
src/conf/virdomainmomentobjlist.c | 55 +-
src/conf/virdomainobjlist.c | 11 +
src/conf/virdomainsnapshotobjlist.c | 9 +
src/libvirt-domain-checkpoint.c | 567 ++++++++
src/libvirt-domain.c | 19 +-
src/libvirt_private.syms | 29 +-
src/libvirt_public.syms | 16 +
src/qemu/qemu_conf.c | 5 +
src/qemu/qemu_domain.c | 190 +++
src/qemu/qemu_driver.c | 731 ++++++++++-
src/qemu/qemu_process.c | 5 +
src/remote/remote_daemon_dispatch.c | 20 +
src/remote/remote_driver.c | 24 +-
src/remote/remote_protocol.x | 123 +-
src/remote_protocol-structs | 69 +
src/rpc/gendispatch.pl | 32 +-
src/test/test_driver.c | 386 +++++-
tests/Makefile.am | 12 +-
.../disk-default.xml | 7 +
.../disk-invalid.xml | 8 +
tests/qemudomaincheckpointxml2xmlin/empty.xml | 1 +
.../name-invalid.xml | 4 +
.../qemudomaincheckpointxml2xmlin/sample.xml | 7 +
tests/qemudomaincheckpointxml2xmlin/size.xml | 4 +
.../disk-default.xml | 11 +
.../qemudomaincheckpointxml2xmlout/empty.xml | 7 +
.../internal-active-invalid.xml | 53 +
.../internal-inactive-invalid.xml | 53 +
.../redefine.xml | 63 +
.../qemudomaincheckpointxml2xmlout/sample.xml | 12 +
tests/qemudomaincheckpointxml2xmlout/size.xml | 11 +
tests/qemudomaincheckpointxml2xmltest.c | 213 +++
tests/virschematest.c | 2 +
tests/virsh-checkpoint | 174 +++
tests/virsh-snapshot | 15 +-
tools/Makefile.am | 1 +
tools/virsh-checkpoint.c | 1153 +++++++++++++++++
tools/virsh-completer.c | 51 +
tools/virsh-domain-monitor.c | 23 +
tools/virsh-domain.c | 7 +
tools/virsh-util.c | 11 +
tools/virsh.c | 2 +
tools/virsh.pod | 201 ++-
80 files changed, 6262 insertions(+), 63 deletions(-)
create mode 100644 include/libvirt/libvirt-domain-checkpoint.h
create mode 100644 src/conf/checkpoint_conf.h
create mode 100644 src/conf/virdomaincheckpointobjlist.h
create mode 100644 tools/virsh-checkpoint.h
create mode 100644 docs/formatcheckpoint.html.in
create mode 100644 docs/kbase/domainstatecapture.html.in
create mode 100644 docs/schemas/domaincheckpoint.rng
create mode 100644 src/conf/checkpoint_conf.c
create mode 100644 src/conf/virdomaincheckpointobjlist.c
create mode 100644 src/libvirt-domain-checkpoint.c
create mode 100644 tests/qemudomaincheckpointxml2xmlin/disk-default.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlin/disk-invalid.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlin/empty.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlin/name-invalid.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlin/sample.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlin/size.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/disk-default.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/empty.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/internal-active-invalid.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/internal-inactive-invalid.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/redefine.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/sample.xml
create mode 100644 tests/qemudomaincheckpointxml2xmlout/size.xml
create mode 100644 tests/qemudomaincheckpointxml2xmltest.c
create mode 100755 tests/virsh-checkpoint
create mode 100644 tools/virsh-checkpoint.c
--
2.20.1
5 years, 4 months