vagrant-libvirt 0.10.3 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5b3a11dacc2b43a80c7419af116d73d2a7e636c325296f22681f23a0d033a20
|
4
|
+
data.tar.gz: 408df37e3ec6a923f884f15a73778d33408ac59169f8152822b0634e384a09a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b890ae1fa0eb2f5ef7b212be83acc94eff485f673e3b1bdd40a1f16afbc035af0996a8e31db76148866cc51f5c9c9bf09cc61549e7c3767ba647a4db55265410
|
7
|
+
data.tar.gz: 211e8ce3e5cf1088e9137fc6ec26829e1fede30b1b714388c48369ddd6d9b7cc4b2aa147776f14f5faa120df0a7a1e9d3bbee13e8f58492b4d17fd3a64afd343
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'diffy'
|
4
3
|
require 'log4r'
|
4
|
+
|
5
|
+
require 'equivalent-xml'
|
5
6
|
require 'rexml/document'
|
6
7
|
|
7
8
|
module VagrantPlugins
|
@@ -425,24 +426,29 @@ module VagrantPlugins
|
|
425
426
|
end
|
426
427
|
|
427
428
|
begin
|
428
|
-
|
429
|
+
# need to check whether the updated XML contains all the changes requested
|
429
430
|
|
430
|
-
# This normalizes the attribute order to be consistent across both XML docs to
|
431
|
-
# for subsequent comparison by diffy
|
432
|
-
|
433
|
-
|
434
|
-
|
431
|
+
# This normalizes the attribute order to be consistent across both XML docs to
|
432
|
+
# eliminate differences for subsequent comparison by diffy
|
433
|
+
applied_xml_descr = REXML::Document.new(libvirt_domain.xml_desc(1))
|
434
|
+
applied_xml = String.new
|
435
|
+
applied_xml_descr.write(applied_xml)
|
436
|
+
|
437
|
+
proposed = Nokogiri::XML(new_xml, &:noblanks)
|
438
|
+
applied = Nokogiri::XML(applied_xml, &:noblanks)
|
435
439
|
|
436
|
-
|
440
|
+
if !EquivalentXml.equivalent?(proposed, applied)
|
441
|
+
require 'diffy'
|
437
442
|
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
443
|
+
# pretty print the XML as even though there can be additional changes,
|
444
|
+
# the output with diffy appears to be clearer
|
445
|
+
pretty_proposed = StringIO.new
|
446
|
+
pretty_applied = StringIO.new
|
447
|
+
proposed.write_xml_to(pretty_proposed, indent: 2)
|
448
|
+
applied.write_xml_to(pretty_applied, indent: 2)
|
442
449
|
|
443
|
-
|
450
|
+
diff = Diffy::Diff.new(pretty_proposed.string, pretty_applied.string, :context => 3).to_s(:text)
|
444
451
|
|
445
|
-
unless diff.empty?
|
446
452
|
error_msg = "Libvirt failed to fully update the domain with the specified XML. Result differs from requested:\n" +
|
447
453
|
"--- requested\n+++ result\n#{diff}\n" +
|
448
454
|
"Typically this means there is a bug in the XML being sent, please log an issue"
|
data/lib/vagrant-libvirt/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.4
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<domain xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0' type=''>
|
2
|
+
<name/>
|
3
|
+
<title/>
|
4
|
+
<description/>
|
5
|
+
<uuid/>
|
6
|
+
<memory/>
|
7
|
+
<vcpu>1</vcpu>
|
8
|
+
<cpu check="none" mode="host-model">
|
9
|
+
|
10
|
+
|
11
|
+
</cpu>
|
12
|
+
<os>
|
13
|
+
<type>hvm</type>
|
14
|
+
<kernel/>
|
15
|
+
<initrd/>
|
16
|
+
<cmdline/>
|
17
|
+
</os>
|
18
|
+
<features>
|
19
|
+
<acpi/>
|
20
|
+
<apic/>
|
21
|
+
<pae/>
|
22
|
+
</features>
|
23
|
+
<clock offset='utc'/>
|
24
|
+
<devices>
|
25
|
+
<serial type='pty'>
|
26
|
+
<target port='0'/>
|
27
|
+
</serial>
|
28
|
+
<console type='pty'>
|
29
|
+
<target port='0'/>
|
30
|
+
</console>
|
31
|
+
<input bus='ps2' type='mouse'/>
|
32
|
+
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/>
|
33
|
+
<video>
|
34
|
+
<model heads='1' type='cirrus' vram='16384'/>
|
35
|
+
</video>
|
36
|
+
</devices>
|
37
|
+
</domain>
|
@@ -50,6 +50,31 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
|
|
50
50
|
expect(subject.call(env)).to be_nil
|
51
51
|
end
|
52
52
|
|
53
|
+
context 'when xml is formatted differently' do
|
54
|
+
let(:test_file) { 'default_with_different_formatting.xml' }
|
55
|
+
let(:updated_domain_xml) {
|
56
|
+
new_xml = domain_xml.dup
|
57
|
+
new_xml.gsub!(/<cpu .*<\/cpu>/m, '<cpu check="none" mode="host-passthrough"/>')
|
58
|
+
new_xml
|
59
|
+
}
|
60
|
+
let(:vagrantfile_providerconfig) do
|
61
|
+
<<-EOF
|
62
|
+
libvirt.cpu_mode = "host-passthrough"
|
63
|
+
EOF
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should correctly detect the domain was updated' do
|
67
|
+
expect(ui).to_not receive(:error)
|
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
|
+
|
76
|
+
end
|
77
|
+
|
53
78
|
context 'when any setting changed' do
|
54
79
|
let(:vagrantfile_providerconfig) do
|
55
80
|
<<-EOF
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Stanek
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-08-
|
14
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-libvirt
|
@@ -55,6 +55,20 @@ dependencies:
|
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: equivalent-xml
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
58
72
|
- !ruby/object:Gem::Dependency
|
59
73
|
name: diffy
|
60
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,6 +304,7 @@ files:
|
|
290
304
|
- spec/unit/action/start_domain_spec/default.xml
|
291
305
|
- spec/unit/action/start_domain_spec/default_added_tpm_path.xml
|
292
306
|
- spec/unit/action/start_domain_spec/default_added_tpm_version.xml
|
307
|
+
- spec/unit/action/start_domain_spec/default_with_different_formatting.xml
|
293
308
|
- spec/unit/action/start_domain_spec/existing.xml
|
294
309
|
- spec/unit/action/start_domain_spec/existing_added_nvram.xml
|
295
310
|
- spec/unit/action/start_domain_spec/nvram_domain.xml
|
@@ -417,6 +432,7 @@ test_files:
|
|
417
432
|
- spec/unit/action/start_domain_spec/existing_added_nvram.xml
|
418
433
|
- spec/unit/action/start_domain_spec/clock_timer_rtc.xml
|
419
434
|
- spec/unit/action/start_domain_spec/existing.xml
|
435
|
+
- spec/unit/action/start_domain_spec/default_with_different_formatting.xml
|
420
436
|
- spec/unit/action/destroy_domain_spec/additional_disks_domain.xml
|
421
437
|
- spec/unit/action/destroy_domain_spec/box_multiple_disks.xml
|
422
438
|
- spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks_no_aliases.xml
|