예제 #1
0
    def _initialize_tests(self):
        """Perform final initialization before tests get run."""
        # Access the sentries for inspecting service units
        self.aodh_sentry = self.d.sentry['aodh'][0]
        self.pxc_sentry = self.d.sentry['percona-cluster'][0]
        self.keystone_sentry = self.d.sentry['keystone'][0]
        self.rabbitmq_sentry = self.d.sentry['rabbitmq-server'][0]
        self.mongodb_sentry = self.d.sentry['mongodb'][0]
        self.ceil_sentry = self.d.sentry['ceilometer'][0]
        u.log.debug('openstack release val: {}'.format(
            self._get_openstack_release()))
        u.log.debug('openstack release str: {}'.format(
            self._get_openstack_release_string()))

        # Authenticate admin with keystone endpoint
        self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
                                                      user='******',
                                                      password='******',
                                                      tenant='admin')

        # Authenticate admin with aodh endpoint
        aodh_ep = self.keystone.service_catalog.url_for(
            service_type='alarming', endpoint_type='publicURL')

        keystone_ep = self.keystone.service_catalog.url_for(
            service_type='identity', endpoint_type='publicURL')

        auth = keystone_identity.V2Token(auth_url=keystone_ep,
                                         token=self.keystone.auth_token)
        sess = keystone_session.Session(auth=auth)
        self.aodh = aodh_client.Client(version=2,
                                       session=sess,
                                       endpoint_override=aodh_ep)
예제 #2
0
    def _initialize_tests(self):
        """Perform final initialization before tests get run."""
        # Access the sentries for inspecting service units
        self.aodh_sentry = self.d.sentry['aodh'][0]
        self.pxc_sentry = self.d.sentry['percona-cluster'][0]
        self.keystone_sentry = self.d.sentry['keystone'][0]
        self.rabbitmq_sentry = self.d.sentry['rabbitmq-server'][0]
        self.ceil_sentry = self.d.sentry['ceilometer'][0]
        u.log.debug('openstack release val: {}'.format(
            self._get_openstack_release()))
        u.log.debug('openstack release str: {}'.format(
            self._get_openstack_release_string()))

        # Authenticate admin with keystone endpoint
        self.keystone_session, self.keystone = u.get_default_keystone_session(
            self.keystone_sentry,
            openstack_release=self._get_openstack_release())

        # Authenticate admin with aodh endpoint
        aodh_ep = self.keystone.service_catalog.url_for(
            service_type='alarming', interface='publicURL')

        self.aodh = aodh_client.Client(version=2,
                                       session=self.keystone_session,
                                       endpoint_override=aodh_ep)
예제 #3
0
파일: aodh.py 프로젝트: zzjeric/heat
    def _create(self, version=None):
        interface = self._get_client_option(CLIENT_NAME, 'endpoint_type')

        return ac.Client(version,
                         session=self.context.keystone_session,
                         interface=interface,
                         service_type=self.ALARMING,
                         region_name=self._get_region_name())
예제 #4
0
    def _create(self, version=None):

        interface = self._get_client_option(CLIENT_NAME, 'endpoint_type')

        self._keystone_session.auth = self.context.auth_plugin
        return ac.Client(version,
                         session=self._keystone_session,
                         interface=interface,
                         service_type=self.ALARMING)
예제 #5
0
 def __init__(self, params):
     super(AodhClient, self).__init__(params)
     self.params = params
     loader = loading.get_plugin_loader('password')
     auth = loader.load_from_options(**self.aodh_credential)
     sess = session.Session(auth)
     version = self.params.get('version', 2)
     self.aodhclient = aodhclient.Client(version, sess)
     self.alarm_utils = self.aodhclient.alarm
예제 #6
0
 def __init__(self, name='', args=None):
     super(AodhDriver, self).__init__(name, args=args)
     datasource_driver.ExecutionDriver.__init__(self)
     session = ds_utils.get_keystone_session(args)
     endpoint = session.get_endpoint(service_type='alarming',
                                     interface='publicURL')
     self.aodh_client = aodh_client.Client(version='2',
                                           session=session,
                                           endpoint_override=endpoint)
     self.add_executable_client_methods(self.aodh_client, 'aodhclient.v2.')
     self.initialize_update_method()
     self._init_end_start_poll()
예제 #7
0
    def __init__(self, conf, session_id, data):
        Thread.__init__(self)
        self.conf = conf
        self.session_id = session_id
        self.stopped = False
        self.thg = threadgroup.ThreadGroup()
        self.timer = {}
        self.session = self._init_session(data)
        self.hosts = []
        if "hosts" in data and data['hosts']:
            # Hosts given as input, not to be discovered in workflow
            self.hosts = self.init_hosts(self.convert(data['hosts']))
        else:
            LOG.info('%s: No hosts as input' % self.session_id)
        if "actions" in data:
            self.actions = self._init_action_plugins(data["actions"])
        else:
            self.actions = []
        self.projects = []
        self.instances = []
        self.proj_instance_actions = {}

        self.states_methods = {'MAINTENANCE': 'maintenance',
                               'SCALE_IN': 'scale_in',
                               'PREPARE_MAINTENANCE': 'prepare_maintenance',
                               'START_MAINTENANCE': 'start_maintenance',
                               'PLANNED_MAINTENANCE': 'planned_maintenance',
                               'MAINTENANCE_COMPLETE': 'maintenance_complete',
                               'MAINTENANCE_DONE': 'maintenance_done',
                               'MAINTENANCE_FAILED': 'maintenance_failed'}
        self.url = "http://%s:%s" % (conf.host, conf.port)
        self.auth = get_identity_auth(conf.workflow_user,
                                      conf.workflow_password,
                                      conf.workflow_project)
        self.auth_session = get_session(auth=self.auth)
        self.aodh = aodhclient.Client('2', self.auth_session)
        transport = messaging.get_transport(self.conf)
        self.notif_proj = messaging.Notifier(transport,
                                             'maintenance.planned',
                                             driver='messaging',
                                             topics=['notifications'])
        self.notif_proj = self.notif_proj.prepare(publisher_id='fenix')
        self.notif_admin = messaging.Notifier(transport,
                                              'maintenance.host',
                                              driver='messaging',
                                              topics=['notifications'])
        self.notif_admin = self.notif_admin.prepare(publisher_id='fenix')
예제 #8
0
    def client(self):
        # NOTE(sileht): we lazy load the client to not
        # load/connect auth stuffs
        if self._client is None:
            if hasattr(self.options, "endpoint"):
                endpoint_override = self.options.endpoint
            else:
                endpoint_override = None
            auth_plugin = loading.load_auth_from_argparse_arguments(
                self.options)
            session = loading.load_session_from_argparse_arguments(
                self.options, auth=auth_plugin)

            self._client = client.Client(self.options.aodh_api_version,
                                         session=session,
                                         interface=self.options.interface,
                                         region_name=self.options.region_name,
                                         endpoint_override=endpoint_override)
        return self._client
예제 #9
0
def aodh_client(version, session):
    return aodhclient.Client(version, session=session)