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

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) ===
Closes #6378

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From bbcd863dd6d09310dd861fc597af1dbd9cdfff4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 1 Nov 2019 02:44:20 +0100
Subject: [PATCH] lxd/resources/storage: Improve cdrom handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6378

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/resources/storage.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lxd/resources/storage.go b/lxd/resources/storage.go
index 2e66e7274c..ee0a00162c 100644
--- a/lxd/resources/storage.go
+++ b/lxd/resources/storage.go
@@ -203,6 +203,16 @@ func GetStorage() (*api.ResourcesStorage, error) {
                                disk.WWN = strings.TrimSpace(string(diskWWN))
                        }
 
+                       // Try to guess if dealing with CD-ROM
+                       if strings.HasPrefix(disk.ID, "sr") && disk.Removable {
+                               disk.Type = "cdrom"
+
+                               // Most cdrom drives report this as size 
regardless of media
+                               if disk.Size == 0x1fffff*512 {
+                                       disk.Size = 0
+                               }
+                       }
+
                        // Look for partitions
                        disk.Partitions = []api.ResourcesStorageDiskPartition{}
                        for _, subEntry := range entries {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to