#NEWLINE# def __init__( self , instance , address = None , content = None , extra_md = None , network_info = None , vd_driver = None , network_metadata = None ) : #NEWLINE# #INDENT# 'Creation of this object should basically cover all time consuming\n        collection.  Methods after that should not cause time delays due to\n        network operations or lengthy cpu operations.\n\n        The user should then get a single instance and make multiple method\n        calls on it.\n        ' #NEWLINE# if ( not content ) : #NEWLINE# #INDENT# content = [ ] #NEWLINE# #UNINDENT# ctxt = context . get_admin_context ( ) #NEWLINE# self . set_mimetype ( MIME_TYPE_TEXT_PLAIN ) #NEWLINE# self . instance = instance #NEWLINE# self . extra_md = extra_md #NEWLINE# self . availability_zone = az . get_instance_availability_zone ( ctxt , instance ) #NEWLINE# secgroup_api = openstack_driver . get_openstack_security_group_driver ( ) #NEWLINE# self . security_groups = secgroup_api . get_instance_security_groups ( ctxt , instance ) #NEWLINE# self . mappings = _format_instance_mapping ( ctxt , instance ) #NEWLINE# if ( instance . user_data is not None ) : #NEWLINE# #INDENT# self . userdata_raw = base64 . b64decode ( instance . user_data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . userdata_raw = None #NEWLINE# #UNINDENT# self . address = address #NEWLINE# self . launch_metadata = utils . instance_meta ( instance ) #NEWLINE# self . password = password . extract_password ( instance ) #NEWLINE# self . uuid = instance . uuid #NEWLINE# self . content = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . files = [ ] #NEWLINE# if ( network_info is None ) : #NEWLINE# #INDENT# network_info = instance . info_cache . network_info #NEWLINE# #UNINDENT# if ( network_metadata is None ) : #NEWLINE# #INDENT# self . network_metadata = netutils . get_network_metadata ( network_info ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . network_metadata = network_metadata #NEWLINE# #UNINDENT# self . ip_info = ec2utils . get_ip_info_for_instance_from_nw_info ( network_info ) #NEWLINE# self . network_config = None #NEWLINE# cfg = netutils . get_injected_network_template ( network_info ) #NEWLINE# if cfg : #NEWLINE# #INDENT# key = ( '%04i' % len ( self . content ) ) #NEWLINE# self . content [ key ] = cfg #NEWLINE# self . network_config = { #NEWLINE# #INDENT# 'name' : 'network_config' , #NEWLINE# 'content_path' : ( '/%s/%s' % ( CONTENT_DIR , key ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# for ( path , contents ) in content : #NEWLINE# #INDENT# key = ( '%04i' % len ( self . content ) ) #NEWLINE# self . files . append ( { #NEWLINE# #INDENT# 'path' : path , #NEWLINE# 'content_path' : ( '/%s/%s' % ( CONTENT_DIR , key ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . content [ key ] = contents #NEWLINE# #UNINDENT# if ( vd_driver is None ) : #NEWLINE# #INDENT# vdclass = importutils . import_class ( CONF . vendordata_driver ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# vdclass = vd_driver #NEWLINE# #UNINDENT# self . vddriver = vdclass ( instance = instance , address = address , extra_md = extra_md , network_info = network_info ) #NEWLINE# self . route_configuration = None