mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
fix(instances): a secure boot loader on q35 gets secure boot
create_instance set secure='yes' (and with it SMM) only while switching a non-q35 machine to q35. With q35 already chosen, a secure boot loader was defined with secure='no' and without SMM. Secure boot is now requested whenever the loader is a secure boot build; the switch to q35 is unchanged. libvirt 11 on RHEL fills in secure='yes' and SMM from the firmware descriptor of a known loader, so there the domain was already correct; without such a descriptor (older libvirt, custom loader) it was not. A unit test checks what WebVirtCloud requests (fails on the previous code); a live test creates a q35 VM with the host's secure boot loader and starts it.
This commit is contained in:
parent
cdbff38223
commit
78ab85f211
3 changed files with 35 additions and 8 deletions
|
|
@ -13,6 +13,16 @@ class CreateInstanceViewTests(TestCase):
|
|||
@patch("instances.views.wvmCreate")
|
||||
@patch("instances.views.NewVMForm")
|
||||
def test_successful_create_redirects_after_saving_instance(self, form_class, connection_class):
|
||||
self.create(form_class, connection_class, "BIOS")
|
||||
|
||||
@patch("instances.views.wvmCreate")
|
||||
@patch("instances.views.NewVMForm")
|
||||
def test_secure_boot_loader_on_q35_requests_secure_boot(self, form_class, connection_class):
|
||||
self.create(form_class, connection_class, "UEFI x86_64: /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd")
|
||||
firmware = connection_class.return_value.create_instance.call_args.kwargs["firmware"]
|
||||
self.assertEqual(firmware["secure"], "yes")
|
||||
|
||||
def create(self, form_class, connection_class, firmware):
|
||||
user = get_user_model().objects.create_superuser(
|
||||
username="create-test-admin", password="password", email="create@example.com"
|
||||
)
|
||||
|
|
@ -43,7 +53,7 @@ class CreateInstanceViewTests(TestCase):
|
|||
form.cleaned_data = {
|
||||
"name": "new-vm", "meta_prealloc": False, "hdd_size": 0,
|
||||
"template": "", "images": "base.qcow2", "cache_mode": "default",
|
||||
"firmware": "BIOS", "net_model": "virtio", "memory": 1024,
|
||||
"firmware": firmware, "net_model": "virtio", "memory": 1024,
|
||||
"vcpu": 1, "vcpu_mode": "host-model", "networks": "default",
|
||||
"virtio": True, "listener_addr": "0.0.0.0", "nwfilter": "",
|
||||
"graphics": "vnc", "video": "vga", "console_pass": "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue