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

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

From bf2277b88ed2a2fd34b3ac02d9a0098429bf3cae Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Thu, 30 Jan 2020 14:41:25 +0000
Subject: [PATCH 1/2] lxd/device/disk: Adds a check for mkisofs tool for qemu
 config drive

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/device/disk.go | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index f2b4eb00c6..2399d70fe4 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -5,6 +5,7 @@ import (
        "fmt"
        "io/ioutil"
        "os"
+       "os/exec"
        "path/filepath"
        "strconv"
        "strings"
@@ -1169,8 +1170,14 @@ func (d *disk) getParentBlocks(path string) ([]string, 
error) {
 func (d *disk) generateVMConfigDrive() (string, error) {
        scratchDir := filepath.Join(d.inst.DevicesPath(), 
deviceNameEncode(d.name))
 
+       // Check we have the mkisofs tool available.
+       mkisofsPath, err := exec.LookPath("mkisofs")
+       if err != nil {
+               return "", err
+       }
+
        // Create config drive dir.
-       err := os.MkdirAll(scratchDir, 0100)
+       err = os.MkdirAll(scratchDir, 0100)
        if err != nil {
                return "", err
        }
@@ -1215,7 +1222,7 @@ local-hostname: %s
        // templates on first boot. The vendor-data template then modifies the 
system so that the
        // config drive is mounted and the agent is started on subsequent boots.
        isoPath := filepath.Join(d.inst.Path(), "config.iso")
-       _, err = shared.RunCommand("mkisofs", "-R", "-V", "cidata", "-o", 
isoPath, scratchDir)
+       _, err = shared.RunCommand(mkisofsPath, "-R", "-V", "cidata", "-o", 
isoPath, scratchDir)
        if err != nil {
                return "", err
        }

From 0f06439089bc68df5a7f44113fbba4896e79d25b Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Thu, 30 Jan 2020 14:41:48 +0000
Subject: [PATCH 2/2] lxd/device/nic/sriov: Loads vfio-pci module

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

diff --git a/lxd/device/nic_sriov.go b/lxd/device/nic_sriov.go
index 9269604381..dd208708f1 100644
--- a/lxd/device/nic_sriov.go
+++ b/lxd/device/nic_sriov.go
@@ -10,9 +10,12 @@ import (
        "strconv"
        "strings"
 
+       "github.com/pkg/errors"
+
        deviceConfig "github.com/lxc/lxd/lxd/device/config"
        "github.com/lxc/lxd/lxd/instance/instancetype"
        "github.com/lxc/lxd/lxd/revert"
+       "github.com/lxc/lxd/lxd/util"
        "github.com/lxc/lxd/shared"
 )
 
@@ -72,6 +75,14 @@ func (d *nicSRIOV) Start() (*deviceConfig.RunConfig, error) {
 
        saveData := make(map[string]string)
 
+       // If VM, then try and load the vfio-pci module first.
+       if d.inst.Type() == instancetype.VM {
+               err = util.LoadModule("vfio-pci")
+               if err != nil {
+                       return nil, errors.Wrapf(err, "Error loading %q 
module", "vfio-pci")
+               }
+       }
+
        reservedDevices, err := instanceGetReservedDevices(d.state, d.config)
        if err != nil {
                return nil, err
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to