From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Miguel Clara <miguelmclara@gmail.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: Xex 4.3.1 issues with HVM + drbd (qemu-system-i386 No such file or directory)
Date: Tue, 1 Apr 2014 12:39:59 +0200 [thread overview]
Message-ID: <533A977F.5050100@citrix.com> (raw)
In-Reply-To: <CADGo8CUU0teqGrBT2+USi365Yf5vnj0OCu8uPygPV-7Sgniuww@mail.gmail.com>
On 01/04/14 00:51, Miguel Clara wrote:
>
> I'm trying to use drbd disks in a FreeBSD HVM+PV guest but it seems Xnew
> qemu doesn't want to do it, this is the error I get:
>
>
> cat /var/log/xen/qemu-dm-freebsd-01.log
>
> qemu-system-i386: -drive
> file=drbd-freebsd-01,if=ide,index=0,media=disk,format=raw,cache=writeback:
> could not open disk image drbd-freebsd-01: No such file or directory
>
>
> I wil ltry with qemu-traditonal but wonder if this is a known issue...
The issue comes from the fact that drbd block devices are not known
until the hotplug script is executed, but even then, the resulting
block device that's passed into blkback is not written anywhere (apart
from the major:minor numbers written to xenstore). One solution to the
problem is to use qemu-xen-traditional stubdomains, but this is not
available with qemu-xen yet.
I have a crappy patch that fetches the major:minor numbers from
xenstore after the hotplug script has run and passes that to qemu-xen
command line, I think it should solve the problem, but I don't have a
drbd setup in order to test it, could you please give it a spin?
If this works OK I can clean the patch and properly submit it.
---
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 8abed7b..7c903ab 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -42,6 +42,39 @@ static const char *qemu_xen_path(libxl__gc *gc)
#endif
}
+static const char *qemu_fetch_device_path(libxl__gc *gc, uint32_t domid,
+ const libxl_device_disk *disk)
+{
+ libxl__device device;
+ char *be_path;
+ const char *phys_dev;
+ unsigned int major, minor;
+ int rc;
+
+ if (disk->backend != LIBXL_DISK_BACKEND_PHY)
+ return disk->pdev_path;
+
+ rc = libxl__device_from_disk(gc, domid, (libxl_device_disk *)disk, &device);
+ if (rc)
+ return NULL;
+
+ be_path = libxl__device_backend_path(gc, &device);
+ if (!be_path)
+ return NULL;
+
+ rc = libxl__xs_read_checked(gc, XBT_NULL,
+ GCSPRINTF("%s/physical-device", be_path),
+ &phys_dev);
+ if (rc)
+ return NULL;
+
+ rc = sscanf(phys_dev, "%x:%x", &major, &minor);
+ if (rc != 2)
+ return NULL;
+
+ return GCSPRINTF("/dev/block/%u:%u", major, minor);
+}
+
static int libxl__create_qemu_logfile(libxl__gc *gc, char *name)
{
char *logfile;
@@ -694,7 +727,8 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
else
drive = libxl__sprintf
(gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s,cache=writeback,id=ide-%i",
- disks[i].pdev_path, disk, format, dev_number);
+ qemu_fetch_device_path(gc, guest_domid, &disks[i]),
+ disk, format, dev_number);
} else {
if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "cannot support"
@@ -717,11 +751,13 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
if (strncmp(disks[i].vdev, "sd", 2) == 0)
drive = libxl__sprintf
(gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback",
- disks[i].pdev_path, disk, format);
+ qemu_fetch_device_path(gc, guest_domid, &disks[i]),
+ disk, format);
else if (disk < 4)
drive = libxl__sprintf
(gc, "file=%s,if=ide,index=%d,media=disk,format=%s,cache=writeback",
- disks[i].pdev_path, disk, format);
+ qemu_fetch_device_path(gc, guest_domid, &disks[i]),
+ disk, format);
else
continue; /* Do not emulate this disk */
}
prev parent reply other threads:[~2014-04-01 10:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 22:51 Xex 4.3.1 issues with HVM + drbd (qemu-system-i386 No such file or directory) Miguel Clara
2014-03-31 23:02 ` Miguel Clara
2014-04-01 8:51 ` Ian Campbell
2014-04-01 10:39 ` Roger Pau Monné [this message]
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=533A977F.5050100@citrix.com \
--to=roger.pau@citrix.com \
--cc=miguelmclara@gmail.com \
--cc=xen-devel@lists.xensource.com \
/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.