Fix Broken /etc/machine-id by vagrant package due to virt-sysprep's customize operation (#1184)

virt-sysprep by default enable the `customize` operation, which will 
regenerate the `/etc/machine-id` by the end of the operation. This 
cause all newly created VMs by `vagrant up` coming with idential 
`/etc/machine-id` and so receive conflicted IP from DHCP.

This PR disable `customize` as per 
https://github.com/vagrant-libvirt/vagrant-libvirt/issues/851#issuecomment-520799720
recommendation.

Fixes #851
This commit is contained in:
Wong Hoi Sing Edison
2020-12-16 20:45:07 +08:00
committed by GitHub
parent f53a5d8175
commit 395ab7141e

View File

@@ -50,7 +50,7 @@ module VagrantPlugins
# remove hw association with interface
# working for centos with lvs default disks
options = ENV.fetch('VAGRANT_LIBVIRT_VIRT_SYSPREP_OPTIONS', '')
operations = ENV.fetch('VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS', 'defaults,-ssh-userdir')
operations = ENV.fetch('VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS', 'defaults,-ssh-userdir,-customize')
`virt-sysprep --no-logfile --operations #{operations} -a #{@tmp_img} #{options}`
# add any user provided file
extra = ''