[lxc-devel] [lxd/master] VM: Adds trans=virtio to 9p mounts

tomponline on Github lxc-bot at linuxcontainers.org
Thu Jun 18 08:30:40 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 416 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200618/60eb48d1/attachment.bin>
-------------- next part --------------
From 0b89e4b39881a1463c0b8a58ea9a9f3481652206 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 18 Jun 2020 09:29:39 +0100
Subject: [PATCH] lxd/instance/drivers/driver/qemu: Adds trans=virtio to 9p
 mounts

Otherwise CentOS 7 VM guests can't mount 9p shares.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/instance/drivers/driver_qemu.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 8316e05ab4..8ebb0fdd41 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -1912,6 +1912,11 @@ func (vm *qemu) addDriveDirConfig(sb *strings.Builder, bus *qemuBus, fdFiles *[]
 		FSType: driveConf.FSType,
 	}
 
+	// If mount type is 9p, we need to specify to use the virtio transport to support more VM guest OSes.
+	if agentMount.FSType == "9p" {
+		agentMount.Options = append(agentMount.Options, "trans=virtio")
+	}
+
 	// Indicate to agent to mount this readonly. Note: This is purely to indicate to VM guest that this is
 	// readonly, it should *not* be used as a security measure, as the VM guest could remount it R/W.
 	if shared.StringInSlice("ro", driveConf.Opts) {


More information about the lxc-devel mailing list