The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6445
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) === - Also removes temporary config drive folder after iso creation Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From c1d5b9b6234b999e1ad9dcaf7a5a36ebf3bbf28e Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Wed, 13 Nov 2019 13:15:56 +0000 Subject: [PATCH] lxd/vm/qemu: Fixes nvram creation on ubuntu 18.04 - Also removes temporary config drive folder after iso creation Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/vm_qemu.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lxd/vm_qemu.go b/lxd/vm_qemu.go index 2a87f9c893..51a97da7be 100644 --- a/lxd/vm_qemu.go +++ b/lxd/vm_qemu.go @@ -427,9 +427,14 @@ func (vm *vmQemu) Start(stateful bool) error { vm.VolatileSet(map[string]string{"volatile.vm.uuid": vmUUID}) } - // Generate an empty nvram file. + // Copy OVMF firmware to nvram file. if !shared.PathExists(vm.getNvramPath()) { - err = shared.FileCopy("/usr/share/OVMF/OVMF_VARS.ms.fd", vm.getNvramPath()) + srcOvmfFile := "/usr/share/OVMF/OVMF_VARS.ms.fd" + if !shared.PathExists(srcOvmfFile) { + srcOvmfFile = "/usr/share/OVMF/OVMF_VARS.fd" + } + + err = shared.FileCopy(srcOvmfFile, vm.getNvramPath()) if err != nil { return err } @@ -619,7 +624,7 @@ func (vm *vmQemu) getNvramPath() string { } func (vm *vmQemu) generateConfigDrive() (string, error) { - configDrivePath := filepath.Join(vm.Path(), "config") + configDrivePath := filepath.Join(vm.Path(), "configdrv") // Create config drive dir. err := os.MkdirAll(configDrivePath, 0100) @@ -640,7 +645,7 @@ runcmd: logger.Warnf("lxd-agent not found, skipping its inclusion in the VM config drive: %v", err) } else { // Install agent into config drive dir if found. - _, err = shared.RunCommand("cp", path, configDrivePath+"/lxd-agent") + err = shared.FileCopy(path, configDrivePath+"/lxd-agent") if err != nil { return "", err } @@ -747,6 +752,9 @@ WantedBy=multi-user.target return "", err } + // Remove the config drive folder. + os.RemoveAll(configDrivePath) + return isoPath, nil }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel