vagrant-libvirt 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +170 -17
  3. data/lib/vagrant-libvirt/action/create_domain.rb +30 -9
  4. data/lib/vagrant-libvirt/action/forward_ports.rb +1 -1
  5. data/lib/vagrant-libvirt/action/package_domain.rb +2 -1
  6. data/lib/vagrant-libvirt/action/start_domain.rb +86 -29
  7. data/lib/vagrant-libvirt/action/wait_till_up.rb +7 -27
  8. data/lib/vagrant-libvirt/config.rb +202 -41
  9. data/lib/vagrant-libvirt/driver.rb +46 -31
  10. data/lib/vagrant-libvirt/provider.rb +2 -9
  11. data/lib/vagrant-libvirt/templates/domain.xml.erb +29 -5
  12. data/lib/vagrant-libvirt/version +1 -1
  13. data/lib/vagrant-libvirt/version.rb +57 -9
  14. data/spec/spec_helper.rb +28 -2
  15. data/spec/support/libvirt_context.rb +2 -0
  16. data/spec/support/sharedcontext.rb +4 -0
  17. data/spec/unit/action/create_domain_spec.rb +110 -35
  18. data/spec/unit/action/create_domain_spec/{default_storage_pool.xml → default_system_storage_pool.xml} +0 -0
  19. data/spec/unit/action/create_domain_spec/default_user_storage_pool.xml +17 -0
  20. data/spec/unit/action/start_domain_spec.rb +183 -1
  21. data/spec/unit/action/start_domain_spec/clock_timer_rtc.xml +50 -0
  22. data/spec/unit/action/start_domain_spec/default.xml +2 -2
  23. data/spec/unit/action/start_domain_spec/default_added_tpm_path.xml +48 -0
  24. data/spec/unit/action/start_domain_spec/default_added_tpm_version.xml +48 -0
  25. data/spec/unit/action/wait_till_up_spec.rb +14 -9
  26. data/spec/unit/config_spec.rb +392 -127
  27. data/spec/unit/provider_spec.rb +11 -0
  28. data/spec/unit/templates/domain_all_settings.xml +6 -3
  29. data/spec/unit/templates/domain_custom_cpu_model.xml +2 -1
  30. data/spec/unit/templates/domain_defaults.xml +2 -1
  31. data/spec/unit/templates/domain_spec.rb +80 -2
  32. data/spec/unit/templates/tpm/version_1.2.xml +54 -0
  33. data/spec/unit/templates/tpm/version_2.0.xml +53 -0
  34. metadata +74 -17
@@ -60,12 +60,12 @@ module VagrantPlugins
60
60
  @@system_connection
61
61
  end
62
62
 
63
- def get_domain(mid)
63
+ def get_domain(machine)
64
64
  begin
65
- domain = connection.servers.get(mid)
65
+ domain = connection.servers.get(machine.id)
66
66
  rescue Libvirt::RetrieveError => e
67
67
  if e.libvirt_code == ProviderLibvirt::Util::ErrorCodes::VIR_ERR_NO_DOMAIN
68
- @logger.debug("machine #{mid} not found #{e}.")
68
+ @logger.debug("machine #{machine.name} domain not found #{e}.")
69
69
  return nil
70
70
  else
71
71
  raise e
@@ -75,34 +75,31 @@ module VagrantPlugins
75
75
  domain
76
76
  end
77
77
 
78
- def created?(mid)
79
- domain = get_domain(mid)
78
+ def created?(machine)
79
+ domain = get_domain(machine)
80
80
  !domain.nil?
81
81
  end
82
82
 
83
83
  def get_ipaddress(machine)
84
84
  # Find the machine
85
- domain = get_domain(machine.id)
86
- if @machine.provider_config.qemu_use_session
87
- return get_ipaddress_system domain.mac
88
- end
85
+ domain = get_domain(machine)
89
86
 
90
87
  if domain.nil?
91
88
  # The machine can't be found
92
89
  return nil
93
90
  end
