<s> import contextlib <EOL> from oslo_config import cfg <EOL> from oslo_db import exception as db_exc <EOL> from oslo_log import log as logging <EOL> from oslo_serialization import jsonutils <EOL> from oslo_utils import timeutils <EOL> from oslo_utils import versionutils <EOL> from nova . cells import opts as cells_opts <EOL> from nova . cells import rpcapi as cells_rpcapi <EOL> from nova . cells import utils as cells_utils <EOL> from nova import db <EOL> from nova import exception <EOL> from nova . i18n import _LE <EOL> from nova import notifications <EOL> from nova import objects <EOL> from nova . objects import base <EOL> from nova . objects import fields <EOL> from nova import utils <EOL> CONF = cfg . CONF <EOL> LOG = logging . getLogger ( __name__ ) <EOL> _INSTANCE_OPTIONAL_JOINED_FIELDS = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> _INSTANCE_OPTIONAL_NON_COLUMN_FIELDS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> _INSTANCE_EXTRA_FIELDS = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> INSTANCE_OPTIONAL_ATTRS = ( _INSTANCE_OPTIONAL_JOINED_FIELDS + <EOL> _INSTANCE_OPTIONAL_NON_COLUMN_FIELDS + <EOL> _INSTANCE_EXTRA_FIELDS ) <EOL> INSTANCE_DEFAULT_FIELDS = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> MAX_TAG_COUNT = <NUM_LIT:50> <EOL> def _expected_cols ( expected_attrs ) : <EOL> """<STR_LIT>""" <EOL> if not expected_attrs : <EOL> return expected_attrs <EOL> simple_cols = [ attr for attr in expected_attrs <EOL> if attr in _INSTANCE_OPTIONAL_JOINED_FIELDS ] <EOL> complex_cols = [ '<STR_LIT>' % field <EOL> for field in _INSTANCE_EXTRA_FIELDS <EOL> if field in expected_attrs ] <EOL> if complex_cols : <EOL> simple_cols . append ( '<STR_LIT>' ) <EOL> simple_cols = [ x for x in simple_cols if x not in _INSTANCE_EXTRA_FIELDS ] <EOL> return simple_cols + complex_cols <EOL> _NO_DATA_SENTINEL = object ( ) <EOL> @ base . NovaObjectRegistry . register <EOL> class Instance ( base . NovaPersistentObject , base . NovaObject , <EOL> base . NovaObjectDictCompat ) : <EOL> VERSION = '<STR_LIT>' <EOL> fields = { <EOL> '<STR_LIT:id>' : fields . IntegerField ( ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . UUIDField ( nullable = True ) , <EOL> '<STR_LIT:host>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . DateTimeField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . DateTimeField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . BooleanField ( default = False ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . UUIDField ( ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IPV4AddressField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . IPV6AddressField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . BooleanField ( default = False ) , <EOL> '<STR_LIT>' : fields . IntegerField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . BooleanField ( default = False ) , <EOL> '<STR_LIT>' : fields . BooleanField ( default = False ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . DictOfStringsField ( ) , <EOL> '<STR_LIT>' : fields . DictOfNullableStringsField ( ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , <EOL> nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , nullable = True ) , <EOL> '<STR_LIT>' : fields . BooleanField ( default = False ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , <EOL> nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , <EOL> nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , <EOL> nullable = True ) <EOL> } <EOL> obj_extra_fields = [ '<STR_LIT:name>' ] <EOL> def obj_make_compatible ( self , primitive , target_version ) : <EOL> super ( Instance , self ) . obj_make_compatible ( primitive , target_version ) <EOL> target_version = versionutils . convert_version_to_tuple ( target_version ) <EOL> if target_version < ( <NUM_LIT:2> , <NUM_LIT:1> ) and '<STR_LIT>' in primitive : <EOL> del primitive [ '<STR_LIT>' ] <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( Instance , self ) . __init__ ( * args , ** kwargs ) <EOL> self . _reset_metadata_tracking ( ) <EOL> @ property <EOL> def image_meta ( self ) : <EOL> return objects . ImageMeta . from_instance ( self ) <EOL> def _reset_metadata_tracking ( self , fields = None ) : <EOL> if fields is None or '<STR_LIT>' in fields : <EOL> self . _orig_system_metadata = ( dict ( self . system_metadata ) if <EOL> '<STR_LIT>' in self else { } ) <EOL> if fields is None or '<STR_LIT>' in fields : <EOL> self . _orig_metadata = ( dict ( self . metadata ) if <EOL> '<STR_LIT>' in self else { } ) <EOL> def obj_reset_changes ( self , fields = None , recursive = False ) : <EOL> super ( Instance , self ) . obj_reset_changes ( fields , <EOL> recursive = recursive ) <EOL> self . _reset_metadata_tracking ( fields = fields ) <EOL> def obj_what_changed ( self ) : <EOL> changes = super ( Instance , self ) . obj_what_changed ( ) <EOL> if '<STR_LIT>' in self and self . metadata != self . _orig_metadata : <EOL> changes . add ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' in self and ( self . system_metadata != <EOL> self . _orig_system_metadata ) : <EOL> changes . add ( '<STR_LIT>' ) <EOL> return changes <EOL> @ classmethod <EOL> def _obj_from_primitive ( cls , context , objver , primitive ) : <EOL> self = super ( Instance , cls ) . _obj_from_primitive ( context , objver , <EOL> primitive ) <EOL> self . _reset_metadata_tracking ( ) <EOL> return self <EOL> @ property <EOL> def name ( self ) : <EOL> try : <EOL> base_name = CONF . instance_name_template % self . id <EOL> except TypeError : <EOL> info = { } <EOL> for key in self . fields : <EOL> if key == '<STR_LIT:name>' : <EOL> continue <EOL> elif not self . obj_attr_is_set ( key ) : <EOL> continue <EOL> info [ key ] = self [ key ] <EOL> try : <EOL> base_name = CONF . instance_name_template % info <EOL> except KeyError : <EOL> base_name = self . uuid <EOL> return base_name <EOL> def _flavor_from_db ( self , db_flavor ) : <EOL> """<STR_LIT>""" <EOL> flavor_info = jsonutils . loads ( db_flavor ) <EOL> self . flavor = objects . Flavor . obj_from_primitive ( flavor_info [ '<STR_LIT>' ] ) <EOL> if flavor_info [ '<STR_LIT>' ] : <EOL> self . old_flavor = objects . Flavor . obj_from_primitive ( <EOL> flavor_info [ '<STR_LIT>' ] ) <EOL> else : <EOL> self . old_flavor = None <EOL> if flavor_info [ '<STR_LIT>' ] : <EOL> self . new_flavor = objects . Flavor . obj_from_primitive ( <EOL> flavor_info [ '<STR_LIT>' ] ) <EOL> else : <EOL> self . new_flavor = None <EOL> self . obj_reset_changes ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> @ staticmethod <EOL> def _from_db_object ( context , instance , db_inst , expected_attrs = None ) : <EOL> """<STR_LIT>""" <EOL> instance . _context = context <EOL> if expected_attrs is None : <EOL> expected_attrs = [ ] <EOL> for field in instance . fields : <EOL> if field in INSTANCE_OPTIONAL_ATTRS : <EOL> continue <EOL> elif field == '<STR_LIT>' : <EOL> instance . deleted = db_inst [ '<STR_LIT>' ] == db_inst [ '<STR_LIT:id>' ] <EOL> elif field == '<STR_LIT>' : <EOL> instance . cleaned = db_inst [ '<STR_LIT>' ] == <NUM_LIT:1> <EOL> else : <EOL> instance [ field ] = db_inst [ field ] <EOL> if hasattr ( db_inst , '<STR_LIT>' ) : <EOL> have_extra = '<STR_LIT>' in db_inst . __dict__ and db_inst [ '<STR_LIT>' ] <EOL> else : <EOL> have_extra = '<STR_LIT>' in db_inst and db_inst [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in expected_attrs : <EOL> instance [ '<STR_LIT>' ] = utils . instance_meta ( db_inst ) <EOL> if '<STR_LIT>' in expected_attrs : <EOL> instance [ '<STR_LIT>' ] = utils . instance_sys_meta ( db_inst ) <EOL> if '<STR_LIT>' in expected_attrs : <EOL> instance [ '<STR_LIT>' ] = ( <EOL> objects . InstanceFault . get_latest_for_instance ( <EOL> context , instance . uuid ) ) <EOL> if '<STR_LIT>' in expected_attrs : <EOL> if have_extra : <EOL> instance . _load_numa_topology ( <EOL> db_inst [ '<STR_LIT>' ] . get ( '<STR_LIT>' ) ) <EOL> else : <EOL> instance . numa_topology = None <EOL> if '<STR_LIT>' in expected_attrs : <EOL> if have_extra : <EOL> instance . _load_pci_requests ( <EOL> db_inst [ '<STR_LIT>' ] . get ( '<STR_LIT>' ) ) <EOL> else : <EOL> instance . pci_requests = None <EOL> if '<STR_LIT>' in expected_attrs : <EOL> if have_extra : <EOL> instance . _load_vcpu_model ( <EOL> db_inst [ '<STR_LIT>' ] . get ( '<STR_LIT>' ) ) <EOL> else : <EOL> instance . vcpu_model = None <EOL> if '<STR_LIT>' in expected_attrs : <EOL> instance . _load_ec2_ids ( ) <EOL> if '<STR_LIT>' in expected_attrs : <EOL> if have_extra : <EOL> instance . _load_migration_context ( <EOL> db_inst [ '<STR_LIT>' ] . get ( '<STR_LIT>' ) ) <EOL> else : <EOL> instance . migration_context = None <EOL> if '<STR_LIT>' in expected_attrs : <EOL> if db_inst . get ( '<STR_LIT>' ) is None : <EOL> instance . info_cache = None <EOL> elif not instance . obj_attr_is_set ( '<STR_LIT>' ) : <EOL> instance . info_cache = objects . InstanceInfoCache ( context ) <EOL> if instance . info_cache is not None : <EOL> instance . info_cache . _from_db_object ( context , <EOL> instance . info_cache , <EOL> db_inst [ '<STR_LIT>' ] ) <EOL> if any ( [ x in expected_attrs for x in ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) ] ) : <EOL> if have_extra and db_inst [ '<STR_LIT>' ] . get ( '<STR_LIT>' ) : <EOL> instance . _flavor_from_db ( db_inst [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> if '<STR_LIT>' in expected_attrs : <EOL> pci_devices = base . obj_make_list ( <EOL> context , objects . PciDeviceList ( context ) , <EOL> objects . PciDevice , db_inst [ '<STR_LIT>' ] ) <EOL> instance [ '<STR_LIT>' ] = pci_devices <EOL> if '<STR_LIT>' in expected_attrs : <EOL> sec_groups = base . obj_make_list ( <EOL> context , objects . SecurityGroupList ( context ) , <EOL> objects . SecurityGroup , db_inst . get ( '<STR_LIT>' , [ ] ) ) <EOL> instance [ '<STR_LIT>' ] = sec_groups <EOL> if '<STR_LIT>' in expected_attrs : <EOL> tags = base . obj_make_list ( <EOL> context , objects . TagList ( context ) , <EOL> objects . Tag , db_inst [ '<STR_LIT>' ] ) <EOL> instance [ '<STR_LIT>' ] = tags <EOL> if '<STR_LIT>' in expected_attrs : <EOL> services = base . obj_make_list ( <EOL> context , objects . ServiceList ( context ) , <EOL> objects . Service , db_inst [ '<STR_LIT>' ] ) <EOL> instance [ '<STR_LIT>' ] = services <EOL> instance . obj_reset_changes ( ) <EOL> return instance <EOL> @ staticmethod <EOL> @ db . select_db_reader_mode <EOL> def _db_instance_get_by_uuid ( context , uuid , columns_to_join , <EOL> use_slave = False ) : <EOL> return db . instance_get_by_uuid ( context , uuid , <EOL> columns_to_join = columns_to_join ) <EOL> @ base . remotable_classmethod <EOL> def get_by_uuid ( cls , context , uuid , expected_attrs = None , use_slave = False ) : <EOL> if expected_attrs is None : <EOL> expected_attrs = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> columns_to_join = _expected_cols ( expected_attrs ) <EOL> db_inst = cls . _db_instance_get_by_uuid ( context , uuid , columns_to_join , <EOL> use_slave = use_slave ) <EOL> return cls . _from_db_object ( context , cls ( ) , db_inst , <EOL> expected_attrs ) <EOL> @ base . remotable_classmethod <EOL> def get_by_id ( cls , context , inst_id , expected_attrs = None ) : <EOL> if expected_attrs is None : <EOL> expected_attrs = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> columns_to_join = _expected_cols ( expected_attrs ) <EOL> db_inst = db . instance_get ( context , inst_id , <EOL> columns_to_join = columns_to_join ) <EOL> return cls . _from_db_object ( context , cls ( ) , db_inst , <EOL> expected_attrs ) <EOL> @ base . remotable <EOL> def create ( self ) : <EOL> if self . obj_attr_is_set ( '<STR_LIT:id>' ) : <EOL> raise exception . ObjectActionError ( action = '<STR_LIT>' , <EOL> reason = '<STR_LIT>' ) <EOL> updates = self . obj_get_changes ( ) <EOL> expected_attrs = [ attr for attr in INSTANCE_DEFAULT_FIELDS <EOL> if attr in updates ] <EOL> if '<STR_LIT>' in updates : <EOL> updates [ '<STR_LIT>' ] = [ x . name for x in <EOL> updates [ '<STR_LIT>' ] ] <EOL> if '<STR_LIT>' in updates : <EOL> updates [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : updates [ '<STR_LIT>' ] . network_info . json ( ) <EOL> } <EOL> updates [ '<STR_LIT>' ] = { } <EOL> numa_topology = updates . pop ( '<STR_LIT>' , None ) <EOL> expected_attrs . append ( '<STR_LIT>' ) <EOL> if numa_topology : <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = numa_topology . _to_json ( ) <EOL> else : <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = None <EOL> pci_requests = updates . pop ( '<STR_LIT>' , None ) <EOL> expected_attrs . append ( '<STR_LIT>' ) <EOL> if pci_requests : <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = ( <EOL> pci_requests . to_json ( ) ) <EOL> else : <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = None <EOL> flavor = updates . pop ( '<STR_LIT>' , None ) <EOL> if flavor : <EOL> expected_attrs . append ( '<STR_LIT>' ) <EOL> old = ( ( self . obj_attr_is_set ( '<STR_LIT>' ) and <EOL> self . old_flavor ) and <EOL> self . old_flavor . obj_to_primitive ( ) or None ) <EOL> new = ( ( self . obj_attr_is_set ( '<STR_LIT>' ) and <EOL> self . new_flavor ) and <EOL> self . new_flavor . obj_to_primitive ( ) or None ) <EOL> flavor_info = { <EOL> '<STR_LIT>' : self . flavor . obj_to_primitive ( ) , <EOL> '<STR_LIT>' : old , <EOL> '<STR_LIT>' : new , <EOL> } <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = jsonutils . dumps ( flavor_info ) <EOL> vcpu_model = updates . pop ( '<STR_LIT>' , None ) <EOL> expected_attrs . append ( '<STR_LIT>' ) <EOL> if vcpu_model : <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = ( <EOL> jsonutils . dumps ( vcpu_model . obj_to_primitive ( ) ) ) <EOL> else : <EOL> updates [ '<STR_LIT>' ] [ '<STR_LIT>' ] = None <EOL> db_inst = db . instance_create ( self . _context , updates ) <EOL> self . _from_db_object ( self . _context , self , db_inst , expected_attrs ) <EOL> self . _load_ec2_ids ( ) <EOL> self . obj_reset_changes ( [ '<STR_LIT>' ] ) <EOL> @ base . remotable <EOL> def destroy ( self ) : <EOL> if not self . obj_attr_is_set ( '<STR_LIT:id>' ) : <EOL> raise exception . ObjectActionError ( action = '<STR_LIT>' , <EOL> reason = '<STR_LIT>' ) <EOL> if not self . obj_attr_is_set ( '<STR_LIT>' ) : <EOL> raise exception . ObjectActionError ( action = '<STR_LIT>' , <EOL> reason = '<STR_LIT>' ) <EOL> if not self . obj_attr_is_set ( '<STR_LIT:host>' ) or not self . host : <EOL> constraint = db . constraint ( host = db . equal_any ( None ) ) <EOL> else : <EOL> constraint = None <EOL> cell_type = cells_opts . get_cell_type ( ) <EOL> if cell_type is not None : <EOL> stale_instance = self . obj_clone ( ) <EOL> try : <EOL> db_inst = db . instance_destroy ( self . _context , self . uuid , <EOL> constraint = constraint ) <EOL> self . _from_db_object ( self . _context , self , db_inst ) <EOL> except exception . ConstraintNotMet : <EOL> raise exception . ObjectActionError ( action = '<STR_LIT>' , <EOL> reason = '<STR_LIT>' ) <EOL> if cell_type == '<STR_LIT>' : <EOL> cells_api = cells_rpcapi . CellsAPI ( ) <EOL> cells_api . instance_destroy_at_top ( self . _context , stale_instance ) <EOL> delattr ( self , base . get_attrname ( '<STR_LIT:id>' ) ) <EOL> def _save_info_cache ( self , context ) : <EOL> if self . info_cache : <EOL> with self . info_cache . obj_alternate_context ( context ) : <EOL> self . info_cache . save ( ) <EOL> def _save_security_groups ( self , context ) : <EOL> security_groups = self . security_groups or [ ] <EOL> for secgroup in security_groups : <EOL> with secgroup . obj_alternate_context ( context ) : <EOL> secgroup . save ( ) <EOL> self . security_groups . obj_reset_changes ( ) <EOL> def _save_fault ( self , context ) : <EOL> pass <EOL> def _save_numa_topology ( self , context ) : <EOL> if self . numa_topology : <EOL> self . numa_topology . instance_uuid = self . uuid <EOL> with self . numa_topology . obj_alternate_context ( context ) : <EOL> self . numa_topology . _save ( ) <EOL> else : <EOL> objects . InstanceNUMATopology . delete_by_instance_uuid ( <EOL> context , self . uuid ) <EOL> def _save_pci_requests ( self , context ) : <EOL> pass <EOL> def _save_pci_devices ( self , context ) : <EOL> pass <EOL> def _save_flavor ( self , context ) : <EOL> if not any ( [ x in self . obj_what_changed ( ) for x in <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) : <EOL> return <EOL> flavor_info = { <EOL> '<STR_LIT>' : self . flavor . obj_to_primitive ( ) , <EOL> '<STR_LIT>' : ( self . old_flavor and <EOL> self . old_flavor . obj_to_primitive ( ) or None ) , <EOL> '<STR_LIT>' : ( self . new_flavor and <EOL> self . new_flavor . obj_to_primitive ( ) or None ) , <EOL> } <EOL> db . instance_extra_update_by_uuid ( <EOL> context , self . uuid , <EOL> { '<STR_LIT>' : jsonutils . dumps ( flavor_info ) } ) <EOL> self . obj_reset_changes ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def _save_old_flavor ( self , context ) : <EOL> if '<STR_LIT>' in self . obj_what_changed ( ) : <EOL> self . _save_flavor ( context ) <EOL> def _save_new_flavor ( self , context ) : <EOL> if '<STR_LIT>' in self . obj_what_changed ( ) : <EOL> self . _save_flavor ( context ) <EOL> def _save_vcpu_model ( self , context ) : <EOL> if '<STR_LIT>' in self . obj_what_changed ( ) : <EOL> if self . vcpu_model : <EOL> update = jsonutils . dumps ( self . vcpu_model . obj_to_primitive ( ) ) <EOL> else : <EOL> update = None <EOL> db . instance_extra_update_by_uuid ( <EOL> context , self . uuid , <EOL> { '<STR_LIT>' : update } ) <EOL> def _save_ec2_ids ( self , context ) : <EOL> pass <EOL> def _save_migration_context ( self , context ) : <EOL> if self . migration_context : <EOL> self . migration_context . instance_uuid = self . uuid <EOL> with self . migration_context . obj_alternate_context ( context ) : <EOL> self . migration_context . _save ( ) <EOL> else : <EOL> objects . MigrationContext . _destroy ( context , self . uuid ) <EOL> @ base . remotable <EOL> def save ( self , expected_vm_state = None , <EOL> expected_task_state = None , admin_state_reset = False ) : <EOL> """<STR_LIT>""" <EOL> self . _sync_cells = not self . _cell_name_blocks_sync ( ) <EOL> context = self . _context <EOL> cell_type = cells_opts . get_cell_type ( ) <EOL> if cell_type is not None : <EOL> stale_instance = self . obj_clone ( ) <EOL> cells_update_from_api = ( cell_type == '<STR_LIT>' and self . cell_name and <EOL> self . _sync_cells ) <EOL> if cells_update_from_api : <EOL> def _handle_cell_update_from_api ( ) : <EOL> cells_api = cells_rpcapi . CellsAPI ( ) <EOL> cells_api . instance_update_from_api ( context , stale_instance , <EOL> expected_vm_state , <EOL> expected_task_state , <EOL> admin_state_reset ) <EOL> updates = { } <EOL> changes = self . obj_what_changed ( ) <EOL> for field in self . fields : <EOL> if ( self . obj_attr_is_set ( field ) and <EOL> isinstance ( self . fields [ field ] , fields . ObjectField ) ) : <EOL> try : <EOL> getattr ( self , '<STR_LIT>' % field ) ( context ) <EOL> except AttributeError : <EOL> LOG . exception ( _LE ( '<STR_LIT>' ) , field , <EOL> instance = self ) <EOL> except db_exc . DBReferenceError as exp : <EOL> if exp . key != '<STR_LIT>' : <EOL> raise <EOL> raise exception . InstanceNotFound ( instance_id = self . uuid ) <EOL> elif field in changes : <EOL> if ( field == '<STR_LIT>' and self [ field ] is not None and <EOL> self [ field ] . startswith ( cells_utils . BLOCK_SYNC_FLAG ) ) : <EOL> updates [ field ] = self [ field ] . replace ( <EOL> cells_utils . BLOCK_SYNC_FLAG , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> else : <EOL> updates [ field ] = self [ field ] <EOL> if not updates : <EOL> if cells_update_from_api : <EOL> _handle_cell_update_from_api ( ) <EOL> return <EOL> if '<STR_LIT>' in updates : <EOL> if updates [ '<STR_LIT>' ] : <EOL> updates [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> else : <EOL> updates [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> if expected_task_state is not None : <EOL> updates [ '<STR_LIT>' ] = expected_task_state <EOL> if expected_vm_state is not None : <EOL> updates [ '<STR_LIT>' ] = expected_vm_state <EOL> expected_attrs = [ attr for attr in _INSTANCE_OPTIONAL_JOINED_FIELDS <EOL> if self . obj_attr_is_set ( attr ) ] <EOL> if '<STR_LIT>' in expected_attrs : <EOL> expected_attrs . remove ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' not in expected_attrs : <EOL> expected_attrs . append ( '<STR_LIT>' ) <EOL> expected_attrs . append ( '<STR_LIT>' ) <EOL> old_ref , inst_ref = db . instance_update_and_get_original ( <EOL> context , self . uuid , updates , <EOL> columns_to_join = _expected_cols ( expected_attrs ) ) <EOL> self . _from_db_object ( context , self , inst_ref , <EOL> expected_attrs = expected_attrs ) <EOL> if cells_update_from_api : <EOL> _handle_cell_update_from_api ( ) <EOL> elif cell_type == '<STR_LIT>' : <EOL> if self . _sync_cells : <EOL> cells_api = cells_rpcapi . CellsAPI ( ) <EOL> cells_api . instance_update_at_top ( context , stale_instance ) <EOL> def _notify ( ) : <EOL> new_ref = self . obj_clone ( ) <EOL> notifications . send_update ( context , old_ref , new_ref ) <EOL> if not self . _sync_cells : <EOL> _notify = lambda : None <EOL> _notify ( ) <EOL> self . obj_reset_changes ( ) <EOL> @ base . remotable <EOL> def refresh ( self , use_slave = False ) : <EOL> extra = [ field for field in INSTANCE_OPTIONAL_ATTRS <EOL> if self . obj_attr_is_set ( field ) ] <EOL> current = self . __class__ . get_by_uuid ( self . _context , uuid = self . uuid , <EOL> expected_attrs = extra , <EOL> use_slave = use_slave ) <EOL> current . _context = None <EOL> for field in self . fields : <EOL> if self . obj_attr_is_set ( field ) : <EOL> if field == '<STR_LIT>' : <EOL> self . info_cache . refresh ( ) <EOL> elif self [ field ] != current [ field ] : <EOL> self [ field ] = current [ field ] <EOL> self . obj_reset_changes ( ) <EOL> def _load_generic ( self , attrname ) : <EOL> instance = self . __class__ . get_by_uuid ( self . _context , <EOL> uuid = self . uuid , <EOL> expected_attrs = [ attrname ] ) <EOL> if instance . obj_attr_is_set ( attrname ) : <EOL> self [ attrname ] = instance [ attrname ] <EOL> else : <EOL> raise exception . ObjectActionError ( <EOL> action = '<STR_LIT>' , <EOL> reason = '<STR_LIT>' % attrname ) <EOL> def _load_fault ( self ) : <EOL> self . fault = objects . InstanceFault . get_latest_for_instance ( <EOL> self . _context , self . uuid ) <EOL> def _load_numa_topology ( self , db_topology = None ) : <EOL> if db_topology is not None : <EOL> self . numa_topology = objects . InstanceNUMATopology . obj_from_db_obj ( self . uuid , <EOL> db_topology ) <EOL> else : <EOL> try : <EOL> self . numa_topology = objects . InstanceNUMATopology . get_by_instance_uuid ( <EOL> self . _context , self . uuid ) <EOL> except exception . NumaTopologyNotFound : <EOL> self . numa_topology = None <EOL> def _load_pci_requests ( self , db_requests = None ) : <EOL> if db_requests is not None : <EOL> self . pci_requests = objects . InstancePCIRequests . obj_from_db ( <EOL> self . _context , self . uuid , db_requests ) <EOL> else : <EOL> self . pci_requests = objects . InstancePCIRequests . get_by_instance_uuid ( <EOL> self . _context , self . uuid ) <EOL> def _load_flavor ( self ) : <EOL> instance = self . __class__ . get_by_uuid ( <EOL> self . _context , uuid = self . uuid , <EOL> expected_attrs = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> instance . _context = None <EOL> self . flavor = instance . flavor <EOL> self . old_flavor = instance . old_flavor <EOL> self . new_flavor = instance . new_flavor <EOL> instance . system_metadata . update ( self . get ( '<STR_LIT>' , { } ) ) <EOL> self . system_metadata = instance . system_metadata <EOL> def _load_vcpu_model ( self , db_vcpu_model = None ) : <EOL> if db_vcpu_model is None : <EOL> self . vcpu_model = objects . VirtCPUModel . get_by_instance_uuid ( <EOL> self . _context , self . uuid ) <EOL> else : <EOL> db_vcpu_model = jsonutils . loads ( db_vcpu_model ) <EOL> self . vcpu_model = objects . VirtCPUModel . obj_from_primitive ( <EOL> db_vcpu_model ) <EOL> def _load_ec2_ids ( self ) : <EOL> self . ec2_ids = objects . EC2Ids . get_by_instance ( self . _context , self ) <EOL> def _load_security_groups ( self ) : <EOL> self . security_groups = objects . SecurityGroupList . get_by_instance ( <EOL> self . _context , self ) <EOL> def _load_pci_devices ( self ) : <EOL> self . pci_devices = objects . PciDeviceList . get_by_instance_uuid ( <EOL> self . _context , self . uuid ) <EOL> def _load_migration_context ( self , db_context = _NO_DATA_SENTINEL ) : <EOL> if db_context is _NO_DATA_SENTINEL : <EOL> try : <EOL> self . migration_context = ( <EOL> objects . MigrationContext . get_by_instance_uuid ( <EOL> self . _context , self . uuid ) ) <EOL> except exception . MigrationContextNotFound : <EOL> self . migration_context = None <EOL> elif db_context is None : <EOL> self . migration_context = None <EOL> else : <EOL> self . migration_context = objects . MigrationContext . obj_from_db_obj ( <EOL> db_context ) <EOL> def apply_migration_context ( self ) : <EOL> if self . migration_context : <EOL> self . numa_topology = self . migration_context . new_numa_topology <EOL> else : <EOL> LOG . debug ( "<STR_LIT>" <EOL> "<STR_LIT>" , instance = self ) <EOL> def revert_migration_context ( self ) : <EOL> if self . migration_context : <EOL> self . numa_topology = self . migration_context . old_numa_topology <EOL> else : <EOL> LOG . debug ( "<STR_LIT>" <EOL> "<STR_LIT>" , instance = self ) <EOL> @ contextlib . contextmanager <EOL> def mutated_migration_context ( self ) : <EOL> """<STR_LIT>""" <EOL> current_numa_topo = self . numa_topology <EOL> self . apply_migration_context ( ) <EOL> try : <EOL> yield <EOL> finally : <EOL> self . numa_topology = current_numa_topo <EOL> @ base . remotable <EOL> def drop_migration_context ( self ) : <EOL> if self . migration_context : <EOL> objects . MigrationContext . _destroy ( self . _context , self . uuid ) <EOL> self . migration_context = None <EOL> def clear_numa_topology ( self ) : <EOL> numa_topology = self . numa_topology <EOL> if numa_topology is not None : <EOL> self . numa_topology = numa_topology . clear_host_pinning ( ) <EOL> def obj_load_attr ( self , attrname ) : <EOL> if attrname not in INSTANCE_OPTIONAL_ATTRS : <EOL> raise exception . ObjectActionError ( <EOL> action = '<STR_LIT>' , <EOL> reason = '<STR_LIT>' % attrname ) <EOL> if not self . _context : <EOL> raise exception . OrphanedObjectError ( method = '<STR_LIT>' , <EOL> objtype = self . obj_name ( ) ) <EOL> LOG . debug ( "<STR_LIT>" , <EOL> { '<STR_LIT>' : attrname , <EOL> '<STR_LIT:name>' : self . obj_name ( ) , <EOL> '<STR_LIT>' : self . uuid , <EOL> } ) <EOL> if attrname == '<STR_LIT>' : <EOL> self . _load_fault ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_numa_topology ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_pci_requests ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_vcpu_model ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_ec2_ids ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_migration_context ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_security_groups ( ) <EOL> elif attrname == '<STR_LIT>' : <EOL> self . _load_pci_devices ( ) <EOL> elif '<STR_LIT>' in attrname : <EOL> self . _load_flavor ( ) <EOL> elif attrname == '<STR_LIT>' and self . deleted : <EOL> self . services = objects . ServiceList ( self . _context ) <EOL> else : <EOL> self . _load_generic ( attrname ) <EOL> self . obj_reset_changes ( [ attrname ] ) <EOL> def get_flavor ( self , namespace = None ) : <EOL> prefix = ( '<STR_LIT>' % namespace ) if namespace is not None else '<STR_LIT>' <EOL> attr = '<STR_LIT>' % prefix <EOL> try : <EOL> return getattr ( self , attr ) <EOL> except exception . FlavorNotFound : <EOL> return None <EOL> @ base . remotable <EOL> def delete_metadata_key ( self , key ) : <EOL> """<STR_LIT>""" <EOL> db . instance_metadata_delete ( self . _context , self . uuid , key ) <EOL> md_was_changed = '<STR_LIT>' in self . obj_what_changed ( ) <EOL> del self . metadata [ key ] <EOL> self . _orig_metadata . pop ( key , None ) <EOL> notifications . send_update ( self . _context , self , self ) <EOL> if not md_was_changed : <EOL> self . obj_reset_changes ( [ '<STR_LIT>' ] ) <EOL> def _cell_name_blocks_sync ( self ) : <EOL> if ( self . obj_attr_is_set ( '<STR_LIT>' ) and <EOL> self . cell_name is not None and <EOL> self . cell_name . startswith ( cells_utils . BLOCK_SYNC_FLAG ) ) : <EOL> return True <EOL> return False <EOL> def _normalize_cell_name ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . obj_attr_is_set ( '<STR_LIT>' ) or self . cell_name is None : <EOL> return <EOL> cn_changed = '<STR_LIT>' in self . obj_what_changed ( ) <EOL> if self . cell_name . startswith ( cells_utils . BLOCK_SYNC_FLAG ) : <EOL> self . cell_name = self . cell_name . replace ( <EOL> cells_utils . BLOCK_SYNC_FLAG , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if len ( self . cell_name ) == <NUM_LIT:0> : <EOL> self . cell_name = None <EOL> if not cn_changed : <EOL> self . obj_reset_changes ( [ '<STR_LIT>' ] ) <EOL> @ contextlib . contextmanager <EOL> def skip_cells_sync ( self ) : <EOL> """<STR_LIT>""" <EOL> cn_changed = '<STR_LIT>' in self . obj_what_changed ( ) <EOL> if not self . obj_attr_is_set ( '<STR_LIT>' ) or self . cell_name is None : <EOL> self . cell_name = '<STR_LIT>' <EOL> self . cell_name = '<STR_LIT>' % ( cells_utils . BLOCK_SYNC_FLAG , self . cell_name ) <EOL> if not cn_changed : <EOL> self . obj_reset_changes ( [ '<STR_LIT>' ] ) <EOL> try : <EOL> yield <EOL> finally : <EOL> self . _normalize_cell_name ( ) <EOL> def _make_instance_list ( context , inst_list , db_inst_list , expected_attrs ) : <EOL> get_fault = expected_attrs and '<STR_LIT>' in expected_attrs <EOL> inst_faults = { } <EOL> if get_fault : <EOL> expected_attrs . remove ( '<STR_LIT>' ) <EOL> instance_uuids = [ inst [ '<STR_LIT>' ] for inst in db_inst_list ] <EOL> faults = objects . InstanceFaultList . get_by_instance_uuids ( <EOL> context , instance_uuids ) <EOL> for fault in faults : <EOL> if fault . instance_uuid not in inst_faults : <EOL> inst_faults [ fault . instance_uuid ] = fault <EOL> inst_cls = objects . Instance <EOL> inst_list . objects = [ ] <EOL> for db_inst in db_inst_list : <EOL> inst_obj = inst_cls . _from_db_object ( <EOL> context , inst_cls ( context ) , db_inst , <EOL> expected_attrs = expected_attrs ) <EOL> if get_fault : <EOL> inst_obj . fault = inst_faults . get ( inst_obj . uuid , None ) <EOL> inst_list . objects . append ( inst_obj ) <EOL> inst_list . obj_reset_changes ( ) <EOL> return inst_list <EOL> @ base . NovaObjectRegistry . register <EOL> class InstanceList ( base . ObjectListBase , base . NovaObject ) : <EOL> VERSION = '<STR_LIT>' <EOL> fields = { <EOL> '<STR_LIT>' : fields . ListOfObjectsField ( '<STR_LIT>' ) , <EOL> } <EOL> @ classmethod <EOL> @ db . select_db_reader_mode <EOL> def _get_by_filters_impl ( cls , context , filters , <EOL> sort_key = '<STR_LIT>' , sort_dir = '<STR_LIT>' , limit = None , <EOL> marker = None , expected_attrs = None , use_slave = False , <EOL> sort_keys = None , sort_dirs = None ) : <EOL> if sort_keys or sort_dirs : <EOL> db_inst_list = db . instance_get_all_by_filters_sort ( <EOL> context , filters , limit = limit , marker = marker , <EOL> columns_to_join = _expected_cols ( expected_attrs ) , <EOL> sort_keys = sort_keys , sort_dirs = sort_dirs ) <EOL> else : <EOL> db_inst_list = db . instance_get_all_by_filters ( <EOL> context , filters , sort_key , sort_dir , limit = limit , <EOL> marker = marker , columns_to_join = _expected_cols ( expected_attrs ) ) <EOL> return _make_instance_list ( context , cls ( ) , db_inst_list , <EOL> expected_attrs ) <EOL> @ base . remotable_classmethod <EOL> def get_by_filters ( cls , context , filters , <EOL> sort_key = '<STR_LIT>' , sort_dir = '<STR_LIT>' , limit = None , <EOL> marker = None , expected_attrs = None , use_slave = False , <EOL> sort_keys = None , sort_dirs = None ) : <EOL> return cls . _get_by_filters_impl ( <EOL> context , filters , sort_key = sort_key , sort_dir = sort_dir , <EOL> limit = limit , marker = marker , expected_attrs = expected_attrs , <EOL> use_slave = use_slave , sort_keys = sort_keys , sort_dirs = sort_dirs ) <EOL> @ staticmethod <EOL> @ db . select_db_reader_mode <EOL> def _db_instance_get_all_by_host ( context , host , columns_to_join , <EOL> use_slave = False ) : <EOL> return db . instance_get_all_by_host ( context , host , <EOL> columns_to_join = columns_to_join ) <EOL> @ base . remotable_classmethod <EOL> def get_by_host ( cls , context , host , expected_attrs = None , use_slave = False ) : <EOL> db_inst_list = cls . _db_instance_get_all_by_host ( <EOL> context , host , columns_to_join = _expected_cols ( expected_attrs ) , <EOL> use_slave = use_slave ) <EOL> return _make_instance_list ( context , cls ( ) , db_inst_list , <EOL> expected_attrs ) <EOL> @ base . remotable_classmethod <EOL> def get_by_host_and_node ( cls , context , host , node , expected_attrs = None ) : <EOL> db_inst_list = db . instance_get_all_by_host_and_node ( <EOL> context , host , node , <EOL> columns_to_join = _expected_cols ( expected_attrs ) ) <EOL> return _make_instance_list ( context , cls ( ) , db_inst_list , <EOL> expected_attrs ) <EOL> @ base . remotable_classmethod <EOL> def get_by_host_and_not_type ( cls , context , host , type_id = None , <EOL> expected_attrs = None ) : <EOL> db_inst_list = db . instance_get_all_by_host_and_not_type ( <EOL> context , host , type_id = type_id ) <EOL> return _make_instance_list ( context , cls ( ) , db_inst_list , <EOL> expected_attrs ) <EOL> @ base . remotable_classmethod <EOL> def get_all ( cls , context , expected_attrs = None ) : <EOL> """<STR_LIT>""" <EOL> db_instances = db . instance_get_all ( <EOL> context , columns_to_join = _expected_cols ( expected_attrs ) ) <EOL> return _make_instance_list ( context , cls ( ) , db_instances , <EOL> expected_attrs ) <EOL> @ base . remotable_classmethod <EOL> def get_hung_in_rebooting ( cls , context , reboot_window , <EOL> expected_attrs = None ) : <EOL> db_inst_list = db . instance_get_all_hung_in_rebooting ( context , <EOL> reboot_window ) <EOL> return _make_instance_list ( context , cls ( ) , db_inst_list , <EOL> expected_attrs ) <EOL> @ staticmethod <EOL> @ db . select_db_reader_mode <EOL> def _db_instance_get_active_by_window_joined ( <EOL> context , begin , end , project_id , host , columns_to_join , <EOL> use_slave = False ) : <EOL> return db . instance_get_active_by_window_joined ( <EOL> context , begin , end , project_id , host , <EOL> columns_to_join = columns_to_join ) <EOL> @ base . remotable_classmethod <EOL> def _get_active_by_window_joined ( cls , context , begin , end = None , <EOL> project_id = None , host = None , <EOL> expected_attrs = None , <EOL> use_slave = False ) : <EOL> begin = timeutils . parse_isotime ( begin ) <EOL> end = timeutils . parse_isotime ( end ) if end else None <EOL> db_inst_list = cls . _db_instance_get_active_by_window_joined ( <EOL> context , begin , end , project_id , host , <EOL> columns_to_join = _expected_cols ( expected_attrs ) , <EOL> use_slave = use_slave ) <EOL> return _make_instance_list ( context , cls ( ) , db_inst_list , <EOL> expected_attrs ) <EOL> @ classmethod <EOL> def get_active_by_window_joined ( cls , context , begin , end = None , <EOL> project_id = None , host = None , <EOL> expected_attrs = None , <EOL> use_slave = False ) : <EOL> """<STR_LIT>""" <EOL> begin = utils . isotime ( begin ) <EOL> end = utils . isotime ( end ) if end else None <EOL> return cls . _get_active_by_window_joined ( context , begin , end , <EOL> project_id , host , <EOL> expected_attrs , <EOL> use_slave = use_slave ) <EOL> @ base . remotable_classmethod <EOL> def get_by_security_group_id ( cls , context , security_group_id ) : <EOL> db_secgroup = db . security_group_get ( <EOL> context , security_group_id , <EOL> columns_to_join = [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return _make_instance_list ( context , cls ( ) , db_secgroup [ '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> @ classmethod <EOL> def get_by_security_group ( cls , context , security_group ) : <EOL> return cls . get_by_security_group_id ( context , security_group . id ) <EOL> @ base . remotable_classmethod <EOL> def get_by_grantee_security_group_ids ( cls , context , security_group_ids ) : <EOL> db_instances = db . instance_get_all_by_grantee_security_groups ( <EOL> context , security_group_ids ) <EOL> return _make_instance_list ( context , cls ( ) , db_instances , [ ] ) <EOL> def fill_faults ( self ) : <EOL> """<STR_LIT>""" <EOL> uuids = [ inst . uuid for inst in self ] <EOL> faults = objects . InstanceFaultList . get_by_instance_uuids ( <EOL> self . _context , uuids ) <EOL> faults_by_uuid = { } <EOL> for fault in faults : <EOL> if fault . instance_uuid not in faults_by_uuid : <EOL> faults_by_uuid [ fault . instance_uuid ] = fault <EOL> for instance in self : <EOL> if instance . uuid in faults_by_uuid : <EOL> instance . fault = faults_by_uuid [ instance . uuid ] <EOL> else : <EOL> instance . fault = None <EOL> instance . obj_reset_changes ( [ '<STR_LIT>' ] ) <EOL> return faults_by_uuid . keys ( ) </s>
