From 4de1560027653b5f331a5838d41805974a35146d Mon Sep 17 00:00:00 2001 From: dima Date: Sun, 17 May 2015 19:47:07 +0200 Subject: [PATCH] improve package process --- README.md | 10 +++++----- lib/vagrant-libvirt/action/package_domain.rb | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a893324..a3dbded 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ welcome and can help a lot :-) ## Features * Control local Libvirt hypervisors. -* Vagrant `up`, `destroy`, `suspend`, `resume`, `halt`, `ssh`, `reload` and `provision` commands. +* Vagrant `up`, `destroy`, `suspend`, `resume`, `halt`, `ssh`, `reload`, `package` and `provision` commands. * Upload box image (qcow2 format) to Libvirt storage pool. * Create volume as COW diff image for domains. * Create private networks. @@ -51,7 +51,7 @@ $ sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev In RedHat, Centos, Fedora, ... ``` -# yum install libxslt-devel libxml2-devel libvirt-devel +# yum install libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c ``` If have problem with installation - check your linker. It should be ld.gold: @@ -375,9 +375,9 @@ You can change the synced folder type for */vagrant* by explicity configuring it an setting the type, e.g. config.vm.synced_folder './', '/vagrant', type: 'rsync' - - or - + + or + config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "vagrant" ## Customized Graphics diff --git a/lib/vagrant-libvirt/action/package_domain.rb b/lib/vagrant-libvirt/action/package_domain.rb index 5b89bf9..c9ce42a 100644 --- a/lib/vagrant-libvirt/action/package_domain.rb +++ b/lib/vagrant-libvirt/action/package_domain.rb @@ -35,6 +35,9 @@ module VagrantPlugins 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} ` 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))