94
91
 
92
+ get_domain_ipaddress(machine, domain)
93
+ end
94
+
95
+ def get_domain_ipaddress(machine, domain)
96
+ if @machine.provider_config.qemu_use_session
97
+ return get_ipaddress_from_system domain.mac
98
+ end
99
+
95
100
  # Get IP address from arp table
96
- ip_address = nil
97
101
  begin
98
- domain.wait_for(2) do
99
- addresses.each_pair do |_type, ip|
100
- # Multiple leases are separated with a newline, return only
101
- # the most recent address
102
- ip_address = ip[0].split("\n").first unless ip[0].nil?
103
- end
104
- !ip_address.nil?
105
- end
102
+ ip_address = get_ipaddress_from_domain(domain)
106
103
  rescue Fog::Errors::TimeoutError
107
104
  @logger.info('Timeout at waiting for an ip address for machine %s' % machine.name)
108
105
  end
@@ -115,7 +112,24 @@ module VagrantPlugins
115
112
  ip_address
116
113
  end
117
114
 
118
- def get_ipaddress_system(mac)
115
+ def state(machine)
116
+ # may be other error states with initial retreival we can't handle
117
+ begin
118
+ domain = get_domain(machine)
119
+ rescue Libvirt::RetrieveError => e
120
+ @logger.debug("Machine #{machine.id} not found #{e}.")
121
+ return :not_created
122
+ end
123
+
124
+ # TODO: terminated no longer appears to be a valid fog state, remove?
125
+ return :not_created if domain.nil? || domain.state.to_sym == :terminated
126
+
127
+ domain.state.tr('-', '_').to_sym
128
+ end
129
+
130
+ private
131
+
132
+ def get_ipaddress_from_system(mac)
119
133
  ip_address = nil
120
134
 
121
135
  system_connection.list_all_networks.each do |net|
@@ -125,23 +139,24 @@ module VagrantPlugins
125
139
  break if ip_address
126
140
  end
127
141
 
128
- return ip_address
142
+ ip_address
129
143
  end
130
144
 
131
- def state(machine)
132
- # may be other error states with initial retreival we can't handle
133
- begin
134
- domain = get_domain(machine.id)
135
- rescue Libvirt::RetrieveError => e
136
- @logger.debug("Machine #{machine.id} not found #{e}.")
137
- return :not_created
138
- end
145
+ def get_ipaddress_from_domain(domain)
146
+ ip_address = nil
147
+ domain.wait_for(2) do
148
+ addresses.each_pair do |type, ip|
149
+ # Multiple leases are separated with a newline, return only
150
+ # the most recent address
151
+ ip_address = ip[0].split("\n").first if ip[0] != nil
152
+ end
139
153
 
140
- # TODO: terminated no longer appears to be a valid fog state, remove?
141
- return :not_created if domain.nil? || domain.state.to_sym == :terminated
154
+ ip_address != nil
155
+ end
142
156
 
143
- domain.state.tr('-', '_').to_sym
157
+ ip_address
144
158
  end
159
+
145
160
  end
146
161
  end
147
162
  end
@@ -68,14 +68,7 @@ module VagrantPlugins
68
68
  forward_x11: @machine.config.ssh.forward_x11
69
69
  }
70
70
 
71
- if @machine.provider_config.connect_via_ssh
72
- ssh_info[:proxy_command] =
73
- "ssh '#{@machine.provider_config.host}' " \
74
- "-l '#{@machine.provider_config.username}' " \
75
- "-i '#{@machine.provider_config.id_ssh_key_file}' " \
76
- 'nc %h %p'
77
-
78
- end
71
+ ssh_info[:proxy_command] = @machine.provider_config.proxy_command if @machine.provider_config.proxy_command
79
72
 
80
73
  ssh_info
81
74
  end
@@ -98,7 +91,7 @@ module VagrantPlugins
98
91
  state_id = nil
99
92
  state_id = :not_created unless @machine.id
100
93
  state_id = :not_created if
