mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-03 12:10:44 -06:00
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 <gscrivan@redhat.com>
This commit is contained in:
parent
d3a6f1a537
commit
d6fbdf717d
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user