vagrant-parallels 1.3.13 → 1.4.0.rc1
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 +4 -4
- data/Vagrantfile +5 -6
- data/lib/vagrant-parallels/action/export.rb +7 -1
- data/lib/vagrant-parallels/action/import.rb +35 -3
- data/lib/vagrant-parallels/action/network.rb +8 -8
- data/lib/vagrant-parallels/config.rb +4 -0
- data/lib/vagrant-parallels/driver/base.rb +424 -53
- data/lib/vagrant-parallels/driver/meta.rb +8 -10
- data/lib/vagrant-parallels/driver/pd_10.rb +15 -21
- data/lib/vagrant-parallels/driver/pd_11.rb +41 -0
- data/lib/vagrant-parallels/driver/pd_8.rb +1 -397
- data/lib/vagrant-parallels/driver/pd_9.rb +1 -1
- data/lib/vagrant-parallels/errors.rb +4 -0
- data/lib/vagrant-parallels/plugin.rb +1 -0
- data/lib/vagrant-parallels/version.rb +1 -1
- data/locales/en.yml +9 -2
- data/tasks/acceptance.rake +2 -2
- data/tasks/test.rake +0 -4
- data/test/acceptance/provider/linked_clone_spec.rb +26 -0
- data/test/acceptance/skeletons/linked_clone/Vagrantfile +7 -0
- data/test/unit/support/shared/pd_driver_examples.rb +13 -18
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b4e446a9236fe27c45d9f8e79cbc7e5debda99d
|
4
|
+
data.tar.gz: c27a4ff8d5072c5ec13e77867b6b006aaf430be7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da331c7f9b348afc57b8e4cd35ac95d9db2ef6691c77e30de2c54a7ebcbf842dc02e90fb842dfa1855e60a66a152714243189e3f6f55388d4ba2042bff6af014
|
7
|
+
data.tar.gz: a30ce5518be12603fc39e76e196f84ac48d664cabe89ca14f4d9f006ad6a89ffe497cd08ba014f53e5db378d592c03c993cd62fe25e19cd350363032277ae8b7
|
data/Vagrantfile
CHANGED
@@ -54,17 +54,16 @@ Vagrant.configure('2') do |config|
|
|
54
54
|
# end
|
55
55
|
|
56
56
|
c.vm.provider :parallels do |prl, config_override|
|
57
|
-
config_override.vm.network :public_network, adapter: 0
|
58
|
-
prl.network_adapter(1, :shared)
|
57
|
+
# config_override.vm.network :public_network, adapter: 0
|
58
|
+
# prl.network_adapter(1, :shared)
|
59
|
+
#prl.use_linked_clone = true
|
59
60
|
end
|
60
61
|
|
61
|
-
# c.vm.network 'private_network', ip: '192.168.60.4'
|
62
|
-
# c.vm.network 'private_network', ip: '10.2.0.220', netmask: '255.255.0.0'
|
63
|
-
# c.vm.network 'public_network'
|
64
|
-
|
65
62
|
c.vm.hostname = 'my-funny-centos.do.sw.ru'
|
66
63
|
c.vm.box = 'parallels/centos-6.6'
|
67
64
|
|
65
|
+
#c.vm.network 'private_network', ip: '192.168.255.3', netmask: '255.255.252.0'
|
66
|
+
|
68
67
|
c.vm.provision :shell do |s|
|
69
68
|
s.inline = 'echo Hello, World'
|
70
69
|
end
|
@@ -51,7 +51,13 @@ module VagrantPlugins
|
|
51
51
|
|
52
52
|
def export
|
53
53
|
@env[:ui].info I18n.t('vagrant.actions.vm.export.exporting')
|
54
|
-
|
54
|
+
|
55
|
+
options = {
|
56
|
+
template: true,
|
57
|
+
dst: @env['export.temp_dir'].to_s
|
58
|
+
}
|
59
|
+
|
60
|
+
@env[:machine].provider.driver.clone_vm(@env[:machine].id, @tpl_name, options) do |progress|
|
55
61
|
@env[:ui].clear_line
|
56
62
|
@env[:ui].report_progress(progress, 100, false)
|
57
63
|
|
@@ -79,10 +79,25 @@ module VagrantPlugins
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def import(env, tpl_name)
|
82
|
-
|
83
|
-
|
82
|
+
# Generate virtual machine name
|
83
|
+
vm_name = "#{tpl_name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
84
|
+
opts = {}
|
85
|
+
|
86
|
+
# Linked clones are supported only for PD 11 and higher
|
87
|
+
if @machine.provider_config.use_linked_clone &&
|
88
|
+
@machine.provider.pd_version_satisfies?('>= 11')
|
89
|
+
|
90
|
+
env[:ui].info I18n.t('vagrant_parallels.actions.vm.import.importing_linked',
|
91
|
+
:name => @machine.box.name)
|
92
|
+
opts[:snapshot_id] = snapshot_id(tpl_name)
|
93
|
+
opts[:linked] = true
|
94
|
+
else
|
95
|
+
env[:ui].info I18n.t("vagrant.actions.vm.import.importing",
|
96
|
+
:name => @machine.box.name)
|
97
|
+
end
|
98
|
+
|
84
99
|
# Import the virtual machine
|
85
|
-
@machine.id = @machine.provider.driver.
|
100
|
+
@machine.id = @machine.provider.driver.clone_vm(tpl_name, vm_name, opts) do |progress|
|
86
101
|
env[:ui].clear_line
|
87
102
|
env[:ui].report_progress(progress, 100, false)
|
88
103
|
|
@@ -101,6 +116,23 @@ module VagrantPlugins
|
|
101
116
|
end
|
102
117
|
end
|
103
118
|
|
119
|
+
def snapshot_id(tpl_name)
|
120
|
+
snap_id = @machine.provider.driver.read_current_snapshot(tpl_name)
|
121
|
+
|
122
|
+
# If there is no current snapshot, just create the new one.
|
123
|
+
if !snap_id
|
124
|
+
@logger.info('Create a new snapshot')
|
125
|
+
opts = {
|
126
|
+
name: 'vagrant_linked_clone',
|
127
|
+
desc: 'Snapshot to create linked clones for Vagrant'
|
128
|
+
}
|
129
|
+
snap_id = @machine.provider.driver.create_snapshot(tpl_name, opts)
|
130
|
+
end
|
131
|
+
|
132
|
+
@logger.info("User this snapshot ID to create a linked clone: #{snap_id}")
|
133
|
+
snap_id
|
134
|
+
end
|
135
|
+
|
104
136
|
def unregister_template(tpl_name)
|
105
137
|
@logger.info("Unregister the box template: '#{tpl_name}'")
|
106
138
|
@machine.provider.driver.unregister(tpl_name)
|
@@ -29,11 +29,8 @@ module VagrantPlugins
|
|
29
29
|
# Get the list of network adapters from the configuration
|
30
30
|
network_adapters_config = env[:machine].provider_config.network_adapters.dup
|
31
31
|
|
32
|
-
# Get maximum number of network adapters
|
33
|
-
max_adapters = env[:machine].provider.driver.max_network_adapters
|
34
|
-
|
35
32
|
# Assign the adapter slot for each high-level network
|
36
|
-
available_slots = Set.new(0...
|
33
|
+
available_slots = Set.new(0...16)
|
37
34
|
network_adapters_config.each do |slot, _data|
|
38
35
|
available_slots.delete(slot)
|
39
36
|
end
|
@@ -197,6 +194,8 @@ module VagrantPlugins
|
|
197
194
|
interface = bridgedifs[index]
|
198
195
|
@env[:ui].info("#{index + 1}) #{interface[:name]}", :prefix => false)
|
199
196
|
end
|
197
|
+
@env[:ui].info(I18n.t(
|
198
|
+
"vagrant.actions.vm.bridged_networking.choice_help")+"\n")
|
200
199
|
|
201
200
|
# The range of valid choices
|
202
201
|
valid = Range.new(1, bridgedifs.length)
|
@@ -204,7 +203,8 @@ module VagrantPlugins
|
|
204
203
|
# The choice that the user has chosen as the bridging interface
|
205
204
|
choice = nil
|
206
205
|
while !valid.include?(choice)
|
207
|
-
choice = @env[:ui].ask(
|
206
|
+
choice = @env[:ui].ask(
|
207
|
+
'Which interface should the network bridge to? Enter a number: ')
|
208
208
|
choice = choice.to_i
|
209
209
|
end
|
210
210
|
|
@@ -289,16 +289,16 @@ module VagrantPlugins
|
|
289
289
|
# with the final octet + 1. So "172.28.0.0" turns into "172.28.0.1"
|
290
290
|
dhcp_ip = ip_parts.dup
|
291
291
|
dhcp_ip[3] += 1
|
292
|
-
dhcp_options[:dhcp_ip]
|
292
|
+
dhcp_options[:dhcp_ip] = options[:dhcp_ip] || dhcp_ip.join(".")
|
293
293
|
|
294
294
|
# Calculate the lower and upper bound for the DHCP server
|
295
295
|
dhcp_lower = ip_parts.dup
|
296
296
|
dhcp_lower[3] += 2
|
297
|
-
dhcp_options[:dhcp_lower]
|
297
|
+
dhcp_options[:dhcp_lower] = options[:dhcp_lower] || dhcp_lower.join(".")
|
298
298
|
|
299
299
|
dhcp_upper = ip_parts.dup
|
300
300
|
dhcp_upper[3] = 254
|
301
|
-
dhcp_options[:dhcp_upper]
|
301
|
+
dhcp_options[:dhcp_upper] = options[:dhcp_upper] || dhcp_upper.join(".")
|
302
302
|
end
|
303
303
|
|
304
304
|
return {
|
@@ -6,6 +6,7 @@ module VagrantPlugins
|
|
6
6
|
attr_accessor :destroy_unused_network_interfaces
|
7
7
|
attr_accessor :functional_psf
|
8
8
|
attr_accessor :optimize_power_consumption
|
9
|
+
attr_accessor :use_linked_clone
|
9
10
|
attr_accessor :name
|
10
11
|
attr_reader :network_adapters
|
11
12
|
attr_accessor :regen_src_uuid
|
@@ -22,6 +23,7 @@ module VagrantPlugins
|
|
22
23
|
@customizations = []
|
23
24
|
@destroy_unused_network_interfaces = UNSET_VALUE
|
24
25
|
@functional_psf = UNSET_VALUE
|
26
|
+
@use_linked_clone = UNSET_VALUE
|
25
27
|
@network_adapters = {}
|
26
28
|
@name = UNSET_VALUE
|
27
29
|
@optimize_power_consumption = UNSET_VALUE
|
@@ -79,6 +81,8 @@ module VagrantPlugins
|
|
79
81
|
@optimize_power_consumption = true
|
80
82
|
end
|
81
83
|
|
84
|
+
@use_linked_clone = false if @use_linked_clone == UNSET_VALUE
|
85
|
+
|
82
86
|
@name = nil if @name == UNSET_VALUE
|
83
87
|
|
84
88
|
@regen_src_uuid = true if @regen_src_uuid == UNSET_VALUE
|