vagrant-libvirt 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +2 -3
- data/lib/vagrant-libvirt/action/is_suspended.rb +2 -2
- data/lib/vagrant-libvirt/action/resume_domain.rb +3 -1
- data/lib/vagrant-libvirt/version +1 -1
- data/locales/en.yml +2 -0
- data/spec/unit/action/resume_domain_spec.rb +66 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40dbf1a78ed383e5c289059d869c281c778fee7414a0a1711849d9dcba16df52
|
4
|
+
data.tar.gz: 2bf17eb2166d56a0386d6bbd70d6548d89def585aaf6f10c929f8afc546496bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9fa89d429ae04d5375930e3bfec06d3cf2c152803e8dc6a3fcb9c4a8ac4e81e1bafe08639fe689e9535cf3889bb1fd548c196ebe064abbad1edbfd85619ce0f
|
7
|
+
data.tar.gz: 4713ea077cc23984256c1a0ed55a67ec44c0a687f3a7c72916762a65807995c4fd5e1206f0ed86cc69008f8bf51a7cfff07b36f6947cd90bd29e136c2649c9f7
|
@@ -146,7 +146,7 @@ module VagrantPlugins
|
|
146
146
|
# FIXME: all options for network driver should be hash from Vagrantfile
|
147
147
|
driver_options = {}
|
148
148
|
driver_options[:name] = @driver_name if @driver_name
|
149
|
-
driver_options[:iommu] = @driver_iommu ? "on" : "off"
|
149
|
+
driver_options[:iommu] = @driver_iommu ? "on" : "off" if @nic_model_type == 'virtio'
|
150
150
|
driver_options[:queues] = @driver_queues if @driver_queues
|
151
151
|
|
152
152
|
@udp_tunnel ||= {}
|
@@ -271,10 +271,9 @@ module VagrantPlugins
|
|
271
271
|
|
272
272
|
xml.mac(address: mac) if mac
|
273
273
|
xml.target(dev: target_dev_name(device_name, type, iface_number))
|
274
|
-
xml.alias(name: "net#{iface_number}")
|
275
274
|
xml.model(type: model_type.to_s)
|
276
275
|
xml.mtu(size: Integer(mtu)) if mtu
|
277
|
-
xml.driver(**driver_options)
|
276
|
+
xml.driver(**driver_options) if driver_options
|
278
277
|
xml.address(type: 'pci', bus: pci_bus, slot: pci_slot) if pci_bus and pci_slot
|
279
278
|
end
|
280
279
|
end.to_xml(
|
@@ -20,7 +20,7 @@ module VagrantPlugins
|
|
20
20
|
if libvirt_domain.has_managed_save?
|
21
21
|
env[:result] = env[:machine].state.id == :shutoff
|
22
22
|
else
|
23
|
-
env[:result] = env[:machine].state.id
|
23
|
+
env[:result] = [:paused, :pmsuspended].include?(env[:machine].state.id)
|
24
24
|
if env[:result]
|
25
25
|
env[:ui].warn('One time switching to pause suspend mode, found a paused VM.')
|
26
26
|
config.suspend_mode = 'pause'
|
@@ -32,7 +32,7 @@ module VagrantPlugins
|
|
32
32
|
env[:result] = [:shutoff, :paused].include?(env[:machine].state.id)
|
33
33
|
config.suspend_mode = 'managedsave'
|
34
34
|
else
|
35
|
-
env[:result] = env[:machine].state.id
|
35
|
+
env[:result] = [:paused, :pmsuspended].include?(env[:machine].state.id)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -20,7 +20,9 @@ module VagrantPlugins
|
|
20
20
|
|
21
21
|
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id)
|
22
22
|
config = env[:machine].provider_config
|
23
|
-
if
|
23
|
+
if env[:machine].state.id == :pmsuspended
|
24
|
+
libvirt_domain.pmwakeup
|
25
|
+
elsif config.suspend_mode == 'managedsave'
|
24
26
|
domain.start
|
25
27
|
else
|
26
28
|
domain.resume
|
data/lib/vagrant-libvirt/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.2
|
data/locales/en.yml
CHANGED
@@ -205,6 +205,8 @@ en:
|
|
205
205
|
states:
|
206
206
|
paused: |-
|
207
207
|
The Libvirt domain is suspended. Run `vagrant resume` to resume it.
|
208
|
+
pmsuspended: |-
|
209
|
+
The Libvirt domain is suspended. Run `vagrant resume` to resume it.
|
208
210
|
shutting_down: |-
|
209
211
|
The Libvirt domain is shutting down. Wait for it to complete and
|
210
212
|
then run `vagrant up` to start it or `vagrant destroy` to remove.
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../spec_helper'
|
4
|
+
|
5
|
+
require 'vagrant-libvirt/action/resume_domain'
|
6
|
+
|
7
|
+
|
8
|
+
describe VagrantPlugins::ProviderLibvirt::Action::ResumeDomain do
|
9
|
+
subject { described_class.new(app, env) }
|
10
|
+
|
11
|
+
include_context 'unit'
|
12
|
+
include_context 'libvirt'
|
13
|
+
|
14
|
+
let(:driver) { instance_double(::VagrantPlugins::ProviderLibvirt::Driver) }
|
15
|
+
let(:libvirt_domain) { instance_double(::Libvirt::Domain) }
|
16
|
+
let(:libvirt_client) { instance_double(::Libvirt::Connect) }
|
17
|
+
let(:servers) { double('servers') }
|
18
|
+
let(:state) { instance_double(::Vagrant::MachineState) }
|
19
|
+
|
20
|
+
before do
|
21
|
+
allow(machine.provider).to receive('driver').and_return(driver)
|
22
|
+
allow(driver).to receive(:connection).and_return(connection)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#call' do
|
26
|
+
before do
|
27
|
+
allow(connection).to receive(:servers).and_return(servers)
|
28
|
+
allow(servers).to receive(:get).and_return(domain)
|
29
|
+
allow(connection).to receive(:client).and_return(libvirt_client)
|
30
|
+
allow(libvirt_client).to receive(:lookup_domain_by_uuid).and_return(libvirt_domain)
|
31
|
+
|
32
|
+
allow(machine).to receive(:state).and_return(state)
|
33
|
+
|
34
|
+
expect(ui).to receive(:info).with(/Resuming domain/)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should resume by default' do
|
38
|
+
expect(state).to receive(:id).and_return(:paused)
|
39
|
+
expect(domain).to receive(:resume)
|
40
|
+
expect(logger).to receive(:info).with('Machine dummy-vagrant_dummy is resumed.')
|
41
|
+
|
42
|
+
expect(subject.call(env)).to be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when in pmsuspend' do
|
46
|
+
it 'should wakeup the domain' do
|
47
|
+
expect(state).to receive(:id).and_return(:pmsuspended)
|
48
|
+
expect(libvirt_domain).to receive(:pmwakeup)
|
49
|
+
expect(logger).to receive(:info).with('Machine dummy-vagrant_dummy is resumed.')
|
50
|
+
|
51
|
+
expect(subject.call(env)).to be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'when suspend_mode is managedsave' do
|
56
|
+
it 'should start the domain' do
|
57
|
+
machine.provider_config.suspend_mode = 'managedsave'
|
58
|
+
expect(state).to receive(:id).and_return(:paused)
|
59
|
+
expect(domain).to receive(:start)
|
60
|
+
expect(logger).to receive(:info).with('Machine dummy-vagrant_dummy is resumed.')
|
61
|
+
|
62
|
+
expect(subject.call(env)).to be_nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
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.11.
|
4
|
+
version: 0.11.2
|
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-12-
|
14
|
+
date: 2022-12-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-libvirt
|
@@ -297,6 +297,7 @@ files:
|
|
297
297
|
- spec/unit/action/resolve_disk_settings_spec/multi_volume_box.xml
|
298
298
|
- spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_and_custom_no_aliases.xml
|
299
299
|
- spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_storage.xml
|
300
|
+
- spec/unit/action/resume_domain_spec.rb
|
300
301
|
- spec/unit/action/set_boot_order_spec.rb
|
301
302
|
- spec/unit/action/set_boot_order_spec/default.xml
|
302
303
|
- spec/unit/action/set_boot_order_spec/explicit_boot_order.xml
|
@@ -422,6 +423,7 @@ test_files:
|
|
422
423
|
- spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_and_custom_no_aliases.xml
|
423
424
|
- spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_storage.xml
|
424
425
|
- spec/unit/action/resolve_disk_settings_spec.rb
|
426
|
+
- spec/unit/action/resume_domain_spec.rb
|
425
427
|
- spec/unit/action/set_boot_order_spec/default.xml
|
426
428
|
- spec/unit/action/set_boot_order_spec/explicit_boot_order.xml
|
427
429
|
- spec/unit/action/set_boot_order_spec.rb
|