mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
fixes #734 fixed logic for set nic model type
This commit is contained in:
@@ -17,7 +17,7 @@ module VagrantPlugins
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action::create_network_interfaces')
|
||||
@management_network_name = env[:machine].provider_config.management_network_name
|
||||
config = env[:machine].provider_config
|
||||
@nic_model_type = config.nic_model_type
|
||||
@nic_model_type = config.nic_model_type || 'virtio'
|
||||
@nic_adapter_count = config.nic_adapter_count
|
||||
@app = app
|
||||
end
|
||||
@@ -243,7 +243,7 @@ module VagrantPlugins
|
||||
xml.mac(address: mac) if mac
|
||||
xml.target(dev: target_dev_name(device_name, type, iface_number))
|
||||
xml.alias(name: "net#{iface_number}")
|
||||
xml.model(type: model_type)
|
||||
xml.model(type: model_type.to_s)
|
||||
xml.driver(driver_options)
|
||||
end
|
||||
end.to_xml(
|
||||
|
||||
@@ -54,10 +54,12 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
# Iterface type
|
||||
REXML::XPath.each(xml_descr, '/domain/devices/interface/model') do |iface_model|
|
||||
if iface_model.attributes['type'] != config.nic_model_type
|
||||
descr_changed = true
|
||||
iface_model.attributes['type'] = config.nic_model_type
|
||||
unless config.nic_model_type.nil?
|
||||
REXML::XPath.each(xml_descr, '/domain/devices/interface/model') do |iface_model|
|
||||
if iface_model.attributes['type'] != config.nic_model_type
|
||||
descr_changed = true
|
||||
iface_model.attributes['type'] = config.nic_model_type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -225,7 +227,7 @@ module VagrantPlugins
|
||||
if config.sound_type
|
||||
sound = REXML::XPath.first(xml_descr,'/domain/devices/sound/model')
|
||||
end
|
||||
|
||||
|
||||
|
||||
# dtb
|
||||
if config.dtb
|
||||
|
||||
@@ -119,7 +119,7 @@ module VagrantPlugins
|
||||
attr_accessor :rng
|
||||
|
||||
# Watchdog device
|
||||
attr_accessor :watchdog_dev
|
||||
attr_accessor :watchdog_dev
|
||||
|
||||
# USB device passthrough
|
||||
attr_accessor :usbs
|
||||
@@ -214,9 +214,9 @@ module VagrantPlugins
|
||||
|
||||
# Random number device passthrough
|
||||
@rng = UNSET_VALUE
|
||||
|
||||
|
||||
# Watchdog device
|
||||
@watchdog_dev = UNSET_VALUE
|
||||
@watchdog_dev = UNSET_VALUE
|
||||
|
||||
# USB device passthrough
|
||||
@usbs = UNSET_VALUE
|
||||
@@ -359,7 +359,7 @@ module VagrantPlugins
|
||||
slot: options[:slot],
|
||||
function: options[:function])
|
||||
end
|
||||
|
||||
|
||||
def watchdog(options = {})
|
||||
if options[:model].nil?
|
||||
raise 'Model must be specified.'
|
||||
@@ -572,7 +572,7 @@ module VagrantPlugins
|
||||
@machine_virtual_size = nil if @machine_virtual_size == UNSET_VALUE
|
||||
@disk_bus = 'virtio' if @disk_bus == UNSET_VALUE
|
||||
@disk_device = 'vda' if @disk_device == UNSET_VALUE
|
||||
@nic_model_type = 'virtio' if @nic_model_type == UNSET_VALUE
|
||||
@nic_model_type = nil if @nic_model_type == UNSET_VALUE
|
||||
@nested = false if @nested == UNSET_VALUE
|
||||
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
|
||||
@kernel = nil if @kernel == UNSET_VALUE
|
||||
|
||||
Reference in New Issue
Block a user