Mailing List Archive

[RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options.
From: Eric Shelton <eshelton@pobox.com>

This patch creates an appropriate command line for the QEMU instance
running in a Linux-based stubdomain.

NOTE: a number of items are not currently implemented for Linux-based
stubdomains, such as:
- save/restore
- QMP socket
- graphics output (e.g., VNC)

Signed-off-by: Eric Shelton <eshelton@pobox.com>

Simon:
* fix disk path
* fix cdrom path and "format"
* pass downscript for network interfaces

Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
[drop Qubes-specific parts]
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
Changes in v2:
- fix serial specified with serial=[ ... ] syntax
- error out on multiple consoles (incompatible with stubdom)
- drop erroneous chunk about cdrom
---
tools/libxl/libxl_dm.c | 114 +++++++++++++++++++++++++++++-------------
1 file changed, 81 insertions(+), 33 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index ebe8e0c..82ff490 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -25,9 +25,24 @@
#include <pwd.h>
#include <grp.h>

-static const char *libxl_tapif_script(libxl__gc *gc)
+static const char *libxl_tapif_script(libxl__gc *gc,
+ const libxl_domain_build_info *info)
{
#if defined(__linux__) || defined(__FreeBSD__)
+ if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
+ return libxl__sprintf(gc, "/etc/qemu-ifup");
+ return libxl__strdup(gc, "no");
+#else
+ return GCSPRINTF("%s/qemu-ifup", libxl__xen_script_dir_path());
+#endif
+}
+
+static const char *libxl_tapif_downscript(libxl__gc *gc,
+ const libxl_domain_build_info *info)
+{
+#if defined(__linux__) || defined(__FreeBSD__)
+ if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
+ return libxl__sprintf(gc, "/etc/qemu-ifdown");
return libxl__strdup(gc, "no");
#else
return GCSPRINTF("%s/qemu-ifup", libxl__xen_script_dir_path());
@@ -616,8 +631,8 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
"tap,vlan=%d,ifname=%s,bridge=%s,"
"script=%s,downscript=%s",
nics[i].devid, ifname, nics[i].bridge,
- libxl_tapif_script(gc),
- libxl_tapif_script(gc)),
+ libxl_tapif_script(gc, b_info),
+ libxl_tapif_downscript(gc, b_info)),
NULL);
ioemu_nics++;
}
@@ -933,6 +948,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
const char *path, *chardev;
char *user = NULL;
struct passwd *user_base, user_pwbuf;
+ bool is_stubdom = libxl_defbool_val(b_info->device_model_stubdomain);

dm_args = flexarray_make(gc, 16, 1);
dm_envs = flexarray_make(gc, 16, 1);
@@ -943,24 +959,27 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
"-xen-domid",
GCSPRINTF("%d", guest_domid), NULL);

- flexarray_append(dm_args, "-chardev");
- flexarray_append(dm_args,
- GCSPRINTF("socket,id=libxl-cmd,"
- "path=%s/qmp-libxl-%d,server,nowait",
- libxl__run_dir_path(), guest_domid));
+ /* There is currently no way to access the QMP socket in the stubdom */
+ if (!is_stubdom) {
+ flexarray_append(dm_args, "-chardev");
+ flexarray_append(dm_args,
+ GCSPRINTF("socket,id=libxl-cmd,"
+ "path=%s/qmp-libxl-%d,server,nowait",
+ libxl__run_dir_path(), guest_domid));

- flexarray_append(dm_args, "-no-shutdown");
- flexarray_append(dm_args, "-mon");
- flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
+ flexarray_append(dm_args, "-no-shutdown");
+ flexarray_append(dm_args, "-mon");
+ flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");

- flexarray_append(dm_args, "-chardev");
- flexarray_append(dm_args,
- GCSPRINTF("socket,id=libxenstat-cmd,"
- "path=%s/qmp-libxenstat-%d,server,nowait",
- libxl__run_dir_path(), guest_domid));
+ flexarray_append(dm_args, "-chardev");
+ flexarray_append(dm_args,
+ GCSPRINTF("socket,id=libxenstat-cmd,"
+ "path=%s/qmp-libxenstat-%d,server,nowait",
+ libxl__run_dir_path(), guest_domid));

- flexarray_append(dm_args, "-mon");
- flexarray_append(dm_args, "chardev=libxenstat-cmd,mode=control");
+ flexarray_append(dm_args, "-mon");
+ flexarray_append(dm_args, "chardev=libxenstat-cmd,mode=control");
+ }

