Compare commits

..

18 Commits

Author SHA1 Message Date
OpenDev Sysadmins
5307f5a80e OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:40:46 +00:00
Ian Wienand
b5467a2a1f Replace openstack.org git:// URLs with https://
This is a mechanically generated change to replace openstack.org
git:// URLs with https:// equivalents.

This is in aid of a planned future move of the git hosting
infrastructure to a self-hosted instance of gitea (https://gitea.io),
which does not support the git wire protocol at this stage.

This update should result in no functional change.

For more information see the thread at

 http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003825.html

Change-Id: I886b29ba8a1814cf876e70b5b20504a221d32fa1
2019-03-24 20:36:26 +00:00
Alexander Chadin
83411ec89f Fix stop_watcher function
Apache should be reloaded after watcher-api is disabled.

Change-Id: Ifee0e7701849348630568aa36b3f3c4c62d3382e
2018-12-10 13:55:44 +00:00
licanwei
08750536e7 optimize get_instances_by_node
We can set host filed in search_opts.
refer to:
https://developer.openstack.org/api-ref/compute/?expanded=list-servers-detail#list-servers

Change-Id: I36b27167d7223f3bf6bb05995210af41ad01fc6d
2018-11-06 13:39:14 +00:00
Tatiana Kholkina
9f7ccfe408 Use limit -1 for nova servers list
By default nova has a limit for returned items in a single response [1].
We should pass limit=-1 to get all items.

[1] https://docs.openstack.org/nova/rocky/configuration/config.html

Change-Id: I1fabd909c4c0356ef5fcb7c51718fb4513e6befa
2018-10-16 08:37:45 +00:00
Tatiana Kholkina
fb2619e538 Provide region name while initialize clients
Add new option 'region_name' to config for each client section.

Change-Id: Ifad8908852f4be69dd294a4c4ab28d2e1df265e8
Closes-Bug: #1787937
(cherry picked from commit 925b971377)
2018-09-21 12:31:04 +00:00
Nguyen Hai
6bd857fa0e import zuul job settings from project-config
This is a mechanically generated patch to complete step 1 of moving
the zuul job settings out of project-config and into each project
repository.

Because there will be a separate patch on each branch, the branch
specifiers for branch-specific jobs have been removed.

Because this patch is generated by a script, there may be some
cosmetic changes to the layout of the YAML file(s) as the contents are
normalized.

See the python3-first goal document for details:
https://governance.openstack.org/tc/goals/stein/python3-first.html

Change-Id: I35a8ce3dc54cb662ee9154e343cf50fe96f64807
Story: #2002586
Task: #24344
2018-08-19 00:59:08 +09:00
Clark Boylan
e0faeea608 Remove undefined job
The legacy-rally-dsvm-watcher-rally job does not exist but it is listed
in the .zuul.yaml config. This is a zuul configuration error. Remove
this job which does not exist to fix zuul.

Change-Id: I1bbfd373ad12b98696ab2ddb78e56e6503cc4c4d
2018-07-03 13:27:12 -07:00
Zuul
61aca40e6e Merge "Update auth_uri option to www_authenticate_uri" into stable/queens 2018-06-05 07:49:22 +00:00
caoyuan
b293389734 Delete the unnecessary '-'
fix a typo

Change-Id: I4ecdb827d94ef0ae88e2f37db9d1a53525140947
(cherry picked from commit 4844baa816)
2018-05-16 05:03:45 +00:00
caoyuan
050e6d58f1 Update auth_uri option to www_authenticate_uri
Option auth_uri from group keystone_authtoken is deprecated in Queens [1].
Use option www_authenticate_uri from group keystone_authtoken.

[1]https://review.openstack.org/#/c/508522/

Change-Id: I2ef330d7f9b632e9a81d22a8edec3c88eb532ff5
(cherry picked from commit 8c916930c8)
2018-05-15 07:57:53 +00:00
Zuul
7223d35c47 Merge "Imported Translations from Zanata" into stable/queens 2018-03-06 05:30:53 +00:00
Zuul
57f1971982 Merge "Add a hacking rule for string interpolation at logging" into stable/queens 2018-03-06 02:42:13 +00:00
OpenStack Proposal Bot
c9b2b2aa39 Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: Ia00d11dd76a27a5c052c7a512cadaefa168d0340
2018-03-03 07:22:16 +00:00
Andreas Jaeger
a42c31c221 Fix exception string format
The string %(action) is not valid, it misses the conversion specified,
add s for string.

Note that this leads to an untranslatable string, since our translation
tools check for valid formats and fail. In this case the failure comes
from a source code fail.

Change-Id: I2e630928dc32542a8a7c02657a9f0ab1eaab62ff
2018-03-02 20:57:41 +00:00
ForestLee
403ec94bc1 Add a hacking rule for string interpolation at logging
String interpolation should be delayed to be handled by
the logging code, rather than being done at the point
of the logging call.
See the oslo i18n guideline
* https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages
and
* https://github.com/openstack-dev/hacking/blob/master/hacking/checks/other.py#L39
Closes-Bug: #1596829

Change-Id: Ibba5791669c137be1483805db657beb907030227
2018-02-28 12:13:10 +00:00
OpenStack Release Bot
3431b77388 Update UPPER_CONSTRAINTS_FILE for stable/queens
The new stable upper-constraints file is only available
after the openstack/requirements repository is branched.
This will happen around the RC1 timeframe.

Recheck and merge this change once the requirements
repository has been branched.

The CI system will work with this patch before the requirements
repository is branched because zuul configues the job to run
with a local copy of the file and defaults to the master branch.
However, accepting the patch will break the test configuration
on developers' local systems, so please wait until after the
requirements repository is branched to merge the patch.

Change-Id: I8ec196a62e7c0146f25045e643073f414ae69249
2018-02-08 16:34:03 +00:00
OpenStack Release Bot
eb4cacc00e Update .gitreview for stable/queens
Change-Id: I4ac0da37285c34471654bb5125c034b415c6031d
2018-02-08 16:33:58 +00:00
584 changed files with 8826 additions and 24675 deletions

6
.gitignore vendored
View File

@@ -23,10 +23,11 @@ pip-log.txt
# Unit test / coverage reports
.coverage*
.tox
nosetests.xml
.stestr/
.testrepository
.venv
.idea
.testrepository/
# Translations
*.mo
@@ -75,6 +76,3 @@ releasenotes/build
# Autogenerated sample config file
etc/watcher/watcher.conf.sample
# Atom
.remote-sync.json

View File

@@ -2,3 +2,4 @@
host=review.opendev.org
port=29418
project=openstack/watcher.git
defaultbranch=stable/queens

View File

@@ -1,4 +1,4 @@
[DEFAULT]
test_path=./watcher/tests
test_path=${OS_TEST_PATH:-./watcher/tests}
top_dir=./

7
.testr.conf Normal file
View File

@@ -0,0 +1,7 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./watcher/tests} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@@ -1,207 +1,45 @@
- project:
templates:
- openstack-python-jobs
- openstack-python35-jobs
- publish-openstack-sphinx-docs
- check-requirements
- openstack-cover-jobs
- openstack-python3-yoga-jobs
- publish-openstack-docs-pti
- release-notes-jobs-python3
- release-notes-jobs
check:
jobs:
- watcher-tempest-functional
- watcher-grenade
- watcher-tempest-strategies
- watcher-tempest-actuator
- watcherclient-tempest-functional
- watcher-tempest-functional-ipv6-only
- watcher-tempest-multinode
gate:
queue: watcher
jobs:
- watcher-tempest-functional
- watcher-tempest-functional-ipv6-only
- job:
name: watcher-tempest-dummy_optim
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_dummy_optim
- job:
name: watcher-tempest-actuator
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_actuator
- job:
name: watcher-tempest-basic_optim
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_basic_optim
- job:
name: watcher-tempest-vm_workload_consolidation
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_vm_workload_consolidation
devstack_local_conf:
test-config:
$WATCHER_CONFIG:
watcher_strategies.vm_workload_consolidation:
datasource: ceilometer
- job:
name: watcher-tempest-workload_balancing
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_workload_balancing
- job:
name: watcher-tempest-zone_migration
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_zone_migration
- job:
name: watcher-tempest-host_maintenance
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_host_maintenance
- job:
name: watcher-tempest-storage_balance
parent: watcher-tempest-multinode
vars:
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_storage_balance
devstack_local_conf:
test-config:
$TEMPEST_CONFIG:
volume:
backend_names: ['BACKEND_1', 'BACKEND_2']
volume-feature-enabled:
multi_backend: true
- job:
name: watcher-tempest-strategies
parent: watcher-tempest-multinode
vars:
tempest_concurrency: 1
tempest_test_regex: watcher_tempest_plugin.tests.scenario.test_execute_strategies
- job:
name: watcher-tempest-multinode
parent: watcher-tempest-functional
nodeset: openstack-two-node-focal
roles:
- zuul: openstack/tempest
group-vars:
subnode:
devstack_local_conf:
post-config:
$WATCHER_CONF:
watcher_cluster_data_model_collectors.compute:
period: 120
watcher_cluster_data_model_collectors.baremetal:
period: 120
watcher_cluster_data_model_collectors.storage:
period: 120
devstack_services:
watcher-api: false
watcher-decision-engine: true
watcher-applier: false
ceilometer: false
ceilometer-acompute: false
ceilometer-acentral: false
ceilometer-anotification: false
watcher: false
gnocchi-api: false
gnocchi-metricd: false
rabbit: false
mysql: false
vars:
devstack_local_conf:
post-config:
$WATCHER_CONF:
watcher_cluster_data_model_collectors.compute:
period: 120
watcher_cluster_data_model_collectors.baremetal:
period: 120
watcher_cluster_data_model_collectors.storage:
period: 120
test-config:
$TEMPEST_CONFIG:
compute:
min_compute_nodes: 2
min_microversion: 2.56
compute-feature-enabled:
live_migration: true
block_migration_for_live_migration: true
placement:
min_microversion: 1.29
devstack_plugins:
ceilometer: https://opendev.org/openstack/ceilometer
- job:
name: watcher-tempest-functional
parent: devstack-tempest
timeout: 7200
required-projects: &base_required_projects
- openstack/ceilometer
name: watcher-tempest-base-multinode
parent: legacy-dsvm-base-multinode
run: playbooks/legacy/watcher-tempest-base-multinode/run.yaml
post-run: playbooks/legacy/watcher-tempest-base-multinode/post.yaml
timeout: 4200
required-projects:
- openstack/devstack-gate
- openstack/python-openstackclient
- openstack/python-watcherclient
- openstack/watcher
- openstack/watcher-tempest-plugin
- openstack/tempest
vars: &base_vars
devstack_plugins:
watcher: https://opendev.org/openstack/watcher
devstack_services:
watcher-api: true
watcher-decision-engine: true
watcher-applier: true
tempest: true
s-account: false
s-container: false
s-object: false
s-proxy: false
tempest_plugins:
- watcher-tempest-plugin
tempest_test_regex: watcher_tempest_plugin.tests.api
tox_envlist: all
zuul_copy_output:
/etc/hosts: logs
nodeset: legacy-ubuntu-xenial-2-node
- job:
name: watcher-tempest-functional-ipv6-only
parent: devstack-tempest-ipv6
description: |
Watcher devstack tempest tests job for IPv6-only deployment
required-projects: *base_required_projects
vars: *base_vars
name: watcher-tempest-multinode
parent: watcher-tempest-base-multinode
voting: false
- job:
name: watcher-grenade
parent: grenade
required-projects:
- openstack/watcher
- openstack/python-watcherclient
- openstack/watcher-tempest-plugin
vars: *base_vars
irrelevant-files:
- ^(test-|)requirements.txt$
- ^.*\.rst$
- ^api-ref/.*$
- ^doc/.*$
- ^watcher/hacking/.*$
- ^watcher/tests/.*$
- ^releasenotes/.*$
- ^setup.cfg$
- ^tools/.*$
- ^tox.ini$
- job:
# This job is used in python-watcherclient repo
# This job is used by python-watcherclient repo
name: watcherclient-tempest-functional
parent: watcher-tempest-functional
parent: legacy-dsvm-base
run: playbooks/legacy/watcherclient-tempest-functional/run.yaml
post-run: playbooks/legacy/watcherclient-tempest-functional/post.yaml
timeout: 4200
vars:
tempest_concurrency: 1
tempest_test_regex: watcher_tempest_plugin.tests.client_functional
required-projects:
- openstack/devstack
- openstack/devstack-gate
- openstack/python-openstackclient
- openstack/python-watcherclient
- openstack/watcher

View File

@@ -8,4 +8,4 @@
watcher Style Commandments
==========================
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/
Read the OpenStack Style Commandments https://docs.openstack.org/developer/hacking/

View File

@@ -1,9 +1,9 @@
=======
Watcher
=======
========================
Team and repository tags
========================
.. image:: https://governance.openstack.org/tc/badges/watcher.svg
:target: https://governance.openstack.org/tc/reference/tags/index.html
.. image:: https://governance.openstack.org/badges/watcher.svg
:target: https://governance.openstack.org/reference/tags/index.html
.. Change things from this point on
@@ -13,17 +13,19 @@ Watcher
https://creativecommons.org/licenses/by/3.0/
=======
Watcher
=======
OpenStack Watcher provides a flexible and scalable resource optimization
service for multi-tenant OpenStack-based clouds.
Watcher provides a robust framework to realize a wide range of cloud
optimization goals, including the reduction of data center
operating costs, increased system performance via intelligent virtual machine
migration, increased energy efficiency and more!
migration, increased energy efficiency-and more!
* Free software: Apache license
* Wiki: https://wiki.openstack.org/wiki/Watcher
* Source: https://opendev.org/openstack/watcher
* Source: https://github.com/openstack/watcher
* Bugs: https://bugs.launchpad.net/watcher
* Documentation: https://docs.openstack.org/watcher/latest/
* Release notes: https://docs.openstack.org/releasenotes/watcher/
* Design specifications: https://specs.openstack.org/openstack/watcher-specs/

View File

@@ -1,75 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# nova documentation build configuration file, created by
# sphinx-quickstart on Sat May 1 15:17:47 2010.
#
# This file is execfile()d with the current directory set to
# its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
extensions = [
'openstackdocstheme',
'os_api_ref',
]
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Infrastructure Optimization API Reference'
copyright = u'2010-present, OpenStack Foundation'
# openstackdocstheme options
openstackdocs_repo_name = 'openstack/watcher'
openstackdocs_auto_name = False
openstackdocs_bug_project = 'watcher'
openstackdocs_bug_tag = ''
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'native'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'openstackdocs'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"sidebar_mode": "toc",
}
# -- Options for LaTeX output -------------------------------------------------
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'Watcher.tex', u'Infrastructure Optimization API Reference',
u'OpenStack Foundation', 'manual'),
]

View File

@@ -1,19 +0,0 @@
:tocdepth: 2
===========
Watcher API
===========
.. rest_expand_all::
.. include:: watcher-api-versions.inc
.. include:: watcher-api-v1-audittemplates.inc
.. include:: watcher-api-v1-audits.inc
.. include:: watcher-api-v1-actionplans.inc
.. include:: watcher-api-v1-actions.inc
.. include:: watcher-api-v1-goals.inc
.. include:: watcher-api-v1-strategies.inc
.. include:: watcher-api-v1-services.inc
.. include:: watcher-api-v1-scoring_engines.inc
.. include:: watcher-api-v1-datamodel.inc
.. include:: watcher-api-v1-webhooks.inc

View File

