xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jiageng Yu <yujiageng734@gmail.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	"Xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] libxl: Support linux-stubdom in libxl
Date: Tue, 31 May 2011 21:54:25 +0800	[thread overview]
Message-ID: <BANLkTikCb2GEodgNCDyL9_qgfLE42hc+pA@mail.gmail.com> (raw)

author jiageng_yu <yujiageng734@gmail.com>
Tue, 31 May 2011 02:18:01 +0000 (03:18 +0100)
committer jiageng_yu <yujiageng734@gmail.com>
ue, 31 May 2011 02:18:01 +0000 (03:18 +0100)
commit 179b4167dd9e86a06a700d60e277c4477f0c06ef
tree 4e4c8492b480e08d9122abcb37aca52ae5650786 tree | snapshot (tar.gz zip)
parent cf4866b9161a724e4b2c366da73de271cf7ef348 commit | diff

libxl: Support linux-stubdom in libxl

Add linux-stubdom support in libxl. Users could start a linux-stubdom
throuh the following options:
device_model_override = 'linux-stubdom'
device_model_stubdomain_override=1

linux-stubdom project: http://repo.or.cz/w/linux-based-stubdoms.git


diff -r 37c77bacb52a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Mon May 23 17:38:28 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Tue May 31 02:41:59 2011 +0100
@@ -556,6 +556,14 @@
     return 0;
 }

+inline int libxl__is_linux_stubdom(libxl_device_model_info *info)
+{
+	if(!strncmp(info->device_model,"linux-stubdom",strlen(info->device_model)))
+		return 1;
+	else
+		return 0;
+};
+
 static int libxl__create_stubdom(libxl__gc *gc,
                                  libxl_device_model_info *info,
                                  libxl_device_disk *disks, int num_disks,
@@ -581,7 +589,12 @@
         goto out;
     }

-    args = libxl__build_device_model_args(gc, "stubdom-dm", info,
+	if(libxl__is_linux_stubdom(info))
+		args = libxl__build_device_model_args(gc, "linux-stubdom", info,
+                                          disks, num_disks,
+                                          vifs, num_vifs);
+	else
+		args = libxl__build_device_model_args(gc, "stubdom-dm", info,
                                           disks, num_disks,
                                           vifs, num_vifs);
     if (!args) {
@@ -599,13 +612,22 @@
     b_info.max_vcpus = 1;
     b_info.max_memkb = 32 * 1024;
     b_info.target_memkb = b_info.max_memkb;
-    b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
-                                              libxl_xenfirmwaredir_path());
     b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
-    b_info.u.pv.ramdisk.path = "";
     b_info.u.pv.features = "";
     b_info.hvm = 0;

+	if(libxl__is_linux_stubdom(info)){
+		b_info.u.pv.kernel.path = libxl__abs_path(gc, "vmlinuz-ioemu",
+						libxl_xenfirmwaredir_path());
+		b_info.u.pv.ramdisk.path = libxl__abs_path(gc, "ramdisk-ioemu",
+						libxl_xenfirmwaredir_path());
+	}
+	else{
+		b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
+						libxl_xenfirmwaredir_path());
+		b_info.u.pv.ramdisk.path = "";
+	}
+
     /* fixme: this function can leak the stubdom if it fails */

     ret = libxl__domain_make(gc, &c_info, &domid);
diff -r 37c77bacb52a tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon May 23 17:38:28 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue May 31 02:41:59 2011 +0100
@@ -249,6 +249,7 @@
                                 libxl__domain_build_state *state);

 /* for device model creation */
+_hidden int libxl__is_linux_stubdom(libxl_device_model_info *info);
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                                libxl_device_model_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
diff -r 37c77bacb52a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon May 23 17:38:28 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue May 31 02:41:59 2011 +0100
@@ -1087,7 +1087,7 @@
             fprintf(stderr,
                     "WARNING: ignoring device_model directive.\n"
                     "WARNING: Use \"device_model_override\" instead
if you really want a non-default device_model\n");
-            if (strstr(buf, "stubdom-dm"))
+            if (strstr(buf, "stubdom-dm") || strstr(buf, "linux-stubdom"))
                 fprintf(stderr, "WARNING: Or use
\"device_model_stubdomain_override\" if you want to enable
stubdomains\n");
         }

             reply	other threads:[~2011-05-31 13:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 13:54 Jiageng Yu [this message]
2011-05-31 14:38 ` [PATCH] libxl: Support linux-stubdom in libxl Stefano Stabellini
2011-06-01 12:58 ` Ian Campbell
2011-06-02 13:40   ` Jiageng Yu
2011-06-02 14:25     ` Ian Campbell
2011-06-02 14:31       ` Stefano Stabellini
2011-06-02 14:35         ` Ian Campbell
2011-06-06 11:56           ` ZhouPeng

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=BANLkTikCb2GEodgNCDyL9_qgfLE42hc+pA@mail.gmail.com \
    --to=yujiageng734@gmail.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefano.stabellini@eu.citrix.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 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).