Hello, good morning,
i am a vagrant noob, i am currently just starting my first project and ran into some problems (maybe misunderstandings only).
I did build a workflow to create and provision vms to do testing and itegration on. Idea was to use Suse kiwi to build customized boxes (works nicely now after a lot of tweaking) and then run vms based on those boxes. I use kvm together with the vagrant-libvirt plugin, provisoning is done via salt and vargant salt plugin.
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "leap421"
config.vm.hostname = "mail"
config.vm.synced_folder "/srv/data/salt/", "/srv/salt/"
config.vm.provision :salt do |salt|
salt.run_highstate = true
salt.masterless = true
salt.verbose = true
salt.bootstrap_script = "/bin/true"
end
config.vm.network :public_network, dev: "eth0", mode: "bridge", ip: "11.12.13.14", netmask: "255.255.255.240", libvirt__dhcp_enabled: false, auto_config: false
# config.vm.network :private_network, :bridge => "virbr2", libvirt__dhcp_enabled: false, auto_config: false
end
Biggest poblem (showstopper): If i do interrupt vagrant up (via control-c for example) vagrant does cleanup itself:
Bringing machine 'default' up with 'libvirt' provider...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
^C==> default: Waiting for cleanup before exiting...
==> default: Removing domain...
==> default: Running cleanup tasks for 'salt' provisioner...
Vagrant exited after cleanup due to external interrupt.
and COMPLETELY removes the domain (including img file in libvirt) ...
Is this intended behaviour? Is there a way to turn the cleanup off ... ?
I found about the cleanup behaviour because of two minor problems :
1. DHCP seems not to work all the time. Usually a vm does not get an IP address assigned at the first time. It waits for an IP indefinitely until i do a CtrlC. Next time the IP gets assigned. A tcpdump doesn't show outgoing DHCPREQUESTS.
2. After a vagrant halt and a subsequent vagrant up the domain immediately jumps into waiting for SSH indefinately. Pressing ctrl-c and vagrant up makes the vm get an ip. Cost of the ctrl-c and maybe the reason it works then is that the domain is created anew.
The dhcp problems could be a problem with the image itself not starting dhcp correctly. I am currently investigating. But its difficult while loosing the domain with most of the tests.
Help is very much appreciated.
Peter