[lxc-devel] [lxd/master] Fix simple VM and storage issues
stgraber on Github
lxc-bot at linuxcontainers.org
Sun Jan 26 15:56:31 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200126/6f27c910/attachment.bin>
-------------- next part --------------
From 96c3963c40b761170c20287dff8fdff595b09a69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 26 Jan 2020 17:51:46 +0200
Subject: [PATCH 1/3] lxd/vm: Prevent attaching directory as disk
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/device/disk.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index 7fd8b50763..f2b4eb00c6 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -393,6 +393,10 @@ func (d *disk) startVM() (*deviceConfig.RunConfig, error) {
return nil, fmt.Errorf("Cannot find disk source")
}
+ if shared.IsDir(d.config["source"]) {
+ return nil, fmt.Errorf("Only block devices and disk images can be attached to VMs")
+ }
+
runConf.Mounts = []deviceConfig.MountEntryItem{
{
DevPath: d.config["source"],
From 963beaea2312f10c1f3473a73d371c9c3aa0b5e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 26 Jan 2020 17:52:13 +0200
Subject: [PATCH 2/3] lxd/storage/zfs: Ignore bookmarks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #6777
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage/drivers/driver_zfs_patches.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lxd/storage/drivers/driver_zfs_patches.go b/lxd/storage/drivers/driver_zfs_patches.go
index 5fc1a9803b..336b7b350e 100644
--- a/lxd/storage/drivers/driver_zfs_patches.go
+++ b/lxd/storage/drivers/driver_zfs_patches.go
@@ -36,6 +36,11 @@ func (d *zfs) patchStorageZFSMount() error {
continue
}
+ // Skip bookmarks.
+ if strings.Contains(dataset, "#") {
+ continue
+ }
+
// Skip block devices.
if strings.HasSuffix(dataset, ".block") {
continue
From 2876dbdec35dc4b0b3e24bd82cba6b62a6c3f9a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 26 Jan 2020 17:55:22 +0200
Subject: [PATCH 3/3] lxd/storage/btrfs: Skip missing quota
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #6778
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage/drivers/driver_btrfs_volumes.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/storage/drivers/driver_btrfs_volumes.go b/lxd/storage/drivers/driver_btrfs_volumes.go
index 1d8af0fc03..36bb9d99e8 100644
--- a/lxd/storage/drivers/driver_btrfs_volumes.go
+++ b/lxd/storage/drivers/driver_btrfs_volumes.go
@@ -366,6 +366,10 @@ func (d *btrfs) GetVolumeUsage(vol Volume) (int64, error) {
// Attempt to get the qgroup information.
_, usage, err := d.getQGroup(vol.MountPath())
if err != nil {
+ if err == errBtrfsNoQuota {
+ return 0, nil
+ }
+
return -1, err
}
More information about the lxc-devel
mailing list