From d6fbdf717d8b81c38fefa085c37ac98898ea0011 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 15 Nov 2013 11:10:29 +0100 Subject: [PATCH] virtManager: when present, prefer the user specified in capabilities Prefer the user specified in the host capabilities to the default one when checking for the access to disk images. Signed-off-by: Giuseppe Scrivano --- virtManager/uihelpers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/virtManager/uihelpers.py b/virtManager/uihelpers.py index 3928849ea..423879082 100644 --- a/virtManager/uihelpers.py +++ b/virtManager/uihelpers.py @@ -21,6 +21,7 @@ import logging import os import statvfs +import pwd # pylint: disable=E0611 from gi.repository import GObject @@ -1008,6 +1009,15 @@ def check_path_search_for_qemu(err, conn, path): user = config.running_config.default_qemu_user + for i in conn.caps.host.secmodels: + if i.model == "dac": + label = i.baselabels.get("kvm") or i.baselabels.get("qemu") + if not label: + continue + pwuid = pwd.getpwuid(int(label.split(":")[0].replace("+", ""))) + if pwuid: + user = pwuid[0] + skip_paths = config.running_config.get_perms_fix_ignore() broken_paths = virtinst.VirtualDisk.check_path_search_for_user( conn.get_backend(),