The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6792

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Otherwise during update if the VM isn't mounted the NVRAM file is written to the host's filesystem preventing subsequent mounts.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From b2ce63726ab4b5354ed22ba1ed8c99a234031795 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Tue, 28 Jan 2020 11:07:46 +0000
Subject: [PATCH] lxd/instance/drivers/driver/qemu: Mount VM config vol before
 generating NVRAM file

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/instance/drivers/driver_qemu.go | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lxd/instance/drivers/driver_qemu.go 
b/lxd/instance/drivers/driver_qemu.go
index fb13696a57..4ebdc409bf 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -837,6 +837,16 @@ func (vm *qemu) Start(stateful bool) error {
 }
 
 func (vm *qemu) setupNvram() error {
+       // Mount the instance's config volume.
+       ourMount, err := vm.mount()
+       if err != nil {
+               return err
+       }
+
+       if ourMount {
+               defer vm.unmount()
+       }
+
        srcOvmfFile := filepath.Join(vm.ovmfPath(), "OVMF_VARS.fd")
        if vm.expandedConfig["security.secureboot"] == "" || 
shared.IsTrue(vm.expandedConfig["security.secureboot"]) {
                srcOvmfFile = filepath.Join(vm.ovmfPath(), "OVMF_VARS.ms.fd")
@@ -847,7 +857,7 @@ func (vm *qemu) setupNvram() error {
        }
 
        os.Remove(vm.getNvramPath())
-       err := shared.FileCopy(srcOvmfFile, vm.getNvramPath())
+       err = shared.FileCopy(srcOvmfFile, vm.getNvramPath())
        if err != nil {
                return err
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to