Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interfaces: allow user to specify an interface name #498

Merged
merged 1 commit into from
Nov 3, 2015

Conversation

jtoppins
Copy link

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:https:///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:https:///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:https:///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]

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:https:///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:https:///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:https:///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]>
pronix added a commit that referenced this pull request Nov 3, 2015
interfaces: allow user to specify an interface name
@pronix pronix merged commit 883db81 into vagrant-libvirt:master Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants