Fixes Fedora 20 network issues when virtual
On Fedora 20 virtual machines biosdevname command 'Returns 4 if running in a virtual machine.' This patch: - Uses the biosdevname command return value to detect if virtual - Uses /sys/net to get interface names - Might be better solution - Leaves unchanged the original 'bare metal' case - I wonder what for though? Tested with Fedora Cloud image adapted for vagrant-libvirt Fixes issue #4104
This commit is contained in:
parent
1615325e46
commit
bd4d4284c4
|
@ -14,7 +14,21 @@ module VagrantPlugins
|
|||
def self.configure_networks(machine, networks)
|
||||
network_scripts_dir = machine.guest.capability("network_scripts_dir")
|
||||
|
||||
virtual = false
|
||||
interface_names = Array.new
|
||||
machine.communicate.sudo("/usr/sbin/biosdevname; echo $?") do |_, result|
|
||||
virtual = true if result.chomp == '4'
|
||||
end
|
||||
|
||||
if virtual
|
||||
machine.communicate.sudo("ls /sys/class/net | grep -v lo") do |_, result|
|
||||
interface_names = result.split("\n")
|
||||
end
|
||||
|
||||
interface_names = networks.map do |network|
|
||||
"eth#{network[:interface]}"
|
||||
end
|
||||
else
|
||||
machine.communicate.sudo("/usr/sbin/biosdevname -d | grep Kernel | cut -f2 -d: | sed -e 's/ //;'") do |_, result|
|
||||
interface_names = result.split("\n")
|
||||
end
|
||||
|
@ -35,6 +49,7 @@ module VagrantPlugins
|
|||
interface_names.delete(interface_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Accumulate the configurations to add to the interfaces file as well
|
||||
# as what interfaces we're actually configuring since we use that later.
|
||||
|
|
Loading…
Reference in New Issue