Exemple #1
0
 def _get_vnffg_db(self, context, vnffg_id, current_statuses, new_status):
     try:
         vnffg_db = (self._model_query(context, Vnffg).filter(
             Vnffg.id == vnffg_id).filter(Vnffg.status.in_(
                 current_statuses)).with_lockmode('update').one())
     except orm_exc.NoResultFound:
         raise nfvo.VnffgNotFoundException(vnffg_id=vnffg_id)
     if vnffg_db.status == constants.PENDING_UPDATE:
         raise nfvo.VnffgInUse(vnffg_id=vnffg_id)
     vnffg_db.update({'status': new_status})
     return vnffg_db
Exemple #2
0
 def _get_resource(self, context, model, res_id):
     try:
         return self._get_by_id(context, model, res_id)
     except orm_exc.NoResultFound:
         if issubclass(model, Vnffg):
             raise nfvo.VnffgNotFoundException(vnffg_id=res_id)
         elif issubclass(model, VnffgClassifier):
             raise nfvo.ClassifierNotFoundException(classifier_id=res_id)
         if issubclass(model, VnffgTemplate):
             raise nfvo.VnffgdNotFoundException(vnffgd_id=res_id)
         if issubclass(model, VnffgChain):
             raise nfvo.SfcNotFoundException(sfc_id=res_id)
         else:
             raise