def get_int_id_from_instance_uuid(context, instance_uuid): if instance_uuid is None: return try: return db.get_ec2_instance_id_by_uuid(context, instance_uuid) except exception.NotFound: return db.ec2_instance_create(context, instance_uuid)['id']
def create(self, context): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') db_imap = db.ec2_instance_create(context, self.uuid) self._from_db_object(context, self, db_imap)