for (i = 0; i < guest_config->num_channels; i++) {
connection = guest_config->channels[i].connection;
@@ -1004,7 +1023,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
flexarray_vappend(dm_args, "-name", c_info->name, NULL);
}

- if (vnc) {
+ if (vnc && !is_stubdom) {
char *vncarg = NULL;

flexarray_append(dm_args, "-vnc");
@@ -1043,7 +1062,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
}

flexarray_append(dm_args, vncarg);
- } else
+ } else if (!is_stubdom)
/*
* Ensure that by default no vnc server is created.
*/
@@ -1055,7 +1074,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
*/
flexarray_append_pair(dm_args, "-display", "none");

- if (sdl) {
+ if (sdl && !is_stubdom) {
flexarray_append(dm_args, "-sdl");
if (sdl->display)
flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
@@ -1099,10 +1118,31 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
return ERROR_INVAL;
}
if (b_info->u.hvm.serial) {
- flexarray_vappend(dm_args,
- "-serial", b_info->u.hvm.serial, NULL);
- } else if (b_info->u.hvm.serial_list) {
+ if (is_stubdom) {
+ flexarray_vappend(dm_args,
+ "-serial",
+ GCSPRINTF("/dev/hvc%d",
+ STUBDOM_CONSOLE_SERIAL),
+ NULL);
+ } else {
+ flexarray_vappend(dm_args,
+ "-serial", b_info->u.hvm.serial, NULL);
+ }
+ } else if (b_info->u.hvm.serial_list &&
+ b_info->u.hvm.serial_list[0]) {
char **p;
+ if (is_stubdom) {
+ if (b_info->u.hvm.serial_list[1]) {
+ LOGD(ERROR, guest_domid,
+ "device model in stubdomain doesn't support multiple serial consoles");
+ return ERROR_INVAL;
+ }
+ flexarray_vappend(dm_args,
+ "-serial",
+ GCSPRINTF("/dev/hvc%d",
+ STUBDOM_CONSOLE_SERIAL),
+ NULL);
+ }
for (p = b_info->u.hvm.serial_list;
*p;
p++) {
@@ -1117,7 +1157,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
flexarray_append(dm_args, "-nographic");
}

- if (libxl_defbool_val(b_info->u.hvm.spice.enable)) {
+ if (libxl_defbool_val(b_info->u.hvm.spice.enable) && !is_stubdom) {
const libxl_spice_info *spice = &b_info->u.hvm.spice;
char *spiceoptions = dm_spice_options(gc, spice);
if (!spiceoptions)
@@ -1256,8 +1296,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
GCSPRINTF("type=tap,id=net%d,ifname=%s,"
"script=%s,downscript=%s",
nics[i].devid, ifname,
- libxl_tapif_script(gc),
- libxl_tapif_script(gc)));
+ libxl_tapif_script(gc, b_info),
+ libxl_tapif_downscript(gc, b_info)));

/* Userspace COLO Proxy need this */
#define APPEND_COLO_SOCK_SERVER(sock_id, sock_ip, sock_port) ({ \
@@ -1503,7 +1543,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
* If qemu isn't doing the interpreting, the parameter is
* always raw
*/
- if (disks[i].backend == LIBXL_DISK_BACKEND_QDISK)
+ if (libxl_defbool_val(b_info->device_model_stubdomain))
+ format = "host_device";
+ else if (disks[i].backend == LIBXL_DISK_BACKEND_QDISK)
format = libxl__qemu_disk_format_string(disks[i].format);
else
format = libxl__qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
@@ -1514,6 +1556,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
disks[i].vdev);
continue;
}
+ } else if (libxl_defbool_val(b_info->device_model_stubdomain)) {
+ target_path = GCSPRINTF("/dev/xvd%c", 'a' + disk);
} else {
if (format == NULL) {
LOGD(WARN, guest_domid,
@@ -1727,7 +1771,7 @@ static int libxl__build_device_model_args(libxl__gc *gc,
char ***args, char ***envs,
const libxl__domain_build_state *state,
int *dm_state_fd)
-/* dm_state_fd may be NULL iff caller knows we are using old stubdom
+/* dm_state_fd may be NULL iff caller knows we are using stubdom
* and therefore will be passing a filename rather than a fd. */
{
switch (guest_config->b_info.device_model_version) {
@@ -1737,8 +1781,10 @@ static int libxl__build_device_model_args(libxl__gc *gc,
args, envs,
state);
case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
- assert(dm_state_fd != NULL);
- assert(*dm_state_fd < 0);
+ if (!libxl_defbool_val(guest_config->b_info.device_model_stubdomain)) {
+ assert(dm_state_fd != NULL);
+ assert(*dm_state_fd < 0);
+ }
return libxl__build_device_model_args_new(gc, dm,
guest_domid, guest_config,
args, envs,
@@ -1796,7 +1842,7 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,

static int libxl__write_stub_dmargs(libxl__gc *gc,
int dm_domid, int guest_domid,
- char **args)
+ char **args, bool linux_stubdom)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
int i;
@@ -1824,7 +1870,9 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
i = 1;
dmargs[0] = '\0';
while (args[i] != NULL) {
- if (strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv")) {
+ if (linux_stubdom ||
+ (strcmp(args[i], "-sdl") &&
+ strcmp(args[i], "-M") && strcmp(args[i], "xenfv"))) {
strcat(dmargs, " ");
strcat(dmargs, args[i]);
}
--
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options. [ In reply to ]
On Tue, Aug 07, 2018 at 04:16:08AM +0200, Marek Marczykowski-Górecki wrote:
> From: Eric Shelton <eshelton@pobox.com>
>
> This patch creates an appropriate command line for the QEMU instance
> running in a Linux-based stubdomain.
>
> NOTE: a number of items are not currently implemented for Linux-based
> stubdomains, such as:
> - save/restore
> - QMP socket
> - graphics output (e.g., VNC)
>
> Signed-off-by: Eric Shelton <eshelton@pobox.com>
>
> Simon:
> * fix disk path
> * fix cdrom path and "format"
> * pass downscript for network interfaces
>
> Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
> [drop Qubes-specific parts]
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Looks okay to me. But I need to review it more closely before giving my
ack.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options. [ In reply to ]
On Mon, Aug 6, 2018 at 10:22 PM Marek Marczykowski-Górecki
<marmarek@invisiblethingslab.com> wrote:
>
> From: Eric Shelton <eshelton@pobox.com>
>
> This patch creates an appropriate command line for the QEMU instance
> running in a Linux-based stubdomain.
>
> NOTE: a number of items are not currently implemented for Linux-based
> stubdomains, such as:
> - save/restore
> - QMP socket
> - graphics output (e.g., VNC)
>
> Signed-off-by: Eric Shelton <eshelton@pobox.com>
>
> Simon:
> * fix disk path
> * fix cdrom path and "format"
> * pass downscript for network interfaces
>
> Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
> [drop Qubes-specific parts]
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> Changes in v2:
> - fix serial specified with serial=[ ... ] syntax
> - error out on multiple consoles (incompatible with stubdom)
> - drop erroneous chunk about cdrom

Reviewed-by: Jason Andryuk <jandryuk@gmail.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options. [ In reply to ]
Marek Marczykowski-Górecki writes ("[RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options."):
> From: Eric Shelton <eshelton@pobox.com>
>
> This patch creates an appropriate command line for the QEMU instance
> running in a Linux-based stubdomain.
...
> -static const char *libxl_tapif_script(libxl__gc *gc)
> +static const char *libxl_tapif_script(libxl__gc *gc,
> + const libxl_domain_build_info *info)
> {
> #if defined(__linux__) || defined(__FreeBSD__)
> + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> + return libxl__sprintf(gc, "/etc/qemu-ifup");
> + return libxl__strdup(gc, "no");
> +#else
> + return GCSPRINTF("%s/qemu-ifup", libxl__xen_script_dir_path());
> +#endif
> +}
> +
> +static const char *libxl_tapif_downscript(libxl__gc *gc,
> + const libxl_domain_build_info *info)
> +{
> +#if defined(__linux__) || defined(__FreeBSD__)
> + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> + return libxl__sprintf(gc, "/etc/qemu-ifdown");

We should never have permitted this #ifdefery. The resulting diff
here is almost incomprehensible due to the 3 levels of improper
nesting: diff, ifdef, and code.

Also we do not currently support any dom0's other than Linux and
FreeBSD anyway! So the #ifdef is entirely redundant. This wasn't
noticed when 2b2ef0c54459722943db6166da28e098af12a9e6
"libxl: don't use a qemu-ifup script on FreeBSD"
was prepared and accepted.

AFAICT this part of this patch is separating out the down and up
versions of libxl_tapif_script. The resulting two functions are quite
similar though.

I suggest the following series of small changes:
1. Drop the #if and all the code in the #else
2. Add a libxl__device_action parameter to libxl_tapif_script
3. Make your new code check for linux stubdom and if so
pass "qemu" + (action == add) ? "up" :
(action == remove) ? "down" : (abort(),0)
or some such

What do you think ?

> @@ -1099,10 +1118,31 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
> return ERROR_INVAL;
> }
> if (b_info->u.hvm.serial) {
> - flexarray_vappend(dm_args,
> - "-serial", b_info->u.hvm.serial, NULL);
> - } else if (b_info->u.hvm.serial_list) {
> + if (is_stubdom) {
> + flexarray_vappend(dm_args,
> + "-serial",
> + GCSPRINTF("/dev/hvc%d",
> + STUBDOM_CONSOLE_SERIAL),
> + NULL);
> + } else {
> + flexarray_vappend(dm_args,
> + "-serial", b_info->u.hvm.serial, NULL);
> + }
> + } else if (b_info->u.hvm.serial_list &&
> + b_info->u.hvm.serial_list[0]) {
> char **p;
> + if (is_stubdom) {
> + if (b_info->u.hvm.serial_list[1]) {

This can't possibly be right. The 2nd if is in the else of a
condition which will always catch all of its cases.

Also,

> + flexarray_vappend(dm_args,
> + "-serial",
> + GCSPRINTF("/dev/hvc%d",
> + STUBDOM_CONSOLE_SERIAL),

it repeats some of the code.

> @@ -1503,7 +1543,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
> * If qemu isn't doing the interpreting, the parameter is
> * always raw
> */
> - if (disks[i].backend == LIBXL_DISK_BACKEND_QDISK)
> + if (libxl_defbool_val(b_info->device_model_stubdomain))
> + format = "host_device";

So I infer that you have created in qemu a "block device format"
called "host_device" which is actually a pv frontend ? Or are we
using Linux's blkfront here ? In which case why not "raw" ?

> + } else if (libxl_defbool_val(b_info->device_model_stubdomain)) {
> + target_path = GCSPRINTF("/dev/xvd%c", 'a' + disk);

Needs an error check in case disk is too large.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options. [ In reply to ]
On Tue, Oct 16, 2018 at 06:16:41PM +0100, Ian Jackson wrote:
> Marek Marczykowski-Górecki writes ("[RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options."):
> > From: Eric Shelton <eshelton@pobox.com>
> >
> > This patch creates an appropriate command line for the QEMU instance
> > running in a Linux-based stubdomain.
> ...
> > -static const char *libxl_tapif_script(libxl__gc *gc)
> > +static const char *libxl_tapif_script(libxl__gc *gc,
> > + const libxl_domain_build_info *info)
> > {
> > #if defined(__linux__) || defined(__FreeBSD__)
> > + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> > + return libxl__sprintf(gc, "/etc/qemu-ifup");
> > + return libxl__strdup(gc, "no");
> > +#else
> > + return GCSPRINTF("%s/qemu-ifup", libxl__xen_script_dir_path());
> > +#endif
> > +}
> > +
> > +static const char *libxl_tapif_downscript(libxl__gc *gc,
> > + const libxl_domain_build_info *info)
> > +{
> > +#if defined(__linux__) || defined(__FreeBSD__)
> > + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> > + return libxl__sprintf(gc, "/etc/qemu-ifdown");
>
> We should never have permitted this #ifdefery. The resulting diff
> here is almost incomprehensible due to the 3 levels of improper
> nesting: diff, ifdef, and code.
>
> Also we do not currently support any dom0's other than Linux and
> FreeBSD anyway! So the #ifdef is entirely redundant. This wasn't
> noticed when 2b2ef0c54459722943db6166da28e098af12a9e6
> "libxl: don't use a qemu-ifup script on FreeBSD"
> was prepared and accepted.
>
> AFAICT this part of this patch is separating out the down and up
> versions of libxl_tapif_script. The resulting two functions are quite
> similar though.
>
> I suggest the following series of small changes:
> 1. Drop the #if and all the code in the #else
> 2. Add a libxl__device_action parameter to libxl_tapif_script
> 3. Make your new code check for linux stubdom and if so
> pass "qemu" + (action == add) ? "up" :
> (action == remove) ? "down" : (abort(),0)
> or some such
>
> What do you think ?

Given updated stubdomain doesn't need qemu-ifup/ifdown at all, this
whole chunk can be dropped.

> > @@ -1099,10 +1118,31 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
> > return ERROR_INVAL;
> > }
> > if (b_info->u.hvm.serial) {
> > - flexarray_vappend(dm_args,
> > - "-serial", b_info->u.hvm.serial, NULL);
> > - } else if (b_info->u.hvm.serial_list) {
> > + if (is_stubdom) {
> > + flexarray_vappend(dm_args,
> > + "-serial",
> > + GCSPRINTF("/dev/hvc%d",
> > + STUBDOM_CONSOLE_SERIAL),
> > + NULL);
> > + } else {
> > + flexarray_vappend(dm_args,
> > + "-serial", b_info->u.hvm.serial, NULL);
> > + }
> > + } else if (b_info->u.hvm.serial_list &&
> > + b_info->u.hvm.serial_list[0]) {
> > char **p;
> > + if (is_stubdom) {
> > + if (b_info->u.hvm.serial_list[1]) {
>
> This can't possibly be right. The 2nd if is in the else of a
> condition which will always catch all of its cases.

Oh, indeed.

> Also,
>
> > + flexarray_vappend(dm_args,
> > + "-serial",
> > + GCSPRINTF("/dev/hvc%d",
> > + STUBDOM_CONSOLE_SERIAL),
>
> it repeats some of the code.
>
> > @@ -1503,7 +1543,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
> > * If qemu isn't doing the interpreting, the parameter is
> > * always raw
> > */
> > - if (disks[i].backend == LIBXL_DISK_BACKEND_QDISK)
> > + if (libxl_defbool_val(b_info->device_model_stubdomain))
> > + format = "host_device";
>
> So I infer that you have created in qemu a "block device format"
> called "host_device" which is actually a pv frontend ? Or are we
> using Linux's blkfront here ? In which case why not "raw" ?

"format" is actually passed to "driver" option for -drive. And according
to qemu documentation, "raw" should be used only for regular file, not
block devices. And since qemu 3.0, "raw" driver rejects block devices[1].

> > + } else if (libxl_defbool_val(b_info->device_model_stubdomain)) {
> > + target_path = GCSPRINTF("/dev/xvd%c", 'a' + disk);
>
> Needs an error check in case disk is too large.

Ok.

> Thanks,
> Ian.

[1] https://qemu.weilnetz.de/doc/qemu-doc.html#g_t_002ddrive-file_003djson_003a_007b_002e_002e_002e_007b_0027driver_0027_003a_0027file_0027_007d_007d-_0028since-3_002e0_0029

--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
Re: [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options. [ In reply to ]
On Tue, Oct 16, 2018 at 06:16:41PM +0100, Ian Jackson wrote:
> Marek Marczykowski-Górecki writes ("[RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options."):
> > From: Eric Shelton <eshelton@pobox.com>
> >
> > This patch creates an appropriate command line for the QEMU instance
> > running in a Linux-based stubdomain.
> ...
> > -static const char *libxl_tapif_script(libxl__gc *gc)
> > +static const char *libxl_tapif_script(libxl__gc *gc,
> > + const libxl_domain_build_info *info)
> > {
> > #if defined(__linux__) || defined(__FreeBSD__)
> > + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> > + return libxl__sprintf(gc, "/etc/qemu-ifup");
> > + return libxl__strdup(gc, "no");
> > +#else
> > + return GCSPRINTF("%s/qemu-ifup", libxl__xen_script_dir_path());
> > +#endif
> > +}
> > +
> > +static const char *libxl_tapif_downscript(libxl__gc *gc,
> > + const libxl_domain_build_info *info)
> > +{
> > +#if defined(__linux__) || defined(__FreeBSD__)
> > + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> > + return libxl__sprintf(gc, "/etc/qemu-ifdown");
>
> We should never have permitted this #ifdefery. The resulting diff
> here is almost incomprehensible due to the 3 levels of improper
> nesting: diff, ifdef, and code.
>
> Also we do not currently support any dom0's other than Linux and
> FreeBSD anyway!

I'm not sure this is entirely true, IIRC NetBSD requires a QEMU nic
hotplug script and is still supported:

http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/sysutils/xentools48/

That's the reason why we require such ifdefery.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel