[Kimchi-devel] [PATCH 3/5] Add functionality of report qemu owner and group
Sheldon
shaohef at linux.vnet.ibm.com
Tue Jun 10 10:32:37 UTC 2014
Just a minor inline comment below
On 06/10/2014 06:06 PM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> Permission fix needs report qemu owner and grp,
> add a function to report it.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
> src/kimchi/utils.py | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
> index 97adbf8..eb3559e 100644
> --- a/src/kimchi/utils.py
> +++ b/src/kimchi/utils.py
> @@ -35,6 +35,7 @@ from cherrypy.lib.reprconf import Parser
> from kimchi.asynctask import AsyncTask
> from kimchi.config import paths, PluginPaths
> from kimchi.exception import InvalidParameter, TimeoutExpired
> +from kimchi.kvmusertests import UserTests
>
>
> kimchi_log = cherrypy.log.error_log
> @@ -264,3 +265,10 @@ def probe_file_permission_as_user(file, user):
> p.start()
> p.join()
> return queue.get()
> +
> +
> +def get_qemu_owner():
> + user = UserTests.probe_user()
> + uid = pwd.getpwnam(user).pw_uid
> + gid = pwd.getpwnam(user).pw_gid
> + return uid, gid
you can also change the follow code to keep consistence, though they can
works.
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
index 4884ccf..330525c 100644
--- a/src/kimchi/kvmusertests.py
+++ b/src/kimchi/kvmusertests.py
@@ -68,5 +68,4 @@ def probe_user(self):
if __name__ == '__main__':
- ut = UserTests()
- print ut.probe_user()
+ print UserTests.probe_user()
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 60f4de5..8aa176e 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -43,7 +43,7 @@ def create(self, params):
iso = params['cdrom']
# check search permission
if iso.startswith('/') and os.path.isfile(iso):
- user = UserTests().probe_user()
+ user = UserTests.probe_user()
ret, excp = probe_file_permission_as_user(iso, user)
if ret is False:
raise InvalidParameter('KCHISO0008E',
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center
More information about the Kimchi-devel
mailing list