Add patch so users can try out virt-dmesg.

This commit is contained in:
Richard W.M. Jones 2011-05-25 21:44:11 +01:00
parent 957403ebec
commit db03f03fd9
4 changed files with 113 additions and 2 deletions

View File

@ -0,0 +1,40 @@
From 78eb8b60d59662271c4a9a1be8c9002ee84dc8cf Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Wed, 25 May 2011 17:52:26 +0100
Subject: [PATCH] json: Avoid passing large positive 64 bit integers to QMP.
http://lists.gnu.org/archive/html/qemu-devel/2011-05/threads.html#02162
Currently, qemu silently clips any JSON integer in the range
0x8000000000000000 - 0xffffffffffffffff (all numbers in this range
will be clipped to 0x7fffffffffffffff == LLONG_MAX).
To avoid this, pass these as signed 64 bit integers in the QMP
request.
---
src/qemu/qemu_monitor_json.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 2d8a390..bdd0dcb 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -413,8 +413,13 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
ret = virJSONValueObjectAppendNumberLong(jargs, key, val);
} break;
case 'U': {
- unsigned long long val = va_arg(args, unsigned long long);
- ret = virJSONValueObjectAppendNumberUlong(jargs, key, val);
+ /* qemu silently truncates numbers larger than LLONG_MAX,
+ * so passing the full range of unsigned 64 bit integers
+ * is not safe here. Pass them as signed 64 bit integers
+ * instead.
+ */
+ long long val = va_arg(args, long long);
+ ret = virJSONValueObjectAppendNumberLong(jargs, key, val);
} break;
case 'd': {
double val = va_arg(args, double);
--
1.7.5.1

View File

@ -0,0 +1,29 @@
From bb12a63909a85c7bf7dac20fb593b6786c78d455 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Fri, 20 May 2011 13:56:46 +0100
Subject: [PATCH 1/2] qemudDomainMemoryPeek: change ownership/selinux label on
temporary file.
Otherwise qemu is unable to write to it, with the error:
libvir: QEMU error : internal error unable to execute QEMU command 'memsave': Could not open '/var/cache/libvirt/qemu/qemu.mem.RRNvLv'
---
src/qemu/qemu_driver.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 44acc6a..691965d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5536,6 +5536,8 @@ qemudDomainMemoryPeek (virDomainPtr dom,
goto endjob;
}
+ virSecurityManagerSetSavedStateLabel(qemu_driver->securityManager, vm, tmp);
+
priv = vm->privateData;
qemuDomainObjEnterMonitor(vm);
if (flags == VIR_MEMORY_VIRTUAL) {
--
1.7.5.1

View File

@ -0,0 +1,25 @@
From aa6e7fb40861c6583534179822db1f32800cdfd5 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Fri, 20 May 2011 15:55:40 +0100
Subject: [PATCH 2/2] remote: remove bogus virDomainFree.
---
daemon/remote.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 42e1cb9..941e92f 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -916,8 +916,6 @@ remoteDispatchDomainMemoryPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainMemoryPeek(dom, offset, size,
ret->buffer.buffer_val, flags) < 0)
goto cleanup;
- if (dom)
- virDomainFree(dom);
rv = 0;
--
1.7.5.1

View File

@ -216,7 +216,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 0.9.1
Release: 1%{?dist}%{?extra_release}
Release: 3%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
Source: http://libvirt.org/sources/libvirt-%{version}.tar.gz
@ -446,6 +446,11 @@ BuildRequires: nfs-utils
# Fedora build root suckage
BuildRequires: gawk
# RWMJ - so that people can try out virt-dmesg.
Patch1: 0001-json-Avoid-passing-large-positive-64-bit-integers-to.patch
Patch2: 0001-qemudDomainMemoryPeek-change-ownership-selinux-label.patch
Patch3: 0002-remote-remove-bogus-virDomainFree.patch
%description
Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). The main package includes
@ -503,6 +508,10 @@ of recent versions of Linux (and other OSes).
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%if ! %{with_xen}
%define _without_xen --without-xen
@ -936,7 +945,7 @@ fi
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
%dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/
%dir %attr(0711, root, root) %{_localstatedir}/cache/libvirt/
%if %{with_qemu}
%dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
@ -1071,6 +1080,14 @@ fi
%endif
%changelog
* Wed May 25 2011 Richard W.M. Jones <rjones@redhat.com> - 0.9.1-3
- Add upstream patches:
0001-json-Avoid-passing-large-positive-64-bit-integers-to.patch
0001-qemudDomainMemoryPeek-change-ownership-selinux-label.patch
0002-remote-remove-bogus-virDomainFree.patch
so that users can try out virt-dmesg.
- Change /var/cache mode to 0711.
* Thu May 5 2011 Daniel Veillard <veillard@redhat.com> - 0.9.1-1
- support various persistent domain updates
- improvements on memory APIs