Merge pull request #149 from frozenfoxx/master

Added prefix parameter to the vmpooler configuration
This commit is contained in:
Scott Schneider 2016-01-14 10:42:33 -08:00
commit 9e8a7d034b
3 changed files with 8 additions and 1 deletions

View file

@ -32,6 +32,7 @@ module Vmpooler
parsed_config[:config]['task_limit'] ||= 10 parsed_config[:config]['task_limit'] ||= 10
parsed_config[:config]['vm_checktime'] ||= 15 parsed_config[:config]['vm_checktime'] ||= 15
parsed_config[:config]['vm_lifetime'] ||= 24 parsed_config[:config]['vm_lifetime'] ||= 24
parsed_config[:config]['prefix'] ||= ''
# Create an index of pool aliases # Create an index of pool aliases
parsed_config[:pools].each do |pool| parsed_config[:pools].each do |pool|

View file

@ -189,7 +189,7 @@ module Vmpooler
# Generate a randomized hostname # Generate a randomized hostname
o = [('a'..'z'), ('0'..'9')].map(&:to_a).flatten o = [('a'..'z'), ('0'..'9')].map(&:to_a).flatten
vm['hostname'] = o[rand(25)] + (0...14).map { o[rand(o.length)] }.join vm['hostname'] = $config[:config]['prefix'] + o[rand(25)] + (0...14).map { o[rand(o.length)] }.join
# Add VM to Redis inventory ('pending' pool) # Add VM to Redis inventory ('pending' pool)
$redis.sadd('vmpooler__pending__' + vm['template'], vm['hostname']) $redis.sadd('vmpooler__pending__' + vm['template'], vm['hostname'])

View file

@ -161,6 +161,11 @@
# #
# - domain # - domain
# If set, returns a top-level 'domain' JSON key in POST requests # If set, returns a top-level 'domain' JSON key in POST requests
#
# - prefix
# If set, prefixes all created VMs with this string. This should include
# a separator.
# (optional; default: '')
# Example: # Example:
@ -176,6 +181,7 @@
- 'created_by' - 'created_by'
- 'project' - 'project'
domain: 'company.com' domain: 'company.com'
prefix: 'poolvm-'
# :pools: # :pools:
# #