core: verify kernel property when its modified
Do not assume that frontend have verified that setting.
This commit is contained in:
parent
09348e86e5
commit
86bae8d276
@ -135,6 +135,7 @@ class QubesVm(object):
|
||||
"uses_default_kernel": { "default": True, 'order': 30 },
|
||||
"uses_default_kernelopts": { "default": True, 'order': 30 },
|
||||
"kernel": {
|
||||
"attr": "_kernel",
|
||||
"default": None,
|
||||
"order": 31,
|
||||
"func": lambda value: self._collection.get_default_kernel() if
|
||||
@ -452,6 +453,24 @@ class QubesVm(object):
|
||||
def mac(self, new_mac):
|
||||
self._mac = new_mac
|
||||
|
||||
@property
|
||||
def kernel(self):
|
||||
return self._kernel
|
||||
|
||||
@kernel.setter
|
||||
def kernel(self, new_value):
|
||||
if new_value is not None:
|
||||
if not os.path.exists(os.path.join(system_path[
|
||||
'qubes_kernels_base_dir'], new_value)):
|
||||
raise QubesException("Kernel '%s' not installed" % new_value)
|
||||
for f in ('vmlinuz', 'modules.img'):
|
||||
if not os.path.exists(os.path.join(
|
||||
system_path['qubes_kernels_base_dir'], new_value, f)):
|
||||
raise QubesException(
|
||||
"Kernel '%s' not properly installed: missing %s "
|
||||
"file" % (new_value, f))
|
||||
self._kernel = new_value
|
||||
|
||||
@property
|
||||
def updateable(self):
|
||||
return self.template is None
|
||||
|
Loading…
Reference in New Issue
Block a user