@@ -1,655 +0,0 @@
# variables in header
header_version:
description: |
Specific API microversion used to generate this response.
in: header
required: true
type: string
openstack-api-max-version:
description: |
Maximum API microversion supported by this endpoint, eg. "1.1"
in: header
required: true
type: string
openstack-api-min-version:
description: |
Minimum API microversion supported by this endpoint, eg. "1.0"
in: header
required: true
type: string
openstack-api-version:
description: >
A request SHOULD include this header to indicate to the Watcher API service what
version the client supports. The server will transform the response object into
compliance with the requested version, if it is supported, or return a
406 Not Acceptable error.
If this header is not supplied, the server will response with server minimum
supported version.
in: header
required: true
type: string
openstack-request-id:
description: >
An unique ID for tracking the request. The request ID associated with the request
appears in the log lines for that request. By default, the middleware configuration
ensures that the request ID appears in the log files.
in: header
required: false
type: string
# Path
action_ident:
description: |
The UUID of the Action.
in: path
required: true
type: string
actionplan_ident:
description: |
The UUID of the Action Plan.
in: path
required: true
type: string
audit_ident:
description: |
The UUID or name of the Audit.
in: path
required: true
type: string
audittemplate_ident:
description: |
The UUID or name of the Audit Template.
in: path
required: true
type: string
goal_ident:
description: |
The UUID or name of the Goal.
in: path
required: true
type: string
scoring_engine_ident:
description: |
The UUID or name of the Scoring Engine.
in: path
required: true
type: string
service_ident:
description: |
The ID or name of the Service.
in: path
required: true
type: string
strategy_ident:
description: |
The UUID or name of the Strategy.
in: path
required: true
type: string
# Query body
limit:
description: |
Requests a page size of items. Returns a number of items up to a ``limit``
value. Use the limit parameter to make an initial limited request and use
the ID of the last-seen item from the response as the ``marker`` parameter
value in a subsequent limited request.
in: query
required: false
type: integer
marker:
description: |
The ID of the last-seen item. Use the ``limit`` parameter to make an
initial limited request and use the ID of the last-seen item from the
response as the ``marker`` parameter value in a subsequent limited request.
in: query
required: false
type: string
r_action_plan:
description: |
UUID of the action plan used for filtering.
in: query
required: false
type: string
r_audit:
description: |
Optional UUID of an audit, to get only actions for that audit.
in: query
required: false
type: string
r_goal:
description: |
The UUID or name of the Goal.
in: query
required: false
type: string
r_strategy:
description: |
The UUID or name of the Strategy.
in: query
required: false
type: string
r_type:
description: |
Type of data model user want to list. Default type is compute.
Supported values: compute.
Future support values: storage, baremetal.
in: query
required: false
type: string
sort_dir:
description: |
Sorts the response by the requested sort direction.
A valid value is ``asc`` (ascending) or ``desc`` (descending).
Default is ``asc``.
in: query
required: false
type: string
sort_key:
description: |
Sorts the response by the this attribute value. Default is ``id``.
in: query
required: false
type: string
# variables in the API response body
# Action
action_action_plan_uuid:
description: |
The action plan this action belongs to.
in: body
required: true
type: string
action_description:
description: |
Action description.
in: body
required: true
type: string
action_input_parameters:
description: |
Input parameters which are used by appropriate action type. For example,
``migration`` action takes into account such parameters as
``migration_type``, ``destination_node``, ``resource_id`` and
``source_node``. To see a list of supported action types and their input
parameters visit `Action plugins page <https://docs.openstack.org/watcher/latest/contributor/plugin/plugins.html#actions>`_.
in: body
required: true
type: JSON
action_parents:
description: |
UUIDs of parent actions.
in: body
required: true
type: array
action_state:
description: |
State of Action.
in: body
required: true
type: string
action_type:
description: |
Action type based on specific API action. Actions in Watcher are
pluggable, to see a list of supported action types visit
`Action plugins page <https://docs.openstack.org/watcher/latest/contributor/plugin/plugins.html#actions>`_.
in: body
required: true
type: string
# Action Plan
actionplan_audit_uuid:
description: |
The UUID of the audit this acton plan belongs to.
in: body
required: false
type: string
actionplan_efficacy_indicators:
description: |
The list of efficacy indicators associated to this action plan.
in: body
required: false
type: array
actionplan_global_efficacy:
description: |
The global efficacy of this action plan.
in: body
required: false
type: array
actionplan_hostname:
description: |
Hostname the actionplan is running on
in: body
required: false
type: string
actionplan_state:
description: |
State of this action plan. To get more information about states and
action plan's lifecycle, visit `Action Plan State Machine page <https://docs.openstack.org/watcher/latest/architecture.html#action-plan-state-machine>`_.
in: body
required: false
type: string
# Audit
audit_autotrigger:
description: |
Auto execute action plan once audit is succeeded.
in: body
required: false
type: boolean
audit_endtime_req:
description: |
The local time after which audit can't be executed.
It will be converted to UTC time by Watcher.
in: body
required: false
type: string
min_version: 1.1
audit_endtime_resp:
description: |
The UTC time after which audit can't be executed.
in: body
required: false
type: string
min_version: 1.1
audit_force:
description: |
Launch audit even if action plan is ongoing.
in: body
required: false
type: boolean
min_version: 1.2
audit_goal:
description: |
The UUID or name of the Goal.
in: body
required: false
type: string
audit_hostname:
description: |
Hostname the audit is running on
in: body
required: false
type: string
audit_interval:
description: |
Time interval between audit's execution.
Can be set either in seconds or cron syntax.
Should be defined only for CONTINUOUS audits.
in: body
required: false
type: string
audit_name:
description: |
Name of this audit.
in: body
required: false
type: string
audit_next_run_time:
description: |
The next time audit launch. Defined only for CONTINUOUS audits.
in: body
required: false
type: string
audit_parameters:
description: |
The strategy parameters for this audit.
in: body
required: false
type: JSON
audit_starttime_req:
description: |
The local time after which audit can be executed in accordance
with interval. It will be converted to UTC time by Watcher.
in: body
required: false
type: string
min_version: 1.1
audit_starttime_resp:
description: |
The UTC time after which audit can be executed in accordance with interval.
in: body
required: false
type: string
min_version: 1.1
audit_state:
description: |
State of this audit. To get more information about states and
audit's lifecycle, visit `Audit State Machine page <https://docs.openstack.org/watcher/latest/architecture.html#audit-state-machine>`_.
in: body
required: true
type: string
audit_strategy:
description: |
The UUID or name of the Strategy.
in: body
required: false
type: string
audit_type:
description: |
Type of this audit. Can only be either ONESHOT or CONTINUOUS.
in: body
required: true
type: string
# Audit Template
audittemplate_description:
description: |
Short description of the Audit Template.
in: body
required: false
type: string
audittemplate_goal:
description: |
The UUID or name of the Goal.
in: body
required: true
type: string
audittemplate_name:
description: |
The name of the Audit template.
in: body
required: true
type: string
audittemplate_scope:
description: |
Audit Scope.
in: body
required: false
type: JSON
audittemplate_strategy:
description: |
The UUID or name of the Strategy.
in: body
required: false
type: string
audittemplate_uuid:
description: |
The UUID of the Audit template.
in: body
required: true
type: string
created_at:
description: |
The date and time when the resource was created. The date and time
stamp format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_
in: body
required: true
type: string
deleted_at:
description: |
The date and time when the resource was deleted. The date and time
stamp format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_
in: body
required: true
type: string
# Goal
goal_display_name:
description: |
Localized name of the goal.
in: body
required: true
type: string
goal_efficacy_specification:
description: |
Efficacy specifications as result of stategy's execution.
in: body
required: true
type: array
goal_name:
description: |
Name of the goal.
in: body
required: true
type: string
goal_uuid:
description: |
Unique UUID for this goal.
in: body
required: true
type: string
links:
description: |
A list of relative links. Includes the self and bookmark links.
in: body
required: true
type: array
# Data Model Node
node_disk:
description: |
The Disk of the node(in GiB).
in: body
required: true
type: integer
node_disk_ratio:
description: |
The Disk Ratio of the node.
in: body
required: true
type: float
node_hostname:
description: |
The Host Name of the node.
in: body
required: true
type: string
node_memory:
description: |
The Memory of the node(in MiB).
in: body
required: true
type: integer
node_memory_ratio:
description: |
The Memory Ratio of the node.
in: body
required: true
type: float
node_state:
description: |
The State of the node. The value is up or down.
in: body
required: true
type: string
node_uuid:
description: |
The Unique UUID of the node.
in: body
required: true
type: string
node_vcpu_ratio:
description: |
The Vcpu ratio of the node.
in: body
required: true
type: float
node_vcpus:
description: |
The Vcpu of the node.
in: body
required: true
type: integer
# Scoring Engine
scoring_engine_description:
description: |
A human readable description of the Scoring Engine.
in: body
required: true
type: string
scoring_engine_metainfo:
description: |
A metadata associated with the scoring engine
in: body
required: true
type: string
scoring_engine_name:
description: |
The name of the scoring engine.
in: body
required: true
type: string
# Data Model Server
server_disk:
description: |
The Disk of the server.
in: body
required: true
type: integer
server_memory:
description: |
The Memory of server.
in: body
required: true
type: integer
server_name:
description: |
The Name of the server.
in: body
required: true
type: string
server_state:
description: |
The State of the server.
in: body
required: true
type: string
server_uuid:
description: |
The Unique UUID of the server.
in: body
required: true
type: string
server_vcpus:
description: |
The Vcpu of the server.
in: body
required: true
type: integer
# Service
service_host:
description: |
The Name of host where service is placed on.
in: body
required: true
type: string
service_id:
description: |
The ID of service.
in: body
required: true
type: integer
service_last_seen_up:
description: |
The Time when Watcher service sent latest heartbeat.
in: body
required: true
type: string
service_name:
description: |
The Name of service like ``watcher-applier``.
in: body
required: true
type: string
service_status:
description: |
The State of service. It can be either in ACTIVE or FAILED state.
in: body
required: true
type: string
# Strategy
strategy_check_comment:
description: |
Requirement comment.
in: body
required: true
type: string
strategy_check_mandatory:
description: |
Whether this requirement mandatory or not.
in: body
required: true
type: boolean
strategy_check_state:
description: |
State of requirement for Strategy.
in: body
required: true
type: string or JSON
strategy_check_type:
description: |
Type of requirement for Strategy.
in: body
required: true
type: string
strategy_display_name:
description: |
Localized name of the strategy.
in: body
required: true
type: string
strategy_name:
description: |
Name of the strategy.
in: body
required: true
type: string
strategy_parameters_spec:
description: |
Parameters specifications for this strategy.
in: body
required: true
type: JSON
strategy_uuid:
description: |
Unique UUID for this strategy.
in: body
required: true
type: string
updated_at:
description: |
The date and time when the resource was updated. The date and time
stamp format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_
in: body
required: true
type: string
uuid:
description: |
The UUID for the resource.
in: body
required: true
type: string
# Version
version:
description: |
Versioning of this API response, eg. "1.1".
in: body
required: true
type: string
version_description:
description: |
Descriptive text about the Watcher service.
in: body
required: true
type: string
version_id:
description: |
Major API version, eg, "v1"
in: body
required: true
type: string
versions:
description: |
Array of information about currently supported versions.
in: body
required: true
type: array

View File

@@ -1,7 +0,0 @@
[
{
"op": "replace",
"value": "CANCELLING",
"path": "/state"
}
]

View File

@@ -1,7 +0,0 @@
[
{
"op": "replace",
"value": "CANCELLED",
"path": "/state"
}
]

View File

@@ -1,27 +0,0 @@
{
"action_plans": [
{
"state": "ONGOING",
"efficacy_indicators": [],
"strategy_uuid": "7dae0eea-9df7-42b8-bb3e-313958ff2242",
"global_efficacy": [],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
},
{
"rel": "bookmark",
"href": "http://controller:9322/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
}
],
"updated_at": "2018-04-10T11:59:52.640067+00:00",
"strategy_name": "dummy_with_resize",
"deleted_at": null,
"uuid": "4cbc4ede-0d25-481b-b86e-998dbbd4f8bf",
"audit_uuid": "7d100b05-0a86-491f-98a7-f93da19b272a",
"created_at": "2018-04-10T11:59:52.640067+00:00",
"hostname": "controller"
}
]
}

View File

@@ -1,24 +0,0 @@
{
"action_plans": [
{
"state": "ONGOING",
"efficacy_indicators": [],
"strategy_uuid": "7dae0eea-9df7-42b8-bb3e-313958ff2242",
"global_efficacy": [],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
},
{
"rel": "bookmark",
"href": "http://controller:9322/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
}
],
"updated_at": "2018-04-10T11:59:52.640067+00:00",
"strategy_name": "dummy_with_resize",
"uuid": "4cbc4ede-0d25-481b-b86e-998dbbd4f8bf",
"audit_uuid": "7d100b05-0a86-491f-98a7-f93da19b272a"
}
]
}

View File

@@ -1,21 +0,0 @@
{
"state": "ONGOING",
"efficacy_indicators": [],
"strategy_uuid": "7dae0eea-9df7-42b8-bb3e-313958ff2242",
"global_efficacy": [],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
},
{
"rel": "bookmark",
"href": "http://controller:9322/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
}
],
"updated_at": "2018-04-10T11:59:52.640067+00:00",
"strategy_name": "dummy_with_resize",
"uuid": "4cbc4ede-0d25-481b-b86e-998dbbd4f8bf",
"audit_uuid": "7d100b05-0a86-491f-98a7-f93da19b272a",
"hostname": "controller"
}

View File

@@ -1,23 +0,0 @@
{
"state": "PENDING",
"efficacy_indicators": [],
"strategy_uuid": "7dae0eea-9df7-42b8-bb3e-313958ff2242",
"global_efficacy": [],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
},
{
"rel": "bookmark",
"href": "http://controller:9322/action_plans/4cbc4ede-0d25-481b-b86e-998dbbd4f8bf"
}
],
"updated_at": "2018-04-10T11:59:41.602430+00:00",
"strategy_name": "dummy_with_resize",
"uuid": "4cbc4ede-0d25-481b-b86e-998dbbd4f8bf",
"audit_uuid": "7d100b05-0a86-491f-98a7-f93da19b272a",
"created_at": "2018-04-10T11:59:12.592729+00:00",
"deleted_at": null,
"hostname": null
}

View File

@@ -1,30 +0,0 @@
{
"actions": [
{
"state": "PENDING",
"description": "Wait for a given interval in seconds.",
"parents": [
"8119d16e-b419-4729-b015-fc04c4e45783"
],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/actions/7182a988-e6c4-4152-a0d6-067119475c83"
},
{
"rel": "bookmark",
"href": "http://controller:9322/actions/7182a988-e6c4-4152-a0d6-067119475c83"
}
],
"action_plan_uuid": "c6bba9ed-a7eb-4370-9993-d873e5e22cba",
"uuid": "7182a988-e6c4-4152-a0d6-067119475c83",
"deleted_at": null,
"updated_at": null,
"input_parameters": {
"duration": 3.2
},
"action_type": "sleep",
"created_at": "2018-03-26T11:56:08.235226+00:00"
}
]
}

View File

@@ -1,23 +0,0 @@
{
"actions": [
{
"state": "PENDING",
"parents": [
"8119d16e-b419-4729-b015-fc04c4e45783"
],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/actions/7182a988-e6c4-4152-a0d6-067119475c83"
},
{
"rel": "bookmark",
"href": "http://controller:9322/actions/7182a988-e6c4-4152-a0d6-067119475c83"
}
],
"action_plan_uuid": "c6bba9ed-a7eb-4370-9993-d873e5e22cba",
"uuid": "7182a988-e6c4-4152-a0d6-067119475c83",
"action_type": "sleep"
}
]
}

View File

@@ -1,26 +0,0 @@
{
"state": "SUCCEEDED",
"description": "Logging a NOP message",
"parents": [
"b4529294-1de6-4302-b57a-9b5d5dc363c6"
],
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/actions/54acc7a0-91b0-46ea-a5f7-4ae2b9df0b0a"
},
{
"rel": "bookmark",
"href": "http://controller:9322/actions/54acc7a0-91b0-46ea-a5f7-4ae2b9df0b0a"
}
],
"action_plan_uuid": "4cbc4ede-0d25-481b-b86e-998dbbd4f8bf",
"uuid": "54acc7a0-91b0-46ea-a5f7-4ae2b9df0b0a",
"deleted_at": null,
"updated_at": "2018-04-10T11:59:44.026973+00:00",
"input_parameters": {
"message": "Welcome"
},
"action_type": "nop",
"created_at": "2018-04-10T11:59:12.725147+00:00"
}

View File

@@ -1,30 +0,0 @@
{
"default_version": {
"id": "v1",
"links": [
{
"href": "http://controller:9322/v1/",
"rel": "self"
}
],
"min_version": "1.0",
"status": "CURRENT",
"max_version": "1.1"
},
"description": "Watcher is an OpenStack project which aims to improve physical resources usage through better VM placement.",
"name": "OpenStack Watcher API",
"versions": [
{
"id": "v1",
"links": [
{
"href": "http://controller:9322/v1/",
"rel": "self"
}
],
"min_version": "1.0",
"status": "CURRENT",
"max_version": "1.1"
}
]
}

View File

@@ -1,80 +0,0 @@
{
"scoring_engines": [
{
"href": "http://controller:9322/v1/scoring_engines/",
"rel": "self"
},
{
"href": "http://controller:9322/scoring_engines/",
"rel": "bookmark"
}
],
"media_types": [
{
"base": "application/json",
"type": "application/vnd.openstack.watcher.v1+json"
}
],
"links": [
{
"href": "http://controller:9322/v1/",
"rel": "self"
},
{
"href": "http://docs.openstack.org/developer/watcher/dev/api-spec-v1.html",
"type": "text/html",
"rel": "describedby"
}
],
"actions": [
{
"href": "http://controller:9322/v1/actions/",
"rel": "self"
},
{
"href": "http://controller:9322/actions/",
"rel": "bookmark"
}
],
"audit_templates": [
{
"href": "http://controller:9322/v1/audit_templates/",
"rel": "self"
},
{
"href": "http://controller:9322/audit_templates/",
"rel": "bookmark"
}
],
"action_plans": [
{
"href": "http://controller:9322/v1/action_plans/",
"rel": "self"
},
{
"href": "http://controller:9322/action_plans/",
"rel": "bookmark"
}
],
"services": [
{
"href": "http://controller:9322/v1/services/",
"rel": "self"
},
{
"href": "http://controller:9322/services/",
"rel": "bookmark"
}
],
"audits": [
{
"href": "http://controller:9322/v1/audits/",
"rel": "self"
},
{
"href": "http://controller:9322/audits/",
"rel": "bookmark"
}
],
"id": "v1"
}

View File

@@ -1,7 +0,0 @@
[
{
"op": "replace",
"value": "CANCELLED",
"path": "/state"
}
]

View File

@@ -1,55 +0,0 @@
{
"interval": "*/2 * * * *",
"strategy_uuid": "6b3b3902-8508-4cb0-bb85-67f32866b086",
"goal_uuid": "e1a5a45b-f251-47cf-9c5f-fa1e66e1286a",
"name": "audit1",
"parameters": {
"host_choice": "retry",
"instance_metrics": {
"cpu_util": "compute.node.cpu.percent",
"memory.resident": "hardware.memory.used"
},
"granularity": 300,
"weights": {
"cpu_util_weight": 1.0,
"memory.resident_weight": 1.0
},
"retry_count": 1,
"metrics": [
"cpu_util"
],
"periods": {
"instance": 720,
"node": 600
},
"thresholds": {
"cpu_util": 0.2,
"memory.resident": 0.2
}
},
"auto_trigger": false,
"force": false,
"uuid": "65a5da84-5819-4aea-8278-a28d2b489028",
"goal_name": "workload_balancing",
"scope": [],
"created_at": "2018-04-06T07:27:27.820460+00:00",
"deleted_at": null,
"state": "CANCELLED",
"audit_type": "CONTINUOUS",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audits/65a5da84-5819-4aea-8278-a28d2b489028"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audits/65a5da84-5819-4aea-8278-a28d2b489028"
}
],
"strategy_name": "workload_stabilization",
"next_run_time": "2018-04-06T11:56:00",
"updated_at": "2018-04-06T11:54:01.266447+00:00",
"hostname": "controller",
"start_time": null,
"end_time": null
}

View File

@@ -1,15 +0,0 @@
{
"auto_trigger": false,
"force": false,
"audit_template_uuid": "76fddfee-a9c4-40b0-8da0-c19ad6904f09",
"name": "test_audit",
"parameters": {
"metrics": [
"cpu_util"
]
},
"audit_type": "CONTINUOUS",
"interval": "*/2 * * * *",
"start_time":"2018-04-02 20:30:00",
"end_time": "2018-04-04 20:30:00"
}

View File

@@ -1,6 +0,0 @@
{
"audit_type": "ONESHOT",
"auto_trigger": false,
"force": true,
"audit_template_uuid": "5e70a156-ced7-4012-b1c6-88fcb02ee0c1"
}

View File

@@ -1,55 +0,0 @@
{
"interval": "*/2 * * * *",
"strategy_uuid": "6b3b3902-8508-4cb0-bb85-67f32866b086",
"goal_uuid": "e1a5a45b-f251-47cf-9c5f-fa1e66e1286a",
"name": "test_audit",
"parameters": {
"host_choice": "retry",
"granularity": 300,
"thresholds": {
"cpu_util": 0.2,
"memory.resident": 0.2
},
"periods": {
"node": 600,
"instance": 720
},
"retry_count": 1,
"metrics": [
"cpu_util"
],
"weights": {
"cpu_util_weight": 1.0,
"memory.resident_weight": 1.0
},
"instance_metrics": {
"cpu_util": "compute.node.cpu.percent",
"memory.resident": "hardware.memory.used"
}
},
"auto_trigger": false,
"force": false,
"uuid": "65a5da84-5819-4aea-8278-a28d2b489028",
"goal_name": "workload_balancing",
"scope": [],
"created_at": "2018-04-06T07:27:27.820460+00:00",
"deleted_at": null,
"state": "PENDING",
"audit_type": "CONTINUOUS",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audits/65a5da84-5819-4aea-8278-a28d2b489028"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audits/65a5da84-5819-4aea-8278-a28d2b489028"
}
],
"strategy_name": "workload_stabilization",
"next_run_time": null,
"updated_at": null,
"hostname": null,
"start_time": null,
"end_time": null
}

View File

@@ -1,59 +0,0 @@
{
"audits": [
{
"interval": "*/2 * * * *",
"strategy_uuid": "6b3b3902-8508-4cb0-bb85-67f32866b086",
"goal_uuid": "e1a5a45b-f251-47cf-9c5f-fa1e66e1286a",
"name": "test_audit",
"parameters": {
"host_choice": "retry",
"instance_metrics": {
"cpu_util": "compute.node.cpu.percent",
"memory.resident": "hardware.memory.used"
},
"granularity": 300,
"weights": {
"cpu_util_weight": 1.0,
"memory.resident_weight": 1.0
},
"retry_count": 1,
"metrics": [
"cpu_util"
],
"periods": {
"instance": 720,
"node": 600
},
"thresholds": {
"cpu_util": 0.2,
"memory.resident": 0.2
}
},
"auto_trigger": false,
"force": false,
"uuid": "65a5da84-5819-4aea-8278-a28d2b489028",
"goal_name": "workload_balancing",
"scope": [],
"created_at": "2018-04-06T07:27:27.820460+00:00",
"deleted_at": null,
"state": "ONGOING",
"audit_type": "CONTINUOUS",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audits/65a5da84-5819-4aea-8278-a28d2b489028"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audits/65a5da84-5819-4aea-8278-a28d2b489028"
}
],
"strategy_name": "workload_stabilization",
"next_run_time": "2018-04-06T09:46:00",
"updated_at": "2018-04-06T09:44:01.604146+00:00",
"hostname": "controller",
"start_time": null,
"end_time": null
}
]
}

View File

@@ -1,28 +0,0 @@
{
"audits": [
{
"interval": null,
"strategy_uuid": "e311727b-b9b3-43ef-a5f7-8bd7ea80df25",
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "dummy-2018-03-26T11:56:07.950400",
"auto_trigger": false,
"uuid": "ccc69a5f-114e-46f4-b15e-a77eaa337b01",
"goal_name": "dummy",
"scope": [],
"state": "SUCCEEDED",
"audit_type": "ONESHOT",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audits/ccc69a5f-114e-46f4-b15e-a77eaa337b01"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audits/ccc69a5f-114e-46f4-b15e-a77eaa337b01"
}
],
"strategy_name": "dummy",
"next_run_time": null
}
]
}

View File

@@ -1,55 +0,0 @@
{
"interval": "*/2 * * * *",
"strategy_uuid": "6b3b3902-8508-4cb0-bb85-67f32866b086",
"goal_uuid": "e1a5a45b-f251-47cf-9c5f-fa1e66e1286a",
"name": "test_audit",
"parameters": {
"host_choice": "retry",
"instance_metrics": {
"cpu_util": "compute.node.cpu.percent",
"memory.resident": "hardware.memory.used"
},
"granularity": 300,
"weights": {
"cpu_util_weight": 1.0,
"memory.resident_weight": 1.0
},
"retry_count": 1,
"metrics": [
"cpu_util"
],
"periods": {
"instance": 720,
"node": 600
},
"thresholds": {
"cpu_util": 0.2,
"memory.resident": 0.2
}
},
"auto_trigger": false,
"force": false,
"uuid": "65a5da84-5819-4aea-8278-a28d2b489028",
"goal_name": "workload_balancing",
"scope": [],
"created_at": "2018-04-06T07:27:27.820460+00:00",
"deleted_at": null,
"state": "ONGOING",
"audit_type": "CONTINUOUS",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audits/65a5da84-5819-4aea-8278-a28d2b489028"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audits/65a5da84-5819-4aea-8278-a28d2b489028"
}
],
"strategy_name": "workload_stabilization",
"next_run_time": "2018-04-06T11:56:00",
"updated_at": "2018-04-06T11:54:01.266447+00:00",
"hostname": "controller",
"start_time": null,
"end_time": null
}

