diff mbox

[v6] libxl: allow 'phy' backend to use empty files

Message ID 56c59c93.878b420a.b7208.ffffe957@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Braunegg Feb. 18, 2016, 10:27 a.m. UTC
Hi Roger,

I have tested and applied the patch locally, and can confirm that the issue reported is now resolved.

Best regards,

Alex

-----Original Message-----
From: Roger Pau Monne [mailto:roger.pau@citrix.com] 
Sent: Thursday, 18 February 2016 4:21 AM
To: xen-devel@lists.xenproject.org
Cc: Roger Pau Monne; Ian Jackson; Ian Campbell; Wei Liu; Alex Braunegg
Subject: [PATCH v6] libxl: allow 'phy' backend to use empty files

This was introduced by 97ee1f (~5 years ago), but was probably never
surfaced because most people used regular files as CDROM images, so the PHY
backend was actually never selected. A year ago this was changed, and now
regular RAW files are also handled by the PHY backend, which has made this
bug surface.

Fix it by allowing empty disks to use the PHY backend, skipping the stat
tests.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported-by: Alex Braunegg <alex.braunegg@gmail.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Alex Braunegg <alex.braunegg@gmail.com>
---
Changes since v4:
 - Split form the rest of the series.
 - Fix disk_try_backend.
---
 tools/libxl/libxl_device.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 8bb5e93..2e08108 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -196,6 +196,14 @@  static int disk_try_backend(disk_try_backend_args *a,
             goto bad_format;
         }
 
+        if (a->disk->format == LIBXL_DISK_FORMAT_EMPTY) {
+            assert(a->disk->pdev_path == NULL ||
+                   !strcmp(a->disk->pdev_path, ""));
+            LOG(DEBUG, "Disk vdev=%s is empty, skipping physical device check",
+                a->disk->vdev);
+            return backend;
+        }
+
         if (a->disk->backend_domid != LIBXL_TOOLSTACK_DOMID) {
             LOG(DEBUG, "Disk vdev=%s, is using a storage driver domain, "
                        "skipping physical device check", a->disk->vdev);