mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Allow setting of Sysprep options and multiple hyperv features (#1089)
Allow setting of multiple hyperv features and support for virt-sysprep options Fixes #1039 and #1077
This commit is contained in:
parent
5658a83723
commit
d39a9a302a
@ -1458,6 +1458,14 @@ documentation](http://libguestfs.org/virt-sysprep.1.html#operations) for
|
||||
further details especially on default sysprep operations enabled for
|
||||
your system.
|
||||
|
||||
Options to the virt-sysprep command call can be passed via
|
||||
`VAGRANT_LIBVIRT_VIRT_SYSPREP_OPTIONS` environment variable.
|
||||
|
||||
```shell
|
||||
$ export VAGRANT_LIBVIRT_VIRT_SYSPREP_OPTIONS="--delete /etc/hostname"
|
||||
$ vagrant package
|
||||
```
|
||||
|
||||
For example, on Chef [bento](https://github.com/chef/bento) VMs that
|
||||
require SSH hostkeys already set (e.g. bento/debian-7) as well as leave
|
||||
existing LVM UUIDs untouched (e.g. bento/ubuntu-18.04), these can be
|
||||
|
@ -38,8 +38,9 @@ module VagrantPlugins
|
||||
`qemu-img rebase -p -b "" #{@tmp_img}`
|
||||
# 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')
|
||||
`virt-sysprep --no-logfile --operations #{operations} -a #{@tmp_img}`
|
||||
`virt-sysprep --no-logfile --operations #{operations} -a #{@tmp_img} #{options}`
|
||||
# add any user provided file
|
||||
extra = ''
|
||||
@tmp_include = @tmp_dir + '/_include'
|
||||
|
@ -355,7 +355,10 @@ module VagrantPlugins
|
||||
raise 'Feature name AND state must be specified'
|
||||
end
|
||||
|
||||
@features_hyperv = [{name: options[:name], state: options[:state]}] if @features_hyperv == UNSET_VALUE
|
||||
@features_hyperv = [] if @features_hyperv == UNSET_VALUE
|
||||
|
||||
@features_hyperv.push(name: options[:name],
|
||||
state: options[:state])
|
||||
end
|
||||
|
||||
def cputopology(options = {})
|
||||
|
Loading…
Reference in New Issue
Block a user