<s> from oslo_serialization import jsonutils <EOL> from nova import db <EOL> from nova . objects import base <EOL> from nova . objects import fields <EOL> @ base . NovaObjectRegistry . register <EOL> class VirtCPUModel ( base . NovaObject ) : <EOL> VERSION = '<STR_LIT:1.0>' <EOL> fields = { <EOL> '<STR_LIT>' : fields . ArchitectureField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . ObjectField ( '<STR_LIT>' , <EOL> nullable = True ) , <EOL> '<STR_LIT>' : fields . ListOfObjectsField ( "<STR_LIT>" , <EOL> default = [ ] ) , <EOL> '<STR_LIT>' : fields . CPUModeField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . StringField ( nullable = True ) , <EOL> '<STR_LIT>' : fields . CPUMatchField ( nullable = True ) , <EOL> } <EOL> def obj_load_attr ( self , attrname ) : <EOL> setattr ( self , attrname , None ) <EOL> def to_json ( self ) : <EOL> return jsonutils . dumps ( self . obj_to_primitive ( ) ) <EOL> @ classmethod <EOL> def from_json ( cls , jsonstr ) : <EOL> return cls . obj_from_primitive ( jsonutils . loads ( jsonstr ) ) <EOL> @ base . remotable_classmethod <EOL> def get_by_instance_uuid ( cls , context , instance_uuid ) : <EOL> db_extra = db . instance_extra_get_by_instance_uuid ( <EOL> context , instance_uuid , columns = [ '<STR_LIT>' ] ) <EOL> if not db_extra or not db_extra [ '<STR_LIT>' ] : <EOL> return None <EOL> return cls . obj_from_primitive ( jsonutils . loads ( db_extra [ '<STR_LIT>' ] ) ) <EOL> @ base . NovaObjectRegistry . register <EOL> class VirtCPUFeature ( base . NovaObject ) : <EOL> VERSION = '<STR_LIT:1.0>' <EOL> fields = { <EOL> '<STR_LIT>' : fields . CPUFeaturePolicyField ( nullable = True ) , <EOL> '<STR_LIT:name>' : fields . StringField ( nullable = False ) , <EOL> } <EOL> def obj_load_attr ( self , attrname ) : <EOL> setattr ( self , attrname , None ) </s>
