[libvirt] [PATCH 00/23] Better approach to add the "pvticketlocks" feature
by Peter Krempa
The paravirtual spinlock feature was introduced recently
into the qemu and linux code base. To test it you need
the most recent -rc version of the linux kernel and the
git version of qemu.
As the requirements to activate this feature in the guest
are really volatile (kernel support, qemu support .. .)
I decided to improve the original version so that it detects
if the feature was actually enabled in the guest. This
avoids possible problems with breaking guest ABI when migrating
between two hosts with different kernels. Additionally we may
start enforcin other features too.
This patchset is partialy based on Jiri's work on getting
actual cpu definition from a running qemu.
Jiri Denemark (8):
cpu: Add support for loading and storing CPU data
cpu: x86: Rename struct cpuX86cpuid as virCPUx86CPUID
cpu: x86: Rename struct cpuX86Data as virCPUx86Data
cpu: x86: Rename x86DataFree() as virCPUx86DataFree()
cpu: x86: Rename x86MakeCPUData as virCPUx86MakeData
cpu: x86: Rename x86DataAddCpuid as virCPUx86DataAddCPUID
cpu: Export few x86-specific APIs
qemu: Add monitor APIs to fetch CPUID data from QEMU
Peter Krempa (15):
schema: Rename option to make it reusable
conf: Clean up few error messages
qemu: command: Fix macro indentation
cpu: x86: Rename data_iterator and DATA_ITERATOR_INIT
cpu: x86: Fix return types of x86cpuidMatch and x86cpuidMatchMasked
cpu: x86: Fix function header formatting and whitespace
cpu: x86: Use whitespace to clarify context and use consistent labels
cpu: x86: Clean up error messages in x86VendorLoad()
qemu: Clean up check of maximum cpu count supported by a machine type
cpu_x86: Refactor storage of CPUID data to add support for KVM
features
cpu: x86: Parse the CPU feature map only once
cpu: x86: Add internal CPUID features support and KVM feature bits
conf: Refactor storing and usage of feature flags
qemu: Add support for paravirtual spinlocks in the guest
qemu: process: Validate specific CPUID flags of a guest
docs/formatdomain.html.in | 7 +
docs/schemas/domaincommon.rng | 18 +-
src/conf/domain_conf.c | 200 ++++--
src/conf/domain_conf.h | 3 +-
src/cpu/cpu.c | 41 ++
src/cpu/cpu.h | 16 +-
src/cpu/cpu_x86.c | 699 ++++++++++++---------
src/cpu/cpu_x86.h | 9 +
src/cpu/cpu_x86_data.h | 26 +-
src/libvirt_private.syms | 8 +
src/libxl/libxl_conf.c | 9 +-
src/lxc/lxc_container.c | 6 +-
src/qemu/qemu_command.c | 31 +-
src/qemu/qemu_monitor.c | 21 +
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 107 ++++
src/qemu/qemu_monitor_json.h | 3 +
src/qemu/qemu_process.c | 50 +-
src/vbox/vbox_tmpl.c | 45 +-
src/xenapi/xenapi_driver.c | 10 +-
src/xenapi/xenapi_utils.c | 22 +-
src/xenxs/xen_sxpr.c | 20 +-
src/xenxs/xen_xm.c | 30 +-
tests/Makefile.am | 1 +
.../qemumonitorjson-getcpu-empty.data | 2 +
.../qemumonitorjson-getcpu-empty.json | 46 ++
.../qemumonitorjson-getcpu-filtered.data | 4 +
.../qemumonitorjson-getcpu-filtered.json | 46 ++
.../qemumonitorjson-getcpu-full.data | 5 +
.../qemumonitorjson-getcpu-full.json | 46 ++
.../qemumonitorjson-getcpu-host.data | 6 +
.../qemumonitorjson-getcpu-host.json | 45 ++
tests/qemumonitorjsontest.c | 76 +++
.../qemuxml2argv-pv-spinlock-disabled.args | 5 +
.../qemuxml2argv-pv-spinlock-disabled.xml | 26 +
.../qemuxml2argv-pv-spinlock-enabled.args | 5 +
.../qemuxml2argv-pv-spinlock-enabled.xml | 26 +
tests/qemuxml2argvtest.c | 2 +
tests/qemuxml2xmltest.c | 2 +
39 files changed, 1279 insertions(+), 448 deletions(-)
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-empty.data
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-empty.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-filtered.data
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-filtered.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.json
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-disabled.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-disabled.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-enabled.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-enabled.xml
--
1.8.3.2
11 years, 1 month
[libvirt] [PATCH] xenapi: Fix build after const correctnes changes
by Peter Krempa
In commit d24677090f1c0596ac1585cc233d6e130b9bb75f the header of one of
the post parse callbacks was changed, but the function used as the
callback in the xenapi driver wasn't adapted. This resulted into:
CC xenapi/libvirt_driver_xenapi_la-xenapi_utils.lo
xenapi/xenapi_driver.c:63:5: error: initialization from incompatible pointer type [-Werror]
xenapi/xenapi_driver.c:63:5: error: (near initialization for 'xenapiDomainDefParserConfig.devicesPostParseCallback') [-Werror]
---
src/xenapi/xenapi_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index bca19af..4b522c0 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -45,7 +45,7 @@
static int
xenapiDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
- virDomainDefPtr def,
+ const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
--
1.8.3.2
11 years, 1 month
[libvirt] [PATCH 00/15] fix misuse of 'const fooPtr'
by Eric Blake
Mostly cleanup, but at least one bug fix (xen was instantiating
a memballoon device too early, during the post-parse callback
of the first device rather than after all devices were known).
Spawned by the conversation here:
https://www.redhat.com/archives/libvir-list/2013-September/thread.html#01311
Eric Blake (15):
maint: avoid 'const fooPtr' in public API
maint: avoid 'const fooPtr' in hashes
maint: avoid 'const fooPtr' in several util files
maint: avoid 'const fooPtr' in virnet files
maint: avoid 'const fooPtr' in cpu files
maint: avoid 'const fooPtr' in nwfilter files
maint: avoid 'const fooPtr' in tests
maint: avoid 'const fooPtr' in python bindings
maint: fix awkward typing of virDomainChrGetDomainPtrs
maint: avoid 'const fooPtr' in domain_conf
maint: avoid 'const fooPtr' in conf
maint: avoid 'const fooPtr' in security
maint: avoid 'const fooPtr' in qemu
maint: avoid 'const fooPtr' in all remaining places
build: syntax check to avoid 'const fooPtr'
cfg.mk | 8 ++
include/libvirt/libvirt.h.in | 6 +-
python/generator.py | 11 --
python/libvirt-override.c | 4 +-
src/conf/cpu_conf.c | 6 +-
src/conf/cpu_conf.h | 8 +-
src/conf/domain_conf.c | 164 ++++++++++++++++++------------
src/conf/domain_conf.h | 33 +++---
src/conf/interface_conf.c | 30 +++---
src/conf/interface_conf.h | 15 ++-
src/conf/netdev_vlan_conf.c | 4 +-
src/conf/netdev_vlan_conf.h | 4 +-
src/conf/network_conf.c | 44 ++++----
src/conf/network_conf.h | 28 ++---
src/conf/node_device_conf.c | 14 +--
src/conf/node_device_conf.h | 14 +--
src/conf/nwfilter_conf.c | 6 +-
src/conf/nwfilter_conf.h | 8 +-
src/conf/nwfilter_params.c | 52 +++++-----
src/conf/nwfilter_params.h | 32 +++---
src/conf/secret_conf.c | 8 +-
src/conf/secret_conf.h | 4 +-
src/conf/snapshot_conf.c | 6 +-
src/conf/snapshot_conf.h | 6 +-
src/cpu/cpu.c | 8 +-
src/cpu/cpu.h | 16 +--
src/cpu/cpu_arm.c | 3 +-
src/cpu/cpu_powerpc.c | 9 +-
src/cpu/cpu_s390.c | 3 +-
src/cpu/cpu_x86.c | 18 ++--
src/libxl/libxl_domain.c | 2 +-
src/lxc/lxc_domain.c | 4 +-
src/lxc/lxc_process.c | 4 +-
src/nwfilter/nwfilter_dhcpsnoop.c | 12 +--
src/nwfilter/nwfilter_dhcpsnoop.h | 3 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 18 ++--
src/nwfilter/nwfilter_gentech_driver.c | 23 +++--
src/nwfilter/nwfilter_gentech_driver.h | 11 +-
src/nwfilter/nwfilter_learnipaddr.c | 9 +-
src/nwfilter/nwfilter_learnipaddr.h | 4 +-
src/openvz/openvz_driver.c | 2 +-
src/qemu/qemu_bridge_filter.c | 10 +-
src/qemu/qemu_bridge_filter.h | 10 +-
src/qemu/qemu_command.c | 34 +++----
src/qemu/qemu_conf.c | 2 +-
src/qemu/qemu_domain.c | 5 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_hostdev.c | 2 +-
src/qemu/qemu_monitor_json.c | 2 +-
src/security/security_apparmor.c | 22 ++--
src/security/security_selinux.c | 2 +-
src/uml/uml_driver.c | 15 +--
src/util/virbuffer.c | 8 +-
src/util/virbuffer.h | 8 +-
src/util/virebtables.c | 4 +-
src/util/virebtables.h | 6 +-
src/util/virhash.c | 21 ++--
src/util/virhash.h | 19 ++--
src/util/virmacaddr.c | 16 +--
src/util/virmacaddr.h | 16 +--
src/util/virnetdev.c | 20 ++--
src/util/virnetdev.h | 8 +-
src/util/virnetdevbandwidth.c | 6 +-
src/util/virnetdevbandwidth.h | 7 +-
src/util/virnetdevmacvlan.c | 22 ++--
src/util/virnetdevmacvlan.h | 12 +--
src/util/virnetdevopenvswitch.c | 3 +-
src/util/virnetdevopenvswitch.h | 3 +-
src/util/virnetdevtap.c | 2 +-
src/util/virnetdevtap.h | 4 +-
src/util/virnetdevvlan.c | 6 +-
src/util/virnetdevvlan.h | 6 +-
src/util/virnetdevvportprofile.c | 28 ++---
src/util/virnetdevvportprofile.h | 10 +-
src/util/virnetlink.c | 10 +-
src/util/virnetlink.h | 8 +-
src/util/virsocketaddr.c | 54 +++++-----
src/util/virsocketaddr.h | 52 +++++-----
src/xen/xen_driver.c | 12 ++-
src/xen/xm_internal.c | 4 +-
tests/cputest.c | 4 +-
tests/qemucapabilitiestest.c | 2 +-
tests/qemumonitorjsontest.c | 21 ++--
tests/virhashtest.c | 8 +-
84 files changed, 625 insertions(+), 555 deletions(-)
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH] esx: Fix floppy.fileName handling in the vmx file parser
by Geoff Hickey
The vmx file parsing code was reporting errors when parsing floppy.fileName
entries if the filename didn't end in .flp. There is no such restriction in
ESX; even using the GUI to configure floppy filenames you can specify any
arbitrary file with any extension.
Fix by changing the vmx parsing code so that it uses the floppy.fileType
value to determine whether floppy.fileName refers to a block device or a
regular file.
Also remove code that would have generated an error if no floppy.fileName
was specified. This is not an error either.
---
src/vmx/vmx.c | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 36bc338..48487f8 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2250,27 +2250,14 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
goto cleanup;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
- if (virFileHasSuffix(fileName, ".flp")) {
- if (fileType != NULL) {
- if (STRCASENEQ(fileType, "file")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VMX entry '%s' to be 'file' but "
- "found '%s'"), fileType_name, fileType);
- goto cleanup;
- }
- }
-
- (*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
- (*def)->src = ctx->parseFileName(fileName, ctx->opaque);
-
- if ((*def)->src == NULL) {
- goto cleanup;
- }
- } else if (fileType != NULL && STRCASEEQ(fileType, "device")) {
+ if (fileType != NULL && STRCASEEQ(fileType, "device")) {
(*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
(*def)->src = fileName;
fileName = NULL;
+ } else if (fileType != NULL && STRCASEEQ(fileType, "file")) {
+ (*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
+ (*def)->src = ctx->parseFileName(fileName, ctx->opaque);
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid or not yet handled value '%s' "
@@ -3538,13 +3525,6 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
virBufferAsprintf(buffer, "floppy%d.fileType = \"file\"\n", unit);
if (def->src != NULL) {
- if (! virFileHasSuffix(def->src, ".flp")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Image file for floppy '%s' has unsupported "
- "suffix, expecting '.flp'"), def->dst);
- return -1;
- }
-
fileName = ctx->formatFileName(def->src, ctx->opaque);
if (fileName == NULL) {
--
1.8.1.2
11 years, 1 month
[libvirt] [RESEND][PATCHv5 0/4] write separate module for hostdev passthrough
by Chunyan Liu
[rebased to latest libvirt code for applying and reviewing the patches]
These patches implements a separate module for hostdev passthrough so that it
could be shared by different drivers and can maintain a global state of a host
device. Plus, add passthrough to libxl driver, and change qemu driver and lxc
driver to use hostdev common library instead of their own hostdev APIs.
---
Changes to v4:
* change the way checking hypervisor driver name to decide whether use pciback
or pci-stub as stub driver, instead, using driver callback to handle that.
* remove get active/inactive list APIs from hostdev common library since
currently no code uses them.
* add nodedev-detach/reattach/reset to libxl driver
* other fixes to Daniel and Jim's comments
v4 is here:
https://www.redhat.com/archives/libvir-list/2013-August/msg00806.html
Changes to v3:
* fix Jim's comments
v3 is here:
https://www.redhat.com/archives/libvir-list/2013-August/msg00019.html
Changes to v2:
* add patches for qemu driver and lxc driver, use common library APIs instead
of their own hostdev APIs.
* add APIs for nodedev-detach and nodedev-reattach calling.
* rename functions to use unified prefix 'virHostdev'
* use VIR_ONCE_GLOBAL_INIT() as others instead of previous Init and Cleanup.
* use VIR_STRDUP instead of strdup
* rebase to latest code
v2 is here:
https://www.redhat.com/archives/libvir-list/2013-June/msg00263.html
Chunyan Liu (4):
add hostdev passthrough common library
add pci passthrough to libxl driver
change qemu driver to use hostdev common library
change lxc driver to use hostdev common library
docs/schemas/domaincommon.rng | 1 +
po/POTFILES.in | 3 +-
src/Makefile.am | 3 +-
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 15 +
src/libxl/libxl_conf.c | 63 ++
src/libxl/libxl_conf.h | 4 +
src/libxl/libxl_domain.c | 9 +
src/libxl/libxl_driver.c | 443 ++++++++++++++-
src/lxc/lxc_conf.h | 4 -
src/lxc/lxc_driver.c | 45 +-
src/lxc/lxc_hostdev.c | 413 -------------
src/lxc/lxc_hostdev.h | 43 --
src/lxc/lxc_process.c | 21 +-
src/qemu/qemu_command.c | 1 -
src/qemu/qemu_conf.h | 9 +-
src/qemu/qemu_domain.c | 9 +
src/qemu/qemu_driver.c | 72 +--
src/qemu/qemu_hostdev.c | 1289 ---------------------------------------
src/qemu/qemu_hostdev.h | 72 ---
src/qemu/qemu_hotplug.c | 126 ++---
src/qemu/qemu_process.c | 34 +-
src/util/virhostdev.c | 1335 +++++++++++++++++++++++++++++++++++++++++
src/util/virhostdev.h | 104 ++++
src/util/virpci.c | 28 +-
src/util/virpci.h | 9 +-
src/util/virscsi.c | 26 +-
src/util/virscsi.h | 8 +-
src/util/virusb.c | 27 +-
src/util/virusb.h | 8 +-
31 files changed, 2195 insertions(+), 2033 deletions(-)
delete mode 100644 src/lxc/lxc_hostdev.c
delete mode 100644 src/lxc/lxc_hostdev.h
delete mode 100644 src/qemu/qemu_hostdev.c
delete mode 100644 src/qemu/qemu_hostdev.h
create mode 100644 src/util/virhostdev.c
create mode 100644 src/util/virhostdev.h
11 years, 1 month
[libvirt] libvirt URI for "UNIX abstract namespace"?
by Philipp Hahn
Hello,
while trying to reproduce a performance problem I had to fake 95 hosts with 300 VMs. My idea was to setup 95 users with each one running a session libvirtd. When adding them to our management system I had was troubled with finding the right libvirt URI, as the default session UNIX socket is in the "abstract ns", which has no file system representation. I solved that by explicitly starting the session libvirtds with a custom config only specifying a physical socket path:
for ((h=0;h<95;h+=1));do su -c "/usr/sbin/libvirtd -f <(echo "unix_sock_dir=\"/home/host$h/.libvirt\"") -d" "host$h";done
1. is there a way to specify an libvirt URI using the abstract ns?
2. Does anybody know another/better way to simulate many hosts with many VMs?
Thanks in advance.
Philipp
PS: libvirt-0.9.12
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH be open. fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
Director:Peter H. Ganten HRB 20755 Amtsgericht Bremen UID:DE 220 051 310
11 years, 1 month
[libvirt] [PATCH 1/3] Revert "VMX: Some serial ports are not actually connected"
by Doug Goldstein
This reverts commit dba04e7fa070a79415ea16141ad2e2ebd4f23033.
This change was unfortunately not correct. We should have been
changing the boolean argument supplied.
---
src/vmx/vmx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 38b7cc0..9906a9c 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2718,7 +2718,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
/* vmx:fileName -> def:data.file.path */
if (virVMXGetConfigString(conf, fileName_name, &fileName, false) < 0) {
- goto ignore;
+ goto cleanup;
}
/* vmx:network.endPoint -> def:data.tcp.listen */
--
1.8.1.5
11 years, 1 month
[libvirt] [PATCHv2] rpc: Retrieve peer PID via new getsockopt() for Mac
by Doug Goldstein
While LOCAL_PEERCRED on the BSDs does not return the pid information of
the peer, Mac OS X 10.8 added LOCAL_PEERPID to retrieve the pid so we
should use that when its available to get that information.
---
v2:
* Make LOCAL_PEERPID call non-fatal in case the user built the binary on
a system that supports it but then runs it on a kernel that does not
support it
---
src/rpc/virnetsocket.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index e8cdfa6..7126c4f 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -1195,12 +1195,29 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
return -1;
}
- /* PID and process creation time are not supported on BSDs */
+ /* PID and process creation time are not supported on BSDs by
+ * LOCAL_PEERCRED.
+ */
*pid = -1;
*timestamp = -1;
*uid = cr.cr_uid;
*gid = cr.cr_gid;
+# ifdef LOCAL_PEERPID
+ /* Exists on Mac OS X 10.8 for retrieving the peer's PID */
+ cr_len = sizeof(*pid);
+
+ if (getsockopt(sock->fd, VIR_SOL_PEERCRED, LOCAL_PEERPID, pid, &cr_len) < 0) {
+ virReportSystemError(errno, "%s",
+ _("Failed to get client socket PID"));
+ /* Don't treat this as fatal, but do set the value to something sane
+ * in case the user built this on a system that has LOCAL_PEERPID
+ * defined but the kernel does not actually support it.
+ */
+ *pid = -1;
+ }
+# endif
+
virObjectUnlock(sock);
return 0;
}
--
1.8.1.5
11 years, 1 month
[libvirt] [PATCHv3] qemu: snapshot: Add support for compressing external snapshot memory
by Peter Krempa
The regular save image code has the support to compress images using a
specified algorithm. This was not implemented for external checkpoints
although it shares most of the backend code.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1017227
---
Notes:
Version 3:
- added changes for augeas (and installed augeas to avoid such problems)
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 6 ++++++
src/qemu/qemu_conf.c | 2 ++
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_driver.c | 23 +++++++++++++++++++++--
src/qemu/test_libvirtd_qemu.aug.in | 1 +
6 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 591d78d..32db983 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -58,6 +58,7 @@ module Libvirtd_qemu =
let save_entry = str_entry "save_image_format"
| str_entry "dump_image_format"
+ | str_entry "snapshot_image_format"
| str_entry "auto_dump_path"
| bool_entry "auto_dump_bypass_cache"
| bool_entry "auto_start_bypass_cache"
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 3032aa6..bf57b9c 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -278,8 +278,14 @@
# the requested compression program can't be found, this falls
# back to "raw" compression.
#
+# snapshot_image_format specifies the compression algorithm of the memory save
+# image when an external snapshot of a domain is taken. This does not apply
+# on disk image format. It is an error if the specified format isn't valid,
+# or the requested compression program can't be found.
+#
#save_image_format = "raw"
#dump_image_format = "raw"
+#snapshot_image_format = "raw"
# When a domain is configured to be auto-dumped when libvirtd receives a
# watchdog event from qemu guest, libvirtd will save dump files in directory
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 16a0b92..295f1eb 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -521,6 +521,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
GET_VALUE_STR("save_image_format", cfg->saveImageFormat);
GET_VALUE_STR("dump_image_format", cfg->dumpImageFormat);
+ GET_VALUE_STR("snapshot_image_format", cfg->snapshotImageFormat);
+
GET_VALUE_STR("auto_dump_path", cfg->autoDumpPath);
GET_VALUE_BOOL("auto_dump_bypass_cache", cfg->autoDumpBypassCache);
GET_VALUE_BOOL("auto_start_bypass_cache", cfg->autoStartBypassCache);
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 40adfce..ea3c691 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -144,6 +144,7 @@ struct _virQEMUDriverConfig {
char *saveImageFormat;
char *dumpImageFormat;
+ char *snapshotImageFormat;
char *autoDumpPath;
bool autoDumpBypassCache;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 80285ff..69086c2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12128,6 +12128,8 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION);
int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
bool pmsuspended = false;
+ virQEMUDriverConfigPtr cfg = NULL;
+ int compressed = QEMU_SAVE_FORMAT_RAW;
if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0)
goto cleanup;
@@ -12189,12 +12191,28 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
JOB_MASK(QEMU_JOB_SUSPEND) |
JOB_MASK(QEMU_JOB_MIGRATION_OP));
+ cfg = virQEMUDriverGetConfig(driver);
+ if (cfg->snapshotImageFormat) {
+ compressed = qemuSaveCompressionTypeFromString(cfg->snapshotImageFormat);
+ if (compressed < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Invalid snapshot image format specified "
+ "in configuration file"));
+ goto cleanup;
+ }
+ if (!qemuCompressProgramAvailable(compressed)) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Compression program for image format "
+ "in configuration file isn't available"));
+ goto cleanup;
+ }
+ }
+
if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true)))
goto endjob;
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
- xml, QEMU_SAVE_FORMAT_RAW,
- resume, 0,
+ xml, compressed, resume, 0,
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
goto endjob;
@@ -12283,6 +12301,7 @@ endjob:
cleanup:
VIR_FREE(xml);
+ virObjectUnref(cfg);
if (memory_unlink && ret < 0)
unlink(snap->def->file);
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index 4b27db1..7af3f64 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -49,6 +49,7 @@ module Test_libvirtd_qemu =
}
{ "save_image_format" = "raw" }
{ "dump_image_format" = "raw" }
+{ "snapshot_image_format" = "raw" }
{ "auto_dump_path" = "/var/lib/libvirt/qemu/dump" }
{ "auto_dump_bypass_cache" = "0" }
{ "auto_start_bypass_cache" = "0" }
--
1.8.3.2
11 years, 1 month
[libvirt] [PATCH 0/3] Misc LXC errore reporting improvements
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
A few more LXC fixes to improve error reporting
Instead of
# virsh -c lxc:/// start shell
error: Failed to start domain shell
error: internal error: guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=95449419-f969-d649-d996-2566ec42af7d LIBVIRT_LXC_UUID=95449419-f969-d649-d996-2566ec42af7d LIBVIRT_LXC_NAME=shell /bin/sh
error receiving signal from container: Input/output error
we now get
# virsh -c lxc:/// start shell
error: Failed to start domain shell
error: internal error: guest failed to start: Failed to access '/mnt/btr/does/not/exist': No such file or directory
Daniel P. Berrange (3):
Ensure lxcContainerMain reports errors on stderr
Ensure lxcContainerResolveSymlinks reports errors
Improve log filtering in virLXCProcessReadLogOutputData
src/lxc/lxc_container.c | 18 ++++++++++++++----
src/lxc/lxc_process.c | 16 +++++++++++++++-
2 files changed, 29 insertions(+), 5 deletions(-)
--
1.8.3.1
11 years, 1 month