vagrant-libvirt 0.10.6 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,9 @@ require 'digest/md5'
7
7
 
8
8
  require 'vagrant/util/subprocess'
9
9
  require 'vagrant/errors'
10
+
10
11
  require 'vagrant-libvirt/errors'
12
+ require 'vagrant-libvirt/util/erb_template'
11
13
 
12
14
  module VagrantPlugins
13
15
  module SyncedFolder9P
@@ -5,9 +5,11 @@ require 'ostruct'
5
5
  require 'nokogiri'
6
6
  require 'digest/md5'
7
7
 
8
- require 'vagrant/util/subprocess'
9
8
  require 'vagrant/errors'
9
+ require 'vagrant/util/subprocess'
10
+
10
11
  require 'vagrant-libvirt/errors'
12
+ require 'vagrant-libvirt/util/erb_template'
11
13
 
12
14
  module VagrantPlugins
13
15
  module SyncedFolderVirtioFS
@@ -896,8 +896,7 @@ module VagrantPlugins
896
896
  @initrd = '' if @initrd == UNSET_VALUE
897
897
  @dtb = nil if @dtb == UNSET_VALUE
898
898
  @graphics_type = 'vnc' if @graphics_type == UNSET_VALUE
899
- @graphics_autoport = 'yes' if @graphics_port == UNSET_VALUE
900
- @graphics_autoport = 'no' if @graphics_port != UNSET_VALUE
899
+ @graphics_autoport = @graphics_port == UNSET_VALUE ? 'yes' : nil
901
900
  if (@graphics_type != 'vnc' && @graphics_type != 'spice') ||
902
901
  @graphics_passwd == UNSET_VALUE
903
902
  @graphics_passwd = nil
@@ -234,12 +234,12 @@ module VagrantPlugins
234
234
  @logger.debug(response)
235
235
  addresses = JSON.parse(response)
236
236
  rescue StandardError => e
237
- puts "Unable to receive IP via qemu agent: [#{e.message}]"
238
237
  @logger.debug("Unable to receive IP via qemu agent: [#{e.message}]")
239
238
  end
240
239
 
241
240
  unless addresses.nil?
242
241
  addresses['return'].each do |interface|
242
+ next unless interface.key?('hardware-address')
243
243
  next unless domain.mac.downcase == interface['hardware-address'].downcase
244
244
 
245
245
  @logger.debug("Found matching interface: [#{interface['name']}]")
@@ -178,6 +178,10 @@ module VagrantPlugins
178
178
  error_key(:no_domain_error)
179
179
  end
180
180
 
181
+ class DomainStartError < VagrantLibvirtError
182
+ error_key(:domain_start_error)
183
+ end
184
+
181
185
  class AttachDeviceError < VagrantLibvirtError
182
186
  error_key(:attach_device_error)
183
187
  end
@@ -11,7 +11,7 @@ module VagrantPlugins
11
11
  module Compat
12
12
  def self.action_hook_args(name, action)
13
13
  # handle different number of arguments for action_hook depending on vagrant version
14
- if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('2.2.11')
14
+ if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('2.2.10')
15
15
  return name, action
16
16
  end
17
17
 
@@ -120,7 +120,7 @@ module VagrantPlugins
120
120
  logger.debug "In config found network type #{type} options #{original_options}"
121
121
  # Options can be specified in Vagrantfile in short format (:ip => ...),
122
122
  # or provider format # (:libvirt__network_name => ...).
123
- # https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/util/scoped_hash_override.rb
123
+ # https://github.com/mitchellh/vagrant/blob/main/lib/vagrant/util/scoped_hash_override.rb
124
124
  options = scoped_hash_override(original_options, :libvirt)
125
125
  # store type in options
126
126
  # use default values if not already set
@@ -1 +1 @@
1
- 0.10.6
1
+ 0.10.8
data/locales/en.yml CHANGED
@@ -153,6 +153,8 @@ en:
153
153
  Error while downloading volume '%{volume_name}' from storage pool '%{pool_name}': %{error_message}
154
154
  no_domain_error: |-
155
155
  No domain found. %{error_message}
156
+ domain_start_error: |-
157
+ Failed to start domain: %{error_message}
156
158
  attach_device_error: |-
