Re: [libvirt] [PATCH 2/3] libxl: Set disk format for empty cdrom device

2014-04-03 Thread Michal Privoznik

On 27.03.2014 17:55, Stefan Bader wrote:

The XML config for a CDROM device can be without a source path,
indicating that there is no media present. Without this change
the libxl driver fails to start a guest in that case because
the libxl library checks for the LIBXL_DISK_FORMAT_EMPTY format
type and tries to stat the NULL pointer that gets passed on.


libxl: error: libxl_device.c:265:libxl__device_disk_set_backend:
Disk vdev=hdc failed to stat: (null): Bad address


Signed-off-by: Stefan Bader stefan.ba...@canonical.com
---
  src/libxl/libxl_conf.c |3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index de6f7ce..b8de72a 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -827,6 +827,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk 
*x_disk)
  x_disk-removable = 1;
  x_disk-readwrite = !l_disk-readonly;
  x_disk-is_cdrom = l_disk-device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
+/* An empty CDROM must have the empty format, otherwise libxl fails. */
+if (x_disk-is_cdrom  !x_disk-pdev_path)
+x_disk-format = LIBXL_DISK_FORMAT_EMPTY;
  if (l_disk-transient) {
  virReportError(VIR_ERR_INTERNAL_ERROR, %s,
 _(libxenlight does not support transient disks));



ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/3] libxl: Set disk format for empty cdrom device

2014-03-27 Thread Stefan Bader
The XML config for a CDROM device can be without a source path,
indicating that there is no media present. Without this change
the libxl driver fails to start a guest in that case because
the libxl library checks for the LIBXL_DISK_FORMAT_EMPTY format
type and tries to stat the NULL pointer that gets passed on.

 libxl: error: libxl_device.c:265:libxl__device_disk_set_backend:
 Disk vdev=hdc failed to stat: (null): Bad address

Signed-off-by: Stefan Bader stefan.ba...@canonical.com
---
 src/libxl/libxl_conf.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index de6f7ce..b8de72a 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -827,6 +827,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk 
*x_disk)
 x_disk-removable = 1;
 x_disk-readwrite = !l_disk-readonly;
 x_disk-is_cdrom = l_disk-device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
+/* An empty CDROM must have the empty format, otherwise libxl fails. */
+if (x_disk-is_cdrom  !x_disk-pdev_path)
+x_disk-format = LIBXL_DISK_FORMAT_EMPTY;
 if (l_disk-transient) {
 virReportError(VIR_ERR_INTERNAL_ERROR, %s,
_(libxenlight does not support transient disks));
-- 
1.7.9.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list