From dba31833a4f4ab1001eb68342ffa898252e704f4 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Wed, 26 May 2021 07:59:47 +0100 Subject: [PATCH] add support for boot 'network' from a vagrant public_network when use a public_network in vagrant, this is how libvirt domain xml looks like (notice that the interface type is 'direct'):
--- lib/vagrant-libvirt/action/set_boot_order.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-libvirt/action/set_boot_order.rb b/lib/vagrant-libvirt/action/set_boot_order.rb index c5997f9..7da5d87 100644 --- a/lib/vagrant-libvirt/action/set_boot_order.rb +++ b/lib/vagrant-libvirt/action/set_boot_order.rb @@ -86,9 +86,13 @@ module VagrantPlugins def search_network(nets, xml) str = '/domain/devices/interface' - str += "[(@type='network' or @type='udp' or @type='bridge')" + str += "[(@type='network' or @type='udp' or @type='bridge' or @type='direct')" unless nets.empty? - str += " and source[@network='#{nets.first['network']}']" + net = nets.first + network = net['network'] + dev = net['dev'] + str += " and source[@network='#{network}']" if network + str += " and source[@dev='#{dev}']" if dev end str += ']' @logger.debug(str)