def preconfigure_instance(session, instance, vdi_ref, network_info):
 key = str(instance['key_data'])
 net = netutils.get_injected_network_template(network_info)
 metadata = instance['metadata']
 mount_required = (key or net or metadata)
 if (not mount_required):
  return
 with vdi_attached(session, vdi_ref, read_only=False) as dev:
  _mounted_processing(dev, key, net, metadata)

def preconfigure_instance ( session , instance , vdi_ref , network_info ) : key = str ( instance [ 'key_data' ] ) net = netutils . get_injected_network_template ( network_info ) metadata = instance [ 'metadata' ] mount_required = ( key or net or metadata ) if ( not mount_required ) : return with vdi_attached ( session , vdi_ref , read_only = False ) as dev : _mounted_processing ( dev , key , net , metadata )
makes alterations to the image before launching as part of spawn .