Skip to contentSkip to conversation

libxl: Tell qemu to use raw format when using a tapdisk

PATCH In review George Dunlap 5 participants 9 messages Dec 9, 2014 – Dec 16, 2014 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: Tell qemu to use raw format when using a tapdisk

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Konrad Wilk <[email protected]>

Release exception justification: This fixes a bug in functionality, in that at the moment HVM guests cannot boot with tapdisk and vhd format.

This is not a regression in xl functionality per se, since (AFAICT) this has never worked. However, given that 4.5 is the first release without xend, this *does* represent a regression in functionality for Xen as a whole (since before people using hvm guest with vhd on blktap could use xend).

The fix is very simple and should only affect codepaths that already don't work, so the risk of regressions should be very low.

While preparing this patch, I also noticed that cdroms will ignore the backend parameter and treat everything as a file. This is a bug but I think it's a much less important one to address this late in the release cycle.

---
 tools/libxl/libxl_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +5 -2
index b25b574..10f3090 100644
@@ -797,11 +797,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 }
 
-                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP)
+                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
+                    format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
                                                       disks[i].format);
-                else
+                } else {
                     pdev_path = disks[i].pdev_path;
+                }
+
 
                 /*
                  * Explicit sd disks are passed through as is.
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · George Dunlap

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

Quoted 7 lines

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Konrad Wilk <[email protected]>

Quoted 9 lines

Release exception justification: This fixes a bug in functionality, in that at the moment HVM guests cannot boot with tapdisk and vhd format.

This is not a regression in xl functionality per se, since (AFAICT) this has never worked. However, given that 4.5 is the first release without xend, this *does* represent a regression in functionality for Xen as a whole (since before people using hvm guest with vhd on blktap could use xend).

Quoted 7 lines

The fix is very simple and should only affect codepaths that already don't work, so the risk of regressions should be very low.

While preparing this patch, I also noticed that cdroms will ignore the backend parameter and treat everything as a file. This is a bug but I think it's a much less important one to address this late in the release cycle.

We should create a bug tracker entry for this.

Quoted 12 lines
---
 tools/libxl/libxl_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index b25b574..10f3090 100644
@@ -797,11 +797,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 }
 

tools/libxl/libxl_dm.c static char ** libxl__build_device_model_args_new(libxl__gc *gc, · line 807

Quoted 10 lines
tools/libxl/libxl_dm.c +5 -2
-                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP)
+                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
+                    format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
                                                       disks[i].format);
-                else
+                } else {
                     pdev_path = disks[i].pdev_path;
+                }
+

Minor nit, extra blank line, but this alone doesn't warrant a resend.

Quoted 5 lines
tools/libxl/libxl_dm.c +0 -0
                 /*
                  * Explicit sd disks are passed through as is.
Signature · 1 line
1.9.1
#2 lore raw
Quoted 54 lines · Wei Liu
Quoted 12 lines · George Dunlap

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

Quoted 7 lines

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Konrad Wilk <[email protected]>

Quoted 9 lines

Release exception justification: This fixes a bug in functionality, in that at the moment HVM guests cannot boot with tapdisk and vhd format.

This is not a regression in xl functionality per se, since (AFAICT) this has never worked. However, given that 4.5 is the first release without xend, this *does* represent a regression in functionality for Xen as a whole (since before people using hvm guest with vhd on blktap could use xend).

Quoted 7 lines

The fix is very simple and should only affect codepaths that already don't work, so the risk of regressions should be very low.

While preparing this patch, I also noticed that cdroms will ignore the backend parameter and treat everything as a file. This is a bug but I think it's a much less important one to address this late in the release cycle.

We should create a bug tracker entry for this.

Quoted 12 lines
---
 tools/libxl/libxl_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index b25b574..10f3090 100644
@@ -797,11 +797,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 }
 
Quoted 12 lines

tools/libxl/libxl_dm.c static char ** libxl__build_device_model_args_new(libxl__gc *gc, · line 807

Quoted 10 lines
tools/libxl/libxl_dm.c +5 -2
-                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP)
+                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
+                    format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
                                                       disks[i].format);
-                else
+                } else {
                     pdev_path = disks[i].pdev_path;
+                }
+

Minor nit, extra blank line, but this alone doesn't warrant a resend.

Yes, I noticed this as soon as I sent it. :-/

-George

Acked-by on v1 1/1
#3 lore raw
In reply to George Dunlap
Quoted 6 lines · George Dunlap

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

Quoted 7 lines

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

Quoted 7 lines

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Konrad Wilk <[email protected]>

Release exception justification:

I agree with your reasoning.

Quoted 41 lines

This fixes a bug in functionality, in
that at the moment HVM guests cannot boot with tapdisk and vhd format.

This is not a regression in xl functionality per se, since (AFAICT) this has never worked. However, given that 4.5 is the first release without xend, this *does* represent a regression in functionality for Xen as a whole (since before people using hvm guest with vhd on blktap could use xend).

The fix is very simple and should only affect codepaths that already don't work, so the risk of regressions should be very low.

While preparing this patch, I also noticed that cdroms will ignore the backend parameter and treat everything as a file. This is a bug but I think it's a much less important one to address this late in the release cycle.

---
 tools/libxl/libxl_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +5 -2
index b25b574..10f3090 100644
@@ -797,11 +797,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 }
 
-                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP)
+                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
+                    format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
                                                       disks[i].format);
-                else
+                } else {
                     pdev_path = disks[i].pdev_path;
+                }
+
 
                 /*
                  * Explicit sd disks are passed through as is.
#4 lore raw
Quoted 10 lines · Ian Campbell
Quoted 9 lines · George Dunlap

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Quoted 6 lines
Quoted 4 lines

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

Quoted 54 lines
Quoted 8 lines

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Konrad Wilk <[email protected]>

Release exception justification:

I agree with your reasoning.

Quoted 41 lines

This fixes a bug in functionality, in
that at the moment HVM guests cannot boot with tapdisk and vhd format.

This is not a regression in xl functionality per se, since (AFAICT) this has never worked. However, given that 4.5 is the first release without xend, this *does* represent a regression in functionality for Xen as a whole (since before people using hvm guest with vhd on blktap could use xend).

The fix is very simple and should only affect codepaths that already don't work, so the risk of regressions should be very low.

While preparing this patch, I also noticed that cdroms will ignore the backend parameter and treat everything as a file. This is a bug but I think it's a much less important one to address this late in the release cycle.

---
 tools/libxl/libxl_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +5 -2
index b25b574..10f3090 100644
@@ -797,11 +797,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 }
 
-                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP)
+                if (disks[i].backend == LIBXL_DISK_BACKEND_TAP) {
+                    format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
                     pdev_path = libxl__blktap_devpath(gc, disks[i].pdev_path,
                                                       disks[i].format);
-                else
+                } else {
                     pdev_path = disks[i].pdev_path;
+                }
+
 
                 /*
                  * Explicit sd disks are passed through as is.
#5 lore raw
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 10 lines · Ian Campbell
Quoted 9 lines · George Dunlap

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

This doesn't seem to have been applied yet.

-George

#6 lore raw
Quoted 16 lines · George Dunlap
Quoted 14 lines · Konrad Rzeszutek Wilk
Quoted 13 lines · Ian Campbell
Quoted 12 lines · George Dunlap

At the moment libxl unconditinally passes the underlying file format to qemu in the device string. However, when tapdisk is in use, tapdisk handles the underlying format and presents qemu with effectively a raw disk. When qemu looks at the tapdisk block device and doesn't find the image format it was looking for, it will fail.

This effectively means that tapdisk cannot be used with HVM domains at the moment except for raw files.

Instead, if we're using a tapdisk backend, tell qemu to use a raw file format.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

This doesn't seem to have been applied yet.

Now applied, nuking the extra blank line which way noticed on the way.

Ian.

#7 lore raw
In reply to George Dunlap

On Tue, Dec 09, 2014 at 02:04:19PM +0000, George Dunlap wrote:
[...]

Quoted 2 lines

While preparing this patch, I also noticed that cdroms will ignore the backend parameter and treat everything as a file. This is a bug

create !
title it CDROM's backend ignored and always treated as file thanks

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Processed: Re: [PATCH for 4.5] libxl: Tell qemu to use raw format when using a tapdisk

Processing commands for [email protected]:

Quoted 1 line

create !

Created new bug #47 rooted at `<[email protected]>'
Title: `Re: [PATCH for 4.5] libxl: Tell qemu to use raw format when using a tapdisk'

Quoted 1 line

title it CDROM backend ignored and always treated as file

Set title for #47 to `CDROM backend ignored and always treated as file'

Quoted 1 line

thanks

Finished processing.

Modified/created Bugs:
- 47: http://bugs.xenproject.org/xen/bug/47 (new)

---
Xen Hypervisor Bug Tracker
See http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen for information on reporting bugs Contact [email protected] with any infrastructure issues