[Kimchi-devel] [PATCH 1/3] Add a method to fix read permission on ISO files

Aline Manera alinefm at linux.vnet.ibm.com
Mon Feb 3 15:01:02 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

When starting a virtual machine, libvirt changes the user:group of the disk
files to libvirt-qemu or qemu (depends on Linux distribution)
That way libvirt can work properly with those files.

But if the file does not have read permission, libvirt won't be able to
access them.

This patch adds a method to add read permission on files to avoiding
problems when starting a virtual machine.

Also remove useless imports from utils.py

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/utils.py |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index 3d8f961..8795957 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -33,9 +33,8 @@ from kimchi.config import paths, PluginPaths
 from kimchi.exception import TimeoutExpired
 
 
-from kimchi import config
 from kimchi.asynctask import AsyncTask
-from kimchi.exception import InvalidParameter, TimeoutExpired
+from kimchi.exception import InvalidParameter
 
 
 kimchi_log = cherrypy.log.error_log
@@ -220,3 +219,9 @@ def listPathModules(path):
         if ext in ('.py', '.pyc', '.pyo'):
             modules.add(base)
     return sorted(modules)
+
+
+def run_setfacl_set_attr(path, attr="r", user=""):
+    set_user = ["setfacl", "--modify", "user:%s:%s" % (user, attr), path]
+    out, error, ret = run_command(set_user)
+    return ret == 0
-- 
1.7.10.4




More information about the Kimchi-devel mailing list