mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #333 from mattkirby/vmp_optional_linkedclone
Make it possible to disable linked clones
This commit is contained in:
commit
9d48bc1b7e
8 changed files with 67 additions and 3 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -10,7 +10,15 @@ The format is based on
|
||||||
Tracking in this Changelog began for this project with the tagging of version 0.1.0.
|
Tracking in this Changelog began for this project with the tagging of version 0.1.0.
|
||||||
If you're looking for changes from before this, refer to the project's
|
If you're looking for changes from before this, refer to the project's
|
||||||
git logs & PR history.
|
git logs & PR history.
|
||||||
# [Unreleased](https://github.com/puppetlabs/vmpooler/compare/0.6.2...master)
|
# [Unreleased](https://github.com/puppetlabs/vmpooler/compare/0.6.3...master)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add capability to disable linked clones for vsphere provider
|
||||||
|
|
||||||
|
# [0.6.3](https://github.com/puppetlabs/vmpooler/compare/0.6.2...0.6.3)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add capability to configure pool cluster via config api (POOLER-143)
|
||||||
|
|
||||||
# [0.6.2](https://github.com/puppetlabs/vmpooler/compare/0.6.1...0.6.2)
|
# [0.6.2](https://github.com/puppetlabs/vmpooler/compare/0.6.1...0.6.2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ COPY ./ ./
|
||||||
|
|
||||||
ENV RACK_ENV=production
|
ENV RACK_ENV=production
|
||||||
|
|
||||||
RUN gem install bundler -v '2.0.1' && bundle install && gem build vmpooler.gemspec && gem install vmpooler*.gem && \
|
RUN gem install bundler && bundle install && gem build vmpooler.gemspec && gem install vmpooler*.gem && \
|
||||||
chmod +x /usr/local/bin/docker-entrypoint.sh
|
chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,12 @@ Note: this will only create the last folder when it does not exist. It will not
|
||||||
Create backing delta disks for the specified templates to support creating linked clones.
|
Create backing delta disks for the specified templates to support creating linked clones.
|
||||||
(optional; default: false)
|
(optional; default: false)
|
||||||
|
|
||||||
|
### CREATE\_LINKED\_CLONES
|
||||||
|
|
||||||
|
Whether to create linked clone virtual machines when using the vsphere provider.
|
||||||
|
This can also be set per pool.
|
||||||
|
(optional; default: true)
|
||||||
|
|
||||||
### PURGE\_UNCONFIGURED\_FOLDERS
|
### PURGE\_UNCONFIGURED\_FOLDERS
|
||||||
|
|
||||||
Enable purging of VMs and folders detected within the base folder path that are not configured for the provider
|
Enable purging of VMs and folders detected within the base folder path that are not configured for the provider
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ module Vmpooler
|
||||||
parsed_config[:config]['retry_factor'] = string_to_int(ENV['RETRY_FACTOR']) if ENV['RETRY_FACTOR']
|
parsed_config[:config]['retry_factor'] = string_to_int(ENV['RETRY_FACTOR']) if ENV['RETRY_FACTOR']
|
||||||
parsed_config[:config]['create_folders'] = ENV['CREATE_FOLDERS'] if ENV['CREATE_FOLDERS']
|
parsed_config[:config]['create_folders'] = ENV['CREATE_FOLDERS'] if ENV['CREATE_FOLDERS']
|
||||||
parsed_config[:config]['create_template_delta_disks'] = ENV['CREATE_TEMPLATE_DELTA_DISKS'] if ENV['CREATE_TEMPLATE_DELTA_DISKS']
|
parsed_config[:config]['create_template_delta_disks'] = ENV['CREATE_TEMPLATE_DELTA_DISKS'] if ENV['CREATE_TEMPLATE_DELTA_DISKS']
|
||||||
|
set_linked_clone(parsed_config)
|
||||||
parsed_config[:config]['experimental_features'] = ENV['EXPERIMENTAL_FEATURES'] if ENV['EXPERIMENTAL_FEATURES']
|
parsed_config[:config]['experimental_features'] = ENV['EXPERIMENTAL_FEATURES'] if ENV['EXPERIMENTAL_FEATURES']
|
||||||
parsed_config[:config]['purge_unconfigured_folders'] = ENV['PURGE_UNCONFIGURED_FOLDERS'] if ENV['PURGE_UNCONFIGURED_FOLDERS']
|
parsed_config[:config]['purge_unconfigured_folders'] = ENV['PURGE_UNCONFIGURED_FOLDERS'] if ENV['PURGE_UNCONFIGURED_FOLDERS']
|
||||||
parsed_config[:config]['usage_stats'] = ENV['USAGE_STATS'] if ENV['USAGE_STATS']
|
parsed_config[:config]['usage_stats'] = ENV['USAGE_STATS'] if ENV['USAGE_STATS']
|
||||||
|
|
@ -183,4 +184,14 @@ module Vmpooler
|
||||||
return unless s =~ /\d/
|
return unless s =~ /\d/
|
||||||
return Integer(s)
|
return Integer(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.true?(obj)
|
||||||
|
obj.to_s.downcase == "true"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.set_linked_clone(parsed_config)
|
||||||
|
parsed_config[:config]['create_linked_clones'] = parsed_config[:config]['create_linked_clones'] || true
|
||||||
|
parsed_config[:config]['create_linked_clones'] = ENV['CREATE_LINKED_CLONES'] if ENV['CREATE_LINKED_CLONES'] =~ /true|false/
|
||||||
|
parsed_config[:config]['create_linked_clones'] = true?(parsed_config[:config]['create_linked_clones']) if parsed_config[:config]['create_linked_clones']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ module Vmpooler
|
||||||
# Put the VM in the specified folder and resource pool
|
# Put the VM in the specified folder and resource pool
|
||||||
relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
|
relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
|
||||||
datastore: find_datastore(target_datastore, connection, target_datacenter_name),
|
datastore: find_datastore(target_datastore, connection, target_datacenter_name),
|
||||||
diskMoveType: :moveChildMostDiskBacking
|
diskMoveType: get_disk_backing(pool)
|
||||||
)
|
)
|
||||||
|
|
||||||
manage_host_selection = @config[:config]['manage_host_selection'] if @config[:config].key?('manage_host_selection')
|
manage_host_selection = @config[:config]['manage_host_selection'] if @config[:config].key?('manage_host_selection')
|
||||||
|
|
@ -1028,6 +1028,17 @@ module Vmpooler
|
||||||
return false if template[-1] == '/'
|
return false if template[-1] == '/'
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_disk_backing(pool)
|
||||||
|
return :moveChildMostDiskBacking if linked_clone?(pool)
|
||||||
|
return :moveAllDiskBackingsAndConsolidate
|
||||||
|
end
|
||||||
|
|
||||||
|
def linked_clone?(pool)
|
||||||
|
return if pool[:create_linked_clone] == false
|
||||||
|
return true if pool[:create_linked_clone]
|
||||||
|
return true if @config[:config]['create_linked_clones']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ describe 'Vmpooler' do
|
||||||
['clone_target', test_string, nil],
|
['clone_target', test_string, nil],
|
||||||
['create_folders', test_bool, nil],
|
['create_folders', test_bool, nil],
|
||||||
['create_template_delta_disks', test_bool, nil],
|
['create_template_delta_disks', test_bool, nil],
|
||||||
|
['create_linked_clones', test_bool, nil],
|
||||||
['experimental_features', test_bool, nil],
|
['experimental_features', test_bool, nil],
|
||||||
['purge_unconfigured_folders', test_bool, nil],
|
['purge_unconfigured_folders', test_bool, nil],
|
||||||
['usage_stats', test_bool, nil],
|
['usage_stats', test_bool, nil],
|
||||||
|
|
|
||||||
|
|
@ -3431,4 +3431,29 @@ EOT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'get_disk_backing' do
|
||||||
|
|
||||||
|
it 'should return moveChildMostDiskBacking when linked clone enabled' do
|
||||||
|
expect( subject.get_disk_backing({create_linked_clone: true}) ).to eq(:moveChildMostDiskBacking)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return moveAllDiskBackingsAndConsolidate when no preference is specified' do
|
||||||
|
expect( subject.get_disk_backing({})).to eq(:moveAllDiskBackingsAndConsolidate)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return moveAllDiskBackingsAndConsolidate when linked clone is false' do
|
||||||
|
expect( subject.get_disk_backing({create_linked_clone: false})).to eq(:moveAllDiskBackingsAndConsolidate)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'linked_clone?' do
|
||||||
|
it 'should return true when linked clone is enabled on the pool' do
|
||||||
|
expect( subject.linked_clone?({create_linked_clone: true}) ).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return nil when linked clone is not enabled on the pool' do
|
||||||
|
expect( subject.linked_clone?({}) ).to be nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -592,6 +592,7 @@
|
||||||
timeout: 15
|
timeout: 15
|
||||||
ready_ttl: 1440
|
ready_ttl: 1440
|
||||||
provider: vsphere
|
provider: vsphere
|
||||||
|
create_linked_clone: true
|
||||||
- name: 'debian-7-x86_64'
|
- name: 'debian-7-x86_64'
|
||||||
alias: [ 'debian-7-64', 'debian-7-amd64' ]
|
alias: [ 'debian-7-64', 'debian-7-amd64' ]
|
||||||
template: 'Templates/debian-7-x86_64'
|
template: 'Templates/debian-7-x86_64'
|
||||||
|
|
@ -601,3 +602,4 @@
|
||||||
timeout: 15
|
timeout: 15
|
||||||
ready_ttl: 1440
|
ready_ttl: 1440
|
||||||
provider: vsphere
|
provider: vsphere
|
||||||
|
create_linked_clone: false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue