Sebastian Reitenbach writes:

> Hi,
>
> I'm toying with OpenBSD 6.3 image on AWS, trying to add/remove Elastic 
> Network Interfaces (ENI).
> OpenBSD 6.3 (GENERIC.MP) #107: Sat Mar 24 14:21:59 MDT 2018
>     dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> So when I attach an ENI to a running instance, then the system recognizes it:
> xnf1 at xen0 backend 0 channel 7: address 02:2f:d6:3e:88:50
>
> and I can use the interface, i.e. dhcp just works.
>
> When I later detach the ENI, there is nothing in dmesg, that it recognized 
> it, no detach line, or the like.
> However, even with the detached interface, I get ifconfig output:
> xnf1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         lladdr 02:2f:d6:3e:88:50
>         index 5 priority 0 llprio 3
>         media: Ethernet manual
>         status: active
>         inet 10.2.2.105 netmask 0xffffff00 broadcast 10.2.2.255
>
> For the OS, the Interface is still available and active, but i.e. dhclient 
> obviously
> doesn't get a lease.
>
> Later on, when I reattach the ENI to the instance, similarily to the detach, 
> no new line
> in dmesg, but I can use the Interface again. It's as if it hasn't been away 
> at all.
>
> Is this all intended, just wondering if I miss something?
>
> cheers,
> Sebastian

AWS XenStore events are a bit finicky.  Do you see anything in your
dmesg?

Please try this patch below and let us know what you see.

diff --git sys/dev/pv/xen.c sys/dev/pv/xen.c
index a2a63537378..4b7f0325911 100644
--- sys/dev/pv/xen.c
+++ sys/dev/pv/xen.c
@@ -1467,10 +1467,12 @@ xen_hotplug(void *arg)
 
        memset(&xst, 0, sizeof(xst));
        xst.xst_id = 0;
        xst.xst_cookie = sc->sc_xs;
 
+       printf("Xen hotplug event for %s\n", xdl->dl_node);
+
        snprintf(path, sizeof(path), "device/%s", xdl->dl_node);
        if ((error = xs_cmd(&xst, XS_LIST, path, &iovp, &iov_cnt)) != 0)
                return;
 
        seen = malloc(iov_cnt, M_TEMP, M_ZERO | M_WAITOK);
@@ -1484,11 +1486,11 @@ xen_hotplug(void *arg)
                                keep++;
                                break;
                        }
                }
                if (!keep) {
-                       DPRINTF("%s: removing \"%s/%s\"\n", sc->sc_dev.dv_xname,
+                       printf("%s: removing \"%s/%s\"\n", sc->sc_dev.dv_xname,
                            xdl->dl_node, xdv->dv_unit);
                        LIST_REMOVE(xdv, dv_entry);
                        config_detach(xdv->dv_dev, 0);
                        free(xdv, M_DEVBUF, sizeof(struct xen_device));
                }
diff --git sys/dev/pv/xenstore.c sys/dev/pv/xenstore.c
index eb77d384b26..412aecc9e2a 100644
--- sys/dev/pv/xenstore.c
+++ sys/dev/pv/xenstore.c
@@ -699,10 +699,12 @@ xs_event(struct xs_softc *xs, struct xs_msg *xsm)
                printf("%s: event on \"%s\" without token\n",
                    xs->xs_sc->sc_dev.dv_xname, xsm->xsm_data);
                return (-1);
        }
 
+       printf("XenStore event for \"%s\"\n", token);
+
        mtx_enter(&xs->xs_watchlck);
        TAILQ_FOREACH(xsw, &xs->xs_watches, xsw_entry) {
                if (strcmp(xsw->xsw_token, token))
                        continue;
                mtx_leave(&xs->xs_watchlck);

Reply via email to