[PATCH] qemudDomainMemoryPeek: chown temporary file to qemu.qemu.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This attached patch resolves a fairly obvious problem which stops
qemuDomainMemoryPeek from working at all.

However, it's not the whole story.  Read on ...

(1) qemu still fails unless I manually set the mode of
/var/cache/libvirt to 0755 (it is normally 0700).

                           Owner      Fails   Works
  /var/cache/libvirt       root.root  0700    0755
  /var/cache/libvirt/qemu  qemu.qemu  0750    0750

qemu is doing:

  open("/var/cache/libvirt/qemu/qemu.mem.fdVCod", O_WRONLY|O_CREAT|O_TRUNC, 0666)

It's kinda annoying that /etc/libvirt and /var/{cache,lib}/libvirt are
unreadable by other users.  Is there some deep reason to do this?

(2) After applying this patch, using virDomainMemoryPeek causes
libvirtd to generate the following serious-looking warning.  It
doesn't appear to crash or fail in any way that I can tell:

  15:17:09.982: 7784: error : virDomainFree:2122 : invalid domain pointer in virDomainFree

I don't know where this is coming from.  It only appears when my
program actually does virDomainMemoryPeek, not when I have the same
code with virDomainMemoryPeek commented out.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
>From 1a2ba0c1b58142a06602722c6bb0995ef6e8b347 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@xxxxxxxxxx>
Date: Fri, 20 May 2011 13:56:46 +0100
Subject: [PATCH] qemudDomainMemoryPeek: chown temporary file to qemu.qemu.

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 |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 44acc6a..08d2549 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5536,6 +5536,14 @@ qemudDomainMemoryPeek (virDomainPtr dom,
         goto endjob;
     }
 
+    if (qemu_driver->privileged &&
+        chown(tmp, qemu_driver->user, qemu_driver->group) < 0) {
+        virReportSystemError(errno,
+                             _("unable to set ownership on %s to %d:%d"),
+                             tmp, qemu_driver->user, qemu_driver->group);
+        goto endjob;
+    }
+
     priv = vm->privateData;
     qemuDomainObjEnterMonitor(vm);
     if (flags == VIR_MEMORY_VIRTUAL) {
-- 
1.7.5.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]