[lxc-devel] [lxd/master] lxd/device/disk: Only unmounts non-root volumes attached

tomponline on Github lxc-bot at linuxcontainers.org
Tue Mar 10 18:01:33 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 427 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200310/8ed31bff/attachment.bin>
-------------- next part --------------
From ff30db5cc23ff39fe96ca551a56a94f629043ca9 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 10 Mar 2020 18:00:28 +0000
Subject: [PATCH] lxd/device/disk: Only unmounts non-root volumes attached

Fixes "root device not found" error when shutting down VM.

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

diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index 4521c5a6e3..ab6b5ac1c7 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -1097,8 +1097,8 @@ func (d *disk) stopVM() (*deviceConfig.RunConfig, error) {
 
 // postStop is run after the device is removed from the instance.
 func (d *disk) postStop() error {
-	// Check if pool-specific action should be taken to unmount custom volume.
-	if d.config["pool"] != "" {
+	// Check if pool-specific action should be taken to unmount custom volume disks.
+	if d.config["pool"] != "" && d.config["path"] != "/" {
 		pool, err := storagePools.GetPoolByName(d.state, d.config["pool"])
 		if err != nil {
 			return err


More information about the lxc-devel mailing list