157
159
  Error while attaching new device to domain. %{error_message}
158
160
  detach_device_error: |-
data/spec/spec_helper.rb CHANGED
@@ -38,13 +38,14 @@ rescue LoadError
38
38
  end
39
39
  end
40
40
 
41
+ RSpec.configure do |config|
42
+ require 'tmpdir'
41
43
 
42
- require 'vagrant-libvirt'
43
- require 'vagrant-spec/unit'
44
-
45
- Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
44
+ # set VAGRANT_HOME before any thing that requires vagrant is loaded to prevent
45
+ # the global plugin manager from trying to use the default VAGRANT_HOME.
46
+ temp_dir = Dir.mktmpdir("rspec-")
47
+ ENV['VAGRANT_HOME'] = temp_dir
46
48
 
47
- RSpec.configure do |config|
48
49
  # ensure that setting of LIBVIRT_DEFAULT_URI in the environment is not picked
49
50
  # up directly by tests, instead they must set as needed. Some build envs will
50
51
  # may have it set to 'qemu:///session'.
@@ -52,10 +53,22 @@ RSpec.configure do |config|
52
53
  ENV.delete('LIBVIRT_DEFAULT_URI')
53
54
  end
54
55
 
56
+ config.after(:suite) do
57
+ FileUtils.remove_entry temp_dir
58
+ end
59
+
55
60
  config.mock_with :rspec do |mocks|
56
61
  mocks.verify_partial_doubles = true
57
62
  end
58
63
 
59
64
  # don't run acceptance tests by default
60
65
  config.filter_run_excluding :acceptance => true
66
+
67
+ config.expect_with :rspec do |c|
68
+ c.max_formatted_output_length = 2000 if c.respond_to?("max_formatted_output_length=")
69
+ end
61
70
  end