View File

@@ -1,12 +0,0 @@
[
{
"value": "CANCELLED",
"path": "/state",
"op": "replace"
},
{
"value": "audit1",
"path": "/name",
"op": "replace"
}
]

View File

@@ -1,55 +0,0 @@
{
"interval": "*/2 * * * *",
"strategy_uuid": "6b3b3902-8508-4cb0-bb85-67f32866b086",
"goal_uuid": "e1a5a45b-f251-47cf-9c5f-fa1e66e1286a",
"name": "audit1",
"parameters": {
"host_choice": "retry",
"instance_metrics": {
"cpu_util": "compute.node.cpu.percent",
"memory.resident": "hardware.memory.used"
},
"granularity": 300,
"weights": {
"cpu_util_weight": 1.0,
"memory.resident_weight": 1.0
},
"retry_count": 1,
"metrics": [
"cpu_util"
],
"periods": {
"instance": 720,
"node": 600
},
"thresholds": {
"cpu_util": 0.2,
"memory.resident": 0.2
}
},
"auto_trigger": false,
"force": false,
"uuid": "65a5da84-5819-4aea-8278-a28d2b489028",
"goal_name": "workload_balancing",
"scope": [],
"created_at": "2018-04-06T07:27:27.820460+00:00",
"deleted_at": null,
"state": "CANCELLED",
"audit_type": "CONTINUOUS",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audits/65a5da84-5819-4aea-8278-a28d2b489028"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audits/65a5da84-5819-4aea-8278-a28d2b489028"
}
],
"strategy_name": "workload_stabilization",
"next_run_time": "2018-04-06T11:56:00",
"updated_at": "2018-04-06T11:54:01.266447+00:00",
"hostname": "controller",
"start_time": null,
"end_time": null
}

View File

@@ -1,7 +0,0 @@
{
"name": "at2",
"goal": "dummy",
"strategy": "dummy",
"description": "the second audit template",
"scope": []
}

View File

@@ -1,4 +0,0 @@
{
"name": "at2",
"goal": "dummy"
}

View File

@@ -1,23 +0,0 @@
{
"description": null,
"strategy_uuid": null,
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "at3",
"uuid": "b4041d8c-85d7-4224-851d-649fe48b7196",
"goal_name": "dummy",
"scope": [],
"created_at": "2018-04-04T08:38:33.110432+00:00",
"deleted_at": null,
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audit_templates/b4041d8c-85d7-4224-851d-649fe48b7196"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audit_templates/b4041d8c-85d7-4224-851d-649fe48b7196"
}
],
"strategy_name": null,
"updated_at": null
}

View File

@@ -1,23 +0,0 @@
{
"audit_templates":[
{
"strategy_uuid": null,
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "at3",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audit_templates/b4041d8c-85d7-4224-851d-649fe48b7196"
},
{
"rel": "bookmark", "href":
"http://controller:9322/audit_templates/b4041d8c-85d7-4224-851d-649fe48b7196"
}
],
"strategy_name": null,
"uuid": "b4041d8c-85d7-4224-851d-649fe48b7196",
"goal_name": "dummy", "scope": [],
"description": null
}
]
}

View File

@@ -1,22 +0,0 @@
{
"audit_templates":[
{
"strategy_uuid": null,
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "at3",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audit_templates/b4041d8c-85d7-4224-851d-649fe48b7196"
},
{
"rel": "bookmark", "href":
"http://controller:9322/audit_templates/b4041d8c-85d7-4224-851d-649fe48b7196"
}
],
"strategy_name": null,
"uuid": "b4041d8c-85d7-4224-851d-649fe48b7196",
"goal_name": "dummy", "scope": []
}
]
}

View File

@@ -1,23 +0,0 @@
{
"description": "test 1",
"strategy_uuid": null,
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "at1",
"uuid": "0d100c27-14af-4962-86fb-f6079287c9c6",
"goal_name": "dummy",
"scope": [],
"created_at": "2018-04-04T07:48:36.175472+00:00",
"deleted_at": null,
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audit_templates/0d100c27-14af-4962-86fb-f6079287c9c6"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audit_templates/0d100c27-14af-4962-86fb-f6079287c9c6"
}
],
"strategy_name": null,
"updated_at": "2018-04-05T07:57:55.803650+00:00"
}

View File

@@ -1,7 +0,0 @@
[
{
"op": "replace",
"value": "PENDING",
"path": "/state"
}
]

View File

@@ -1,23 +0,0 @@
{
"description": "test 1",
"strategy_uuid": null,
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "at11",
"uuid": "0d100c27-14af-4962-86fb-f6079287c9c6",
"goal_name": "dummy",
"scope": [],
"created_at": "2018-04-04T07:48:36.175472+00:00",
"deleted_at": null,
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/audit_templates/0d100c27-14af-4962-86fb-f6079287c9c6"
},
{
"rel": "bookmark",
"href": "http://controller:9322/audit_templates/0d100c27-14af-4962-86fb-f6079287c9c6"
}
],
"strategy_name": null,
"updated_at": "2018-04-05T07:57:42.139127+00:00"
}

View File

@@ -1,38 +0,0 @@
{
"context": [
{
"server_uuid": "1bf91464-9b41-428d-a11e-af691e5563bb",
"server_name": "chenke-test1",
"server_vcpus": "1",
"server_memory": "512",
"server_disk": "1",
"server_state": "active",
"node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112",
"node_hostname": "localhost.localdomain",
"node_vcpus": "4",
"node_vcpu_ratio": "16.0",
"node_memory": "16383",
"node_memory_ratio": "1.5",
"node_disk": "37"
"node_disk_ratio": "1.0",
"node_state": "up",
},
{
"server_uuid": "e2cb5f6f-fa1d-4ba2-be1e-0bf02fa86ba4",
"server_name": "chenke-test2",
"server_vcpus": "1",
"server_memory": "512",
"server_disk": "1",
"server_state": "active",
"node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112",
"node_hostname": "localhost.localdomain",
"node_vcpus": "4",
"node_vcpu_ratio": "16.0",
"node_memory": "16383",
"node_memory_ratio": "1.5",
"node_disk": "37"
"node_disk_ratio": "1.0",
"node_state": "up",
}
]
}

View File

@@ -1,55 +0,0 @@
{
"goals": [
{
"efficacy_specification": [],
"uuid": "e1a5a45b-f251-47cf-9c5f-fa1e66e1286a",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/goals/e1a5a45b-f251-47cf-9c5f-fa1e66e1286a"
},
{
"rel": "bookmark",
"href": "http://controller:9322/goals/e1a5a45b-f251-47cf-9c5f-fa1e66e1286a"
}
],
"name": "workload_balancing",
"display_name": "Workload Balancing"
},
{
"efficacy_specification": [
{
"description": "The total number of enabled compute nodes.",
"schema": "Range(min=0, max=None, min_included=True, max_included=True, msg=None)",
"name": "compute_nodes_count",
"unit": null
},
{
"description": "The number of compute nodes to be released.",
"schema": "Range(min=0, max=None, min_included=True, max_included=True, msg=None)",
"name": "released_compute_nodes_count",
"unit": null
},
{
"description": "The number of VM migrations to be performed.",
"schema": "Range(min=0, max=None, min_included=True, max_included=True, msg=None)",
"name": "instance_migrations_count",
"unit": null
}
],
"uuid": "cb9afa5e-aec7-4a8c-9261-c15c33f2262b",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/goals/cb9afa5e-aec7-4a8c-9261-c15c33f2262b"
},
{
"rel": "bookmark",
"href": "http://controller:9322/goals/cb9afa5e-aec7-4a8c-9261-c15c33f2262b"
}
],
"name": "server_consolidation",
"display_name": "Server Consolidation"
}
]
}

View File

@@ -1,19 +0,0 @@
{
"efficacy_specification": [],
"name": "saving_energy",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/goals/6f52889a-9dd4-4dbb-8e70-39b56c4836cc"
},
{
"rel": "bookmark",
"href": "http://controller:9322/goals/6f52889a-9dd4-4dbb-8e70-39b56c4836cc"
}
],
"uuid": "6f52889a-9dd4-4dbb-8e70-39b56c4836cc",
"updated_at": null,
"display_name": "Saving Energy",
"created_at": "2018-03-26T11:55:24.365584+00:00",
"deleted_at": null
}

View File

@@ -1,20 +0,0 @@
{
"scoring_engines": [
{
"description": "Dummy Scorer calculating the average value",
"uuid": "5a44f007-55b1-423c-809f-6a274a9bd93b",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/scoring_engines/5a44f007-55b1-423c-809f-6a274a9bd93b"
},
{
"rel": "bookmark",
"href": "http://controller:9322/scoring_engines/5a44f007-55b1-423c-809f-6a274a9bd93b"
}
],
"name": "dummy_avg_scorer",
"metainfo": ""
}
]
}

View File

@@ -1,19 +0,0 @@
{
"scoring_engines": [
{
"description": "Dummy Scorer calculating the average value",
"uuid": "5a44f007-55b1-423c-809f-6a274a9bd93b",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/scoring_engines/5a44f007-55b1-423c-809f-6a274a9bd93b"
},
{
"rel": "bookmark",
"href": "http://controller:9322/scoring_engines/5a44f007-55b1-423c-809f-6a274a9bd93b"
}
],
"name": "dummy_avg_scorer"
}
]
}

View File

@@ -1,16 +0,0 @@
{
"description": "Dummy Scorer calculating the maximum value",
"uuid": "1ac42282-4e77-473e-898b-62ea007f1deb",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/scoring_engines/1ac42282-4e77-473e-898b-62ea007f1deb"
},
{
"rel": "bookmark",
"href": "http://controller:9322/scoring_engines/1ac42282-4e77-473e-898b-62ea007f1deb"
}
],
"name": "dummy_max_scorer",
"metainfo": ""
}

View File

@@ -1,24 +0,0 @@
{
"services": [
{
"status": "ACTIVE",
"name": "watcher-applier",
"host": "controller",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/services/1"
},
{
"rel": "bookmark",
"href": "http://controller:9322/services/1"
}
],
"id": 1,
"deleted_at": null,
"updated_at": "2018-04-26T08:52:37.652895+00:00",
"last_seen_up": "2018-04-26T08:52:37.648572",
"created_at": "2018-03-26T11:55:24.075093+00:00"
}
]
}

View File

@@ -1,36 +0,0 @@
{
"services": [
{
"id": 1,
"status": "ACTIVE",
"name": "watcher-applier",
"host": "controller",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/services/1"
},
{
"rel": "bookmark",
"href": "http://controller:9322/services/1"
}
]
},
{
"id": 2,
"status": "ACTIVE",
"name": "watcher-decision-engine",
"host": "controller",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/services/2"
},
{
"rel": "bookmark",
"href": "http://controller:9322/services/2"
}
]
}
]
}

View File

@@ -1,20 +0,0 @@
{
"status": "ACTIVE",
"name": "watcher-applier",
"host": "controller",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/services/1"
},
{
"rel": "bookmark",
"href": "http://controller:9322/services/1"
}
],
"id": 1,
"deleted_at": null,
"updated_at": "2018-04-26T09:45:37.653061+00:00",
"last_seen_up": "2018-04-26T09:45:37.649314",
"created_at": "2018-03-26T11:55:24.075093+00:00"
}

View File

@@ -1,35 +0,0 @@
{
"strategies": [
{
"goal_uuid": "cb9afa5e-aec7-4a8c-9261-c15c33f2262b",
"name": "vm_workload_consolidation",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/strategies/6382b2d7-259e-487d-88db-78c852ffea54"
},
{
"rel": "bookmark",
"href": "http://controller:9322/strategies/6382b2d7-259e-487d-88db-78c852ffea54"
}
],
"parameters_spec": {
"properties": {
"granularity": {
"default": 300,
"type": "number",
"description": "The time between two measures in an aggregated timeseries of a metric."
},
"period": {
"default": 3600,
"type": "number",
"description": "The time interval in seconds for getting statistic aggregation"
}
}
},
"uuid": "6382b2d7-259e-487d-88db-78c852ffea54",
"goal_name": "server_consolidation",
"display_name": "VM Workload Consolidation Strategy"
}
]
}

View File

@@ -1,21 +0,0 @@
{
"strategies": [
{
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "dummy",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/strategies/e311727b-b9b3-43ef-a5f7-8bd7ea80df25"
},
{
"rel": "bookmark",
"href": "http://controller:9322/strategies/e311727b-b9b3-43ef-a5f7-8bd7ea80df25"
}
],
"uuid": "e311727b-b9b3-43ef-a5f7-8bd7ea80df25",
"goal_name": "dummy",
"display_name": "Dummy strategy"
}
]
}

View File

@@ -1,33 +0,0 @@
{
"goal_uuid": "4690f8ba-18ff-45c1-99e9-159556d23810",
"name": "dummy",
"links": [
{
"rel": "self",
"href": "http://controller:9322/v1/strategies/e311727b-b9b3-43ef-a5f7-8bd7ea80df25"
},
{
"rel": "bookmark",
"href": "http://controller:9322/strategies/e311727b-b9b3-43ef-a5f7-8bd7ea80df25"
}
],
"parameters_spec": {
"properties": {
"para2": {
"default": "hello",
"type": "string",
"description": "string parameter example"
},
"para1": {
"maximum": 10.2,
"type": "number",
"minimum": 1.0,
"description": "number parameter example",
"default": 3.2
}
}
},
"uuid": "e311727b-b9b3-43ef-a5f7-8bd7ea80df25",
"goal_name": "dummy",
"display_name": "Dummy strategy"
}

View File

@@ -1,49 +0,0 @@
[
{
"state": "gnocchi: available",
"comment": "",
"mandatory": true,
"type": "Datasource"
},
{
"state": [
{
"compute.node.cpu.percent": "available"
},
{
"cpu_util": "available"
},
{
"memory.resident": "available"
},
{
"hardware.memory.used": "available"
}
],
"comment": "",
"mandatory": false,
"type": "Metrics"
},
{
"state": [
{
"compute_model": "available"
},
{
"storage_model": "not available"
},
{
"baremetal_model": "not available"
}
],
"comment": "",
"mandatory": true,
"type": "CDM"
},
{
"state": "workload_stabilization",
"mandatory": "",
"comment": "",
"type": "Name"
}
]

View File

@@ -1,258 +0,0 @@
.. -*- rst -*-
============
Action Plans
============
An ``Action Plan`` specifies a flow of ``Actions`` that should be executed
in order to satisfy a given ``Goal``. It also contains an estimated
``global efficacy`` alongside a set of ``efficacy indicators``.
An ``Action Plan`` is generated by Watcher when an ``Audit`` is successful
which implies that the ``Strategy`` which was used has found a ``Solution``
to achieve the ``Goal`` of this ``Audit``.
In the default implementation of Watcher, an action plan is composed of
a graph of linked ``Actions``. Each action may have parent actions, which
should be executed prior to child action.
Start Action Plan
=================
.. rest_method:: POST /v1/action_plans/{actionplan_ident}/start
Starts a created Action Plan resource.
Normal response codes: 200
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- actionplan_ident: actionplan_ident
Response
--------
The list and example below are representative of the response as of API
version 1:
.. rest_parameters:: parameters.yaml
- uuid: uuid
- state: actionplan_state
- audit_uuid: actionplan_audit_uuid
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- efficacy_indicators: actionplan_efficacy_indicators
- global_efficacy: actionplan_global_efficacy
- links: links
- hostname: actionplan_hostname
**Example JSON representation of an Action Plan:**
.. literalinclude:: samples/actionplan-start-response.json
:language: javascript
List Action Plan
================
.. rest_method:: GET /v1/action_plans
Returns a list of Action Plan resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- audit_uuid: r_audit
- strategy: r_strategy
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- state: actionplan_state
- audit_uuid: actionplan_audit_uuid
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- efficacy_indicators: actionplan_efficacy_indicators
- global_efficacy: actionplan_global_efficacy
- links: links
**Example JSON representation of an Action Plan:**
.. literalinclude:: samples/actionplan-list-response.json
:language: javascript
List Action Plan detailed
=========================
.. rest_method:: GET /v1/action_plans/detail
Returns a list of Action Plan resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- audit_uuid: r_audit
- strategy: r_strategy
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- deleted_at: deleted_at
- updated_at: updated_at
- created_at: created_at
- uuid: uuid
- state: actionplan_state
- audit_uuid: actionplan_audit_uuid
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- efficacy_indicators: actionplan_efficacy_indicators
- global_efficacy: actionplan_global_efficacy
- links: links
- hostname: actionplan_hostname
**Example JSON representation of an Action Plan:**
.. literalinclude:: samples/actionplan-list-detailed-response.json
:language: javascript
Show Action Plan
================
.. rest_method:: GET /v1/action_plans/{actionplan_ident}
Shows details for an Action Plan.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- actionplan_ident: actionplan_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- state: actionplan_state
- audit_uuid: actionplan_audit_uuid
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- efficacy_indicators: actionplan_efficacy_indicators
- global_efficacy: actionplan_global_efficacy
- links: links
- hostname: actionplan_hostname
**Example JSON representation of an Audit:**
.. literalinclude:: samples/actionplan-show-response.json
:language: javascript
Cancel Action Plan
==================
.. rest_method:: PATCH /v1/action_plans/{actionplan_ident}
Cancels a created Action Plan resource.
.. note:
If Action Plan is in ONGOING state, then ``state`` attribute should be
replaced with ``CANCELLING`` value. Otherwise, ``CANCELLED`` is to be
used.
Normal response codes: 200
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- actionplan_ident: actionplan_ident
**Example Action Plan ONGOING cancelling request:**
.. literalinclude:: samples/actionplan-cancel-request-cancelling.json
:language: javascript
**Example Action Plan PENDING cancelling request:**
.. literalinclude:: samples/actionplan-cancel-request-pending.json
:language: javascript
Response
--------
The list and example below are representative of the response as of API
version 1:
.. rest_parameters:: parameters.yaml
- uuid: uuid
- state: actionplan_state
- audit_uuid: actionplan_audit_uuid
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- efficacy_indicators: actionplan_efficacy_indicators
- global_efficacy: actionplan_global_efficacy
- links: links
- hostname: actionplan_hostname
**Example JSON representation of an Action Plan:**
.. literalinclude:: samples/actionplan-start-response.json
:language: javascript
Delete Action Plan
==================
.. rest_method:: DELETE /v1/action_plans/{actionplan_ident}
Deletes an Action Plan. Action Plan can be deleted only from SUCCEEDED, RECOMMENDED, FAILED, SUPERSEDED, CANCELLED states.
Normal response codes: 204
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- actionplan_ident: actionplan_ident

View File

@@ -1,155 +0,0 @@
.. -*- rst -*-
=======
Actions
=======
An ``Action`` is what enables Watcher to transform the current state of a
``Cluster`` after an ``Audit``.
An ``Action`` is an atomic task which changes the current state of a target
Managed resource of the OpenStack ``Cluster`` such as:
- Live migration of an instance from one compute node to another compute
node with Nova
- Changing the power level of a compute node (ACPI level, ...)
- Changing the current state of a compute node (enable or disable) with Nova
In most cases, an ``Action`` triggers some concrete commands on an existing
OpenStack module (Nova, Neutron, Cinder, Ironic, etc.).
An ``Action`` has a life-cycle and its current state may be one of the
following:
- **PENDING** : the ``Action`` has not been executed yet by the
``Watcher Applier``.
- **ONGOING** : the ``Action`` is currently being processed by the
``Watcher Applier``.
- **SUCCEEDED** : the ``Action`` has been executed successfully
- **FAILED** : an error occurred while trying to execute the ``Action``.
- **DELETED** : the ``Action`` is still stored in the ``Watcher database``
but is not returned any more through the Watcher APIs.
- **CANCELLED** : the ``Action`` was in **PENDING** or **ONGOING** state and
was cancelled by the ``Administrator``
``Actions`` are created by ``Watcher Planner`` as result of Audit's execution.
``Action`` can't be created, modified or deleted by user.
List Action
===========
.. rest_method:: GET /v1/actions
Returns a list of Action resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- action_plan_uuid: r_action_plan
- audit_uuid: r_audit
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- action_type: action_type
- state: action_state
- action_plan_uuid: action_action_plan_uuid
- parents: action_parents
- links: links
**Example JSON representation of an Action:**
.. literalinclude:: samples/actions-list-response.json
:language: javascript
List Action Detailed
====================
.. rest_method:: GET /v1/actions/detail
Returns a list of Action resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- action_plan_uuid: r_action_plan
- audit_uuid: r_audit
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- action_type: action_type
- state: action_state
- action_plan_uuid: action_action_plan_uuid
- parents: action_parents
- description: action_description
- input_parameters: action_input_parameters
- links: links
**Example JSON representation of an Action:**
.. literalinclude:: samples/actions-list-detailed-response.json
:language: javascript
Show Action
===========
.. rest_method:: GET /v1/actions/{action_ident}
Shows details for an Action.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- action_ident: action_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- action_type: action_type
- state: action_state
- action_plan_uuid: action_action_plan_uuid
- parents: action_parents
- description: action_description
- input_parameters: action_input_parameters
- links: links
**Example JSON representation of an Action:**
.. literalinclude:: samples/actions-show-response.json
:language: javascript

