コード例 #1
0
 def _get_resource(self, resource_type, resource_id):
     try:
         resource = getattr(self.neutron_client,
                            'show_%s' % resource_type)(resource_id)
         return getattr(utils, 'convert_%s_dict_to_model' %
                        resource_type)(resource)
     except neutron_client_exceptions.NotFound:
         message = _('{resource_type} not found '
                     '({resource_type} id: {resource_id}).').format(
                         resource_type=resource_type,
                         resource_id=resource_id)
         raise getattr(
             base, '%sNotFound' %
             ''.join([w.capitalize()
                      for w in resource_type.split('_')]))(message)
     except Exception:
         message = _('Error retrieving {resource_type} '
                     '({resource_type} id: {resource_id}.').format(
                         resource_type=resource_type,
                         resource_id=resource_id)
         LOG.exception(message)
         raise base.NetworkException(message)
コード例 #2
0
 def _check_aap_loaded(self):
     if not self._check_extension_enabled(AAP_EXT_ALIAS):
         raise base.NetworkException(
             'The {alias} extension is not enabled in neutron.  This '
             'driver cannot be used with the {alias} extension '
             'disabled.'.format(alias=AAP_EXT_ALIAS))