vagrant-mutate 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13ec603ec569b8231d5560dd29c8897ef8b13bee
4
- data.tar.gz: 290f07e0ac8daaeb868447f0b0f157e7e8b81d0c
3
+ metadata.gz: 8d95a6ed26edca3fd9acfc503fac048f3f5e895b
4
+ data.tar.gz: 011568c7558b966ffd0559f5732d1defd027ba8d
5
5
  SHA512:
6
- metadata.gz: 232699da95537caa799db9aac7aa2050475fa64c76cb66d9c1ede25e2666ea71a6bcc5c6707700c5e0e3d5a6f77e58893eb3a1a222abff291f501c5a594f3261
7
- data.tar.gz: 5cef673601437980747e4490887b41f4f10c98e8211cb04e48b6b2ca7000c617425aedf118081c0ebeb61e1eac67c9d707f888754ecb812146c07d579df76d53
6
+ metadata.gz: e1f6285665108a943b5d6c913aa32e4c92b46146869b896f7402d8af3a376e197ff6c027ebb3d0f2f671990658f30a78742076671184b211c761b8004f96ee30
7
+ data.tar.gz: ebb8c38126842b3f19122e201501fe87e32bd57f4f6600c683d1d5be5eb8c143703ac19ca166ae975416046f4fa2695e0358aa63ed5a3d7b34874a03794b71da
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.1.1 (2016-02-24)
2
+ * Add option to force use of virtio for disks (#82)
3
+
1
4
  # 1.0.4 (2016-01-01)
2
5
  * Support spaces in box names (#79)
3
6
 
data/README.md CHANGED
@@ -82,6 +82,8 @@ To export a box you created with vagrant mutate, just repackage it, e.g.
82
82
 
83
83
  vagrant box repackage precise32 libvirt
84
84
 
85
+ If you want to force the output box to use virtio for the disk interface, no matter what interface the input box used, use the *--force-virtio* option.
86
+
85
87
 
86
88
  ## Debugging
87
89
 
@@ -4,23 +4,24 @@ require 'shellwords'
4
4
  module VagrantMutate
5
5
  module Converter
6
6
  class Converter
7
- def self.create(env, input_box, output_box)
8
- case output_box.provider_name
7
+ def self.create(env, input_box, output_box, force_virtio='false')
8
+ case output_box.provider_name
9
9
  when 'kvm'
10
10
  require_relative 'kvm'
11
11
  Kvm.new(env, input_box, output_box)
12
12
  when 'libvirt'
13
13
  require_relative 'libvirt'
14
- Libvirt.new(env, input_box, output_box)
14
+ Libvirt.new(env, input_box, output_box, force_virtio)
15
15
  else
16
16
  fail Errors::ProviderNotSupported, provider: output_box.provider_name, direction: 'output'
17
17
  end
18
18
  end
19
19
 
20
- def initialize(env, input_box, output_box)
20
+ def initialize(env, input_box, output_box, force_virtio='false')
21
21
  @env = env
22
22
  @input_box = input_box
23
23
  @output_box = output_box
24
+ @force_virtio = force_virtio
24
25
  @logger = Log4r::Logger.new('vagrant::mutate')
25
26
  end
26
27
 
@@ -17,7 +17,12 @@ module VagrantMutate
17
17
 
18
18
  uuid = nil
19
19
  gui = true
20
- disk_bus = @input_box.disk_interface
20
+
21
+ if @force_virtio == true
22
+ disk_bus = 'virtio'
23
+ else
24
+ disk_bus = @input_box.disk_interface
25
+ end
21
26
 
22
27
  image_type = @output_box.image_format
23
28
  disk = @output_box.image_name
@@ -1,6 +1,7 @@
1
1
  module VagrantMutate
2
2
  module Converter
3
3
  class Libvirt < Converter
4
+
4
5
  def generate_metadata
5
6
  {
6
7
  'provider' => @output_box.provider_name,
@@ -10,9 +11,16 @@ module VagrantMutate
10
11
  end
11
12
 
12
13
  def generate_vagrantfile
14
+
15
+ if @force_virtio == true
16
+ disk_bus = 'virtio'
17
+ else
18
+ disk_bus = @input_box.disk_interface
19
+ end
20
+
13
21
  <<-EOF
14
22
  config.vm.provider :libvirt do |libvirt|
15
- libvirt.disk_bus = '#{@input_box.disk_interface}'
23
+ libvirt.disk_bus = '#{disk_bus}'
16
24
  end
17
25
  EOF
18
26
  end
@@ -8,6 +8,7 @@ module VagrantMutate
8
8
  options = {}
9
9
  options[:input_provider] = nil
10
10
  options[:version] = nil
11
+ options[:force_virtio] = false
11
12
 
12
13
  opts = OptionParser.new do |o|
13
14
  o.banner = 'Usage: vagrant mutate <box-name-or-file-or-url> <provider>'
@@ -19,6 +20,10 @@ module VagrantMutate
19
20
  'Specify version for input box') do |p|
20
21
  options[:version] = p
21
22
  end
23
+ o.on('--force-virtio',
24
+ 'Force virtio disk driver') do |p|
25
+ options[:force_virtio] = true
26
+ end
22
27
  end
23
28
 
24
29
  argv = parse_options(opts)
@@ -41,7 +46,7 @@ module VagrantMutate
41
46
  output_loader = BoxLoader.new(@env)
42
47
  output_box = output_loader.prepare_for_output(input_box.name, options[:output_provider], input_box.version)
43
48
 
44
- converter = Converter::Converter.create(@env, input_box, output_box)
49
+ converter = Converter::Converter.create(@env, input_box, output_box, options[:force_virtio])
45
50
  converter.convert
46
51
 
47
52
  input_loader.cleanup
@@ -1,3 +1,3 @@
1
1
  module VagrantMutate
2
- VERSION = '1.0.4'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-mutate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pitts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-02 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler