Reviewed-by: Daniel Barboza <danielhb(a)linux.vnet.ibm.com>
On 02/03/2014 01:01 PM, Aline Manera wrote:
From: ShaoHe Feng <shaohef(a)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(a)linux.vnet.ibm.com>
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
Signed-off-by: Royce Lv <lvroyce(a)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