Added prefix parameter to the vmpooler configuration

This commit is contained in:
FOXX 2016-01-14 11:42:12 -06:00
parent ad4e760f56
commit 10e507c262
3 changed files with 6 additions and 1 deletions

View file

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

View file

@ -189,7 +189,7 @@ module Vmpooler
# Generate a randomized hostname
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)
$redis.sadd('vmpooler__pending__' + vm['template'], vm['hostname'])