101
- !state_id && (!@machine.id || !driver.created?(@machine.id))
94
+ !state_id && (!@machine.id || !driver.created?(@machine))
102
95
  # Query the driver for the current state of the machine
103
96
  state_id = driver.state(@machine) if @machine.id && !state_id
104
97
  state_id = :unknown unless state_id
@@ -104,14 +104,22 @@
104
104
  </hyperv>
105
105
  <% end %>
106
106
  </features>
107
- <clock offset='utc'/>
107
+ <clock offset='<%= @clock_offset %>'>
108
+ <% @clock_timers.each do |clock_timer| %>
109
+ <timer<% clock_timer.each do |attr, value| %> <%= attr %>='<%= value %>'<% end %>/>
110
+ <% end %>
111
+ </clock>
108
112
  <devices>
109
113
  <% if @emulator_path %>
110
114
  <emulator><%= @emulator_path %></emulator>
111
115
  <% end %>
112
116
  <% if @domain_volume_path %>
113
117
  <disk type='file' device='disk'>
114
- <driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
118
+ <driver name='qemu' type='qcow2' <%=
119
+ @disk_driver_opts.empty? ? "cache='#{@domain_volume_cache}'" :
120
+ @disk_driver_opts.reject { |k,v| v.nil? }
121
+ .map { |k,v| "#{k}='#{v}'"}
122
+ .join(' ') -%>/>
115
123
  <source file='<%= @domain_volume_path %>'/>
116
124
  <%# we need to ensure a unique target dev -%>
117
125
  <target dev='<%= @disk_device %>' bus='<%= @disk_bus %>'/>
@@ -120,7 +128,12 @@
120
128
  <%# additional disks -%>
121
129
  <% @disks.each do |d| -%>
122
130
  <disk type='file' device='disk'>
123
- <driver name='qemu' type='<%= d[:type] %>' cache='<%= d[:cache] %>'/>
131
+ <driver name='qemu' type='<%= d[:type] %>' <%=
132
+ d.select { |k,_| [:cache, :io, :copy_on_read, :discard, :detect_zeroes].include? k }
133
+ .reject { |k,v| v.nil? }
134
+ .map { |k,v| "#{k}='#{v}'"}
135
+ .join(' ')
136
+ -%>/>
124
137
  <source file='<%= d[:absolute_path] %>'/>
125
138
  <target dev='<%= d[:device] %>' bus='<%= d[:bus] %>'/>
126
139
  <% if d[:shareable] %>
@@ -257,11 +270,13 @@
257
270
  <% end %>
258
271
  <% end -%>
259
272
 
260
- <% if @tpm_path -%>
273
+ <% if @tpm_path || @tpm_version -%>
261
274
  <%# TPM Device -%>
262
275
  <tpm model='<%= @tpm_model %>'>
263
- <backend type='<%= @tpm_type %>'>
276
+ <backend type='<%= @tpm_type %>'<% if @tpm_version %> version='<%= @tpm_version %>'<% end %>>
277
+ <% if @tpm_path -%>
264
278
  <device path='<%= @tpm_path %>'/>
279
+ <% end -%>
265
280
  </backend>
266
281
  </tpm>
267
282
  <% end -%>
@@ -269,6 +284,15 @@
269
284
  <%# USB Controller -%>
270
285
  <controller type='usb' model='<%= @usbctl_dev[:model] %>' <%= "ports=\"#{@usbctl_dev[:ports]}\" " if @usbctl_dev[:ports] %>/>
271
286
  <% end %>
287
+ <% unless @memballoon_enabled.nil? %>
288
+ <% if @memballoon_enabled %>
289
+ <memballoon model='<%= @memballoon_model %>'>
290
+ <address type='pci' domain='0x0000' bus='<%= @memballoon_pci_bus %>' slot='<%= @memballoon_pci_slot %>' function='0x0'/>
291
+ </memballoon>
292
+ <% else %>
293
+ <memballoon model='none'/>
294
+ <% end %>
295
+ <% end %>
272
296
  </devices>