71
+
72
+ require 'vagrant-spec/unit'
73
+
74
+ Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
@@ -0,0 +1,76 @@
1
+ <domain type="qemu">
2
+ <name>vagrant-libvirt_default</name>
3
+ <uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
4
+ <description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
5
+ <memory unit="KiB">2097152</memory>
6
+ <currentMemory unit="KiB">2097152</currentMemory>
7
+ <vcpu placement="static">2</vcpu>
8
+ <os>
9
+ <type arch="x86_64" machine="pc-i440fx-6.0">hvm</type>
10
+ <boot dev="hd"/>
11
+ </os>
12
+ <features>
13
+ <acpi/>
14
+ <apic/>
15
+ <pae/>
16
+ </features>
17
+ <cpu mode="host-model" check="partial"/>
18
+ <clock offset="utc"/>
19
+ <on_poweroff>destroy</on_poweroff>
20
+ <on_reboot>restart</on_reboot>
21
+ <on_crash>destroy</on_crash>
22
+ <devices>
23
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
24
+ <disk type="file" device="disk">
25
+ <driver name="qemu" type="qcow2"/>
26
+ <source file="/var/lib/libvirt/images/vagrant-libvirt_default.img"/>
27
+ <target dev="vda" bus="virtio"/>
28
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
29
+ </disk>
30
+ <disk type="file" device="cdrom">
31
+ <driver name="qemu" type="raw"/>
32
+ <source file=""/>
33
+ <target dev="hda" bus="ide"/>
34
+ <readonly/>
35
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
36
+ </disk>
37
+ <disk type="file" device="cdrom">
38
+ <driver name="qemu" type="raw"/>
39
+ <source file=""/>
40
+ <target dev="hdb" bus="ide"/>
41
+ <readonly/>
42
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
43
+ </disk>
44
+ <controller type="usb" index="0" model="piix3-uhci">
45
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x2"/>
46
+ </controller>
47
+ <controller type="pci" index="0" model="pci-root"/>
48
+ <interface type="network">
49
+ <mac address="52:54:00:7d:14:0e"/>
50
+ <source network="vagrant-libvirt"/>
51
+ <model type="virtio"/>
52
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
53
+ </interface>
54
+ <serial type="pty">
55
+ <target type="isa-serial" port="0">
56
+ <model name="isa-serial"/>
57
+ </target>
58
+ </serial>
59
+ <console type="pty">
60
+ <target type="serial" port="0"/>
61
+ </console>
62
+ <input type="mouse" bus="ps2"/>
63
+ <input type="keyboard" bus="ps2"/>
64
+ <graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1" keymap="en-us">
65
+ <listen type="address" address="127.0.0.1"/>
66
+ </graphics>
67
+ <audio id="1" type="none"/>
68
+ <video>
69
+ <model type="cirrus" vram="16384" heads="1" primary="yes"/>
70
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
71
+ </video>
72
+ <memballoon model="virtio">
73
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
74
+ </memballoon>
75
+ </devices>
76
+ </domain>
@@ -0,0 +1,77 @@
1
+ <?xml version="1.0"?>
2
+ <domain type="qemu">
3
+ <name>vagrant-libvirt_default</name>
4
+ <uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
5
+ <description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
6
+ <memory unit="KiB">2097152</memory>
7
+ <currentMemory unit="KiB">2097152</currentMemory>
8
+ <vcpu placement="static">2</vcpu>
9
+ <os>
10
+ <type arch="x86_64" machine="pc-i440fx-6.0">hvm</type>
11
+
12
+ </os>
13
+ <features>
14
+ <acpi/>
15
+ <apic/>
16
+ <pae/>
17
+ </features>
18
+ <cpu mode="host-model" check="partial"/>
19
+ <clock offset="utc"/>
20
+ <on_poweroff>destroy</on_poweroff>
21
+ <on_reboot>restart</on_reboot>
22
+ <on_crash>destroy</on_crash>
23
+ <devices>
24
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
25
+ <disk type="file" device="disk">
26
+ <driver name="qemu" type="qcow2"/>
27
+ <source file="/var/lib/libvirt/images/vagrant-libvirt_default.img"/>
28
+ <target dev="vda" bus="virtio"/>
29
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
30
+ <boot order="1"/></disk>
31
+ <disk type="file" device="cdrom">
32
+ <driver name="qemu" type="raw"/>
33
+ <source file=""/>
34
+ <target dev="hda" bus="ide"/>
35
+ <readonly/>
36
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
37
+ <boot order="2"/></disk>
38
+ <disk type="file" device="cdrom">
39
+ <driver name="qemu" type="raw"/>
40
+ <source file=""/>
41
+ <target dev="hdb" bus="ide"/>
42
+ <readonly/>
43
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
44
+ <boot order="3"/></disk>
45
+ <controller type="usb" index="0" model="piix3-uhci">
46
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x2"/>
47
+ </controller>
48
+ <controller type="pci" index="0" model="pci-root"/>
49
+ <interface type="network">
50
+ <mac address="52:54:00:7d:14:0e"/>
51
+ <source network="vagrant-libvirt"/>
52
+ <model type="virtio"/>
53
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
54
+ <boot order="4"/></interface>
55
+ <serial type="pty">
56
+ <target type="isa-serial" port="0">
57
+ <model name="isa-serial"/>
58
+ </target>
59
+ </serial>
60
+ <console type="pty">
61
+ <target type="serial" port="0"/>
62
+ </console>
63
+ <input type="mouse" bus="ps2"/>
64
+ <input type="keyboard" bus="ps2"/>
65
+ <graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1" keymap="en-us">
66
+ <listen type="address" address="127.0.0.1"/>
67
+ </graphics>
68
+ <audio id="1" type="none"/>
69
+ <video>
70
+ <model type="cirrus" vram="16384" heads="1" primary="yes"/>
71
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
72
+ </video>
73
+ <memballoon model="virtio">
74
+ <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
75
+ </memballoon>
76
+ </devices>
77
+ </domain>
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'support/sharedcontext'
5
+ require 'support/libvirt_context'
6
+
7
+ require 'vagrant-libvirt/action/set_boot_order'
8
+
9
+ describe VagrantPlugins::ProviderLibvirt::Action::SetBootOrder do
10
+ subject { described_class.new(app, env) }
11
+
12
+ include_context 'unit'
13
+ include_context 'libvirt'
14
+
15
+ #before do
16
+ # allow(driver).to receive(:created?).and_return(true)
17
+ #end
18
+
19
+ describe '#call' do
20
+ it 'should return early' do
21
+ expect(connection).to_not receive(:client)
22
+
23
+ expect(subject.call(env)).to be_nil
24
+ end
25
+
26
+ context 'with boot_order defined' do
27
+ let(:domain_xml) { File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), test_file)) }
28
+ let(:updated_domain_xml) { File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), updated_test_file)) }
29
+ let(:test_file) { 'default.xml' }
30
+ let(:updated_test_file) { 'explicit_boot_order.xml' }
31
+ let(:vagrantfile_providerconfig) do
32
+ <<-EOF
33
+ libvirt.boot "hd"
34
+ libvirt.boot "cdrom"
35
+ libvirt.boot "network" => 'vagrant-libvirt'
36
+ EOF
37
+ end
38
+
39
+ before do
40
+ allow(connection).to receive(:client).and_return(libvirt_client)
41
+ allow(libvirt_client).to receive(:lookup_domain_by_uuid).and_return(libvirt_domain)
42
+ allow(libvirt_domain).to receive(:xml_desc).and_return(domain_xml)
43
+ allow(logger).to receive(:debug)
44
+ end
45
+
46
+ it 'should configure the boot order' do
47
+ expect(libvirt_client).to receive(:define_domain_xml).with(updated_domain_xml)
48
+ expect(subject.call(env)).to be_nil
49
+ end
50
+
51
+ context 'with multiple networks in bootorder' do
52
+ let(:vagrantfile_providerconfig) do
53
+ <<-EOF
54
+ libvirt.boot "hd"
55
+ libvirt.boot "cdrom"
56
+ libvirt.boot "network" => 'vagrant-libvirt'
57
+ libvirt.boot "network" => 'vagrant-libvirt'
58
+ EOF
59
+ end
60
+
61
+ it 'should raise an exception' do
62
+ expect { subject.call(env) }.to raise_error('Defined only for 1 network for boot')
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,62 @@
1
+ <domain type='qemu'>
2
+ <name>vagrant-libvirt_default</name>
3
+ <uuid>881a931b-0110-4d10-81aa-47a1a19f5726</uuid>
4
+ <description>Source: /home/test/vagrant-libvirt/Vagrantfile</description>
5
+ <memory unit='KiB'>2097152</memory>
6
+ <currentMemory unit='KiB'>2097152</currentMemory>
7
+ <vcpu placement='static'>2</vcpu>
8
+ <os>
9
+ <type arch='x86_64' machine='pc-i440fx-6.0'>hvm</type>
10
+ <boot dev='hd'/>
11
+ </os>
12
+ <features>
13
+ <acpi/>
14
+ <apic/>
15
+ <pae/>
16
+ </features>
17
+ <cpu check='partial' mode='host-passthrough'/>
18
+ <clock offset='utc'/>
19
+ <on_poweroff>destroy</on_poweroff>
20
+ <on_reboot>restart</on_reboot>
21
+ <on_crash>destroy</on_crash>
22
+ <devices>
23
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
24
+ <disk device='disk' type='file'>
25
+ <driver name='qemu' type='qcow2'/>
26
+ <source file='/var/lib/libvirt/images/vagrant-libvirt_default.img'/>
27
+ <target bus='virtio' dev='vda'/>
28
+ <address bus='0x00' domain='0x0000' function='0x0' slot='0x03' type='pci'/>
29
+ </disk>
30
+ <controller index='0' model='pci-root' type='pci'/>
31
+ <controller index='0' model='piix3-uhci' type='usb'>
32
+ <address bus='0x00' domain='0x0000' function='0x2' slot='0x01' type='pci'/>
33
+ </controller>
34
+ <interface type='network'>
35
+ <mac address='52:54:00:7d:14:0e'/>
36
+ <source network='vagrant-libvirt'/>
37
+ <model type='virtio'/>
38
+ <address bus='0x00' domain='0x0000' function='0x0' slot='0x05' type='pci'/>
39
+ </interface>
40
+ <serial type='pty'>
41
+ <target port='0' type='isa-serial'>
42
+ <model name='isa-serial'/>
43
+ </target>
44
+ </serial>
45
+ <console type='pty'>
46
+ <target port='0' type='serial'/>
47
+ </console>
48
+ <input bus='ps2' type='mouse'/>
49
+ <input bus='ps2' type='keyboard'/>
50
+ <graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'>
51
+ <listen address='127.0.0.1' type='address'/>
52
+ </graphics>
53
+ <audio id='1' type='none'/>
54
+ <video>
55
+ <model heads='1' primary='yes' type='cirrus' vram='16384'/>
56
+ <address bus='0x00' domain='0x0000' function='0x0' slot='0x02' type='pci'/>
57
+ </video>
58
+ <memballoon model='virtio'>
59
+ <address bus='0x00' domain='0x0000' function='0x0' slot='0x04' type='pci'/>
60
+ </memballoon>
61
+ </devices>
62
+ </domain>
@@ -42,7 +42,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
42
42
  end
