#NEWLINE# def handle( self , request , data ) : #NEWLINE# #INDENT# flavor_projects = data [ 'flavor_access' ] #NEWLINE# is_public = ( not flavor_projects ) #NEWLINE# try : #NEWLINE# #INDENT# flavor_id = data [ 'flavor_id' ] #NEWLINE# extras_dict = api . nova . flavor_get_extras ( self . request , flavor_id , raw = True ) #NEWLINE# api . nova . flavor_delete ( request , flavor_id ) #NEWLINE# flavor = api . nova . flavor_create ( request , data [ 'name' ] , data [ 'memory_mb' ] , data [ 'vcpus' ] , data [ 'disk_gb' ] , ephemeral = data [ 'eph_gb' ] , swap = data [ 'swap_mb' ] , is_public = is_public , rxtx_factor = data [ 'rxtx_factor' ] ) #NEWLINE# if extras_dict : #NEWLINE# #INDENT# api . nova . flavor_extra_set ( request , flavor . id , extras_dict ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , ignore = True ) #NEWLINE# return False #NEWLINE# #UNINDENT# for project in flavor_projects : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# api . nova . add_tenant_to_flavor ( request , flavor . id , project ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , _ ( 'Modified flavor information, but unable to modify flavor access.' ) ) #NEWLINE# #UNINDENT# #UNINDENT# return True