273
297
 
274
298
  <% if not @qemu_args.empty? or not @qemu_env.empty? %>
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -1,21 +1,49 @@
1
+ require 'open3'
2
+ require 'tmpdir'
3
+
1
4
  module VagrantPlugins
2
5
  module ProviderLibvirt
3
6
  VERSION_FILE = File.dirname(__FILE__) + "/version"
4
7
 
8
+ GIT_ARCHIVE_VERSION = "$Format:%H %D$"
9
+
10
+ HOMEPAGE = 'https://github.com/vagrant-libvirt/vagrant-libvirt'
11
+
5
12
  def self.get_version
6
13
  if File.exist?(VERSION_FILE)
14
+ # built gem
7
15
  version = File.read(VERSION_FILE)
8
- else
16
+ elsif self.inside_git_repository
17
+ # local repo
9
18
  git_version = `git describe --tags`
10
- version_parts = git_version.split('-').first(2) # drop the git sha if it exists
11
- if version_parts.length > 1
12
- # increment the patch number so that this is marked as a pre-release of the
13
- # next possible release
14
- main_version_parts = Gem::Version.new(version_parts[0]).segments
15
- main_version_parts[-1] = main_version_parts.last + 1
16
- version_parts = main_version_parts + ["pre", version_parts[1]]
19
+ version = self.version_from_describe(git_version)
20
+ elsif !GIT_ARCHIVE_VERSION.start_with?('$Format')
21
+ # archive - format string replaced during export
22
+ hash, refs = GIT_ARCHIVE_VERSION.split(' ', 2)
23
+
24
+ tag = refs.split(',').select { |ref| ref.strip.start_with?("tag:") }.first
25
+ if tag != nil
26
+ # tagged
27
+ version = tag.strip.split(' ').last
28
+ else
29
+ version = ""
30
+ # arbitrary branch/commit
31
+ Dir.mktmpdir do |dir|
32
+ stdout_and_stderr, status = Open3.capture2e("git -C #{dir} clone --bare #{HOMEPAGE}")
33
+ raise "failed to clone original to resolve version: #{stdout_and_stderr}" unless status.success?
34
+
35
+ stdout_and_stderr, status = Open3.capture2e("git --git-dir=#{dir}/vagrant-libvirt.git describe --tags #{hash}")
36
+ raise "failed to determine version for #{hash}: #{stdout_and_stderr}" unless status.success?
37
+
38
+ version = version_from_describe(stdout_and_stderr)
39
+ end
40
+
41
+ # in this case write the version file to avoid cloning a second time
42
+ File.write(VERSION_FILE, version)
17
43
  end
18
- version = version_parts.join(".")
44
+ else
45
+ # no idea
46
+ version = "9999"
19
47
  end
20
48
 
21
49
  return version.freeze
@@ -24,5 +52,25 @@ module VagrantPlugins
24
52
  def self.write_version
25
53
  File.write(VERSION_FILE, self.get_version)
26
54
  end
55
+
56
+ private
57
+
58
+ def self.inside_git_repository
59
+ _, status = Open3.capture2e("git rev-parse --git-dir")
60
+
61
+ status.success?
62
+ end
63
+
64
+ def self.version_from_describe(describe)
65
+ version_parts = describe.split('-').first(2) # drop the git sha if it exists
66
+ if version_parts.length > 1
67
+ # increment the patch number so that this is marked as a pre-release of the
68
+ # next possible release
69
+ main_version_parts = Gem::Version.new(version_parts[0]).segments
70
+ main_version_parts[-1] = main_version_parts.last + 1
71
+ version_parts = main_version_parts + ["pre", version_parts[1]]
72
+ end
73
+ version = version_parts.join(".")
74
+ end
27
75
  end
28
76
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,31 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ require 'simplecov'
2
+ require 'simplecov-lcov'
3
+
4
+ # patch simplecov configuration
5
+ if ! SimpleCov::Configuration.method_defined? :branch_coverage?
6
+ module SimpleCov
7
+ module Configuration
8
+ def branch_coverage?
9
+ return false
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ SimpleCov::Formatter::LcovFormatter.config do |config|
16
+ config.report_with_single_file = true
17
+ config.single_report_path = 'coverage/lcov.info'
18
+ end
19
+
20
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
21
+ [
22
+ SimpleCov::Formatter::HTMLFormatter,
23
+ SimpleCov::Formatter::LcovFormatter,
24
+ ]
25
+ )
26
+ SimpleCov.start do
27
+ add_filter 'spec/'
28
+ end
3
29
 
4
30
  require 'vagrant-libvirt'
5
31
  require 'support/environment_helper'
@@ -7,6 +7,7 @@ shared_context 'libvirt' do
7
7
  let(:id) { 'dummy-vagrant_dummy' }
8
8
  let(:connection) { double('connection') }
9
9
  let(:domain) { double('domain') }
10
+ let(:logger) { double('logger') }
10
11
 
11
12
  def connection_result(options = {})
12
13
  result = options.fetch(:result, nil)
@@ -26,5 +27,6 @@ shared_context 'libvirt' do
26
27
  allow(domain).to receive(:mac).and_return('9C:D5:53:F1:5A:E7')
27
28
 
28
29
  allow(machine).to receive(:id).and_return(id)
30
+ allow(Log4r::Logger).to receive(:new).and_return(logger)
29
31
  end
30
32
  end
@@ -3,10 +3,14 @@ require 'spec_helper'
3
3
  shared_context 'unit' do
4
4
  include_context 'vagrant-unit'
5
5
 
6
+ let(:vagrantfile_providerconfig) { '' }
6
7
  let(:vagrantfile) do
7
8
  <<-EOF
8
9
  Vagrant.configure('2') do |config|
9
10
  config.vm.define :test
11
+ config.vm.provider :libvirt do |libvirt|
12
+ #{vagrantfile_providerconfig}
13
+ end
10
14
  end
11
15
  EOF
12
16
  end
@@ -26,59 +26,134 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomain do
26
26
 
27
27
  allow(connection).to receive(:servers).and_return(servers)
28
28
  allow(connection).to receive(:volumes).and_return(volumes)
29
+
30
+ allow(logger).to receive(:info)
31
+
32
+ env[:domain_name] = "vagrant-test_default"
33
+
34
+ # should be ignored for system session and used for user session
35
+ allow(Process).to receive(:uid).and_return(9999)
36
+ allow(Process).to receive(:gid).and_return(9999)
29
37
  end
30
38
 
31
- context 'default pool' do
32
- let(:test_file) { 'default_storage_pool.xml' }
39
+ context 'connection => qemu:///system' do
40
+ context 'default pool' do
41
+ let(:test_file) { 'default_system_storage_pool.xml' }
33
42
 
34
- it 'should execute correctly' do
35
- expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
36
- expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
37
- expect(servers).to receive(:create).and_return(machine)
43
+ it 'should execute correctly' do
44
+ expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
45
+ expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
46
+ expect(servers).to receive(:create).and_return(machine)
47
+ expect(volumes).to_not receive(:create) # additional disks only
38
48
 
39
- expect(subject.call(env)).to be_nil
40
- end
49
+ expect(subject.call(env)).to be_nil
50
+ end
41
51
 
42
- context 'additional disks' do
43
- let(:vagrantfile) do
44
- <<-EOF
45
- Vagrant.configure('2') do |config|
46
- config.vm.define :test
47
- config.vm.provider :libvirt do |libvirt|
48
- libvirt.storage :file, :size => '20G'
52
+ context 'additional disks' do
53
+ let(:vagrantfile) do
54
+ <<-EOF
55
+ Vagrant.configure('2') do |config|
56
+ config.vm.define :test
57
+ config.vm.provider :libvirt do |libvirt|
58
+ libvirt.storage :file, :size => '20G'
59
+ end
49
60
  end