43
43
 
44
44
  it 'should execute without changing' do
45
- expect(ui).to_not receive(:error)
45
+ expect(ui).to_not receive(:warn)
46
46
  expect(libvirt_client).to_not receive(:define_domain_xml)
47
47
  expect(libvirt_domain).to receive(:autostart=)
48
48
  expect(domain).to receive(:start)
@@ -64,7 +64,27 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
64
64
  end
65
65
 
66
66
  it 'should correctly detect the domain was updated' do
67
- expect(ui).to_not receive(:error)
67
+ expect(ui).to_not receive(:warn)
68
+ expect(libvirt_domain).to receive(:autostart=)
69
+ expect(connection).to receive(:define_domain).and_return(libvirt_domain)
70
+ expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
71
+ expect(domain).to receive(:start)
72
+
73
+ expect(subject.call(env)).to be_nil
74
+ end
75
+ end
76
+
77
+ context 'when xml elements and attributes reordered' do
78
+ let(:test_file) { 'existing.xml' }
79
+ let(:updated_test_file) { 'existing_reordered.xml' }
80
+ let(:vagrantfile_providerconfig) do
81
+ <<-EOF
82
+ libvirt.cpu_mode = "host-passthrough"
83
+ EOF
84
+ end
85
+
86
+ it 'should correctly detect the domain was updated' do
87
+ expect(ui).to_not receive(:warn)
68
88
  expect(libvirt_domain).to receive(:autostart=)