View File

@@ -1,367 +0,0 @@
.. -*- rst -*-
======
Audits
======
There are creating, listing, updating and deleting methods of Watcher Audit
resources which are implemented via the ``/v1/audits`` resource.
In the Watcher system, an ``Audit`` is a request for optimizing a ``Cluster``.
The optimization is done in order to satisfy one ``Goal`` on a given
``Cluster``.
For each ``Audit``, the Watcher system generates an ``Action Plan``.
Create Audit
============
.. rest_method:: POST /v1/audits
Creates a new Audit resource.
Mandatory attribute to be supplied: ``audit_type``.
``Audit`` can be created either based on existed ``Audit Template`` or by
itself. In the first case, there also should be supplied
``audit_template_uuid``. If ``Audit`` is created without ``Audit Template``,
``goal`` should be provided.
Normal response codes: 201
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- audit_template_uuid: audittemplate_uuid
- audit_type: audit_type
- name: audit_name
- goal: audit_goal
- strategy: audit_strategy
- parameters: audit_parameters
- interval: audit_interval
- auto_trigger: audit_autotrigger
- start_time: audit_starttime_req
- end_time: audit_endtime_req
- force: audit_force
**Example ONESHOT Audit creation request:**
.. literalinclude:: samples/audit-create-request-oneshot.json
:language: javascript
**Example CONTINUOUS Audit creation request with a specified strategy:**
.. literalinclude:: samples/audit-create-request-continuous.json
:language: javascript
Response
--------
The list and example below are representative of the response as of API
version 1:
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audit_name
- audit_type: audit_type
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- interval: audit_interval
- next_run_time: audit_next_run_time
- parameters: audit_parameters
- auto_trigger: audit_autotrigger
- state: audit_state
- scope: audittemplate_scope
- links: links
- hostname: audit_hostname
- start_time: audit_starttime_resp
- end_time: audit_endtime_resp
- force: audit_force
**Example JSON representation of an Audit:**
.. literalinclude:: samples/audit-create-response.json
:language: javascript
List Audit
==========
.. rest_method:: GET /v1/audits
Returns a list of Audit resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- goal: r_goal
- strategy: r_strategy
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audit_name
- audit_type: audit_type
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- interval: audit_interval
- next_run_time: audit_next_run_time
- auto_trigger: audit_autotrigger
- state: audit_state
- scope: audittemplate_scope
- links: links
**Example JSON representation of an Audit:**
.. literalinclude:: samples/audit-list-response.json
:language: javascript
List Audit Detailed
===================
.. rest_method:: GET /v1/audits/detail
Returns a list of Audit resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- goal: r_goal
- strategy: r_strategy
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audit_name
- audit_type: audit_type
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- interval: audit_interval
- next_run_time: audit_next_run_time
- parameters: audit_parameters
- auto_trigger: audit_autotrigger
- state: audit_state
- scope: audittemplate_scope
- links: links
- hostname: audit_hostname
- start_time: audit_starttime_resp
- end_time: audit_endtime_resp
- force: audit_force
**Example JSON representation of an Audit:**
.. literalinclude:: samples/audit-list-detailed-response.json
:language: javascript
Show Audit
==========
.. rest_method:: GET /v1/audits/{audit_ident}
Shows details for an Audit.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- audit_ident: audit_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audit_name
- audit_type: audit_type
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- interval: audit_interval
- next_run_time: audit_next_run_time
- parameters: audit_parameters
- auto_trigger: audit_autotrigger
- state: audit_state
- scope: audittemplate_scope
- links: links
- hostname: audit_hostname
- start_time: audit_starttime_resp
- end_time: audit_endtime_resp
- force: audit_force
**Example JSON representation of an Audit:**
.. literalinclude:: samples/audit-show-response.json
:language: javascript
Cancel Audit
============
.. rest_method:: PATCH /v1/audits/{audit_ident}
Cancels an ONGOING Audit resource.
Normal response codes: 200
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- audit_ident: audit_ident
**Example Audit cancelling request:**
.. literalinclude:: samples/audit-cancel-request.json
:language: javascript
Response
--------
The list and example below are representative of the response as of API
version 1:
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audit_name
- audit_type: audit_type
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- interval: audit_interval
- next_run_time: audit_next_run_time
- parameters: audit_parameters
- auto_trigger: audit_autotrigger
- state: audit_state
- scope: audittemplate_scope
- links: links
- hostname: audit_hostname
- start_time: audit_starttime_resp
- end_time: audit_endtime_resp
- force: audit_force
**Example JSON representation of an Audit:**
.. literalinclude:: samples/audit-cancel-response.json
:language: javascript
Update Audit
============
.. rest_method:: PATCH /v1/audits/{audit_ident}
Updates an Audit with the given information.
.. note:
``audit_type`` shouldn't be changed by PATCH method.
Normal response codes: 200
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- audit_ident: audit_ident
**Example PATCH document updating Audit:**
.. literalinclude:: samples/audit-update-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audit_name
- audit_type: audit_type
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- interval: audit_interval
- next_run_time: audit_next_run_time
- parameters: audit_parameters
- auto_trigger: audit_autotrigger
- state: audit_state
- scope: audittemplate_scope
- links: links
- hostname: audit_hostname
- start_time: audit_starttime_resp
- end_time: audit_endtime_resp
- force: audit_force
**Example JSON representation of an Audit:**
.. literalinclude:: samples/audit-update-response.json
:language: javascript
Delete Audit
============
.. rest_method:: DELETE /v1/audits/{audit_ident}
Deletes an Audit. Audit can be deleted only from FAILED, SUCCEEDED, CANCELLED,
SUSPENDED states.
Normal response codes: 204
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- audit_ident: audit_ident

View File

@@ -1,257 +0,0 @@
.. -*- rst -*-
===============
Audit Templates
===============
There are creating, listing, updating and deleting methods of Watcher Audit
Template resources which are implemented via the ``/v1/audit_templates``
resource.
An Audit may be launched several times with the same settings
(Goal, thresholds, ...). Therefore it makes sense to save those settings in
some sort of Audit preset object, which is known as an Audit Template.
An Audit Template contains at least the Goal of the Audit.
Create Audit Template
=====================
.. rest_method:: POST /v1/audit_templates
Creates a new Audit Template resource.
It requires ``name`` and ``goal`` attributes to be supplied in the request
body.
Normal response codes: 201
Error codes: 400,404,409
Request
-------
.. rest_parameters:: parameters.yaml
- name: audittemplate_name
- goal: audittemplate_goal
- strategy: audittemplate_strategy
- description: audittemplate_description
- scope: audittemplate_scope
**Example Audit Template creation request without a specified strategy:**
.. literalinclude:: samples/audittemplate-create-request-minimal.json
:language: javascript
**Example Audit Template creation request with a specified strategy:**
.. literalinclude:: samples/audittemplate-create-request-full.json
:language: javascript
Response
--------
The list and example below are representative of the response as of API
version 1:
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audittemplate_name
- description: audittemplate_description
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- scope: audittemplate_scope
- links: links
**Example JSON representation of an Audit Template:**
.. literalinclude:: samples/audittemplate-create-response.json
:language: javascript
List Audit Template
===================
.. rest_method:: GET /v1/audit_templates
Returns a list of Audit Template resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- goal: r_goal
- strategy: r_strategy
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audittemplate_name
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- scope: audittemplate_scope
- links: links
**Example JSON representation of an Audit Template:**
.. literalinclude:: samples/audittemplate-list-response.json
:language: javascript
List Audit Template Detailed
============================
.. rest_method:: GET /v1/audit_templates/detail
Returns a list of Audit Template resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- goal: r_goal
- strategy: r_strategy
- limit: limit
- marker: marker
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audittemplate_name
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- scope: audittemplate_scope
- links: links
- description: audittemplate_description
**Example JSON representation of an Audit Template:**
.. literalinclude:: samples/audittemplate-list-detailed-response.json
:language: javascript
Show Audit Template
===================
.. rest_method:: GET /v1/audit_templates/{audittemplate_ident}
Shows details for an Audit Template.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- audittemplate_ident: audittemplate_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audittemplate_name
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- scope: audittemplate_scope
- links: links
- description: audittemplate_description
**Example JSON representation of an Audit Template:**
.. literalinclude:: samples/audittemplate-show-response.json
:language: javascript
Update Audit Template
=====================
.. rest_method:: PATCH /v1/audit_templates/{audittemplate_ident}
Updates an Audit Template with the given information.
Normal response codes: 200
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- audittemplate_ident: audittemplate_ident
**Example PATCH document updating Audit Template:**
.. literalinclude:: samples/audittemplate-update-request.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: audittemplate_name
- strategy_uuid: strategy_uuid
- strategy_name: strategy_name
- goal_uuid: goal_uuid
- goal_name: goal_name
- scope: audittemplate_scope
- links: links
- description: audittemplate_description
**Example JSON representation of an Audit Template:**
.. literalinclude:: samples/audittemplate-update-response.json
:language: javascript
Delete Audit Template
=====================
.. rest_method:: DELETE /v1/audit_templates/{audittemplate_ident}
Deletes an Audit Template.
Normal response codes: 204
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- audittemplate_ident: audittemplate_ident

View File

@@ -1,57 +0,0 @@
.. -*- rst -*-
==========
Data Model
==========
.. versionadded:: 1.3
``Data Model`` is very important for Watcher to generate resource
optimization solutions. Users can easily view the data model by the
API.
List Data Model
===============
.. rest_method:: GET /v1/data_model
Returns the information about Data Model.
Normal response codes: 200
Error codes: 400,401,406
Request
-------
.. rest_parameters:: parameters.yaml
- audit: r_audit
- type: r_type
Response
--------
.. rest_parameters:: parameters.yaml
- server_uuid: server_uuid
- server_name: server_name
- server_vcpus: server_vcpus
- server_memory: server_memory
- server_disk: server_disk
- server_state: server_state
- node_uuid: node_uuid
- node_hostname: node_hostname
- node_vcpus: node_vcpus
- node_vcpu_ratio: node_vcpu_ratio
- node_memory: node_memory
- node_memory_ratio: node_memory_ratio
- node_disk: node_disk
- node_disk_ratio: node_disk_ratio
- node_state: node_state
**Example JSON representation of a Data Model:**
.. literalinclude:: samples/datamodel-list-response.json
:language: javascript

View File

@@ -1,126 +0,0 @@
.. -*- rst -*-
=====
Goals
=====
A ``Goal`` is a human readable, observable and measurable end result having
one objective to be achieved.
Here are some examples of ``Goals``:
- minimize the energy consumption
- minimize the number of compute nodes (consolidation)
- balance the workload among compute nodes
- minimize the license cost (some softwares have a licensing model which is
based on the number of sockets or cores where the software is deployed)
- find the most appropriate moment for a planned maintenance on a
given group of host (which may be an entire availability zone):
power supply replacement, cooling system replacement, hardware
modification, ...
List Goal
=========
.. rest_method:: GET /v1/goals
Returns a list of Goal resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- efficacy_specification: goal_efficacy_specification
- name: goal_name
- display_name: goal_display_name
- links: links
**Example JSON representation of a Goal:**
.. literalinclude:: samples/goal-list-response.json
:language: javascript
List Goal Detailed
==================
.. rest_method:: GET /v1/goals/detail
Returns a list of Goal resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- efficacy_specification: goal_efficacy_specification
- name: goal_name
- display_name: goal_display_name
- links: links
**Example JSON representation of a Goal:**
.. literalinclude:: samples/goal-list-response.json
:language: javascript
Show Goal
=========
.. rest_method:: GET /v1/goals/{goal_ident}
Shows details for an Goal.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- goal_ident: goal_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- efficacy_specification: goal_efficacy_specification
- name: goal_name
- display_name: goal_display_name
- links: links
**Example JSON representation of a Goal:**
.. literalinclude:: samples/goal-show-response.json
:language: javascript

View File

@@ -1,120 +0,0 @@
.. -*- rst -*-
===============
Scoring Engines
===============
A ``Scoring Engine`` is an executable that has a well-defined input, a
well-defined output, and performs a purely mathematical task. That is,
the calculation does not depend on the environment in which it is running - it
would produce the same result anywhere.
Because there might be multiple algorithms used to build a particular data
model (and therefore a scoring engine), the usage of scoring engine might
vary. A metainfo field is supposed to contain any information which might
be needed by the user of a given scoring engine.
List Scoring Engine
===================
.. rest_method:: GET /v1/scoring_engines
Returns a list of Scoring Engine resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: scoring_engine_name
- description: scoring_engine_description
- links: links
**Example JSON representation of a Scoring Engine:**
.. literalinclude:: samples/scoring_engine-list-response.json
:language: javascript
List Scoring Engine Detailed
============================
.. rest_method:: GET /v1/scoring_engines/detail
Returns a list of Scoring Engine resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: scoring_engine_name
- description: scoring_engine_description
- metainfo: scoring_engine_metainfo
- links: links
**Example JSON representation of a Scoring Engine:**
.. literalinclude:: samples/scoring_engine-list-detailed-response.json
:language: javascript
Show Scoring Engine
===================
.. rest_method:: GET /v1/scoring_engines/{scoring_engine_ident}
Shows details for a Scoring Engine resource.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- scoring_engine_ident: scoring_engine_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: scoring_engine_name
- description: scoring_engine_description
- metainfo: scoring_engine_metainfo
- links: links
**Example JSON representation of a Scoring Engine:**
.. literalinclude:: samples/scoring_engine-show-response.json
:language: javascript

View File

@@ -1,116 +0,0 @@
.. -*- rst -*-
========
Services
========
This resource represents Watcher services, their states and hosts they are
placed on.
List Service
============
.. rest_method:: GET /v1/services
Returns a list of Service resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- id: service_id
- name: service_name
- host: service_host
- status: service_status
- links: links
**Example JSON representation of a Service:**
.. literalinclude:: samples/service-list-response.json
:language: javascript
List Service Detailed
=====================
.. rest_method:: GET /v1/services/detail
Returns a list of Service resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- id: service_id
- name: service_name
- host: service_host
- status: service_status
- last_seen_up: service_last_seen_up
- links: links
**Example JSON representation of a Service:**
.. literalinclude:: samples/service-list-detailed-response.json
:language: javascript
Show Service
============
.. rest_method:: GET /v1/services/{service_ident}
Shows details for a Service resource.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- service_ident: service_ident
Response
--------
.. rest_parameters:: parameters.yaml
- id: service_id
- name: service_name
- host: service_host
- status: service_status
- last_seen_up: service_last_seen_up
- links: links
**Example JSON representation of a Service:**
.. literalinclude:: samples/service-show-response.json
:language: javascript

View File

@@ -1,164 +0,0 @@
.. -*- rst -*-
==========
Strategies
==========
A ``Strategy`` is an algorithm implementation which is able to find a
``Solution`` for a given ``Goal``. To get more information about strategies
that are shipped along with Watcher, visit `strategies page`_.
There may be several potential strategies which are able to achieve the same
``Goal``. This is why it is possible to configure which specific ``Strategy``
should be used for each goal.
Some strategies may provide better optimization results but may take more time
to find an optimal ``Solution``.
.. _`strategies page`: https://docs.openstack.org/watcher/latest/strategies/index.html
List Strategy
=============
.. rest_method:: GET /v1/strategies
Returns a list of Strategy resources.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- goal: r_goal
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: strategy_name
- display_name: strategy_display_name
- goal_name: goal_name
- goal_uuid: goal_uuid
- links: links
**Example JSON representation of a Strategy:**
.. literalinclude:: samples/strategy-list-response.json
:language: javascript
List Strategy Detailed
======================
.. rest_method:: GET /v1/strategies/detail
Returns a list of Strategy resources with complete details.
Normal response codes: 200
Error codes: 400,401
Request
-------
.. rest_parameters:: parameters.yaml
- goal: r_goal
- limit: limit
- sort_dir: sort_dir
- sort_key: sort_key
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: strategy_name
- display_name: strategy_display_name
- parameters_spec: strategy_parameters_spec
- goal_name: goal_name
- goal_uuid: goal_uuid
- links: links
**Example JSON representation of a Strategy:**
.. literalinclude:: samples/strategy-list-detailed-response.json
:language: javascript
Show Strategy
=============
.. rest_method:: GET /v1/strategies/{strategy_ident}
Shows details for a Strategy resource.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- strategy_ident: strategy_ident
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- name: strategy_name
- display_name: strategy_display_name
- parameters_spec: strategy_parameters_spec
- goal_name: goal_name
- goal_uuid: goal_uuid
- links: links
**Example JSON representation of a Strategy:**
.. literalinclude:: samples/strategy-show-response.json
:language: javascript
Show Strategy State
===================
.. rest_method:: GET /v1/strategies/{strategy_ident}/state
Retrieve an information about strategy requirements.
Normal response codes: 200
Error codes: 404
Request
-------
.. rest_parameters:: parameters.yaml
- strategy_ident: strategy_ident
Response
--------
.. rest_parameters:: parameters.yaml
- state: strategy_check_state
- comment: strategy_check_comment
- mandatory: strategy_check_mandatory
- type: strategy_check_type
**Example JSON representation of a Strategy:**
.. literalinclude:: samples/strategy-state-response.json
:language: javascript

View File

@@ -1,26 +0,0 @@
.. -*- rst -*-
========
Webhooks
========
.. versionadded:: 1.4
Triggers an event based Audit.
Trigger EVENT Audit
===================
.. rest_method:: POST /v1/webhooks/{audit_ident}
Normal response codes: 202
Error codes: 400,404
Request
-------
.. rest_parameters:: parameters.yaml
- audit_ident: audit_ident

View File

@@ -1,81 +0,0 @@
.. -*- rst -*-
============
API versions
============
In order to bring new features to users over time, the Watcher API
supports versioning. There are two kinds of versions in Watcher.
- ''major versions'', which have dedicated URLs.
- ''microversions'', which can be requested using the
``OpenStack-API-Version`` header.
.. note:: The maximum microversion depends on release.
Please reference:
`API Microversion History
<https://docs.openstack.org/watcher/latest/contributor/api_microversion_history.html>`__
for API microversion history details.
The Version API resource works differently from other API resources as they *do not*
require authentication.
If Watcher receives a request with unsupported version, it responds with a 406 Not Acceptable,
along with the -Min- and -Max- headers that it can support.
List API versions
=================
.. rest_method:: GET /
This fetches all the information about all known major API versions in the
deployment. Links to more specific information will be provided for each major
API version, as well as information about supported min and max microversions.
Normal response codes: 200
Request
-------
Response Example
----------------
.. rest_parameters:: parameters.yaml
- description: version_description
- versions: versions
- version: version
- id: version_id
- links: links
- min_version: openstack-api-min-version
- max_version: openstack-api-max-version
.. literalinclude:: samples/api-root-response.json
:language: javascript
Show v1 API
===========
.. rest_method:: GET /v1/
Show all the resources within the Watcher v1 API.
Normal response codes: 200
Request
-------
Response Example
----------------
.. rest_parameters:: parameters.yaml
- id: version_id
- links: links
- OpenStack-API-Version: header_version
- OpenStack-API-Minimum-Version: openstack-api-min-version
- OpenStack-API-Maximum-Version: openstack-api-max-version
.. literalinclude:: samples/api-v1-root-response.json
:language: javascript

2
babel.cfg Normal file
View File

@@ -0,0 +1,2 @@
[python: **.py]

View File

