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

Re: [Nbd] nbd-server only active if an interface is active in Linux



Op dinsdag 22 juli 2014 11:52:52 schreef Santiago Villafuerte:
> Hello Wouter
> 
> I tested the workaround with the 3.8 version. I can tell if the 3.8 is
> actually running on the system by typing:
> 
> ./nbd-server -help
> 
> I created a config file whenever the USB drive has to be shared via NBD:
> 
> cat /tmp/nbd.conf
> [generic]
> oldstyle = true
> [usb]
> exportname = /dev/sdb1
> port = 9000
> readonly = true

Ah, yes, but the workaround is that you *shouldn't* use oldstyle ;-)

(in other words, remove the 'oldstyle=true' and 'port=9000' lines;
clients would then need to connect with "nbd-client -N usb <server>" in
your example).

> The nbd-server throws this warnings when it's run...
> 
> ./nbd-server -C /tmp/nbd.conf
> 
> ** (process:353): WARNING **: A port was specified, but oldstyle exports
> were not requested. This may not do what you expect.
> 
> ** (process:353): WARNING **: Please read 'man 5 nbd-server' and search for
> oldstyle for more info

This message is fixed in git HEAD.

> After that, nothing happens. The netstat command shows nothing on the 9000
> port.
> 
> The same issue is present on the 2.9.23 version..
> 
> Only after setting an interface up is when the config file is actually
> serviced.
> 
> You mentioned on your last email you had an idea on how to fix that issue
> (you were working on tap0 all the time). Could you please share a hint on
> how to solve it so that I can work on that?

I believe the issue is that the getaddrinfo() call that nbd-server does
to figure out where to listen may fail when trying to do so while no
network connectivity is present. It would mean I need to fiddle with
the hints.ai_flags setting on line 2386 in nbd-server (git HEAD).

For some reason it does seem to work when for newstyle negotiation. The
only obvious difference there is that newstyle negotiation *doesn't*
have AI_NUMERICSERV set, but that doesn't make any sense.

I would need to find some time to debug this, but during my latest
session on the train today I didn't find what the problem was.

It *might* work if you specify a listen address. Haven't tested that
yet.

> At the moment I made a workaround that whenever an interface is up, I
> relaunch the nbd-server and it stays alive. However, it's a dirty patch
> which I would like to solve with the nbd-server binary itself.

Yeah, that makes sense.

-- 
It is easy to love a country that is famous for chocolate and beer

  -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26




Reply to: