xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH RFC 08/10] libxl: add new hotplug interface support for HVM guests
Date: Fri, 21 Dec 2012 18:00:06 +0100	[thread overview]
Message-ID: <1356109208-6830-9-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1356109208-6830-1-git-send-email-roger.pau@citrix.com>

Reads the results of the hotplug script execution and changes
pdev_path libxl_device_disk to point to the block device. This will be
used later when Qemu is launched.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/libxl/libxl_create.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index c176967..1d5410f 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -964,6 +964,10 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
     libxl__domain_create_state *dcs = CONTAINER_OF(multidev, *dcs, multidev);
     STATE_AO_GC(dcs->ao);
     int i;
+    char *hotplug_path;
+    const char *pdev;
+    libxl__device dev;
+    libxl_device_disk *disk;
 
     /* convenience aliases */
     const uint32_t domid = dcs->guest_domid;
@@ -975,6 +979,35 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
         goto error_out;
     }
 
+    /*
+     * If using the new hotplug interface change disks pdev_path
+     * to point to the real physical path, so it can be used by Qemu.
+     */
+    for (i = 0; i < d_config->num_disks; i++) {
+        disk = &d_config->disks[i];
+        if (disk->hotplug_version != 0) {
+            /* Update pdev_path */
+            ret = libxl__device_from_disk(gc, domid, disk, &dev);
+            if (ret != 0) {
+                LOG(ERROR, "Invalid or unsupported virtual disk identifier %s",
+                           disk->vdev);
+                goto error_out;
+            }
+            hotplug_path = libxl__device_xs_hotplug_path(gc, &dev);
+            ret = libxl__xs_read_checked(gc, XBT_NULL,
+                                         GCSPRINTF("%s/pdev", hotplug_path),
+                                         &pdev);
+            if (ret)
+                goto error_out;
+            if (!pdev) {
+                ret = ERROR_FAIL;
+                goto error_out;
+            }
+            free(disk->pdev_path);
+            disk->pdev_path = libxl__strdup(NOGC, pdev);
+        }
+    }
+
     for (i = 0; i < d_config->b_info.num_ioports; i++) {
         libxl_ioport_range *io = &d_config->b_info.ioports[i];
 
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2012-12-21 17:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 16:59 [PATCH RFC 00/10] libxl: new hotplug calling convention Roger Pau Monne
2012-12-21 16:59 ` [PATCH RFC 01/10] libxl: libxl__prepare_ao_device should reset num_exec Roger Pau Monne
2013-01-17 13:57   ` Ian Campbell
2012-12-21 17:00 ` [PATCH RFC 02/10] libxl: add new hotplug interface support to hotplug script callers Roger Pau Monne
2013-01-18 13:29   ` Ian Campbell
2013-01-18 16:24     ` Roger Pau Monné
2013-01-21 10:07       ` Ian Campbell
2013-01-21 12:11         ` Roger Pau Monné
2013-01-21 12:18           ` Ian Campbell
2013-01-22  9:30     ` Roger Pau Monné
2012-12-21 17:00 ` [PATCH RFC 03/10] libxl: add new "method" parameter to xl disk config Roger Pau Monne
2013-01-17 15:49   ` Ian Campbell
2012-12-21 17:00 ` [PATCH RFC 04/10] libxl: add prepare/unprepare operations to the libxl public interface Roger Pau Monne
2012-12-21 17:00 ` [PATCH RFC 05/10] libxl: add disk specific remove functions Roger Pau Monne
2012-12-21 17:00 ` [PATCH RFC 06/10] xl: add support for new hotplug interface to block-attach/detach Roger Pau Monne
2012-12-21 17:00 ` [PATCH RFC 07/10] libxl: add local attach support for new hotplug scripts Roger Pau Monne
2012-12-21 17:00 ` Roger Pau Monne [this message]
2012-12-21 17:00 ` [PATCH RFC 09/10] hotplug: document new hotplug interface Roger Pau Monne
2012-12-21 17:00 ` [PATCH RFC 10/10] hotplug/Linux: add iscsi block hotplug script Roger Pau Monne
2013-01-15 16:56 ` [PATCH RFC 00/10] libxl: new hotplug calling convention Roger Pau Monné
2013-01-17 13:56 ` Ian Campbell
2013-01-17 15:30   ` Roger Pau Monné
2013-01-17 15:40     ` Ian Campbell
2013-01-17 15:47       ` Roger Pau Monné
2013-01-17 15:57         ` Ian Campbell
2013-01-17 16:10           ` Roger Pau Monné
2013-01-17 16:15             ` Ian Campbell
2013-01-17 16:45               ` Roger Pau Monné

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=1356109208-6830-9-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).