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'
This commit is contained in:
Maximilian Fischer 2014-03-08 13:06:32 +01:00 committed by Mitchell Hashimoto
parent 96971194bc
commit a7b70dcf70
1 changed files with 11 additions and 1 deletions

View File

@ -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}")