@@ -47,23 +47,14 @@ WATCHER_POLICY_YAML=$WATCHER_CONF_DIR/policy.yaml.sample
WATCHER_DEVSTACK_DIR=$WATCHER_DIR/devstack
WATCHER_DEVSTACK_FILES_DIR=$WATCHER_DEVSTACK_DIR/files
NOVA_CONF_DIR=/etc/nova
NOVA_CONF=$NOVA_CONF_DIR/nova.conf
if is_ssl_enabled_service "watcher" || is_service_enabled tls-proxy; then
WATCHER_SERVICE_PROTOCOL="https"
fi
# Support entry points installation of console scripts
if [[ -d $WATCHER_DIR/bin ]]; then
WATCHER_BIN_DIR=$WATCHER_DIR/bin
else
WATCHER_BIN_DIR=$(get_python_exec_prefix)
fi
# There are 2 modes, which is "uwsgi" which runs with an apache
# proxy uwsgi in front of it, or "mod_wsgi", which runs in
# apache. mod_wsgi is deprecated, don't use it.
WATCHER_USE_WSGI_MODE=${WATCHER_USE_WSGI_MODE:-$WSGI_MODE}
WATCHER_UWSGI=$WATCHER_BIN_DIR/watcher-api-wsgi
WATCHER_UWSGI_CONF=$WATCHER_CONF_DIR/watcher-uwsgi.ini
WATCHER_USE_MOD_WSGI=$(trueorfalse True WATCHER_USE_MOD_WSGI)
if is_suse; then
WATCHER_WSGI_DIR=${WATCHER_WSGI_DIR:-/srv/www/htdocs/watcher}
@@ -71,15 +62,16 @@ else
WATCHER_WSGI_DIR=${WATCHER_WSGI_DIR:-/var/www/watcher}
fi
# Public facing bits
WATCHER_SERVICE_HOST=${WATCHER_SERVICE_HOST:-$SERVICE_HOST}
WATCHER_SERVICE_HOST=${WATCHER_SERVICE_HOST:-$HOST_IP}
WATCHER_SERVICE_PORT=${WATCHER_SERVICE_PORT:-9322}
WATCHER_SERVICE_PORT_INT=${WATCHER_SERVICE_PORT_INT:-19322}
WATCHER_SERVICE_PROTOCOL=${WATCHER_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
if [[ "$WATCHER_USE_WSGI_MODE" == "uwsgi" ]]; then
WATCHER_API_URL="$WATCHER_SERVICE_PROTOCOL://$WATCHER_SERVICE_HOST/infra-optim"
# Support entry points installation of console scripts
if [[ -d $WATCHER_DIR/bin ]]; then
WATCHER_BIN_DIR=$WATCHER_DIR/bin
else
WATCHER_API_URL="$WATCHER_SERVICE_PROTOCOL://$WATCHER_SERVICE_HOST:$WATCHER_SERVICE_PORT"
WATCHER_BIN_DIR=$(get_python_exec_prefix)
fi
# Entry Points
@@ -104,9 +96,7 @@ function _cleanup_watcher_apache_wsgi {
# runs that a clean run would need to clean up
function cleanup_watcher {
sudo rm -rf $WATCHER_STATE_PATH $WATCHER_AUTH_CACHE_DIR
if [[ "$WATCHER_USE_WSGI_MODE" == "uwsgi" ]]; then
remove_uwsgi_config "$WATCHER_UWSGI_CONF" "$WATCHER_UWSGI"
else
if [[ "$WATCHER_USE_MOD_WSGI" == "True" ]]; then
_cleanup_watcher_apache_wsgi
fi
}
@@ -152,32 +142,29 @@ function create_watcher_accounts {
"infra-optim" "Watcher Infrastructure Optimization Service")
get_or_create_endpoint $watcher_service \
"$REGION_NAME" \
"$WATCHER_API_URL"\
"$WATCHER_API_URL"\
"$WATCHER_API_URL"
"$WATCHER_SERVICE_PROTOCOL://$WATCHER_SERVICE_HOST:$WATCHER_SERVICE_PORT" \
"$WATCHER_SERVICE_PROTOCOL://$WATCHER_SERVICE_HOST:$WATCHER_SERVICE_PORT" \
"$WATCHER_SERVICE_PROTOCOL://$WATCHER_SERVICE_HOST:$WATCHER_SERVICE_PORT"
}
# _config_watcher_apache_wsgi() - Set WSGI config files of watcher
function _config_watcher_apache_wsgi {
local watcher_apache_conf
if [[ "$WATCHER_USE_WSGI_MODE" == "mod_wsgi" ]]; then
local service_port=$WATCHER_SERVICE_PORT
if is_service_enabled tls-proxy; then
service_port=$WATCHER_SERVICE_PORT_INT
service_protocol="http"
fi
if [[ "$WATCHER_USE_MOD_WSGI" == "True" ]]; then
sudo mkdir -p $WATCHER_WSGI_DIR
sudo cp $WATCHER_DIR/watcher/api/app.wsgi $WATCHER_WSGI_DIR/app.wsgi
watcher_apache_conf=$(apache_site_config_for watcher-api)
sudo cp $WATCHER_DEVSTACK_FILES_DIR/apache-watcher-api.template $watcher_apache_conf
sudo sed -e "
s|%WATCHER_SERVICE_PORT%|$service_port|g;
s|%WATCHER_SERVICE_PORT%|$WATCHER_SERVICE_PORT|g;
s|%WATCHER_WSGI_DIR%|$WATCHER_WSGI_DIR|g;
s|%USER%|$STACK_USER|g;
s|%APIWORKERS%|$API_WORKERS|g;
s|%APACHE_NAME%|$APACHE_NAME|g;
" -i $watcher_apache_conf
enable_apache_site watcher-api
tail_log watcher-access /var/log/$APACHE_NAME/watcher-api-access.log
tail_log watcher-api /var/log/$APACHE_NAME/watcher-api.log
fi
}
@@ -190,26 +177,21 @@ function create_watcher_conf {
iniset $WATCHER_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
iniset $WATCHER_CONF DEFAULT control_exchange watcher
iniset_rpc_backend watcher $WATCHER_CONF
iniset $WATCHER_CONF database connection $(database_connection_url watcher)
iniset $WATCHER_CONF api host "$(ipv6_unquote $WATCHER_SERVICE_HOST)"
if is_service_enabled tls-proxy; then
iniset $WATCHER_CONF api host "$(ipv6_unquote $WATCHER_SERVICE_HOST)"
iniset $WATCHER_CONF api port "$WATCHER_SERVICE_PORT_INT"
# iniset $WATCHER_CONF api enable_ssl_api "True"
else
if [[ "$WATCHER_USE_WSGI_MODE" == "mod_wsgi" ]]; then
iniset $WATCHER_CONF api host "$(ipv6_unquote $WATCHER_SERVICE_HOST)"
iniset $WATCHER_CONF api port "$WATCHER_SERVICE_PORT"
fi
fi
iniset $WATCHER_CONF api host "$WATCHER_SERVICE_HOST"
iniset $WATCHER_CONF api port "$WATCHER_SERVICE_PORT"
iniset $WATCHER_CONF oslo_policy policy_file $WATCHER_POLICY_YAML
iniset $WATCHER_CONF oslo_messaging_rabbit rabbit_userid $RABBIT_USERID
iniset $WATCHER_CONF oslo_messaging_rabbit rabbit_password $RABBIT_PASSWORD
iniset $WATCHER_CONF oslo_messaging_rabbit rabbit_host $RABBIT_HOST
iniset $WATCHER_CONF oslo_messaging_notifications driver "messagingv2"
iniset $NOVA_CONF oslo_messaging_notifications topics "notifications,watcher_notifications"
iniset $NOVA_CONF notifications notify_on_state_change "vm_and_task_state"
configure_auth_token_middleware $WATCHER_CONF watcher $WATCHER_AUTH_CACHE_DIR
configure_auth_token_middleware $WATCHER_CONF watcher $WATCHER_AUTH_CACHE_DIR "watcher_clients_auth"
@@ -229,12 +211,15 @@ function create_watcher_conf {
fi
# Format logging
setup_logging $WATCHER_CONF
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
setup_colorized_logging $WATCHER_CONF DEFAULT
else
# Show user_name and project_name instead of user_id and project_id
iniset $WATCHER_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(project_domain)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
#config apache files
if [[ "$WATCHER_USE_WSGI_MODE" == "uwsgi" ]]; then
write_uwsgi_config "$WATCHER_UWSGI_CONF" "$WATCHER_UWSGI" "/infra-optim"
else
if [[ "$WATCHER_USE_MOD_WSGI" == "True" ]]; then
_config_watcher_apache_wsgi
fi
# Register SSL certificates if provided
@@ -246,6 +231,10 @@ function create_watcher_conf {
iniset $WATCHER_CONF DEFAULT enabled_ssl_apis "$WATCHER_ENABLED_APIS"
fi
if is_service_enabled ceilometer; then
iniset $WATCHER_CONF watcher_messaging notifier_driver "messaging"
fi
}
# create_watcher_cache_dir() - Part of the init_watcher() process
@@ -281,7 +270,7 @@ function install_watcherclient {
function install_watcher {
git_clone $WATCHER_REPO $WATCHER_DIR $WATCHER_BRANCH
setup_develop $WATCHER_DIR
if [[ "$WATCHER_USE_WSGI_MODE" == "mod_wsgi" ]]; then
if [[ "$WATCHER_USE_MOD_WSGI" == "True" ]]; then
install_apache_wsgi
fi
}
@@ -292,29 +281,25 @@ function start_watcher_api {
local service_port=$WATCHER_SERVICE_PORT
local service_protocol=$WATCHER_SERVICE_PROTOCOL
local watcher_url
if is_service_enabled tls-proxy; then
service_port=$WATCHER_SERVICE_PORT_INT
service_protocol="http"
fi
if [[ "$WATCHER_USE_WSGI_MODE" == "uwsgi" ]]; then
run_process "watcher-api" "$(which uwsgi) --procname-prefix watcher-api --ini $WATCHER_UWSGI_CONF"
watcher_url=$service_protocol://$SERVICE_HOST/infra-optim
else
watcher_url=$service_protocol://$SERVICE_HOST:$service_port
enable_apache_site watcher-api
if [[ "$WATCHER_USE_MOD_WSGI" == "True" ]]; then
restart_apache_server
# Start proxies if enabled
if is_service_enabled tls-proxy; then
start_tls_proxy watcher '*' $WATCHER_SERVICE_PORT $WATCHER_SERVICE_HOST $WATCHER_SERVICE_PORT_INT
fi
else
run_process watcher-api "$WATCHER_BIN_DIR/watcher-api --config-file $WATCHER_CONF"
fi
echo "Waiting for watcher-api to start..."
if ! wait_for_service $SERVICE_TIMEOUT $watcher_url; then
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$WATCHER_SERVICE_HOST:$service_port; then
die $LINENO "watcher-api did not start"
fi
# Start proxies if enabled
if is_service_enabled tls-proxy; then
start_tls_proxy '*' $WATCHER_SERVICE_PORT $WATCHER_SERVICE_HOST $WATCHER_SERVICE_PORT_INT &
start_tls_proxy '*' $EC2_SERVICE_PORT $WATCHER_SERVICE_HOST $WATCHER_SERVICE_PORT_INT &
fi
}
# start_watcher() - Start running processes, including screen
@@ -327,11 +312,11 @@ function start_watcher {
# stop_watcher() - Stop running processes (non-screen)
function stop_watcher {
if [[ "$WATCHER_USE_WSGI_MODE" == "uwsgi" ]]; then
stop_process watcher-api
else
if [[ "$WATCHER_USE_MOD_WSGI" == "True" ]]; then
disable_apache_site watcher-api
restart_apache_server
restart_apache_server
else
stop_process watcher-api
fi
for serv in watcher-decision-engine watcher-applier; do
stop_process $serv

View File

@@ -10,7 +10,6 @@ SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=azertytoken
HOST_IP=192.168.42.2 # Change this to this compute node's IP address
#HOST_IPV6=2001:db8::7
FLAT_INTERFACE=eth0
FIXED_RANGE=10.254.1.0/24 # Change this to whatever your network is
@@ -31,12 +30,12 @@ ENABLED_SERVICES=n-cpu,n-api-meta,c-vol,q-agt,placement-client
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
VNCSERVER_LISTEN=0.0.0.0
VNCSERVER_PROXYCLIENT_ADDRESS=$HOST_IP # or HOST_IPV6
VNCSERVER_PROXYCLIENT_ADDRESS=$HOST_IP
NOVA_INSTANCES_PATH=/opt/stack/data/instances
# Enable the Ceilometer plugin for the compute agent
enable_plugin ceilometer https://opendev.org/openstack/ceilometer
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer
disable_service ceilometer-acentral,ceilometer-collector,ceilometer-api
LOGFILE=$DEST/logs/stack.sh.log
@@ -45,9 +44,6 @@ LOGDAYS=2
[[post-config|$NOVA_CONF]]
[DEFAULT]
compute_monitors=cpu.virt_driver
notify_on_state_change = vm_and_task_state
[notifications]
# Enable both versioned and unversioned notifications. Watcher only
# uses versioned notifications but ceilometer uses unversioned. We
# can change this to just versioned when ceilometer handles versioned
# notifications from nova: https://bugs.launchpad.net/ceilometer/+bug/1665449
notification_format=both
notify_on_state_change = vm_and_task_state

View File

@@ -10,7 +10,6 @@ SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=azertytoken
HOST_IP=192.168.42.1 # Change this to your controller node IP address
#HOST_IPV6=2001:db8::7
FLAT_INTERFACE=eth0
FIXED_RANGE=10.254.1.0/24 # Change this to whatever your network is
@@ -26,13 +25,13 @@ MULTI_HOST=1
disable_service n-cpu
# Enable the Watcher Dashboard plugin
enable_plugin watcher-dashboard https://opendev.org/openstack/watcher-dashboard
enable_plugin watcher-dashboard https://git.openstack.org/openstack/watcher-dashboard
# Enable the Watcher plugin
enable_plugin watcher https://opendev.org/openstack/watcher
enable_plugin watcher https://git.openstack.org/openstack/watcher
# Enable the Ceilometer plugin
enable_plugin ceilometer https://opendev.org/openstack/ceilometer
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer
# This is the controller node, so disable the ceilometer compute agent
disable_service ceilometer-acompute
@@ -49,9 +48,6 @@ LOGDAYS=2
[[post-config|$NOVA_CONF]]
[DEFAULT]
compute_monitors=cpu.virt_driver
notify_on_state_change = vm_and_task_state
[notifications]
# Enable both versioned and unversioned notifications. Watcher only
# uses versioned notifications but ceilometer uses unversioned. We
# can change this to just versioned when ceilometer handles versioned
# notifications from nova: https://bugs.launchpad.net/ceilometer/+bug/1665449
notification_format=both
notify_on_state_change = vm_and_task_state

View File

@@ -1,9 +0,0 @@
# Plug-in overrides
# https://docs.openstack.org/devstack/latest/plugins.html#plugin-interface
# Enable both versioned and unversioned notifications. Watcher only
# uses versioned notifications but ceilometer uses unversioned. We
# can change this to just versioned when ceilometer handles
# versioned notifications from nova:
# https://bugs.launchpad.net/ceilometer/+bug/1665449
NOVA_NOTIFICATION_FORMAT=both

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-watcher``
function configure_watcher_upgrade {
XTRACE=$(set +o | grep xtrace)
set -o xtrace
# Copy release-specific files
sudo cp $TARGET_RELEASE_DIR/watcher/etc/watcher/watcher.conf $WATCHER_CONF_DIR/watcher.conf
sudo cp $TARGET_RELEASE_DIR/watcher/etc/watcher/policy.yaml.sample $WATCHER_CONF_DIR/policy.yaml.sample
# reset to previous state
$XTRACE
}

View File

@@ -1,126 +0,0 @@
#!/bin/bash
set -o errexit
source $GRENADE_DIR/grenaderc
source $GRENADE_DIR/functions
source $TOP_DIR/openrc admin demo
set -o xtrace
function _wait_for_status {
while :
do
state=$("${@:2}" -f value -c State)
[[ $state == "SUCCEEDED" ]] && break
if [ $state == "ERROR" ]; then
die $LINENO "ERROR creating audit"
fi
sleep 10
done
}
function create_audit_template {
at_id=$(openstack optimize audittemplate create d1 dummy -s dummy -f value -c UUID)
resource_save watcher at_id $at_id
}
function create_audit {
audit_id=$(openstack optimize audit create -s dummy -g dummy -f value -c UUID)
resource_save watcher audit_id $audit_id
}
function create_audit_with_autotrigger {
audit_at_id=$(openstack optimize audit create -s dummy -g dummy -f value -c UUID --auto-trigger)
resource_save watcher audit_at_id $audit_at_id
}
function verify_audit_template {
local at_id=$(resource_get watcher at_id)
openstack optimize audittemplate show $at_id
}
function verify_audit_with_autotrigger {
local audit_at_id=$(resource_get watcher audit_at_id)
_wait_for_status "SUCCEEDED" openstack optimize audit show $audit_at_id
local actionplan_at_id=$(openstack optimize actionplan list --audit $audit_at_id -c UUID -f value)
resource_save watcher actionplan_at $actionplan_at_id
actionplan_at_state=$(openstack optimize actionplan show $actionplan_at_id -c State -f value)
if [ $actionplan_at_state != "SUCCEEDED" ]; then
die $LINENO "ERROR executing actionplan"
fi
}
function verify_audit {
local audit_id=$(resource_get watcher audit_id)
_wait_for_status "SUCCEEDED" openstack optimize audit show $audit_id
local actionplan_id=$(openstack optimize actionplan list --audit $audit_id -c UUID -f value)
resource_save watcher actionplan $actionplan_id
actionplan_state=$(openstack optimize actionplan show $actionplan_id -c State -f value)
if [ $actionplan_state != "RECOMMENDED" ]; then
die $LINENO "ERROR creating actionplan"
fi
}
function verify_noapi {
# currently no good way
:
}
function delete_audit {
local audit_id=$(resource_get watcher audit_id)
local actionplan_id=$(resource_get watcher actionplan)
watcher actionplan delete $actionplan_id
openstack optimize audit delete $audit_id
}
function delete_audit_with_autotrigger {
local audit_at_id=$(resource_get watcher audit_at_id)
local actionplan_id=$(resource_get watcher actionplan_at)
watcher actionplan delete $actionplan_id
openstack optimize audit delete $audit_at_id
}
function delete_audit_template {
local at_id=$(resource_get watcher at_id)
openstack optimize audittemplate delete $at_id
}
function create {
create_audit_template
create_audit
create_audit_with_autotrigger
}
function verify {
verify_audit_template
verify_audit
verify_audit_with_autotrigger
}
function destroy {
delete_audit_template
delete_audit
delete_audit_with_autotrigger
}
# Dispatcher
case $1 in
"create")
create
;;
"verify_noapi")
verify_noapi
;;
"verify")
verify
;;
"destroy")
destroy
;;
"force_destroy")
set +o errexit
destroy
;;
esac

View File

@@ -1,18 +0,0 @@
register_project_for_upgrade watcher
register_db_to_save watcher
devstack_localrc base enable_plugin watcher https://opendev.org/openstack/watcher $BASE_DEVSTACK_BRANCH
devstack_localrc target enable_plugin watcher https://opendev.org/openstack/watcher
devstack_localrc base enable_service watcher-api watcher-decision-engine watcher-applier
devstack_localrc target enable_service watcher-api watcher-decision-engine watcher-applier
BASE_RUN_SMOKE=False
TARGET_RUN_SMOKE=False
# Enable both versioned and unversioned notifications. Watcher only
# uses versioned notifications but ceilometer uses unversioned. We
# can change this to just versioned when ceilometer handles
# versioned notifications from nova:
# https://bugs.launchpad.net/ceilometer/+bug/1665449
devstack_localrc base NOVA_NOTIFICATION_FORMAT=both

View File

@@ -1,24 +0,0 @@
#!/bin/bash
set -o errexit
source $GRENADE_DIR/grenaderc
source $GRENADE_DIR/functions
# We need base DevStack functions for this
source $BASE_DEVSTACK_DIR/functions
source $BASE_DEVSTACK_DIR/stackrc # needed for status directory
source $BASE_DEVSTACK_DIR/lib/tls
source $BASE_DEVSTACK_DIR/lib/apache
WATCHER_DEVSTACK_DIR=$(dirname $(dirname $0))
source $WATCHER_DEVSTACK_DIR/settings
source $WATCHER_DEVSTACK_DIR/plugin.sh
source $WATCHER_DEVSTACK_DIR/lib/watcher
set -o xtrace
stop_watcher
# sanity check that service is actually down
ensure_services_stopped watcher-api watcher-decision-engine watcher-applier

View File

@@ -1,83 +0,0 @@
#!/usr/bin/env bash
# ``upgrade-watcher``
echo "*********************************************************************"
echo "Begin $0"
echo "*********************************************************************"
# Clean up any resources that may be in use
cleanup() {
set +o errexit
echo "********************************************************************"
echo "ERROR: Abort $0"
echo "********************************************************************"
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
trap cleanup SIGHUP SIGINT SIGTERM
# Keep track of the grenade directory
RUN_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
# Upgrade watcher
# ============
# Get functions from current DevStack
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/apache
source $TARGET_DEVSTACK_DIR/lib/tls
source $TARGET_DEVSTACK_DIR/lib/keystone
source $TOP_DIR/openrc admin admin
source $(dirname $(dirname $BASH_SOURCE))/settings
source $(dirname $(dirname $BASH_SOURCE))/plugin.sh
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
# Save current config files for posterity
[[ -d $SAVE_DIR/etc.watcher ]] || cp -pr $WATCHER_CONF_DIR $SAVE_DIR/etc.watcher
# Install the target watcher
install_watcher
# calls upgrade-watcher for specific release
upgrade_project watcher $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
if [[ ! -f "$WATCHER_UWSGI_CONF" ]] && [[ "$WATCHER_USE_WSGI_MODE" == "uwsgi" ]]
then write_uwsgi_config "$WATCHER_UWSGI_CONF" "$WATCHER_UWSGI" "/infra-optim"
endpoints=$(openstack endpoint list --service watcher -c ID -f value)
for id in $endpoints; do
openstack endpoint delete $id
done
create_watcher_accounts
fi
# Migrate the database
watcher-db-manage upgrade || die $LINO "DB migration error"
start_watcher
# Don't succeed unless the services come up
ensure_services_started watcher-api watcher-decision-engine watcher-applier
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"

View File

@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals
import importlib
import inspect

View File

@@ -20,7 +20,7 @@ It is used via a single directive in the .rst file
"""
from docutils.parsers.rst import Directive
from sphinx.util.compat import Directive
from docutils import nodes
from watcher.notifications import base as notification

View File

@@ -1,10 +0,0 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
openstackdocstheme>=2.2.1 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD
sphinxcontrib-pecanwsme>=0.8.0 # Apache-2.0
sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
reno>=3.1.0 # Apache-2.0
sphinxcontrib-apidoc>=0.2.0 # BSD
os-api-ref>=1.4.0 # Apache-2.0

View File

@@ -44,6 +44,6 @@ Installing API behind mod_wsgi
Fedora/RHEL7/CentOS7:
sudo systemctl reload httpd
Debian/Ubuntu:
sudo a2ensite watcher
sudo service apache2 reload
Debian/Ubuntu:
sudo a2ensite watcher
sudo service apache2 reload

View File

@@ -8,7 +8,5 @@ Administrator Guide
apache-mod-wsgi
gmr
policy
ways-to-install
../strategies/index
../datasources/index
../contributor/notifications
../contributor/concurrency

View File

@@ -17,14 +17,6 @@
Policies
========
.. warning::
JSON formatted policy file is deprecated since Watcher 6.0.0 (Wallaby).
This `oslopolicy-convert-json-to-yaml`__ tool will migrate your existing
JSON-formatted policy file to YAML in a backward-compatible way.
.. __: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html
Watcher's public API calls may be restricted to certain sets of users using a
policy configuration file. This document explains exactly how policies are
configured and what they apply to.
@@ -139,16 +131,6 @@ The actions that may have a rule enforced on them are:
* ``GET /v1/actions/<ACTION_UUID>``
* ``service:get_all``, ``service:detail`` - List available Watcher services
* ``GET /v1/services``
* ``GET /v1/services/detail``
* ``service:get`` - Retrieve a specific Watcher service entity
* ``GET /v1/services/<SERVICE_ID>``
To limit an action to a particular role or roles, you list the roles like so ::

View File

@@ -19,7 +19,7 @@ The source install instructions specifically avoid using platform specific
packages, instead using the source for the code and the Python Package Index
(PyPi_).
.. _PyPi: https://pypi.org/
.. _PyPi: https://pypi.python.org/pypi
It's expected that your system already has python2.7_, latest version of pip_,
and git_ available.
@@ -30,7 +30,7 @@ and git_ available.
Your system shall also have some additional system libraries:
On Ubuntu (tested on 16.04LTS):
On Ubuntu (tested on 14.04LTS):
.. code-block:: bash
@@ -51,7 +51,7 @@ Clone the Watcher repository:
.. code-block:: bash
$ git clone https://opendev.org/openstack/watcher.git
$ git clone https://git.openstack.org/openstack/watcher.git
$ cd watcher
Install the Watcher modules:
@@ -92,7 +92,7 @@ these commands:
By default, this will show logging on the console from which it was started.
Once started, you can use the `Watcher Client`_ to play with Watcher service.
.. _`Watcher Client`: https://opendev.org/openstack/python-watcherclient
.. _`Watcher Client`: https://git.openstack.org/cgit/openstack/python-watcherclient
Installing from packages: PyPI
--------------------------------

8
doc/source/api/index.rst Normal file
View File

@@ -0,0 +1,8 @@
==================================================
OpenStack Infrastructure Optimization Service APIs
==================================================
.. toctree::
:maxdepth: 1
v1

100
doc/source/api/v1.rst Normal file
View File

@@ -0,0 +1,100 @@
..
Except where otherwise noted, this document is licensed under Creative
Commons Attribution 3.0 License. You can view the license at:
https://creativecommons.org/licenses/by/3.0/
====================
RESTful Web API (v1)
====================
Goals
=====
.. rest-controller:: watcher.api.controllers.v1.goal:GoalsController
:webprefix: /v1/goal
.. autotype:: watcher.api.controllers.v1.goal.GoalCollection
:members:
.. autotype:: watcher.api.controllers.v1.goal.Goal
:members:
Strategies
==========
.. rest-controller:: watcher.api.controllers.v1.strategy:StrategiesController
:webprefix: /v1/strategies
.. autotype:: watcher.api.controllers.v1.strategy.StrategyCollection
:members:
.. autotype:: watcher.api.controllers.v1.strategy.Strategy
:members:
Audit Templates
===============
.. rest-controller:: watcher.api.controllers.v1.audit_template:AuditTemplatesController
:webprefix: /v1/audit_templates
.. autotype:: watcher.api.controllers.v1.audit_template.AuditTemplateCollection
:members:
.. autotype:: watcher.api.controllers.v1.audit_template.AuditTemplate
:members:
Audits
======
.. rest-controller:: watcher.api.controllers.v1.audit:AuditsController
:webprefix: /v1/audits
.. autotype:: watcher.api.controllers.v1.audit.AuditCollection
:members:
.. autotype:: watcher.api.controllers.v1.audit.Audit
:members:
Links
=====
.. autotype:: watcher.api.controllers.link.Link
:members:
Action Plans
============
.. rest-controller:: watcher.api.controllers.v1.action_plan:ActionPlansController
:webprefix: /v1/action_plans
.. autotype:: watcher.api.controllers.v1.action_plan.ActionPlanCollection
:members:
.. autotype:: watcher.api.controllers.v1.action_plan.ActionPlan
:members:
Actions
=======
.. rest-controller:: watcher.api.controllers.v1.action:ActionsController
:webprefix: /v1/actions
.. autotype:: watcher.api.controllers.v1.action.ActionCollection
:members:
.. autotype:: watcher.api.controllers.v1.action.Action
:members:
Scoring Engine
==============
.. rest-controller:: watcher.api.controllers.v1.scoring_engine:ScoringEngineController
:webprefix: /v1/scoring_engine
.. autotype:: watcher.api.controllers.v1.scoring_engine.ScoringEngineCollection
:members:
.. autotype:: watcher.api.controllers.v1.scoring_engine.ScoringEngine
:members:

View File

@@ -76,7 +76,6 @@ Watcher Applier
This component is in charge of executing the
:ref:`Action Plan <action_plan_definition>` built by the
:ref:`Watcher Decision Engine <watcher_decision_engine_definition>`.
Taskflow is the default workflow engine for Watcher.
It connects to the :ref:`message bus <amqp_bus_definition>` and launches the
:ref:`Action Plan <action_plan_definition>` whenever a triggering message is
@@ -111,23 +110,6 @@ If the :ref:`Action <action_definition>` fails, the
previous state of the :ref:`Managed resource <managed_resource_definition>`
(i.e. before the command was sent to the underlying OpenStack service).
In Stein, added a new config option 'action_execution_rule' which is a
dict type. Its key field is strategy name and the value is 'ALWAYS' or 'ANY'.
'ALWAYS' means the callback function returns True as usual.
'ANY' means the return depends on the result of previous action execution.
The callback returns True if previous action gets failed, and the engine
continues to run the next action. If previous action executes success,
the callback returns False then the next action will be ignored.
For strategies that aren't in 'action_execution_rule', the callback always
returns True.
Please add the next section in the watcher.conf file
if your strategy needs this feature.
::
[watcher_workflow_engines.taskflow]
action_execution_rule = {'your strategy name': 'ANY'}
.. _archi_watcher_cli_definition:
Watcher CLI
@@ -281,13 +263,11 @@ previously created :ref:`Audit template <audit_template_definition>`:
:width: 100%
The :ref:`Administrator <administrator_definition>` also can specify type of
Audit and interval (in case of CONTINUOUS type). There is three types of Audit:
ONESHOT, CONTINUOUS and EVENT. ONESHOT Audit is launched once and if it
succeeded executed new action plan list will be provided; CONTINUOUS Audit
creates action plans with specified interval (in seconds or cron format, cron
inteval can be used like: `*/5 * * * *`), if action plan
has been created, all previous action plans get CANCELLED state;
EVENT audit is launched when receiving webhooks API.
Audit and interval (in case of CONTINUOUS type). There is two types of Audit:
ONESHOT and CONTINUOUS. Oneshot Audit is launched once and if it succeeded
executed new action plan list will be provided. Continuous Audit creates
action plans with specified interval (in seconds); if action plan
has been created, all previous action plans get CANCELLED state.
A message is sent on the :ref:`AMQP bus <amqp_bus_definition>` which triggers
the Audit in the
@@ -481,4 +461,4 @@ change to a new value:
.. _Watcher API: https://docs.openstack.org/api-ref/resource-optimization/
.. _Watcher API: webapi/v1.html

View File

@@ -14,6 +14,7 @@
import os
import sys
from watcher import version as watcher_version
from watcher import objects
objects.register_all()
@@ -31,16 +32,16 @@ sys.path.insert(0, os.path.abspath('./'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'oslo_config.sphinxext',
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinxcontrib.httpdomain',
'sphinxcontrib.pecanwsme.rest',
'stevedore.sphinxext',
'wsmeext.sphinxext',
'ext.term',
'ext.versioned_notifications',
'oslo_config.sphinxconfiggen',
'openstackdocstheme',
'sphinx.ext.napoleon',
'sphinxcontrib.rsvgconverter',
]
wsme_protocols = ['restjson']
@@ -49,6 +50,10 @@ config_generator_config_file = [(
'_static/watcher')]
sample_config_basename = 'watcher'
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# The suffix of source filenames.
source_suffix = '.rst'
@@ -59,6 +64,16 @@ master_doc = 'index'
project = u'Watcher'
copyright = u'OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# The full version, including alpha/beta/rc tags.
release = watcher_version.version_info.release_string()
# The short X.Y version.
version = watcher_version.version_string
# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['watcher.']
@@ -83,7 +98,7 @@ add_module_names = True
suppress_warnings = ['app.add_directive']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'native'
pygments_style = 'sphinx'
# -- Options for man page output --------------------------------------------
@@ -114,34 +129,22 @@ html_theme = 'openstackdocs'
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
html_last_updated_fmt = '%Y-%m-%d %H:%M'
#openstackdocstheme options
openstackdocs_repo_name = 'openstack/watcher'
openstackdocs_pdf_link = True
openstackdocs_auto_name = False
openstackdocs_bug_project = 'watcher'
openstackdocs_bug_tag = ''
repository_name = 'openstack/watcher'
bug_project = 'watcher'
bug_tag = ''
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index',
'doc-watcher.tex',
u'Watcher Documentation',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
]
# If false, no module index is generated.
latex_domain_indices = False
latex_elements = {
'makeindex': '',
'printindex': '',
'preamble': r'\setcounter{tocdepth}{3}',
}
# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664
latex_use_xindy = False
# Example configuration for intersphinx: refer to the Python standard library.
# intersphinx_mapping = {'http://docs.python.org/': None}

View File

@@ -19,17 +19,11 @@ optimize your IaaS platform. The Watcher service may, depending upon
configuration, interact with several other OpenStack services. This includes:
- the OpenStack Identity service (`keystone`_) for request authentication and
to locate other OpenStack services.
- the OpenStack Telemetry service (`ceilometer`_) for collecting the resources
metrics.
- the time series database (`gnocchi`_) for consuming the resources
metrics.
to locate other OpenStack services
- the OpenStack Telemetry service (`ceilometer`_) for consuming the resources
metrics
- the OpenStack Compute service (`nova`_) works with the Watcher service and
acts as a user-facing API for instance migration.
- the OpenStack Bare Metal service (`ironic`_) works with the Watcher service
and allows to manage power state of nodes.
- the OpenStack Block Storage service (`cinder`_) works with the Watcher
service and as an API for volume node migration.
The Watcher service includes the following components:
@@ -59,9 +53,6 @@ additional functionality:
.. _`keystone`: https://github.com/openstack/keystone
.. _`ceilometer`: https://github.com/openstack/ceilometer
.. _`nova`: https://github.com/openstack/nova
.. _`gnocchi`: https://github.com/gnocchixyz/gnocchi
.. _`ironic`: https://github.com/openstack/ironic
.. _`cinder`: https://github.com/openstack/cinder
.. _`python-watcherclient`: https://github.com/openstack/python-watcherclient
.. _`watcher-dashboard`: https://github.com/openstack/watcher-dashboard
.. _`watcher metering`: https://github.com/b-com/watcher-metering
@@ -138,14 +129,10 @@ Configure the Identity service for the Watcher service
.. code-block:: bash
$ openstack endpoint create --region YOUR_REGION
watcher public http://WATCHER_API_PUBLIC_IP:9322
$ openstack endpoint create --region YOUR_REGION
watcher internal http://WATCHER_API_INTERNAL_IP:9322
$ openstack endpoint create --region YOUR_REGION
watcher admin http://WATCHER_API_ADMIN_IP:9322
$ openstack endpoint create --region YOUR_REGION watcher \
--publicurl http://WATCHER_API_PUBLIC_IP:9322 \
--internalurl http://WATCHER_API_INTERNAL_IP:9322 \
--adminurl http://WATCHER_API_ADMIN_IP:9322
.. _watcher-db_configuration:
@@ -159,7 +146,7 @@ MySQL database that is used by other OpenStack services.
``watcher`` user. Replace WATCHER_DBPASSWORD
with the actual password::
# mysql
$ mysql -u root -p
mysql> CREATE DATABASE watcher CHARACTER SET utf8;
mysql> GRANT ALL PRIVILEGES ON watcher.* TO 'watcher'@'localhost' \
@@ -178,7 +165,7 @@ You can easily generate and update a sample configuration file
named :ref:`watcher.conf.sample <watcher_sample_configuration_files>` by using
these following commands::
$ git clone https://opendev.org/openstack/watcher.git
$ git clone https://git.openstack.org/openstack/watcher
$ cd watcher/
$ tox -e genconfig
$ vi etc/watcher/watcher.conf.sample
@@ -230,7 +217,7 @@ so that the watcher service is configured for your needs.
# The SQLAlchemy connection string used to connect to the
# database (string value)
#connection=<None>
connection = mysql+pymysql://watcher:WATCHER_DBPASSWORD@DB_IP/watcher?charset=utf8
connection = mysql://watcher:WATCHER_DBPASSWORD@DB_IP/watcher?charset=utf8
#. Configure the Watcher Service to use the RabbitMQ message broker by
setting one or more of these options. Replace RABBIT_HOST with the
@@ -239,13 +226,30 @@ so that the watcher service is configured for your needs.
[DEFAULT]
# The messaging driver to use, defaults to rabbit. Other drivers
# include qpid and zmq. (string value)
#rpc_backend = rabbit
# The default exchange under which topics are scoped. May be
# overridden by an exchange name specified in the transport_url
# option. (string value)
control_exchange = watcher
# ...
transport_url = rabbit://RABBITMQ_USER:RABBITMQ_PASSWORD@RABBIT_HOST
...
[oslo_messaging_rabbit]
# The username used by the message broker (string value)
rabbit_userid = RABBITMQ_USER
# The password of user used by the message broker (string value)
rabbit_password = RABBITMQ_PASSWORD
# The host where the message brokeris installed (string value)
rabbit_host = RABBIT_HOST
# The port used bythe message broker (string value)
#rabbit_port = 5672
#. Watcher API shall validate the token provided by every incoming request,
@@ -269,7 +273,7 @@ so that the watcher service is configured for your needs.
# Authentication URL (unknown value)
#auth_url = <None>
auth_url = http://IDENTITY_IP:5000
auth_url = http://IDENTITY_IP:35357
# Username (unknown value)
# Deprecated group/name - [DEFAULT]/username
@@ -315,7 +319,7 @@ so that the watcher service is configured for your needs.
# Authentication URL (unknown value)
#auth_url = <None>
auth_url = http://IDENTITY_IP:5000
auth_url = http://IDENTITY_IP:35357
# Username (unknown value)
# Deprecated group/name - [DEFAULT]/username
@@ -345,7 +349,7 @@ so that the watcher service is configured for your needs.
[nova_client]
# Version of Nova API to use in novaclient. (string value)
#api_version = 2.56
#api_version = 2.53
api_version = 2.1
#. Create the Watcher Service database tables::
@@ -403,22 +407,26 @@ Watcher can consume notifications generated by the Nova services, in order to
build or update, in real time, its cluster data model related to computing
resources.
Nova emits unversioned(legacy) and versioned notifications on different
topics. Because legacy notifications will be deprecated, Watcher consumes
Nova versioned notifications.
Nova publishes, by default, notifications on ``notifications`` AMQP queue
(configurable) and ``versioned_notifications`` AMQP queue (not
configurable). ``notifications`` queue is mainly used by ceilometer, so we can
not use it. And some events, related to nova-compute service state, are only
sent into the ``versioned_notifications`` queue.
* In the file ``/etc/nova/nova.conf``, the value of driver in the section
``[oslo_messaging_notifications]`` can't be noop, and the value of
notification_format in the section ``[notifications]``
should be both or versioned ::
By default, Watcher listens to AMQP queues named ``watcher_notifications``
and ``versioned_notifications``. So you have to update the Nova
configuration file on controller and compute nodes, in order
to Watcher receives Nova notifications in ``watcher_notifications`` as well.
* In the file ``/etc/nova/nova.conf``, update the section
``[oslo_messaging_notifications]``, by redefining the list of topics
into which Nova services will publish events ::
[oslo_messaging_notifications]
driver = messagingv2
topics = notifications,watcher_notifications
...
[notifications]
notification_format = both
* Restart the Nova services.
Configure Cinder Notifications

View File

@@ -1,9 +1,5 @@
===================
Configuration Guide
===================
.. toctree::
:maxdepth: 2
:maxdepth: 1
configuring
watcher

View File

@@ -1 +0,0 @@
.. include:: ../../../watcher/api/controllers/rest_api_version_history.rst

View File

@@ -1,248 +0,0 @@
===========
Concurrency
===========
Introduction
************
Modern processors typically contain multiple cores all capable of executing
instructions in parallel. Ensuring applications can fully utilize modern
underlying hardware requires developing with these concepts in mind. The
OpenStack foundation maintains a number of libraries to facilitate this
utilization, combined with constructs like CPython's GIL_ the proper use of
these concepts becomes more straightforward compared to other programming
languages.
The primary libraries maintained by OpenStack to facilitate concurrency are
futurist_ and taskflow_. Here futurist is a more straightforward and
lightweight library while taskflow is more advanced supporting features like
rollback mechanisms. Within Watcher both libraries are used to facilitate
concurrency.
.. _GIL: https://wiki.python.org/moin/GlobalInterpreterLock
.. _futurist: https://docs.openstack.org/futurist/latest/
.. _taskflow: https://docs.openstack.org/taskflow/latest/
Threadpool
**********
A threadpool is a collection of one or more threads typically called *workers*
to which tasks can be submitted. These submitted tasks will be scheduled by a
threadpool and subsequently executed. In the case of Python tasks typically are
bounded or unbounded methods while other programming languages like Java
require implementing an interface.
The order and amount of concurrency with which these tasks are executed is up
to the threadpool to decide. Some libraries like taskflow allow for either
strong or loose ordering of tasks while others like futurist might only support
loose ordering. Taskflow supports building tree-based hierarchies of dependent
tasks for example.
Upon submission of a task to a threadpool a so called future_ is returned.
These objects allow to determine information about the task such as if it is
currently being executed or if it has finished execution. When the task has
finished execution the future can also be used to retrieve what was returned by
the method.
Some libraries like futurist provide synchronization primitives for collections
of futures such as wait_for_any_. The following sections will cover different
types of concurrency used in various services of Watcher.
.. _future: https://docs.python.org/3/library/concurrent.futures.html
.. _wait_for_any: https://docs.openstack.org/futurist/latest/reference/index.html#waiters
Decision engine concurrency
***************************
The concurrency in the decision engine is governed by two independent
threadpools. Both of these threadpools are GreenThreadPoolExecutor_ from the
futurist_ library. One of these is used automatically and most contributors
will not interact with it while developing new features. The other threadpool
can frequently be used while developing new features or updating existing ones.
It is known as the DecisionEngineThreadpool and allows to achieve performance
improvements in network or I/O bound operations.
.. _GreenThreadPoolExecutor: https://docs.openstack.org/futurist/latest/reference/index.html#executors
AuditEndpoint
#############
The first threadpool is used to allow multiple audits to be run in parallel.
In practice, however, only one audit can be run in parallel. This is due to
the data model used by audits being a singleton. To prevent audits destroying
each others data model one must wait for the other to complete before being
allowed to access this data model. A performance improvement could be achieved
by being more intelligent in the use, caching and construction of these
data models.
DecisionEngineThreadPool
########################
The second threadpool is used for generic tasks, typically networking and I/O
could benefit the most of this threadpool. Upon execution of an audit this
threadpool can be utilized to retrieve information from the Nova compute
service for instance. This second threadpool is a singleton and is shared
amongst concurrently running audits as a result the amount of workers is static
and independent from the amount of workers in the first threadpool. The use of
the :class:`~.DecisionEngineThreadpool` while building the Nova compute data
model is demonstrated to show how it can effectively be used.
In the following example a reference to the
:class:`~.DecisionEngineThreadpool` is stored in ``self.executor``. Here two
tasks are submitted one with function ``self._collect_aggregates`` and the
other function ``self._collect_zones``. With both ``self.executor.submit``
calls subsequent arguments are passed to the function. All subsequent arguments
are passed to the function being submitted as task following the common
``(fn, *args, **kwargs)`` signature. One of the original signatures would be
``def _collect_aggregates(host_aggregates, compute_nodes)`` for example.
.. code-block:: python
zone_aggregate_futures = {
self.executor.submit(
self._collect_aggregates, host_aggregates, compute_nodes),
self.executor.submit(
self._collect_zones, availability_zones, compute_nodes)
}
waiters.wait_for_all(zone_aggregate_futures)
The last statement of the example above waits on all futures to complete.
Similarly, ``waiters.wait_for_any`` will wait for any future of the specified
collection to complete. To simplify the usage of ``wait_for_any`` the
:class:`~.DecisiongEngineThreadpool` defines a ``do_while_futures`` method.
This method will iterate in a do_while loop over a collection of futures until
all of them have completed. The advantage of ``do_while_futures`` is that it
allows to immediately call a method as soon as a future finishes. The arguments
for this callback method can be supplied when calling ``do_while_futures``,
however, the first argument to the callback is always the future itself! If
the collection of futures can safely be modified ``do_while_futures_modify``
can be used and should have slightly better performance. The following example
will show how ``do_while_futures`` is used in the decision engine.
.. code-block:: python
# For every compute node from compute_nodes submit a task to gather the node it's information.
# List comprehension is used to store all the futures of the submitted tasks in node_futures.
node_futures = [self.executor.submit(
self.nova_helper.get_compute_node_by_name,
node, servers=True, detailed=True)
for node in compute_nodes]
LOG.debug("submitted {0} jobs".format(len(compute_nodes)))
future_instances = []
# do_while iterate over node_futures and upon completion of a future call
# self._compute_node_future with the future and future_instances as arguments.
self.executor.do_while_futures_modify(
node_futures, self._compute_node_future, future_instances)
# Wait for all instance jobs to finish
waiters.wait_for_all(future_instances)
Finally, let's demonstrate how powerful this ``do_while_futures`` can be by
showing what the ``compute_node_future`` callback does. First, it retrieves the
result from the future and adds the compute node to the data model. Afterwards,
it checks if the compute node has any associated instances and if so it submits
an additional task to the :class:`~.DecisionEngineThreadpool`. The future is
appended to the ``future_instances`` so ``waiters.wait_for_all`` can be called
on this list. This is important as otherwise the building of the data model
might return before all tasks for instances have finished.
.. code-block:: python
# Get the result from the future.
node_info = future.result()[0]
# Filter out baremetal nodes.
if node_info.hypervisor_type == 'ironic':
LOG.debug("filtering out baremetal node: %s", node_info)
return
# Add the compute node to the data model.
self.add_compute_node(node_info)
# Get the instances from the compute node.
instances = getattr(node_info, "servers", None)
# Do not submit job if there are no instances on compute node.
if instances is None:
LOG.info("No instances on compute_node: {0}".format(node_info))
return
# Submit a job to retrieve detailed information about the instances.
future_instances.append(
self.executor.submit(
self.add_instance_node, node_info, instances)
)
Without ``do_while_futures`` an additional ``waiters.wait_for_all`` would be
required in between the compute node tasks and the instance tasks. This would
cause the progress of the decision engine to stall as less and less tasks
remain active before the instance tasks could be submitted. This demonstrates
how ``do_while_futures`` can be used to achieve more constant utilization of
the underlying hardware.
Applier concurrency
*******************
The applier does not use the futurist_ GreenThreadPoolExecutor_ directly but
instead uses taskflow_. However, taskflow still utilizes a greenthreadpool.
This threadpool is initialized in the workflow engine called
:class:`~.DefaultWorkFlowEngine`. Currently Watcher supports one workflow
engine but the base class allows contributors to develop other workflow engines
as well. In taskflow tasks are created using different types of flows such as a
linear, unordered or a graph flow. The linear and graph flow allow for strong
ordering between individual tasks and it is for this reason that the workflow
engine utilizes a graph flow. The creation of tasks, subsequently linking them
into a graph like structure and submitting them is shown below.
.. code-block:: python
self.execution_rule = self.get_execution_rule(actions)
flow = gf.Flow("watcher_flow")
actions_uuid = {}
for a in actions:
task = TaskFlowActionContainer(a, self)
flow.add(task)
actions_uuid[a.uuid] = task
for a in actions:
for parent_id in a.parents:
flow.link(actions_uuid[parent_id], actions_uuid[a.uuid],
decider=self.decider)
e = engines.load(
flow, executor='greenthreaded', engine='parallel',
max_workers=self.config.max_workers)
e.run()
return flow
In the applier tasks are contained in a :class:`~.TaskFlowActionContainer`
which allows them to trigger events in the workflow engine. This way the
workflow engine can halt or take other actions while the action plan is being
executed based on the success or failure of individual actions. However, the
base workflow engine simply uses these notifies to store the result of
individual actions in the database. Additionally, since taskflow uses a graph
flow if any of the tasks would fail all childs of this tasks not be executed
while ``do_revert`` will be triggered for all parents.
.. code-block:: python
class TaskFlowActionContainer(...):
...
def do_execute(self, *args, **kwargs):
...
result = self.action.execute()
if result is True:
return self.engine.notify(self._db_action,
objects.action.State.SUCCEEDED)
else:
self.engine.notify(self._db_action,
objects.action.State.FAILED)
class BaseWorkFlowEngine(...):
...
def notify(self, action, state):
db_action = objects.Action.get_by_uuid(self.context, action.uuid,
eager=True)
db_action.state = state
db_action.save()
return db_action

View File

@@ -1,111 +1,72 @@
============================
So You Want to Contribute...
============================
..
Except where otherwise noted, this document is licensed under Creative
Commons Attribution 3.0 License. You can view the license at:
For general information on contributing to OpenStack, please check out the
`contributor guide <https://docs.openstack.org/contributors/>`_ to get started.
It covers all the basics that are common to all OpenStack projects:
the accounts you need, the basics of interacting with our Gerrit review system,
how we communicate as a community, etc.
https://creativecommons.org/licenses/by/3.0/
Below will cover the more project specific information you need to get started
with Watcher.
.. _contributing:
Communication
~~~~~~~~~~~~~~
.. This would be a good place to put the channel you chat in as a project; when/
where your meeting is, the tags you prepend to your ML threads, etc.
=======================
Contributing to Watcher
=======================
If you're interested in contributing to the Watcher project,
the following will help get you started.
Contributor License Agreement
-----------------------------
.. index::
single: license; agreement
In order to contribute to the Watcher project, you need to have
signed OpenStack's contributor's agreement.
.. seealso::
* https://docs.openstack.org/infra/manual/developers.html
* https://wiki.openstack.org/CLA
LaunchPad Project
-----------------
Most of the tools used for OpenStack depend on a launchpad.net ID for
authentication. After signing up for a launchpad account, join the
"openstack" team to have access to the mailing list and receive
notifications of important events.
.. seealso::
* https://launchpad.net
* https://launchpad.net/watcher
* https://launchpad.net/~openstack
Project Hosting Details
-----------------------
Bug tracker
https://launchpad.net/watcher
Mailing list (prefix subjects with ``[watcher]`` for faster responses)
https://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Wiki
https://wiki.openstack.org/Watcher
Code Hosting
https://git.openstack.org/cgit/openstack/watcher
Code Review
https://review.openstack.org/#/q/status:open+project:openstack/watcher,n,z
IRC Channel
``#openstack-watcher`` (changelog_)
Mailing list(prefix subjects with ``[watcher]``)
http://lists.openstack.org/pipermail/openstack-discuss/
Weekly Meetings
Bi-weekly, on Wednesdays at 08:00 UTC on odd weeks in the
``#openstack-meeting-alt`` IRC channel (`meetings logs`_)
Meeting Agenda
https://wiki.openstack.org/wiki/Watcher_Meeting_Agenda
On Wednesdays at 14:00 UTC on even weeks in the ``#openstack-meeting-4``
IRC channel, 13:00 UTC on odd weeks in the ``#openstack-meeting-alt``
IRC channel (`meetings logs`_)
.. _changelog: http://eavesdrop.openstack.org/irclogs/%23openstack-watcher/
.. _meetings logs: http://eavesdrop.openstack.org/meetings/watcher/
Contacting the Core Team
~~~~~~~~~~~~~~~~~~~~~~~~~
.. This section should list the core team, their irc nicks, emails, timezones etc.
If all this info is maintained elsewhere (i.e. a wiki), you can link to that
instead of enumerating everyone here.
+--------------------+---------------+------------------------------------+
| Name | IRC | Email |
+====================+===============+====================================+
| `Li Canwei`_ | licanwei | li.canwei2@zte.com.cn |
+--------------------+---------------+------------------------------------+
| `chen ke`_ | chenke | chen.ke14@zte.com.cn |
+--------------------+---------------+------------------------------------+
| `Corne Lukken`_ | dantalion | info@dantalion.nl |
+--------------------+---------------+------------------------------------+
| `su zhengwei`_ | suzhengwei | sugar-2008@163.com |
+--------------------+---------------+------------------------------------+
| `Yumeng Bao`_ | Yumeng | yumeng_bao@yahoo.com |
+--------------------+---------------+------------------------------------+
.. _Corne Lukken: https://launchpad.net/~dantalion
.. _Li Canwei: https://launchpad.net/~li-canwei2
.. _su zhengwei: https://launchpad.net/~sue.sam
.. _Yumeng Bao: https://launchpad.net/~yumeng-bao
.. _chen ke: https://launchpad.net/~chenker
New Feature Planning
~~~~~~~~~~~~~~~~~~~~
.. This section is for talking about the process to get a new feature in. Some
projects use blueprints, some want specs, some want both! Some projects
stick to a strict schedule when selecting what new features will be reviewed
for a release.
New feature will be discussed via IRC or ML (with [Watcher] prefix).
Watcher team uses blueprints in `Launchpad`_ to manage the new features.
.. _Launchpad: https://launchpad.net/watcher
Task Tracking
~~~~~~~~~~~~~~
.. This section is about where you track tasks- launchpad? storyboard?
is there more than one launchpad project? what's the name of the project
group in storyboard?
We track our tasks in Launchpad.
If you're looking for some smaller, easier work item to pick up and get started
on, search for the 'low-hanging-fruit' tag.
.. NOTE: If your tag is not 'low-hanging-fruit' please change the text above.
Reporting a Bug
~~~~~~~~~~~~~~~
.. Pretty self explanatory section, link directly to where people should report bugs for
your project.
You found an issue and want to make sure we are aware of it? You can do so
`HERE`_.
.. _HERE: https://bugs.launchpad.net/watcher
Getting Your Patch Merged
~~~~~~~~~~~~~~~~~~~~~~~~~
.. This section should have info about what it takes to get something merged.
Do you require one or two +2's before +W? Do some of your repos require
unit test changes with all patches? etc.
Due to the small number of core reviewers of the Watcher project,
we only need one +2 before +W (merge). All patches excepting for documentation
or typos fixes must have unit test.
Project Team Lead Duties
------------------------
.. this section is where you can put PTL specific duties not already listed in
the common PTL guide (linked below) or if you already have them written
up elsewhere, you can link to that doc here.
All common PTL duties are enumerated here in the `PTL guide <https://docs.openstack.org/project-team-guide/ptl.html>`_.

View File

@@ -19,7 +19,7 @@ model. To enable the Watcher plugin with DevStack, add the following to the
`[[local|localrc]]` section of your controller's `local.conf` to enable the
Watcher plugin::
enable_plugin watcher https://opendev.org/openstack/watcher
enable_plugin watcher https://git.openstack.org/openstack/watcher
For more detailed instructions, see `Detailed DevStack Instructions`_. Check
out the `DevStack documentation`_ for more information regarding DevStack.
@@ -27,38 +27,6 @@ out the `DevStack documentation`_ for more information regarding DevStack.
.. _PluginModelDocs: https://docs.openstack.org/devstack/latest/plugins.html
.. _DevStack documentation: https://docs.openstack.org/devstack/latest
Quick Devstack Instructions with Datasources
============================================
Watcher requires a datasource to collect metrics from compute nodes and
instances in order to execute most strategies. To enable this a
`[[local|localrc]]` to setup DevStack for some of the supported datasources
is provided. These examples specify the minimal configuration parameters to
get both Watcher and the datasource working but can be expanded is desired.
Gnocchi
-------
With the Gnocchi datasource most of the metrics for compute nodes and
instances will work with the provided configuration but metrics that
require Ironic such as `host_airflow and` `host_power` will still be
unavailable as well as `instance_l3_cpu_cache`::
[[local|localrc]]
enable_plugin watcher https://opendev.org/openstack/watcher
enable_plugin watcher-dashboard https://opendev.org/openstack/watcher-dashboard
enable_plugin ceilometer https://opendev.org/openstack/ceilometer.git
CEILOMETER_BACKEND=gnocchi
enable_plugin aodh https://opendev.org/openstack/aodh
enable_plugin panko https://opendev.org/openstack/panko
[[post-config|$NOVA_CONF]]
[DEFAULT]
compute_monitors=cpu.virt_driver
Detailed DevStack Instructions
==============================
@@ -76,7 +44,7 @@ Detailed DevStack Instructions
sudo apt-get update
sudo apt-get install git
git clone https://opendev.org/openstack/devstack.git
git clone https://git.openstack.org/openstack-dev/devstack
sudo ./devstack/tools/create-stack-user.sh
Now you have a stack user that is used to run the DevStack processes. You
@@ -88,7 +56,7 @@ Detailed DevStack Instructions
sudo su stack
cd ~
git clone https://opendev.org/openstack/devstack.git
git clone https://git.openstack.org/openstack-dev/devstack
#. For each compute node, copy the provided `local.conf.compute`_ example file
to the compute node's system at ~/devstack/local.conf. Make sure the

View File

@@ -16,7 +16,7 @@ for development purposes.
To install Watcher from packaging, refer instead to Watcher `User
Documentation`_.
.. _`Git Repository`: https://opendev.org/openstack/watcher
.. _`Git Repository`: https://git.openstack.org/cgit/openstack/watcher
.. _`User Documentation`: https://docs.openstack.org/watcher/latest/
Prerequisites
@@ -37,7 +37,7 @@ different version of the above, please document your configuration here!
.. _Python: https://www.python.org/
.. _git: https://git-scm.com/
.. _setuptools: https://pypi.org/project/setuptools
.. _setuptools: https://pypi.python.org/pypi/setuptools
.. _virtualenvwrapper: https://virtualenvwrapper.readthedocs.io/en/latest/install.html
Getting the latest code
@@ -47,7 +47,7 @@ Make a clone of the code from our `Git repository`:
.. code-block:: bash
$ git clone https://opendev.org/openstack/watcher.git
$ git clone https://git.openstack.org/openstack/watcher.git
When that is complete, you can:
@@ -69,8 +69,8 @@ itself.
These dependencies can be installed from PyPi_ using the Python tool pip_.
.. _PyPi: https://pypi.org/
.. _pip: https://pypi.org/project/pip
.. _PyPi: https://pypi.python.org/
.. _pip: https://pypi.python.org/pypi/pip
However, your system *may* need additional dependencies that `pip` (and by
extension, PyPi) cannot satisfy. These dependencies should be installed
@@ -99,7 +99,7 @@ useful to keep a clean environment for working on Watcher.
.. code-block:: bash
$ mkvirtualenv watcher
$ git clone https://opendev.org/openstack/watcher.git
$ git clone https://git.openstack.org/openstack/watcher
# Use 'python setup.py' to link Watcher into Python's site-packages
$ cd watcher && python setup.py install
@@ -123,10 +123,9 @@ You can re-activate this virtualenv for your current shell using:
$ workon watcher
For more information on virtual environments, see virtualenv_ and
virtualenvwrapper_.
For more information on virtual environments, see virtualenv_.
.. _virtualenv: https://pypi.org/project/virtualenv/
.. _virtualenv: https://www.virtualenv.org/
@@ -193,8 +192,6 @@ still need to configure the following sections:
:ref:`Identity service <identity-service_configuration>` i.e. Keystone
- The ``[watcher_messaging]`` section to configure the OpenStack AMQP-based
message bus
- The ``watcher_clients_auth`` section to configure Keystone client to access
related OpenStack projects
So if you need some more details on how to configure one or more of these
sections, please do have a look at :doc:`../configuration/configuring` before

View File

@@ -1,12 +1,8 @@
==================
Contribution Guide
==================
.. toctree::
:maxdepth: 2
:maxdepth: 1
contributing
environment
devstack
notifications
testing
rally_link

View File

@@ -79,7 +79,7 @@ requirements.txt file::
.. _cookiecutter: https://github.com/audreyr/cookiecutter
.. _OpenStack cookiecutter: https://github.com/openstack-dev/cookiecutter
.. _python-watcher: https://pypi.org/project/python-watcher
.. _python-watcher: https://pypi.python.org/pypi/python-watcher
Implementing a plugin for Watcher
=================================

View File

@@ -208,7 +208,7 @@ Here below is how to register ``DummyClusterDataModelCollector`` using pbr_:
watcher_cluster_data_model_collectors =
dummy = thirdparty.dummy:DummyClusterDataModelCollector
.. _pbr: https://docs.openstack.org/pbr/latest/
.. _pbr: http://docs.openstack.org/pbr/latest
Add new notification endpoints

View File

@@ -1,7 +1,3 @@
============
Plugin Guide
============
.. toctree::
:maxdepth: 1

View File

@@ -56,6 +56,9 @@ Here is an example showing how you can write a plugin called ``NewStrategy``:
# filepath: thirdparty/new.py
# import path: thirdparty.new
import abc
import six
from watcher._i18n import _
from watcher.decision_engine.strategy.strategies import base
@@ -242,16 +245,15 @@ Querying metrics
A large set of metrics, generated by OpenStack modules, can be used in your
strategy implementation. To collect these metrics, Watcher provides a
`DataSourceManager`_ for two data sources which are `Ceilometer`_
(with `Gnocchi`_ as API) and `Monasca`_. If you wish to query metrics from a
different data source, you can implement your own and use it via
DataSourceManager from within your new strategy. Indeed, strategies in Watcher
have the cluster data models decoupled from the data sources which means that
you may keep the former while changing the latter. The recommended way for you
to support a new data source is to implement a new helper that would
encapsulate within separate methods the queries you need to perform. To then
use it, you would just have to add it to appropriate watcher_strategies.*
section in config file.
`Helper`_ for two data sources which are `Ceilometer`_ and `Monasca`_. If you
wish to query metrics from a different data source, you can implement your own
and directly use it from within your new strategy. Indeed, strategies in
Watcher have the cluster data models decoupled from the data sources which
means that you may keep the former while changing the latter.
The recommended way for you to support a new data source is to implement a new
helper that would encapsulate within separate methods the queries you need to
perform. To then use it, you would just have to instantiate it within your
strategy.
If you want to use Ceilometer but with your own metrics database backend,
please refer to the `Ceilometer developer guide`_. The list of the available
@@ -261,45 +263,52 @@ requires new metrics not covered by Ceilometer, you can add them through a
`Ceilometer plugin`_.
.. _`DataSourceManager`: https://github.com/openstack/watcher/blob/master/watcher/datasource/manager.py
.. _`Helper`: https://github.com/openstack/watcher/blob/master/watcher/datasource/ceilometer.py
.. _`Ceilometer developer guide`: https://docs.openstack.org/ceilometer/latest/contributor/architecture.html#storing-accessing-the-data
.. _`Ceilometer`: https://docs.openstack.org/ceilometer/latest
.. _`Monasca`: https://github.com/openstack/monasca-api/blob/master/docs/monasca-api-spec.md
.. _`here`: https://docs.openstack.org/ceilometer/latest/contributor/install/dbreco.html#choosing-a-database-backend
.. _`Ceilometer plugin`: https://docs.openstack.org/ceilometer/latest/contributor/plugins.html
.. _`Ceilosca`: https://github.com/openstack/monasca-ceilometer/blob/master/ceilosca/ceilometer/storage/impl_monasca.py
.. _`Gnocchi`: https://gnocchi.xyz/
Read usage metrics using the Watcher Datasource Helper
------------------------------------------------------
The following code snippet shows how datasource_backend is defined:
The following code snippet shows how to invoke a Datasource Helper class:
.. code-block:: py
from watcher.datasource import manager as ds_manager
from watcher.datasource import ceilometer as ceil
from watcher.datasource import monasca as mon
@property
def datasource_backend(self):
if not self._datasource_backend:
def ceilometer(self):
if self._ceilometer is None:
self._ceilometer = ceil.CeilometerHelper(osc=self.osc)
return self._ceilometer
# Load the global preferred datasources order but override it
# if the strategy has a specific datasources config
datasources = CONF.watcher_datasources
if self.config.datasources:
datasources = self.config
self._datasource_backend = ds_manager.DataSourceManager(
config=datasources,
osc=self.osc
).get_backend(self.DATASOURCE_METRICS)
return self._datasource_backend
@property
def monasca(self):
if self._monasca is None:
self._monasca = mon.MonascaHelper(osc=self.osc)
return self._monasca
Using that you can now query the values for that specific metric:
.. code-block:: py
avg_meter = self.datasource_backend.statistic_aggregation(
instance.uuid, 'cpu_util', self.periods['instance'],
self.granularity,
aggregation=self.aggregation_method['instance'])
if self.config.datasource == "ceilometer":
resource_id = "%s_%s" % (node.uuid, node.hostname)
return self.ceilometer.statistic_aggregation(
resource_id=resource_id,
meter_name='compute.node.cpu.percent',
period="7200",
aggregate='avg',
)
elif self.config.datasource == "monasca":
statistics = self.monasca.statistic_aggregation(
meter_name='compute.node.cpu.percent',
dimensions=dict(hostname=node.uuid),
period=7200,
aggregate='avg'
)

View File

@@ -4,41 +4,48 @@
https://creativecommons.org/licenses/by/3.0/
=================
Developer Testing
=================
=======
Testing
=======
.. _unit_tests:
Unit tests
==========
All unit tests should be run using `tox`_. Before running the unit tests, you
should download the latest `watcher`_ from the github. To run the same unit
tests that are executing onto `Gerrit`_ which includes ``py36``, ``py37`` and
``pep8``, you can issue the following command::
All unit tests should be run using `tox`_. To run the same unit tests that are
executing onto `Gerrit`_ which includes ``py35``, ``py27`` and ``pep8``, you
can issue the following command::
$ git clone https://opendev.org/openstack/watcher
$ cd watcher
$ pip install tox
$ tox
$ workon watcher
(watcher) $ pip install tox
(watcher) $ cd watcher
(watcher) $ tox
If you only want to run one of the aforementioned, you can then issue one of
If you want to only run one of the aforementioned, you can then issue one of
the following::
$ tox -e py36
$ tox -e py37
$ tox -e pep8
$ workon watcher
(watcher) $ tox -e py35
(watcher) $ tox -e py27
(watcher) $ tox -e pep8
.. _tox: https://tox.readthedocs.org/
.. _watcher: https://opendev.org/openstack/watcher
.. _Gerrit: https://review.opendev.org/
.. _Gerrit: http://review.openstack.org/
If you only want to run specific unit test code and don't like to waste time
waiting for all unit tests to execute, you can add parameters ``--`` followed
by a regex string::
You may pass options to the test programs using positional arguments. To run a
specific unit test, you can pass extra options to `os-testr`_ after putting
the ``--`` separator. So using the ``-r`` option followed by a regex string,
you can run the desired test::
$ tox -e py37 -- watcher.tests.api
$ workon watcher
(watcher) $ tox -e py27 -- -r watcher.tests.api
.. _os-testr: https://docs.openstack.org/os-testr/latest
When you're done, deactivate the virtualenv::
$ deactivate
.. _tempest_tests:
@@ -48,4 +55,4 @@ Tempest tests
Tempest tests for Watcher has been migrated to the external repo
`watcher-tempest-plugin`_.
.. _watcher-tempest-plugin: https://opendev.org/openstack/watcher-tempest-plugin
.. _watcher-tempest-plugin: https://github.com/openstack/watcher-tempest-plugin

View File

@@ -1,426 +0,0 @@
==================
Grafana datasource
==================
Synopsis
--------
Grafana can interface with many different types of storage backends that
Grafana calls datasources_. Since the term datasources causes significant
confusion by overlapping definitions used in Watcher these **datasources are
called projects instead**. Some examples of supported projects are InfluxDB
or Elasticsearch while others might be more familiar such as Monasca or
Gnocchi. The Grafana datasource provides the functionality to retrieve metrics
from Grafana for different projects. This functionality is achieved by using
the proxy interface exposed in Grafana to communicate with Grafana projects
directly.
Background
**********
Since queries to retrieve metrics from Grafana are proxied to the project the
format of these queries will change significantly depending on the type of
project. The structure of the projects themselves will also change
significantly as they are structured by users and administrators. For instance,
some developers might decide to store metrics about compute_nodes in MySQL and
use the UUID as primary key while others use InfluxDB and use the hostname as
primary key. Furthermore, datasources in Watcher should return metrics in
specific units strictly defined in the baseclass_ depending on how the units
are stored in the projects they might require conversion before being returned.
The flexible configuration parameters of the Grafana datasource allow to
specify exactly how the deployment is configured and this will enable to
correct retrieval of metrics and with the correct units.
.. _datasources: https://grafana.com/plugins?type=datasource
.. _baseclass: https://github.com/openstack/watcher/blob/584eeefdc8/watcher/datasources/base.py
Requirements
------------
The use of the Grafana datasource requires a reachable Grafana endpoint and an
authentication token for access to the desired projects. The projects behind
Grafana will need to contain the metrics for compute_nodes_ or instances_ and
these need to be identifiable by an attribute of the Watcher datamodel_ for
instance hostname or UUID.
.. _compute_nodes: https://opendev.org/openstack/watcher/src/branch/master/watcher/decision_engine/model/element/node.py
.. _instances: https://opendev.org/openstack/watcher/src/branch/master/watcher/decision_engine/model/element/instance.py
.. _datamodel: https://opendev.org/openstack/watcher/src/branch/master/watcher/decision_engine/model/element
Limitations
***********
* Only the InfluxDB project is currently supported [#f1]_.
* All metrics must be retrieved from the same Grafana endpoint (same URL).
* All metrics must be retrieved with the same authentication token.
.. [#f1] A base class for projects is available_ and easily extensible.
.. _available: https://review.opendev.org/#/c/649341/24/watcher/datasources/grafana_translator/base.py
Configuration
-------------
Several steps are required in order to use the Grafana datasource, Most steps
are related configuring Watcher to match the deployed Grafana setup such as
queries proxied to the project or the type of project for any given metric.
Most of the configuration can either be supplied via the traditional
configuration file or in a `special yaml`_ file.
.. _special yaml: https://specs.openstack.org/openstack/watcher-specs/specs/train/approved/file-based-metricmap.html
token
*****
First step is to generate an access token with access to the required projects.
This can be done from the api_ or from the web interface_. Tokens generated
from the web interface will have the same access to projects as the user that
created them while using the cli allows to generate a key for a specific
role.The token will only be displayed once so store it well. This token will go
into the configuration file later and this parameter can not be placed in the
yaml.
.. _api: https://grafana.com/docs/http_api/auth/#create-api-key
.. _interface: https://grafana.com/docs/http_api/auth/#create-api-token
base_url
********
Next step is supplying the base url of the Grafana endpoint. The base url
parameter will need to specify the type of http protocol and the use of
plain text http is strongly discouraged due to the transmission of the access
token. Additionally the path to the proxy interface needs to be supplied as
well in case Grafana is placed in a sub directory of the web server. An example
would be: `https://mygrafana.org/api/datasource/proxy/` were
`/api/datasource/proxy` is the default path without any subdirectories.
Likewise, this parameter can not be placed in the yaml.
To prevent many errors from occurring and potentially filing the logs files it
is advised to specify the desired datasource in the configuration as it would
prevent the datasource manager from having to iterate and try possible
datasources with the launch of each audit. To do this specify `datasources` in
the `[watcher_datasources]` group.
The current configuration that is required to be placed in the traditional
configuration file would look like the following:
.. code-block:: shell
[grafana_client]
token = 0JLbF0oB4R3Q2Fl337Gh4Df5VN12D3adBE3f==
base_url = https://mygranfa.org/api/datasource/proxy
[watcher_datasources]
datasources = grafana
metric parameters
*****************
The last five remaining configuration parameters can all be placed both in the
traditional configuration file or in the yaml, however, it is not advised to
mix and match but in the case it does occur the yaml would override the
settings from the traditional configuration file. All five of these parameters
are dictionaries mapping specific metrics to a configuration parameter. For
instance the `project_id_map` will specify the specific project id in Grafana
to be used. The parameters are named as follow:
* project_id_map
* database_map
* translator_map
* attribute_map
* query_map
These five parameters are named differently if configured using the yaml
configuration file. The parameters are named as follows and are in
identical order as to the list of the traditional configuration file:
* project
* db
* translator
* attribute
* query
When specified in the yaml the parameters are no longer dictionaries instead
each parameter needs to be defined per metric as sub-parameters. Examples of
these parameters configured for both the yaml and traditional configuration
are described at the end of this document.
project_id
**********
The project id's can only be determined by someone with the admin role in
Grafana as that role is required to open the list of projects. The list of
projects can be found on `/datasources` in the web interface but
unfortunately it does not immediately display the project id. To display
the id one can best hover the mouse over the projects and the url will show the
project id's for example `/datasources/edit/7563`. Alternatively the entire
list of projects can be retrieved using the `REST api`_. To easily make
requests to the REST api a tool such as Postman can be used.
.. _REST api: https://grafana.com/docs/http_api/data_source/#get-all-datasources
database
********
The database is the parameter for the schema / database that is actually
defined in the project. For instance, if the project would be based on MySQL
this is were the name of schema used within the MySQL server would be
specified. For many different projects it is possible to list all the databases
currently available. Tools like Postman can be used to list all the available
databases per project. For InfluxDB based projects this would be with the
following path and query, however be sure to construct these request in Postman
as the header needs to contain the authorization token:
.. code-block:: shell
https://URL.DOMAIN/api/datasources/proxy/PROJECT_ID/query?q=SHOW%20DATABASES
translator
**********
Each translator is for a specific type of project will have a uniquely
identifiable name and the baseclass allows to easily support new types of
projects such as elasticsearch or prometheus. Currently only InfluxDB based
projects are supported as a result the only valid value for this parameter is `
influxdb`.
attribute
*********
The attribute parameter specifies which attribute to use from Watcher's
data model in order to construct the query. The available attributes differ
per type of object in the data model but the following table shows the
attributes for ComputeNodes, Instances and IronicNodes.
+-----------------+-----------------+--------------------+
| ComputeNode | Instance | IronicNode |
+=================+=================+====================+
| uuid | uuid | uuid |
+-----------------+-----------------+--------------------+
| id | name | human_id |
+-----------------+-----------------+--------------------+
| hostname | project_id | power_state |
+-----------------+-----------------+--------------------+
| status | watcher_exclude | maintenance |
+-----------------+-----------------+--------------------+
| disabled_reason | locked | maintenance_reason |
+-----------------+-----------------+--------------------+
| state | metadata | extra |
+-----------------+-----------------+--------------------+
| memory | state | |
+-----------------+-----------------+--------------------+
| disk | memory | |
+-----------------+-----------------+--------------------+
| disk_capacity | disk | |
+-----------------+-----------------+--------------------+
| vcpus | disk_capacity | |
+-----------------+-----------------+--------------------+
| | vcpus | |
+-----------------+-----------------+--------------------+
Many if not all of these attributes map to attributes of the objects that are
fetched from clients such as Nova. To see how these attributes are put into the
data model the following source files can be analyzed for Nova_ and Ironic_.
.. _Nova: https://opendev.org/openstack/watcher/src/branch/master/watcher/decision_engine/model/collector/nova.py#L304
.. _Ironic: https://opendev.org/openstack/watcher/src/branch/master/watcher/decision_engine/model/collector/ironic.py#L85
query
*****
The query is the single most important parameter it will be passed to the
project and should return the desired metric for the specific host and return
the value in the correct unit. The units for all available metrics are
documented in the `datasource baseclass`_. This might mean the query specified
in this parameter is responsible for converting the unit. The following query
demonstrates how such a conversion could be achieved and demonstrates the
conversion from bytes to megabytes.
.. code-block:: shell
SELECT value/1000000 FROM memory...
Queries will be formatted using the .format string method within Python. This
format will currently have give attributes exposed to it labeled `{0}` to
`{4}`. Every occurrence of these characters within the string will be replaced
with the specific attribute.
- {0} is the aggregate typically `mean`, `min`, `max` but `count` is also
supported.
- {1} is the attribute as specified in the attribute parameter.
- {2} is the period of time to aggregate data over in seconds.
- {3} is the granularity or the interval between data points in seconds.
- {4} is translator specific and in the case of InfluxDB it will be used for
retention_periods.
**InfluxDB**
Constructing the queries or rather anticipating how the results should look to
be correctly interpreted by Watcher can be a challenge. The following json
example demonstrates how what the result should look like and the query used to
get this result.
.. code-block:: json
{
"results": [
{
"statement_id": 0,
"series": [
{
"name": "vmstats",
"tags": {
"host": "autoserver01"
},
"columns": [
"time",
"mean"
],
"values": [
[
1560848284284,
7680000
]
]
}
]
}
]
}
.. code-block:: shell
SELECT {0}("{0}_value") FROM "vmstats" WHERE host =~ /^{1}$/ AND
"type_instance" =~ /^mem$/ AND time >= now() - {2}s GROUP BY host
.. _datasource baseclass: https://opendev.org/openstack/watcher/src/branch/master/watcher/datasources/base.py
Example configuration
---------------------
The example configurations will show both how to achieve the entire
configuration in the config file or use a combination of the regular file and
yaml. Using yaml to define all the parameters for each metric is recommended
since it has better human readability and supports mutli-line option
definitions.
Configuration file
******************
**It is important to note that the line breaks shown in between assignments of
parameters can not be used in the actual configuration and these are simply here
for readability reasons.**
.. code-block:: shell
[grafana_client]
# Authentication token to gain access (string value)
# Note: This option can be changed without restarting.
token = eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk==
# first part of the url (including https:// or http://) up until project id
# part. Example: https://secure.org/api/datasource/proxy/ (string value)
# Note: This option can be changed without restarting.
base_url = https://monitoring-grafana.com/api/datasources/proxy/
# Project id as in url (integer value)
# Note: This option can be changed without restarting.
project_id_map = host_cpu_usage:1337,host_ram_usage:6969,
instance_cpu_usage:1337,instance_ram_usage:9696
# Mapping of grafana databases to datasource metrics. (dict value)
# Note: This option can be changed without restarting.
database_map = host_cpu_usage:monit_production,
host_ram_usage:monit_production,instance_cpu_usage:prod_cloud,
instance_ram_usage:prod_cloud
translator_map = host_cpu_usage:influxdb,host_ram_usage:influxdb,
instance_cpu_usage:influxdb,instance_ram_usage:influxdb
attribute_map = host_cpu_usage:hostname,host_ram_usage:hostname,
instance_cpu_usage:name,instance_ram_usage:name
query_map = host_cpu_usage:SELECT 100-{0}("{0}_value") FROM {4}.cpu WHERE
("host" =~ /^{1}$/ AND "type_instance" =~/^idle$/ AND time > now()-{2}s),
host_ram_usage:SELECT {0}("{0}_value")/1000000 FROM {4}.memory WHERE
("host" =~ /^{1}$/) AND "type_instance" =~ /^used$/ AND time >= now()-{2}s
GROUP BY "type_instance",instance_cpu_usage:SELECT {0}("{0}_value") FROM
"vmstats" WHERE host =~ /^{1}$/ AND "type_instance" =~ /^cpu$/ AND time >=
now() - {2}s GROUP BY host,instance_ram_usage:SELECT {0}("{0}_value") FROM
"vmstats" WHERE host =~ /^{1}$/ AND "type_instance" =~ /^mem$/ AND time >=
now() - {2}s GROUP BY host
[grafana_translators]
retention_periods = one_week:10080,one_month:302400,five_years:525600
[watcher_datasources]
datasources = grafana
yaml
****
When using the yaml configuration file some parameters still need to be defined
using the regular configuration such as the path for the yaml file these
parameters are detailed below:
.. code-block:: shell
[grafana_client]
token = eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk==
base_url = https://monitoring-grafana.com/api/datasources/proxy/
[watcher_datasources]
datasources = grafana
[watcher_decision_engine]
metric_map_path = /etc/watcher/metric_map.yaml
Using the yaml allows to more effectively define the parameters per metric with
greater human readability due to the availability of multi line options. These
multi line options are demonstrated in the query parameters.
.. code-block:: yaml
grafana:
host_cpu_usage:
project: 1337
db: monit_production
translator: influxdb
attribute: hostname
query: >
SELECT 100-{0}("{0}_value") FROM {4}.cpu
WHERE ("host" =~ /^{1}$/ AND "type_instance" =~/^idle$/ AND
time > now()-{2}s)
host_ram_usage:
project: 6969
db: monit_production
translator: influxdb
attribute: hostname
query: >
SELECT {0}("{0}_value")/1000000 FROM {4}.memory WHERE
("host" =~ /^{1}$/) AND "type_instance" =~ /^used$/ AND time >=
now()-{2}s GROUP BY "type_instance"
instance_cpu_usage:
project: 1337
db: prod_cloud
translator: influxdb
attribute: name
query: >
SELECT {0}("{0}_value") FROM
"vmstats" WHERE host =~ /^{1}$/ AND "type_instance" =~ /^cpu$/ AND
time >= now() - {2}s GROUP BY host
instance_ram_usage:
project: 9696
db: prod_cloud
translator: influxdb
attribute: name
query: >
SELECT {0}("{0}_value") FROM
"vmstats" WHERE host =~ /^{1}$/ AND "type_instance" =~ /^mem$/ AND
time >= now() - {2}s GROUP BY host
External Links
--------------
- `List of Grafana datasources <https://grafana.com/plugins?type=datasource>`_

View File

@@ -1,8 +0,0 @@
Datasources
===========
.. toctree::
:glob:
:maxdepth: 1
./*

View File

@@ -8,7 +8,7 @@
Glossary
========
.. _glossary:
.. glossary::
:sorted:
This page explains the different terms used in the Watcher system.
@@ -274,7 +274,7 @@ In OpenStack Identity, a :ref:`project <project_definition>` must be owned by a
specific domain.
Please, read `the official OpenStack definition of a Project
<https://docs.openstack.org/doc-contrib-guide/common/glossary.html>`_.
<http://docs.openstack.org/glossary/content/glossary.html>`_.
.. _scoring_engine_definition:

Some files were not shown because too many files have changed in this diff Show More