Merge pull request #1294 from rgl/rgl-add-public-network-boot

add support for boot 'network' from a vagrant public_network
This commit is contained in:
Darragh Bailey
2021-05-27 10:42:44 +01:00
committed by GitHub
2 changed files with 24 additions and 2 deletions

View File

@@ -1389,6 +1389,24 @@ Name of network "foreman_managed" is key for define boot order
end
```
An example VM that is PXE booted from the `br1` device (which must already be configured in the host machine), and if that fails, is booted from the disk:
```ruby
Vagrant.configure("2") do |config|
config.vm.define :pxeclient do |pxeclient|
pxeclient.vm.network :public_network,
dev: 'br1',
auto_config: false
pxeclient.vm.provider :libvirt do |domain|
boot_network = {'dev' => 'br1'}
domain.storage :file, :size => '100G'
domain.boot boot_network
domain.boot 'hd'
end
end
end
```
## SSH Access To VM
vagrant-libvirt supports vagrant's [standard ssh

View File

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