utils: get linux-kernels from storage API

This commit is contained in:
Frédéric Pierret (fepitre) 2019-11-10 10:16:08 +01:00
parent 283ed2540c
commit 044d91d73e
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -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)