lib/vagrant-libvirt/action/package_domain.rb in vagrant-libvirt-0.0.30 vs lib/vagrant-libvirt/action/package_domain.rb in vagrant-libvirt-0.0.31

- old
+ new

@@ -12,13 +12,13 @@ env['package.output'] ||= 'package.box' end def call(env) env[:ui].info(I18n.t('vagrant_libvirt.package_domain')) - libvirt_domain = env[:libvirt_compute].client.lookup_domain_by_uuid( + libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid( env[:machine].id) - domain = env[:libvirt_compute].servers.get(env[:machine].id.to_s) + domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s) root_disk = domain.volumes.select do |x| x.name == libvirt_domain.name + '.img' end.first boxname = env['package.output'] raise "#{boxname}: Already exists" if File.exists?(boxname) @@ -35,10 +35,10 @@ env[:ui].info('Image has backing image, copying image and rebasing ...') FileUtils.cp(root_disk.path, @tmp_img) `qemu-img rebase -p -b "" #{@tmp_img}` # remove hw association with interface # working for centos with lvs default disks - `virt-sysprep --no-logfile -a #{@tmp_img} ` + `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 File.write(@tmp_dir + '/metadata.json', metadata_content(img_size)) File.write(@tmp_dir + '/Vagrantfile',vagrantfile_content) assebmle_box(boxname)