69
89
  expect(connection).to receive(:define_domain).and_return(libvirt_domain)
70
90
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -88,13 +108,16 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
88
108
  end
89
109
 
90
110
  it 'should error and revert the update' do
91
- expect(ui).to receive(:error)
111
+ expect(ui).to receive(:warn).with(/\+ <cpu mode="host-passthrough" \/>.*Typically this means there is a bug in the XML being sent, please log an issue/m)
92
112
  expect(connection).to receive(:define_domain).and_return(libvirt_domain)
93
- expect(connection).to receive(:define_domain).with(domain_xml) # undo
113
+ #expect(connection).to receive(:define_domain).with(domain_xml) # undo
94
114
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
95
- expect(domain).to_not receive(:start)
115
+ #expect(domain).to_not receive(:start)
96
116
 
97
- expect { subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::FogError)
117
+ #expect { subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::UpdateServerError)
118
+ expect(libvirt_domain).to receive(:autostart=)
119
+ expect(domain).to receive(:start)
120
+ expect(subject.call(env)).to be_nil
98
121
  end
99
122
  end
100
123
 
@@ -112,7 +135,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
112
135
  }
113
136
 
114
137
  it 'should update the domain' do
115
- expect(ui).to_not receive(:error)
138
+ expect(ui).to_not receive(:warn)
116
139
  expect(libvirt_domain).to receive(:autostart=)
117
140
  expect(connection).to receive(:define_domain).and_return(libvirt_domain)
118
141
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -151,7 +174,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
151
174
  let(:updated_test_file) { 'existing_added_nvram.xml' }
152
175
 
153
176
  it 'should add the nvram element' do
154
- expect(ui).to_not receive(:error)
177
+ expect(ui).to_not receive(:warn)
155
178
  expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain)
156
179
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
157
180
  expect(libvirt_domain).to receive(:autostart=)
@@ -172,7 +195,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
172
195
  let(:updated_test_file) { 'nvram_domain_other_setting.xml' }
