Skip to content

Commit

Permalink
Merge pull request #331 from legal90/linked-clone-default
Browse files Browse the repository at this point in the history
Turn on the linked_clone feature by default
  • Loading branch information
legal90 committed Nov 6, 2018
2 parents 6b61ce4 + 239098d commit 07c834f
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 121 deletions.
2 changes: 1 addition & 1 deletion lib/vagrant-parallels/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def finalize!
@functional_psf = true
end

@linked_clone = false if @linked_clone == UNSET_VALUE
@linked_clone = true if @linked_clone == UNSET_VALUE
@linked_clone_snapshot = nil if @linked_clone_snapshot == UNSET_VALUE

@name = nil if @name == UNSET_VALUE
Expand Down
4 changes: 2 additions & 2 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ en:
check_shared_interface:
connecting: Connecting host to Shared network...
clone:
full: Cloning new virtual machine...
linked: Creating new virtual machine as a linked clone...
full: Creating new virtual machine as a full clone of the box image...
linked: Creating new virtual machine as a linked clone of the box image...
handle_guest_tools:
cant_install: |-
Vagrant doesn't support installing Parallels Tools for the guest OS
Expand Down
2 changes: 1 addition & 1 deletion tasks/acceptance.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace :acceptance do
task :run do
components = %w(
basic
linked_clone
full_clone
network/forwarded_port
network/private_network
snapshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This tests that VM is up as a linked clone
shared_examples 'provider/linked_clone' do |provider, options|
# This tests that VM is up as a full clone
shared_examples 'provider/full_clone' do |provider, options|
if !options[:box]
raise ArgumentError,
"box option must be specified for provider: #{provider}"
Expand All @@ -8,19 +8,19 @@
include_context 'acceptance'

before do
environment.skeleton('linked_clone')
environment.skeleton('full_clone')
assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
end

after do
assert_execute('vagrant', 'destroy', '--force')
end

it 'creates machine as linked clone' do
status('Test: machine is created as a linked clone')
it 'creates machine as full clone' do
status('Test: machine is created as a full clone')
result = execute('vagrant', 'up', "--provider=#{provider}")
expect(result).to exit_with(0)
expect(result.stdout).to match(/linked clone/)
expect(result.stdout).to match(/full clone/)

status('Test: machine is available by ssh')
result = execute('vagrant', 'ssh', '-c', 'echo foo')
Expand Down
68 changes: 0 additions & 68 deletions test/acceptance/provider/package_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Vagrant.configure('2') do |config|
config.vm.box = 'basic'

config.vm.provider 'parallels' do |prl|
prl.linked_clone = true
prl.linked_clone = false
end
end
20 changes: 1 addition & 19 deletions test/unit/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def assert_valid
it { expect(subject.check_guest_tools).to eq(true) }
it { expect(subject.name).to be_nil }
it { expect(subject.functional_psf).to eq(true) }
it { expect(subject.linked_clone).to eq(false) }
it { expect(subject.linked_clone).to eq(true) }
it { expect(subject.regen_src_uuid).to eq(true) }

it 'should have one Shared adapter' do
Expand Down Expand Up @@ -85,22 +85,4 @@ def assert_valid
[:bridged, auto_config: true])
end
end

describe '#linked_clone' do
it 'is not overridden by use_linked_lone' do
subject.linked_clone = false
subject.use_linked_clone = true
subject.finalize!
expect(subject.linked_clone).to eql(false)
end
end

describe '#regen_src_uuid' do
it 'is not overridden by regen_box_uuid' do
subject.regen_src_uuid = true
subject.regen_box_uuid = false
subject.finalize!
expect(subject.regen_src_uuid).to eql(true)
end
end
end
43 changes: 20 additions & 23 deletions website/docs/source/docs/configuration.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_current: "configuration"
# Configuration

While the Parallels provider is a drop-in replacement for VirtualBox, there are
additional features that allow you to more finely configure Parallels-specific
additional features that allow you to more finely configure Parallels-specific
aspects of your machines.

## Virtual Machine Name
Expand All @@ -23,36 +23,33 @@ config.vm.provider "parallels" do |prl|
end
```

## Create VM as a Linked Clone
<div class="alert alert-info">
<p>
<strong>Note:</strong> This feature is available only with Parallels
Desktop 11 or higher.
</p>
</div>
## Virtual Machine type: Full Clone vs Linked Clone

When you run `vagrant up` for the first time, the new virtual machine
will be created by cloning the box image. By default the Parallels provider
creates a regular clone, e.q. the full copy of the box image.
Starting since vagrant-parallels v2.0.0, when you create a new virtual machine with
`vagrant up` it is created as a linked clone of the box image.
Previously the provider created a full clone of the box image.

You can configure it to create a linked clone instead:
Differences between linked and full clones:

- Linked clone creation is extremely faster than the full cloning, because
there is no image copying process.
- Linked clone requires much less disk space, because initially its hard disk
image is less than 1Mb (it is bound to the parent's snapshot).
- Full clone is a full image copy, which is totally independent from the box.
Linked clones are always bound to the specific snapshot of the box image. That means
that the box deletion will cause all its linked clones being corrupted. Vagrant will
warn you about such cases but you still need be careful when you delete boxes!

If you want the provider to create a full clone instead, you should disable the linked
clone feature explicitly in Vagrantfile:

```ruby
config.vm.provider "parallels" do |prl|
prl.linked_clone = true
prl.linked_clone = false
end
```

Difference between linked and full clones:

- Linked clone creation is extremely faster than the full cloning, because
there is no image copying process.
- Linked clone requires much less disk space, because initially its hard disk
image is less than 1Mb (it is bound to the parent's snapshot).
- Full clone is a full image copy, which is independent from the box.
Linked clones are bound to the specific snapshot of the box image. It means
that box deletion will cause all its linked clones being corrupted. Then please,
delete your boxes carefully!
_Note:_ Changes of this setting will take an effect only for newly created machines.

## Parallels Tools Auto-Update

Expand Down

0 comments on commit 07c834f

Please sign in to comment.