Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/xentools413 Improve tap handling: pass bridge...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/07075ffa9d7d
branches:  trunk
changeset: 437609:07075ffa9d7d
user:      bouyer <bouyer%pkgsrc.org@localhost>
date:      Thu Aug 27 13:39:04 2020 +0000

description:
Improve tap handling: pass bridge name to qemu-ifup (partially from
Roman Shaposhnik via xen-devel) as qemu-xen-traditional does.
Also set an XEN_DOMAIN_ID environnement variable, so that the xenstore can
be looked up from qemu scripts.

While there, check /usr/include/xen/xenio.h presense instead of relying
only on ONLY_FOR_PLATFORM. This way this package can be built on recent
9.0_STABLE.
Bump PKGREVISION.

diffstat:

 sysutils/xentools413/Makefile                               |  12 +-
 sysutils/xentools413/distinfo                               |   5 +-
 sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c   |  43 +++++++-
 sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap.c |  70 +++++++++++++
 4 files changed, 120 insertions(+), 10 deletions(-)

diffs (191 lines):

diff -r 92b7c24c8db5 -r 07075ffa9d7d sysutils/xentools413/Makefile
--- a/sysutils/xentools413/Makefile     Thu Aug 27 13:11:41 2020 +0000
+++ b/sysutils/xentools413/Makefile     Thu Aug 27 13:39:04 2020 +0000
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.8 2020/08/27 08:22:33 bouyer Exp $
+# $NetBSD: Makefile,v 1.9 2020/08/27 13:39:04 bouyer Exp $
 #
 VERSION=       4.13.1
 
 DIST_SUBDIR=           xen413
 DISTNAME=              xen-${VERSION}
 PKGNAME=               xentools413-${VERSION}
-PKGREVISION=           1
+PKGREVISION=           2
 CATEGORIES=            sysutils
 MASTER_SITES=          https://downloads.xenproject.org/release/xen/${VERSION}/
 
@@ -35,10 +35,14 @@
 
 PKG_SYSCONFSUBDIR=     xen
 
-ONLY_FOR_PLATFORM=     Linux-2.6*-x86_64
-ONLY_FOR_PLATFORM+=    NetBSD-9.99.6[4-9]-x86_64 NetBSD-9.99.[7-9]*-x86_64
+
+.if exists(/usr/include/xen/xenio.h)
+ONLY_FOR_PLATFORM=     NetBSD-*-x86_64
+.else
+ONLY_FOR_PLATFORM=     NetBSD-9.99.6[4-9]-x86_64 NetBSD-9.99.[7-9]*-x86_64
 ONLY_FOR_PLATFORM+=    NetBSD-9.[1-9]-x86_64
 ONLY_FOR_PLATFORM+=    NetBSD-9.[1-9]_*-x86_64
+.endif
 
 SSP_SUPPORTED=         no
 
diff -r 92b7c24c8db5 -r 07075ffa9d7d sysutils/xentools413/distinfo
--- a/sysutils/xentools413/distinfo     Thu Aug 27 13:11:41 2020 +0000
+++ b/sysutils/xentools413/distinfo     Thu Aug 27 13:39:04 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.2 2020/08/27 08:22:33 bouyer Exp $
+$NetBSD: distinfo,v 1.3 2020/08/27 13:39:04 bouyer Exp $
 
 SHA1 (xen413/ipxe-1dd56dbd11082fb622c2ed21cfaced4f47d798a6.tar.gz) = b78d21457bc07b4c4d3e770109c169ddafdacdf5
 RMD160 (xen413/ipxe-1dd56dbd11082fb622c2ed21cfaced4f47d798a6.tar.gz) = 846dbcc0f56e87fca8c87b00ca2ed031471d4246