173
196
 
174
197
  it 'should keep the XML element' do
175
- expect(ui).to_not receive(:error)
198
+ expect(ui).to_not receive(:warn)
176
199
  expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain)
177
200
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
178
201
  expect(libvirt_domain).to receive(:autostart=)
@@ -186,7 +209,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
186
209
  let(:updated_test_file) { 'nvram_domain_removed.xml' }
187
210
 
188
211
  it 'should delete the XML element' do
189
- expect(ui).to_not receive(:error)
212
+ expect(ui).to_not receive(:warn)
190
213
  expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain)
191
214
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
192
215
  expect(libvirt_domain).to receive(:autostart=)
@@ -210,7 +233,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
210
233
  end
211
234
 
212
235
  it 'should modify the domain tpm_path' do
213
- expect(ui).to_not receive(:error)
236
+ expect(ui).to_not receive(:warn)
214
237
  expect(logger).to receive(:debug).with('tpm config changed')
215
238
  expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain)
216
239
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -232,7 +255,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
232
255
  end
233
256
 
234
257
  it 'should modify the domain tpm_path' do
235
- expect(ui).to_not receive(:error)
258
+ expect(ui).to_not receive(:warn)
236
259
  expect(logger).to receive(:debug).with('tpm config changed')
237
260
  expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain)
238
261
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -255,7 +278,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
255
278
  end
256
279
 
257
280
  it 'should execute without changing' do
258
- expect(ui).to_not receive(:error)
281
+ expect(ui).to_not receive(:warn)
259
282
  expect(libvirt_domain).to receive(:autostart=)
260
283
  expect(domain).to receive(:start)
261
284
 
@@ -275,7 +298,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
275
298
  end
276
299
 
277
300
  it 'should execute without changing' do
278
- expect(ui).to_not receive(:error)
301
+ expect(ui).to_not receive(:warn)
279
302
  expect(libvirt_domain).to receive(:autostart=)
280
303
  expect(domain).to receive(:start)
281
304
 
@@ -295,7 +318,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
295
318
  end
296
319
 
297
320
  it 'should modify the domain' do
298
- expect(ui).to_not receive(:error)
321
+ expect(ui).to_not receive(:warn)
299
322
  expect(logger).to receive(:debug).with('tpm config changed')
300
323
  expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain)
301
324
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -318,7 +341,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
318
341
  end
319
342
 
320
343
  it 'should not modify the domain' do
321
- expect(ui).to_not receive(:error)
344
+ expect(ui).to_not receive(:warn)
322
345
  expect(logger).to_not receive(:debug).with('clock timers config changed')
323
346
  expect(connection).to_not receive(:define_domain)
324
347
  expect(libvirt_domain).to receive(:autostart=)
@@ -339,7 +362,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
339
362
  let(:updated_test_file) { 'clock_timer_rtc_tsc.xml' }
340
363
 
341
364
  it 'should modify the domain' do
342
- expect(ui).to_not receive(:error)
365
+ expect(ui).to_not receive(:warn)
343
366
  expect(logger).to receive(:debug).with('clock timers config changed')
344
367
  expect(connection).to receive(:define_domain).with(match(/<clock offset='utc'>\s*<timer name='rtc'\/>\s*<timer name='tsc'\/>\s*<\/clock>/)).and_return(libvirt_domain)
345
368
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -354,7 +377,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
354
377
  let(:updated_test_file) { 'clock_timer_removed.xml' }
355
378
 
356
379
  it 'should modify the domain' do
357
- expect(ui).to_not receive(:error)
380
+ expect(ui).to_not receive(:warn)
358
381
  expect(logger).to receive(:debug).with('clock timers config changed')
359
382
  expect(connection).to receive(:define_domain).with(match(/<clock offset='utc'>\s*<\/clock>/)).and_return(libvirt_domain)
360
383
  expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
@@ -3,6 +3,7 @@
3
3
  require 'spec_helper'
4
4
  require 'support/sharedcontext'
5
5
 
6
+ require 'vagrant-libvirt'
6
7
  require 'vagrant-libvirt/plugin'
7
8
 
8
9