61
+ EOF
50
62
  end
51
- EOF
52
- end
53
63
 
54
- context 'volume create failed' do
55
- it 'should raise an exception' do
56
- expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
57
- expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
58
- expect(volumes).to receive(:create).and_raise(Libvirt::Error)
64
+ context 'volume create failed' do
65
+ it 'should raise an exception' do
66
+ expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
67
+ expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
68
+ expect(volumes).to receive(:create).and_raise(Libvirt::Error)
59
69
 
60
- expect{ subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::FogCreateDomainVolumeError)
70
+ expect{ subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::FogCreateDomainVolumeError)
71
+ end
72
+ end
73
+
74
+ context 'volume create succeeded' do
75
+ it 'should complete' do
76
+ expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
77
+ expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
78
+ expect(volumes).to receive(:create).with(
79
+ hash_including(
80
+ :path => "/var/lib/libvirt/images/vagrant-test_default-vdb.qcow2",
81
+ :owner => 0,
82
+ :group => 0,
83
+ :pool_name => "default",
84
+ )
85
+ )
86
+ expect(servers).to receive(:create).and_return(machine)
87
+
88
+ expect(subject.call(env)).to be_nil
89
+ end
61
90
  end
62
91
  end
92
+ end
63
93
 
64
- context 'volume create succeeded' do
65
- it 'should complete' do
66
- expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
67
- expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
68
- expect(volumes).to receive(:create)
69
- expect(servers).to receive(:create).and_return(machine)
94
+ context 'no default pool' do
95
+ it 'should raise an exception' do
96
+ expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(nil)
70
97
 
71
- expect(subject.call(env)).to be_nil
72
- end
98
+ expect{ subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::NoStoragePool)
73
99
  end
74
100
  end
75
101
  end
76
102
 
77
- context 'no default pool' do
78
- it 'should raise an exception' do
79
- expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(nil)
103
+ context 'connection => qemu:///session' do
104
+ let(:vagrantfile) do
105
+ <<-EOF
106
+ Vagrant.configure('2') do |config|
107
+ config.vm.define :test
108
+ config.vm.provider :libvirt do |libvirt|
109
+ libvirt.qemu_use_session = true
110
+ end
111
+ end
112
+ EOF
113
+ end
114
+
115
+ context 'default pool' do
116
+ let(:test_file) { 'default_user_storage_pool.xml' }
117
+
118
+ it 'should execute correctly' do
119
+ expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
120
+ expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
121
+ expect(servers).to receive(:create).and_return(machine)
122
+
123
+ expect(subject.call(env)).to be_nil
124
+ end
80
125
 
81
- expect{ subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::NoStoragePool)
126
+ context 'additional disks' do
127
+ let(:vagrantfile) do
128
+ <<-EOF
129
+ Vagrant.configure('2') do |config|
130
+ config.vm.define :test
131
+ config.vm.provider :libvirt do |libvirt|
132
+ libvirt.qemu_use_session = true
133
+ libvirt.storage :file, :size => '20G'
134
+ end
135
+ end
136
+ EOF
137
+ end
138
+
139
+ context 'volume create succeeded' do
140
+ it 'should complete' do
141
+ expect(libvirt_client).to receive(:lookup_storage_pool_by_name).and_return(libvirt_storage_pool)
142
+ expect(libvirt_storage_pool).to receive(:xml_desc).and_return(storage_pool_xml)
143
+ expect(volumes).to receive(:create).with(
144
+ hash_including(
145
+ :path => "/var/lib/libvirt/images/vagrant-test_default-vdb.qcow2",
146
+ :owner => 9999,
147
+ :group => 9999,
148
+ :pool_name => "default",
149
+ )
150
+ )
151
+ expect(servers).to receive(:create).and_return(machine)
152
+
153
+ expect(subject.call(env)).to be_nil
154
+ end
155
+ end
156
+ end
82
157
  end
83
158
  end
84
159
  end