All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Bader <stefan.bader@canonical.com>
To: libvir-list@redhat.com, xen-devel@lists.xen.org
Cc: Jim Fehlig <jfehlig@suse.com>, Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2/3] libxl: Set disk format for empty cdrom device
Date: Thu, 27 Mar 2014 17:55:03 +0100	[thread overview]
Message-ID: <1395939304-9017-3-git-send-email-stefan.bader@canonical.com> (raw)
In-Reply-To: <1395939304-9017-1-git-send-email-stefan.bader@canonical.com>

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.bader@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

  parent reply	other threads:[~2014-03-27 16:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1395939304-9017-1-git-send-email-stefan.bader@canonical.com>
2014-03-27 16:55 ` [PATCH 1/3] libxl: Use id from virDomainObj inside the driver Stefan Bader
2014-04-03 14:16   ` [libvirt] " Michal Privoznik
2014-03-27 16:55 ` Stefan Bader [this message]
2014-04-03 14:16   ` [libvirt] [PATCH 2/3] libxl: Set disk format for empty cdrom device Michal Privoznik
2014-03-27 16:55 ` [PATCH 3/3] libxl: Implement basic video device selection Stefan Bader
2014-04-03 14:16   ` [libvirt] " Michal Privoznik
2014-03-31 17:14 ` libxl fixes/improvements for libvirt Jim Fehlig
2014-04-03 15:45 ` [libvirt] " Michal Privoznik
     [not found] ` <533D8207.8040402@redhat.com>
2014-04-03 15:49   ` Stefan Bader
2014-04-04  9:36   ` [PATCH v2] libxl: Implement basic video device selection Stefan Bader
     [not found]   ` <1396604199-8198-1-git-send-email-stefan.bader@canonical.com>
2014-04-04  9:48     ` Ian Campbell
     [not found]     ` <1396604917.4211.184.camel@kazak.uk.xensource.com>
2014-04-04 10:31       ` Stefan Bader
     [not found]       ` <533E8A1A.4030904@canonical.com>
2014-04-04 10:34         ` Ian Campbell
2014-04-04 10:34         ` Stefan Bader
     [not found]         ` <1396607657.4211.190.camel@kazak.uk.xensource.com>
2014-04-04 10:52           ` Stefan Bader
2014-04-04 12:51           ` [libvirt] " Daniel P. Berrange
     [not found]           ` <20140404125113.GA13990@redhat.com>
2014-04-04 12:56             ` Ian Campbell
     [not found]             ` <1396616169.4211.222.camel@kazak.uk.xensource.com>
2014-04-04 13:08               ` Daniel P. Berrange
2014-04-04 13:10               ` Stefan Bader
2014-04-04 13:17     ` Daniel P. Berrange
     [not found]     ` <20140404131711.GD13990@redhat.com>
2014-04-04 13:36       ` Stefan Bader
     [not found]       ` <533EB566.7000903@canonical.com>
2014-04-04 13:51         ` Daniel P. Berrange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395939304-9017-3-git-send-email-stefan.bader@canonical.com \
    --to=stefan.bader@canonical.com \
    --cc=ian.campbell@citrix.com \
    --cc=jfehlig@suse.com \
    --cc=libvir-list@redhat.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.