From e715856f5228ab8199f4a0bd08253137411c0b99 Mon Sep 17 00:00:00 2001 From: Martin André Date: Tue, 9 Feb 2016 12:09:33 +0900 Subject: Fetching IP addresses for vagrant-hostmanager from libvirt To fetch the IP address from the interface other than eth0 for vagrant-hostmanager plugin, it must be fetched from the DHCP leases from libvirt network. The previously used one-liner, which was using virsh with awk, returns multiple addresses when VM was destroyed before expiration of its DHCP lease. This script solved this problem by getting only the newest DHCP lease and gives a possibility to destroy Vagrant environment and set up again without worrying about hosts resolving. Co-Authored-By: Michal Rostecki Partially-Implements: blueprint vagrant Related-Id: Ic469b46f4d02d873c27114cbd268b86521eef32b Related-Id: I81f07b7e4a202af68fd3cf9fdb308c3734c40a83 Change-Id: I408415e95483c1b8988d0f67c654212de63bece2 --- dev/vagrant/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dev/vagrant/Vagrantfile') diff --git a/dev/vagrant/Vagrantfile b/dev/vagrant/Vagrantfile index aa1d2b342..a7e46533e 100644 --- a/dev/vagrant/Vagrantfile +++ b/dev/vagrant/Vagrantfile @@ -141,7 +141,7 @@ Vagrant.configure(2) do |config| case PROVIDER when "libvirt" if vm.name - `virsh -c qemu:///system net-dhcp-leases vagrant-private-dhcp | awk -F'[ /]+' '/#{vm.name} / {print $6}'`.chop + `python newest_dhcp_lease.py #{vm.name}`.chop end when "virtualbox_ubuntu" when "virtualbox_centos" -- cgit v1.2.3