NEmu

Network Emulator for Mobile Universes

Documentation - Network Block Device (NBD)

Network Block is a way to share a VFs by several virtual nodes.

RemoteNBD(name, hd, cli, addr, port)

Setups a Network Block Device server called name, with the VFs hd. cli is the maximum number of simultaneous connections on the RNbd (Default: 1). addr (Default: 127.0.0.1) and port (Default: autoset) are the real listen address and listen port for the server.

StartRemoteNBD(*names)

Starts several Network Block Device servers. If no name is given, all NBD servers will be launched.

StopRemoteNBD(*names)

Stops several Network Block Device servers. If no name is given, all NBD servers will be halted.

DelRemoteNBD(*names)

Deletes several Network Block Device servers. If no name is given, all NBD servers will be deleted.

Here is a simple usage example:

InitNemu()

RemoteNBD('myfs', hd=VFs('rootfs.img'), cli=2, port=7000)

VHost('a', hfs=[VFs('a.img'), VFs('myfs', type='nbd')])
VHost('b', hfs=[VFs('b.img'), VFs('myfs', type='nbd')])

StartRemoteNBD()
StartNemu()

Here is a multi-hosts usage example:

# Physical host 1 [192.168.0.1]

InitNemu()

RemoteNBD('myfs', hd=VFs('rootfs.img'), cli=2, addr='0.0.0.0', port=7000)

VHost('a', hfs=[VFs('a.img'), VFs('myfs', type='nbd')])

StartRemoteNBD()
StartNemu()
# Physical host 2 [192.168.0.2]

InitNemu()

RemoteNBD('remotefs', addr='192.168.0.1', port=7000)

VHost('b', hfs=[VFs('b.img'), VFs('remotefs', type='nbd')])

StartNemu()