[libvirt] [PATCH 0/2] libxl: Add support for qdisk disk backend

An update of https://www.redhat.com/archives/libvir-list/2013-April/msg02104.html This small patch series adds support for qdisk backend type in libxl. A qdisk uses the block drivers in qemu to serve as a block backend, verses blktap or blkbk. While testing the second patch, I noticed a slightly misleading error was emitted when the tap backend didn't support the requested disk format. Fix this with the first patch, including adding format checks in the other supported disk backends. V2: Fix logic errors when validating disk format Jim Fehlig (2): libxl: Fix disk format error message libxl: support qdisk backend src/libxl/libxl_conf.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 2 deletions(-) -- 1.7.7

Specifying an unsupported disk format with the tap driver resulted in a less than helpful error message error: Failed to start domain test-hvm error: internal error libxenlight does not support disk driver qed Change the message to state that the qed format is not supported by the tap driver, e.g. error: Failed to start domain test-hvm error: internal error libxenlight does not support disk format qed with disk driver tap While at it, check for unsupported formats in the other driver backends. --- V2: Fix logic errors when validating disk format src/libxl/libxl_conf.c | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 1be66da..a47204e 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -484,14 +484,34 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) break; default: virReportError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight does not support disk driver %s"), - virStorageFileFormatTypeToString(l_disk->format)); + _("libxenlight does not support disk format %s " + "with disk driver %s"), + virStorageFileFormatTypeToString(l_disk->format), + l_disk->driverName); return -1; } } else if (STREQ(l_disk->driverName, "file")) { + if (l_disk->format != VIR_STORAGE_FILE_NONE && + l_disk->format != VIR_STORAGE_FILE_RAW) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight does not support disk format %s " + "with disk driver %s"), + virStorageFileFormatTypeToString(l_disk->format), + l_disk->driverName); + return -1; + } x_disk->format = LIBXL_DISK_FORMAT_RAW; x_disk->backend = LIBXL_DISK_BACKEND_TAP; } else if (STREQ(l_disk->driverName, "phy")) { + if (l_disk->format != VIR_STORAGE_FILE_NONE && + l_disk->format != VIR_STORAGE_FILE_RAW) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight does not support disk format %s " + "with disk driver %s"), + virStorageFileFormatTypeToString(l_disk->format), + l_disk->driverName); + return -1; + } x_disk->format = LIBXL_DISK_FORMAT_RAW; x_disk->backend = LIBXL_DISK_BACKEND_PHY; } else { -- 1.7.7

On Fri, Jun 21, 2013 at 02:32:49PM -0600, Jim Fehlig wrote:
Specifying an unsupported disk format with the tap driver resulted in a less than helpful error message
error: Failed to start domain test-hvm error: internal error libxenlight does not support disk driver qed
Change the message to state that the qed format is not supported by the tap driver, e.g.
error: Failed to start domain test-hvm error: internal error libxenlight does not support disk format qed with disk driver tap
While at it, check for unsupported formats in the other driver backends. ---
V2: Fix logic errors when validating disk format
src/libxl/libxl_conf.c | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-)
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

libxl supports the LIBXL_DISK_BACKEND_QDISK disk backend, where qemu is used to provide the disk backend. This patch simply maps the existing <driver name='qemu'/> to LIBXL_DISK_BACKEND_QDISK. --- src/libxl/libxl_conf.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index a47204e..e170357 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -490,6 +490,31 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) l_disk->driverName); return -1; } + } else if (STREQ(l_disk->driverName, "qemu")) { + x_disk->backend = LIBXL_DISK_BACKEND_QDISK; + switch (l_disk->format) { + case VIR_STORAGE_FILE_QCOW: + x_disk->format = LIBXL_DISK_FORMAT_QCOW; + break; + case VIR_STORAGE_FILE_QCOW2: + x_disk->format = LIBXL_DISK_FORMAT_QCOW2; + break; + case VIR_STORAGE_FILE_VHD: + x_disk->format = LIBXL_DISK_FORMAT_VHD; + break; + case VIR_STORAGE_FILE_NONE: + /* No subtype specified, default to raw */ + case VIR_STORAGE_FILE_RAW: + x_disk->format = LIBXL_DISK_FORMAT_RAW; + break; + default: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight does not support disk format %s " + "with disk driver %s"), + virStorageFileFormatTypeToString(l_disk->format), + l_disk->driverName); + return -1; + } } else if (STREQ(l_disk->driverName, "file")) { if (l_disk->format != VIR_STORAGE_FILE_NONE && l_disk->format != VIR_STORAGE_FILE_RAW) { -- 1.7.7

On Fri, Jun 21, 2013 at 02:32:50PM -0600, Jim Fehlig wrote:
libxl supports the LIBXL_DISK_BACKEND_QDISK disk backend, where qemu is used to provide the disk backend. This patch simply maps the existing <driver name='qemu'/> to LIBXL_DISK_BACKEND_QDISK. --- src/libxl/libxl_conf.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index a47204e..e170357 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -490,6 +490,31 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) l_disk->driverName); return -1; } + } else if (STREQ(l_disk->driverName, "qemu")) { + x_disk->backend = LIBXL_DISK_BACKEND_QDISK; + switch (l_disk->format) { + case VIR_STORAGE_FILE_QCOW: + x_disk->format = LIBXL_DISK_FORMAT_QCOW; + break; + case VIR_STORAGE_FILE_QCOW2: + x_disk->format = LIBXL_DISK_FORMAT_QCOW2; + break; + case VIR_STORAGE_FILE_VHD: + x_disk->format = LIBXL_DISK_FORMAT_VHD; + break; + case VIR_STORAGE_FILE_NONE: + /* No subtype specified, default to raw */ + case VIR_STORAGE_FILE_RAW: + x_disk->format = LIBXL_DISK_FORMAT_RAW; + break; + default: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight does not support disk format %s " + "with disk driver %s"), + virStorageFileFormatTypeToString(l_disk->format), + l_disk->driverName); + return -1; + }
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Daniel P. Berrange wrote:
On Fri, Jun 21, 2013 at 02:32:50PM -0600, Jim Fehlig wrote:
libxl supports the LIBXL_DISK_BACKEND_QDISK disk backend, where qemu is used to provide the disk backend. This patch simply maps the existing <driver name='qemu'/> to LIBXL_DISK_BACKEND_QDISK. --- src/libxl/libxl_conf.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index a47204e..e170357 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -490,6 +490,31 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) l_disk->driverName); return -1; } + } else if (STREQ(l_disk->driverName, "qemu")) { + x_disk->backend = LIBXL_DISK_BACKEND_QDISK; + switch (l_disk->format) { + case VIR_STORAGE_FILE_QCOW: + x_disk->format = LIBXL_DISK_FORMAT_QCOW; + break; + case VIR_STORAGE_FILE_QCOW2: + x_disk->format = LIBXL_DISK_FORMAT_QCOW2; + break; + case VIR_STORAGE_FILE_VHD: + x_disk->format = LIBXL_DISK_FORMAT_VHD; + break; + case VIR_STORAGE_FILE_NONE: + /* No subtype specified, default to raw */ + case VIR_STORAGE_FILE_RAW: + x_disk->format = LIBXL_DISK_FORMAT_RAW; + break; + default: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight does not support disk format %s " + "with disk driver %s"), + virStorageFileFormatTypeToString(l_disk->format), + l_disk->driverName); + return -1; + }
ACK
Thanks, I've pushed both patches. Regards, Jim
participants (2)
-
Daniel P. Berrange
-
Jim Fehlig