@@ -54,7 +54,7 @@
 SHA1 (patch-tools_libs_gnttab_netbsd.c) = fecbb0d41365fc49621964dbf8d3b3fcbfddb5d3
 SHA1 (patch-tools_libxc_xc_private.h) = b627c3f92a6e74e3708bbc110d0b6a4d6ea64c37
 SHA1 (patch-tools_libxl_libxl__create.c) = 09cd562f0839dda6f92d63d8fc8ed6de08dd82a8
-SHA1 (patch-tools_libxl_libxl_dm.c) = f1f1842dc75afbc6114f201b8a7ed09fea0e271b
+SHA1 (patch-tools_libxl_libxl_dm.c) = 7067dd7f99d31617074442a4e7c1b4d4389fb17d
 SHA1 (patch-tools_libxl_libxl_dom.c) = 0c4a96523d13de65aaa71ef705c3579ee8d641f3
 SHA1 (patch-tools_libxl_libxl_event.c) = 8147122d03102eccc45c48a7d6ca1aa5d6286040
 SHA1 (patch-tools_libxl_libxl_internal.h) = 31da26f2121fe2a1928d75f719554ed9389c187b
@@ -81,6 +81,7 @@
 SHA1 (patch-tools_qemu-xen_audio_audio.c) = a7f47ff0350900bcb99b5515eeee162144a98cf8
 SHA1 (patch-tools_qemu-xen_configure) = 38eee924f66c226a09c2408312fc0f67d99d2b81
 SHA1 (patch-tools_qemu-xen_net_tap-bsd.c) = ac1ed72daeb051eae7352542630a9a02c99e485e
+SHA1 (patch-tools_qemu-xen_net_tap.c) = 53d8c1799136c412b775d7d02d72b1abc63f4dd3
 SHA1 (patch-tools_qemu-xen_qemu-doc.texi) = e72d480ec29829055f01226eaf020d4cbd100d5d
 SHA1 (patch-tools_xenpaging_xenpaging.c) = 0a154b97f1f452a5f80f7c9a835a1f216f12f7e1
 SHA1 (patch-tools_xenpmd_xenpmd.c) = 851ce7a295e2f41ffcd966850d8003c82670c751
