From 044d91d73e155a40dc3ae5c77059996358e018d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 10 Nov 2019 10:16:08 +0100 Subject: [PATCH] utils: get linux-kernels from storage API --- qubesmanager/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qubesmanager/utils.py b/qubesmanager/utils.py index 4830053..d6a38de 100644 --- a/qubesmanager/utils.py +++ b/qubesmanager/utils.py @@ -146,9 +146,13 @@ class KernelVersion: # pylint: disable=too-few-public-methods def prepare_kernel_choice(widget, holder, propname, default, *args, **kwargs): - # TODO get from storage API (pool 'linux-kernel') (suggested by @marmarta) - kernels = sorted(os.listdir('/var/lib/qubes/vm-kernels'), - key=KernelVersion) + try: + app = holder.app + except AttributeError: + app = holder + kernels = [kernel.vid for kernel in app.pools['linux-kernel'].volumes] + kernels = sorted(kernels, key=KernelVersion) + return prepare_choice( widget, holder, propname, kernels, default, *args, **kwargs)