#NEWLINE# def provision( self , instance , flavor = None , image = None , ssh_key = None , **kwargs ) : #NEWLINE# #INDENT# if ssh_key : #NEWLINE# #INDENT# instance . key_name = self . get_key_name ( ssh_key ) #NEWLINE# instance . key_fingerprint = ssh_key . fingerprint #NEWLINE# kwargs [ 'public_key' ] = ssh_key . public_key #NEWLINE# #UNINDENT# instance . flavor_name = flavor . name #NEWLINE# instance . cores = flavor . cores #NEWLINE# instance . ram = flavor . ram #NEWLINE# instance . flavor_disk = flavor . disk #NEWLINE# instance . disk = ( instance . system_volume_size + instance . data_volume_size ) #NEWLINE# if image : #NEWLINE# #INDENT# instance . image_name = image . name #NEWLINE# instance . min_disk = image . min_disk #NEWLINE# instance . min_ram = image . min_ram #NEWLINE# #UNINDENT# instance . save ( ) #NEWLINE# kwargs [ 'backend_flavor_id' ] = flavor . backend_id #NEWLINE# if image : #NEWLINE# #INDENT# kwargs [ 'backend_image_id' ] = image . backend_id #NEWLINE# #UNINDENT# send_task ( 'openstack' , 'provision' ) ( instance . uuid . hex , ** kwargs )