diff --git a/vmware-host-pooler b/vmware-host-pooler index 1bc3448..c59969f 100755 --- a/vmware-host-pooler +++ b/vmware-host-pooler @@ -223,13 +223,20 @@ loop do end if vm['template'].length == 0 - raise "Unable to find template '#{h['template']}'!" + raise "Unable to find template '#{vm['template']}'!" end # Generate a randomized hostname o = [('a'..'z'),('0'..'9')].map{|r| r.to_a}.flatten vm['hostname'] = o[rand(25)]+(0...14).map{o[rand(o.length)]}.join + # Annotate with creation time, origin template, etc. + configSpec = RbVmomi::VIM.VirtualMachineConfigSpec( + :annotation => + 'Base template: ' + vm['template'] + "\n" + + 'Creation time: ' + Time.now.strftime("%Y-%m-%d %H:%M") + ) + # Put the VM in the specified folder and resource pool relocateSpec = RbVmomi::VIM.VirtualMachineRelocateSpec( :datastore => vsphere_helper.find_datastore(pool['datastore']), @@ -240,6 +247,7 @@ loop do # Create a clone spec spec = RbVmomi::VIM.VirtualMachineCloneSpec( :location => relocateSpec, + :config => configSpec, :powerOn => true, :template => false )