From a7b70dcf70b9a537b0002abdcd08a3a776547739 Mon Sep 17 00:00:00 2001 From: Maximilian Fischer Date: Sat, 8 Mar 2014 13:06:32 +0100 Subject: [PATCH] OpenBSD support for virtio interfaces - When using KVM as provider you were not able to configure network interfaces that use virtio, because the interface name was strictly set to 'em' --- plugins/guests/openbsd/cap/configure_networks.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/guests/openbsd/cap/configure_networks.rb b/plugins/guests/openbsd/cap/configure_networks.rb index 820627a80..a5778ebfd 100644 --- a/plugins/guests/openbsd/cap/configure_networks.rb +++ b/plugins/guests/openbsd/cap/configure_networks.rb @@ -18,8 +18,18 @@ module VagrantPlugins temp.write(entry) temp.close - ifname = "em#{network[:interface]}" + command = "ifconfig -a | grep -o ^[0-9a-z]*" + result = "" + ifname = "" + machine.communicate.execute(command) do |type, data| + result << data if type == :stdout + if result.split(/\n/).any?{|i| i.match(/vio*/)} + ifname = "vio#{network[:interface]}" + else + ifname = "em#{network[:interface]}" + end + end machine.communicate.upload(temp.path, "/tmp/vagrant-network-entry") machine.communicate.sudo("mv /tmp/vagrant-network-entry /etc/hostname.#{ifname}")