Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (35 sloc) 1.29 KB
sflinks = [ [ 'linux-base', 'vcenter-vm-base' ] ]
[ foundation.vcenter-vm-base ]
description = 'Base VCenter VM'
scripts = { 'create' = 'vcenter-vm-create', 'destroy' = 'vcenter-vm-destroy' }
foundation_types = [ 'VCenter' ]
template = {}
physical_interface_names = []
[ foundation.vcenter-vm-base.config_values ]
vcenter_ds_name_regex = ''
[ script.vcenter-vm-create ]
description = 'Create VCenter VM'
script = """# Create VCenter VM
vm_spec = foundation.vcenter_vmspec
begin( description='Locate Host' )
host_list = vcenter.host_list( min_memory=vm_spec[ 'memory_size' ], min_cpu=vm_spec[ 'cpu_count' ] )
end
begin( description='Locate Datastore' )
datastore_list = vcenter.datastore_list( host=host_list[0], min_free_space=5, name_regex=config.vcenter_ds_name_regex )
end
begin( description='VM Creation' )
vm_uuid = vcenter.create( host=host_list[0], datastore=datastore_list[0], vm_spec=vm_spec )
foundation.vcenter_uuid = vm_uuid
interface_map = foundation.get_interface_map()
foundation.set_interface_macs( interface_map=interface_map )
end
"""
[ script.vcenter-vm-destroy ]
description = 'Destroy VCenter VM'
script = """# Destory VCenter VM
begin( description='VM Destruction' )
foundation.power_off()
foundation.destroy()
foundation.vcenter_uuid = None
end
"""
You can’t perform that action at this time.