diff -r 92b7c24c8db5 -r 07075ffa9d7d sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c
--- a/sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c Thu Aug 27 13:11:41 2020 +0000
+++ b/sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c Thu Aug 27 13:39:04 2020 +0000
@@ -1,6 +1,41 @@
---- ./tools/libxl/libxl_dm.c.orig      2020-05-08 21:07:35.429483538 +0200
-+++ ./tools/libxl/libxl_dm.c   2020-05-08 21:21:20.119079508 +0200
-@@ -3351,6 +3351,14 @@
+$NetBSD: patch-tools_libxl_libxl_dm.c,v 1.2 2020/08/27 13:39:04 bouyer Exp $
+
+--- tools/libxl/libxl_dm.c.orig        2020-05-14 14:19:32.000000000 +0200
++++ tools/libxl/libxl_dm.c     2020-08-27 14:12:38.150082263 +0200
+@@ -742,6 +742,10 @@
+         int nr_set_cpus = 0;
+         char *s;
+ 
++      static char buf[12];
++      snprintf(buf, sizeof(buf), "%d", domid);
++        flexarray_append_pair(dm_envs, "XEN_DOMAIN_ID", buf);
++
+         if (b_info->kernel) {
+             LOGD(ERROR, domid, "HVM direct kernel boot is not supported by "
+                  "qemu-xen-traditional");
+@@ -1503,8 +1507,10 @@
+                 flexarray_append(dm_args, "-netdev");
+                 flexarray_append(dm_args,
+                                  GCSPRINTF("type=tap,id=net%d,ifname=%s,"
++                                         "br=%s,"
+                                            "script=%s,downscript=%s",
+                                            nics[i].devid, ifname,
++                                         nics[i].bridge,
+                                            libxl_tapif_script(gc),
+                                            libxl_tapif_script(gc)));
+ 
+@@ -1772,6 +1778,10 @@
+     flexarray_append(dm_args, GCSPRINTF("%"PRId64, ram_size));
+ 
+     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
++      static char buf[12];
++      snprintf(buf, sizeof(buf), "%d", guest_domid);
++        flexarray_append_pair(dm_envs, "XEN_DOMAIN_ID", buf);
++
+         if (b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI)
+             flexarray_append_pair(dm_args, "-device", "ahci,id=ahci0");
+         for (i = 0; i < num_disks; i++) {
+@@ -3351,6 +3361,14 @@
  
      LOGD(DEBUG, domid, "DM reaper: calling setresuid(%d, %d, 0)",
           reaper_uid, dm_kill_uid);
@@ -15,7 +50,7 @@
      r = setresuid(reaper_uid, dm_kill_uid, 0);
      if (r) {
          LOGED(ERROR, domid, "setresuid to (%d, %d, 0)",
-@@ -3358,6 +3366,7 @@
+@@ -3358,6 +3376,7 @@
          rc = rc ?: ERROR_FAIL;
          goto out;
      }
diff -r 92b7c24c8db5 -r 07075ffa9d7d sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap.c       Thu Aug 27 13:39:04 2020 +0000
@@ -0,0 +1,70 @@
+$NetBSD: patch-tools_qemu-xen_net_tap.c,v 1.1 2020/08/27 13:39:04 bouyer Exp $
+
+From Roman Shaposhnik via xen-devel: pass bridge name to ifup script
+
+--- tools/qemu-xen/net/tap.c.orig
++++ tools/qemu-xen/net/tap.c
+@@ -62,7 +62,7 @@
+     Notifier exit;
+ } TAPState;
+ 
+-static void launch_script(const char *setup_script, const char *ifname,
++static void launch_script(const char *setup_script, const char *ifname, const char *bridge,
+                           int fd, Error **errp);
+ 
+ static void tap_send(void *opaque);
+@@ -300,7 +300,7 @@
+     Error *err = NULL;
+ 
+     if (s->down_script[0]) {
+-        launch_script(s->down_script, s->down_script_arg, s->fd, &err);
++        launch_script(s->down_script, s->down_script_arg, "bn1", s->fd, &err);
+         if (err) {
+             error_report_err(err);
+         }
+@@ -397,7 +397,7 @@
+     return s;
+ }
+ 
+-static void launch_script(const char *setup_script, const char *ifname,
++static void launch_script(const char *setup_script, const char *ifname, const char *bridge,
+                           int fd, Error **errp)
+ {
+     int pid, status;
+@@ -422,6 +422,7 @@
+         parg = args;
+         *parg++ = (char *)setup_script;
+         *parg++ = (char *)ifname;
++      *parg++ = (char *)bridge;
+         *parg = NULL;
+         execv(setup_script, args);
+         _exit(1);
+@@ -607,7 +608,7 @@
+ 
+ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr,
+                         const char *setup_script, char *ifname,
+-                        size_t ifname_sz, int mq_required, Error **errp)
++                        size_t ifname_sz, const char *bridge, int mq_required, Error **errp)
+ {
+     Error *err = NULL;
+     int fd, vnet_hdr_required;
+@@ -629,7 +630,7 @@
+     if (setup_script &&
+         setup_script[0] != '\0' &&
+         strcmp(setup_script, "no") != 0) {
+-        launch_script(setup_script, ifname, fd, &err);
++        launch_script(setup_script, ifname, bridge, fd, &err);
+         if (err) {
+             error_propagate(errp, err);
+             close(fd);
+@@ -918,7 +919,9 @@
+ 
+         for (i = 0; i < queues; i++) {
+             fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script,
+-                              ifname, sizeof ifname, queues > 1, errp);
++                              ifname, sizeof ifname, 
++                            tap->has_br ? tap->br : "bn1",
++                            queues > 1, errp);
+             if (fd == -1) {
+                 return -1;
+             }



Home | Main Index | Thread Index | Old Index