[libvirt] [PATCH] Set owner and group for file used for saving domain

Anoop Vijayan acv at linux.vnet.ibm.com
Wed Nov 11 10:40:37 UTC 2009


virsh save a domain created by libvirt and it hangs with the log message "sh: /home/newguest: Permission denied".

---
 src/qemu/qemu_driver.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 30003e6..a2d9534 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3415,6 +3415,11 @@ static int qemudDomainSave(virDomainPtr dom,
         goto endjob;
     }
 
+    if (qemuDomainSetFileOwnership(dom->conn, path, driver->user,
+                                                    driver->group) < 0 ) {
+        goto endjob;
+    }
+
     if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) {
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
                          "%s", _("failed to write save header"));
-- 
1.5.4.5


-- 
Cheers!

Anoop
Linux Technology Center, IBM




More information about the libvir-list mailing list