xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <liuw@liuw.name>
To: Takeshi HASEGAWA <hasegaw@gmail.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
	Xen Devel <Xen-devel@lists.xensource.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: Re: [PATCH] libxl: virtio-blk-pci support for FV domain
Date: Tue, 10 May 2011 20:57:21 +0800	[thread overview]
Message-ID: <BANLkTikhOGKdjGeOzpctbK4+yZWs-qGbuw@mail.gmail.com> (raw)
In-Reply-To: <BANLkTin1H5kxUc63NdtNU=r-pGqstj15HQ@mail.gmail.com>

Refine the patch according to Stefano's advice.

1. Writing to Xenstore in libxl_device_disk_add is left as-it-is.
2. Reserved encoding for virtio disk.

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index ccf6518..6943b9d 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1028,6 +1028,9 @@ int libxl_device_disk_add(libxl_ctx *ctx,
uint32_t domid, libxl_device_disk *dis

libxl__device_disk_string_of_format(disk->format), disk->pdev_path));
             device.backend_kind = DEVICE_QDISK;
             break;
+        case LIBXL_DISK_BACKEND_NONE:
+	    /* Nothing to do, not a Xen VBD */
+	    break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk
backend type: %d\n", disk->backend);
             rc = ERROR_INVAL;
diff --git a/tools/libxl/libxl.idl b/tools/libxl/libxl.idl
index a5be66f..6b27eae 100644
--- a/tools/libxl/libxl.idl
+++ b/tools/libxl/libxl.idl
@@ -54,6 +54,7 @@ libxl_disk_backend = Enumeration("disk_backend", [
     (1, "PHY"),
     (2, "TAP"),
     (3, "QDISK"),
+    (4, "NONE"),
     ])

 libxl_nic_type = Enumeration("nic_type", [
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 5d85822..d8de1b7 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -239,6 +239,13 @@ int libxl__device_disk_dev_number(char *virtpath,
int *pdisk, int *ppartition)
         if (ppartition) *ppartition = partition;
         return (8 << 8) | (disk << 4) | partition;
     }
+    if (device_virtdisk_matches(virtpath, "vd",
+				&disk, 15,
+				&partition, 15)) {
+        if (pdisk) *pdisk = disk;
+        if (ppartition) *ppartition = partition;
+        return (2 << 28) | (disk << 8) | partition;
+    }
     return -1;
 }

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 76479fe..3403b5e 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -423,6 +423,10 @@ static char **
libxl__build_device_model_args_new(libxl__gc *gc,
                     drive = libxl__sprintf
                         (gc, "file=%s,if=ide,index=%d,media=disk,format=%s",
                          disks[i].pdev_path, disk, format);
+		else if (strncmp(disks[i].vdev, "vd", 2) == 0)
+                    drive = libxl__sprintf
+                        (gc, "file=%s,if=virtio,index=%d,media=disk,format=%s",
+                         disks[i].pdev_path, disk, format);
                 else
                     continue; /* Do not emulate this disk */
             }
@@ -976,6 +980,7 @@ int libxl__need_xenpv_qemu(libxl__gc *gc,

             case LIBXL_DISK_BACKEND_PHY:
             case LIBXL_DISK_BACKEND_UNKNOWN:
+	    case LIBXL_DISK_BACKEND_NONE:
                 break;
             }
         }


-- 
Best regards
Wei Liu
Twitter: @iliuw
Site: http://liuw.name

  reply	other threads:[~2011-05-10 12:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10  2:26 Re: [PATCH] libxl: virtio-blk-pci support for FV domain Takeshi HASEGAWA
2011-05-10 12:57 ` Wei Liu [this message]
2011-05-10 14:28   ` Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2011-05-08  3:48 Takeshi HASEGAWA
2011-05-08  4:56 ` Wei Liu
2011-05-08  5:24   ` Wei Liu
2011-05-08 11:26     ` Takeshi HASEGAWA
2011-05-09  9:04       ` Ian Campbell
2011-05-09 14:44       ` Stefano Stabellini

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=BANLkTikhOGKdjGeOzpctbK4+yZWs-qGbuw@mail.gmail.com \
    --to=liuw@liuw.name \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=anthony.perard@citrix.com \
    --cc=hasegaw@gmail.com \
    --cc=stefano.stabellini@eu.citrix.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 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).