interfaces: allow user to specify an interface name #498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow the user to specify what the domif name will be for an interface
by defining a name in the Vagrantfile. This allows one to later build link
toggling from within vagrant or easily toggle the link using virsh. An
example using virsh.
By default the name of tunnel interfaces will be "tnet" + interface
number.
Given a Vagrantfile snippet:
node.vm.network :private_network,
:libvirt__tunnel_type => 'udp',
:libvirt__tunnel_port => 8001,
:libvirt__tunnel_local_port => 8002,
:libvirt__iface_name => 'test1'
Generates named domain interface called 'test1':
$ virsh -c qemu:///system domiflist vagrant_default
Interface Type Source Model MAC
-------------------------------------------------------
vnet0 network vagrant-libvirt virtio 52:54:00:2f:c1:82
vnet1 network switch_mgmt virtio 12:11:22:33:44:11
test1 udp - virtio 52:54:00:7d:8a:2a
tnet3 udp - virtio 52:54:00:ec:39:12
To toggle the interface link status one can do the following, toggle
the link up:
$ virsh -c qemu:///system domif-setlink vagrant_default test1 up
$ vagrant ssh -- sudo ip link set eth2 up
$ vagrant ssh -- ip link show eth2
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:7d:8a:2a brd ff:ff:ff:ff:ff:ff
Toggle the link down:
$ virsh -c qemu:///system domif-setlink vagrant_default test1 down
$ vagrant ssh -- sudo ip link set eth2 up
$ vagrant ssh -- ip link show eth2
4: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:7d:8a:2a brd ff:ff:ff:ff:ff:ff
Signed-off-by: Jonathan Toppins [email protected]