mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge branch 'master' of github.com:vagrant-libvirt/vagrant-libvirt
This commit is contained in:
@@ -67,8 +67,11 @@ module VagrantPlugins
|
||||
Vagrant::Action::Builder.new.tap do |b|
|
||||
b.use ConfigValidate
|
||||
b.use Call, IsRunning do |env, b2|
|
||||
# If the VM is running, then our work here is done, exit
|
||||
next if env[:result]
|
||||
# If the VM is running, run the necessary provisioners
|
||||
if env[:result]
|
||||
b2.use action_provision
|
||||
next
|
||||
end
|
||||
|
||||
b2.use Call, IsSuspended do |env2, b3|
|
||||
# if vm is suspended resume it then exit
|
||||
|
||||
@@ -40,7 +40,8 @@ module VagrantPlugins
|
||||
# working for centos with lvs default disks
|
||||
`virt-sysprep --no-logfile --operations defaults,-ssh-userdir -a #{@tmp_img}`
|
||||
Dir.chdir(@tmp_dir)
|
||||
img_size = `qemu-img info #{@tmp_img} | grep 'virtual size' | awk '{print $3;}' | tr -d 'G'`.chomp
|
||||
info = JSON.parse(`qemu-img info --output=json #{@tmp_img}`)
|
||||
img_size = (Float(info['virtual-size'])/(1024**3)).ceil
|
||||
File.write(@tmp_dir + '/metadata.json', metadata_content(img_size))
|
||||
File.write(@tmp_dir + '/Vagrantfile', vagrantfile_content)
|
||||
assebmle_box(boxname)
|
||||
|
||||
Reference in New Issue
Block a user