### Install Masakari Dependencies and Package Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Navigate to the Masakari source directory and install the required Python dependencies using `requirements.txt`, followed by installing the Masakari package itself using `setup.py`. ```bash # cd masakari # sudo python -m pip install -r requirements.txt # sudo python setup.py install ``` -------------------------------- ### Start Masakari Services Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Start the Masakari API and Engine services to make the Masakari functionality available. ```bash # masakari-api # masakari-engine ``` -------------------------------- ### Example feature release note content Source: https://docs.openstack.org/masakari/latest/contributor/release_notes.html An example of a filled-out feature release note, demonstrating how to describe a feature, mention limitations, and link to a blueprint. ```yaml --- features: - | Implements support for a future generation of proactive failure detectors. However, please note we don't support alternative time streams yet. `Partial Blueprint proactive-failure-detectors `__ ``` -------------------------------- ### Masakari Process Start Notification Example Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object details a 'process.start' event notification from Masakari. It contains information about the event, payload, and metadata. ```json { "event_type": "notification.process.start", "message_id": "285be756-ac29-4b78-9e2b-9756f5077012", "payload": { "masakari_object.data": { "fault": null, "generated_time": "2017-06-13T15:34:55Z", "id": 47, "notification_uuid": "15505a8c-8856-4f3d-9747-55b6e899c0f5", "payload": { "process_name": "nova-compute" }, "source_host_uuid": "6bfaf80d-7592-4ea8-ad12-60d45476d056", "status": "new", "type": "VM" }, "masakari_object.name": "NotificationApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-engine:fake-mini", "timestamp": "2018-12-20 05:26:05.002421" } ``` -------------------------------- ### Connect to Database Server on Ubuntu Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Use the database access client to connect to the database server as the root user. This is a prerequisite step before installing Masakari. ```bash mysql -u root -p ``` -------------------------------- ### Example fix release note content Source: https://docs.openstack.org/masakari/latest/contributor/release_notes.html An example of a filled-out fix release note, demonstrating how to describe a bug fix and link to the Launchpad bug report. ```yaml --- fixes: - | Fixes everything. RLY `LP#1234567890 `__ ``` -------------------------------- ### Build Masakari Documentation Source: https://docs.openstack.org/masakari/latest/install/development.environment.html Builds the Masakari documentation using tox. This command creates a Python virtual environment, installs prerequisites, and generates the documentation. ```bash tox -e docs ``` -------------------------------- ### Run DevStack Utility Source: https://docs.openstack.org/masakari/latest/install/development.environment.html Executes the DevStack setup script to initialize and configure the OpenStack environment with the enabled Masakari plugin. This command should be run from the DevStack directory. ```bash cd $DEVSTACK_DIR ./stack.sh ``` -------------------------------- ### Sample Host Create Start Notification Payload Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON payload indicates the beginning of a host creation process. It includes initial host details and its associated failover segment information. ```json { "event_type": "host.create.start", "message_id": "0ed836cc-353a-40bc-b86b-d89e6632d838", "payload": { "masakari_object.data": { "control_attributes": "TEST", "failover_segment": { "masakari_object.data": { "created_at": "2018-11-27T09:26:30Z", "deleted": false, "deleted_at": null, "description": null, "id": 877, "name": "test", "recovery_method": "auto", "service_type": "compute", "updated_at": "2018-11-27T09:54:50Z", "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" }, "masakari_object.name": "FailoverSegment", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e", "fault": null, "name": "fake-mini", "on_maintenance": false, "reserved": false, "type": "COMPUTE" }, "masakari_object.name": "HostApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 13:09:30.716747" } ``` -------------------------------- ### Synchronize Masakari Database Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Run the `masakari-manage db sync` command to synchronize the Masakari database schema. This command should be executed after installing the Masakari package. ```bash # masakari-manage db sync ``` -------------------------------- ### List Commands in a Category Source: https://docs.openstack.org/masakari/latest/cli/masakari-status.html To see all commands within a specific category, provide the category name as an argument. For example, to list commands in the 'upgrade' category. ```bash masakari-status upgrade ``` -------------------------------- ### List Commands in a Category Source: https://docs.openstack.org/masakari/latest/cli/masakari-manage.html To view all commands within a specific category, provide the category name as an argument. For example, 'db' lists database-related commands. ```bash masakari-manage db ``` -------------------------------- ### Configure Custom Task Entry Points in setup.cfg Source: https://docs.openstack.org/masakari/latest/configuration/recovery_workflow_custom_task.html Configure custom task entry points in the Third Party Library's setup.cfg file. The entry point key must match the key in Masakari's setup.cfg for the respective failure recovery. ```ini masakari.task_flow.tasks = custom_pre_task = custom_main_task = custom_post_task = ``` -------------------------------- ### Masakari Versioned Notification Payload Example Source: https://docs.openstack.org/masakari/latest/user/notifications.html This is an example of the wire format for a 'segment.update' notification, showcasing the versioned object payload structure. ```json { "event_type": "api.update.segments.start", "timestamp": "2018-11-27 14:32:20.396940", "payload": { "masakari_object.name": "SegmentApiPayload", "masakari_object.data": { "description": null, "fault": null, "recovery_method": "auto", "name": "test", "service_type": "compute", "id": 877, "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" }, "masakari_object.version": "1.0", "masakari_object.namespace": "masakari" }, "priority": "INFO", "publisher_id": "masakari-api:test-virtualbox", "message_id": "e6322900-025d-4dd6-a3a1-3e0e1e9badeb" } ``` -------------------------------- ### Masakari Notification Create Start Event Source: https://docs.openstack.org/masakari/latest/user/notifications.html Indicates the beginning of a notification creation process. Contains payload information related to the Masakari object. ```json { "event_type": "notification.create.start", "message_id": "5e2e4699-0bbd-4583-b1e2-a87c458f84eb", "payload": { "masakari_object.data": { "fault": null, "generated_time": "2017-06-13T15:34:55Z", "payload": { "process_name": "nova-compute" }, "source_host_uuid": "d4ffe3a4-b2a8-41f3-a2b0-bae3b06fc1a3", "status": "new", "type": "VM" }, "masakari_object.name": "NotificationApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 13:46:23.060352" } ``` -------------------------------- ### Generate Masakari Configuration Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Generate a sample Masakari configuration file (`masakari.conf.sample`) using tox. This command should be run from the Masakari source directory. ```bash # tox -egenconfig ``` -------------------------------- ### Copy Masakari Configuration File Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Copy the prepared `masakari.conf` file to the `/etc/masakari/` directory. This ensures the service uses the correct configuration. ```bash # cp -p etc/masakari/masakari.conf.sample /etc/masakari/masakari.conf ``` -------------------------------- ### Configure Masakari Service Source: https://docs.openstack.org/masakari/latest/install/install_and_configure_ubuntu.html Edit the `masakari.conf` file to set up transport URLs, database connections, and authentication details. Replace placeholders like `` and `` with your specific environment values. ```ini [DEFAULT] transport_url = rabbit://stackrabbit:admin@:5672/ graceful_shutdown_timeout = 5 os_privileged_user_tenant = service os_privileged_user_password = admin os_privileged_user_auth_url = http:///identity os_privileged_user_name = nova logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m logging_debug_format_suffix = [00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m use_syslog = False debug = True masakari_api_workers = 2 [database] connection = mysql+pymysql://root:admin@/masakari?charset=utf8 [keystone_authtoken] memcached_servers = localhost:11211 cafile = /opt/stack/data/ca-bundle.pem project_domain_name = Default project_name = service user_domain_name = Default password = username = masakari auth_url = http:///identity auth_type = password [taskflow] connection = mysql+pymysql://root:admin@/masakari?charset=utf8 ``` -------------------------------- ### Host API Payload Example Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object represents a payload for a host API notification, detailing information about a failover segment and host status. ```json { "event_type": "host.delete.start", "message_id": "b5914f94-99dd-42fa-aaf3-3cedacda6b67", "payload": { "masakari_object.data": { "control_attributes": "TEST", "failover_segment": { "masakari_object.data": { "created_at": "2018-11-27T09:26:30Z", "deleted": false, "deleted_at": null, "description": null, "id": 877, "name": "test", "recovery_method": "auto", "service_type": "compute", "updated_at": "2018-11-27T09:54:50Z", "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" }, "masakari_object.name": "FailoverSegment", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e", "fault": null, "id": 71, "name": "fake-mini", "on_maintenance": false, "reserved": false, "type": "COMPUTE", "uuid": "3d8d1751-9cab-4a48-8801-96f102200077" }, "masakari_object.name": "HostApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 13:31:47.451466" } ``` ```json { "event_type": "host.update.end", "message_id": "e7f85d49-7d02-4713-b90b-433f8e447558", "payload": { "masakari_object.data": { "control_attributes": "TEST", "failover_segment": { "masakari_object.data": { "created_at": "2018-11-27T09:26:30Z", "deleted": false, "deleted_at": null, "description": null, "id": 877, "name": "test", "recovery_method": "auto", "service_type": "compute", "updated_at": "2018-11-27T09:54:50Z", "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" }, "masakari_object.name": "FailoverSegment", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e", "fault": null, "id": 70, "name": "fake-mini", "on_maintenance": false, "reserved": false, "type": "COMPUTE", "uuid": "d6a2d900-1977-48fd-aa52-ad7a41fc068b" }, "masakari_object.name": "HostApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 13:13:25.361394" } ``` ```json { "event_type": "host.update.start", "message_id": "d1a3ae84-7f41-4884-bc3f-fa34c7cd1424", "payload": { "masakari_object.data": { "control_attributes": "TEST", "failover_segment": { "masakari_object.data": { "created_at": "2018-11-27T09:26:30Z", "deleted": false, "deleted_at": null, "description": null, ``` -------------------------------- ### List API Endpoints Source: https://docs.openstack.org/masakari/latest/install/verify.html List API endpoints in the Identity service to verify connectivity. The displayed endpoints may vary based on your OpenStack component installation. ```bash openstack endpoint list ``` -------------------------------- ### List Available Command Categories Source: https://docs.openstack.org/masakari/latest/cli/masakari-manage.html Run masakari-manage without any arguments to display a list of all available command categories. ```bash masakari-manage ``` -------------------------------- ### Download DevStack Source: https://docs.openstack.org/masakari/latest/install/development.environment.html Clones the DevStack repository to set up a development environment. Ensure you are familiar with git before proceeding. ```bash export DEVSTACK_DIR=~/devstack git clone https://opendev.org/openstack/devstack.git $DEVSTACK_DIR ``` -------------------------------- ### Enable Masakari Plugin in DevStack Source: https://docs.openstack.org/masakari/latest/install/development.environment.html Adds the Masakari plugin to your DevStack installation by modifying the local.conf file. This enables Masakari services within the OpenStack environment. ```ini [[local|localrc]] enable_plugin masakari https://opendev.org/openstack/masakari ``` ```ini [[local|localrc]] enable_plugin masakari https://opendev.org/openstack/masakari ``` -------------------------------- ### Create a host Source: https://docs.openstack.org/masakari/latest/configuration/policy.html Creates a host under a given segment. ```APIDOC ## POST /segments/{segment_id}/hosts ### Description Creates a host under given segment. ### Method POST ### Endpoint /segments/{segment_id}/hosts ``` -------------------------------- ### List all versions Source: https://docs.openstack.org/masakari/latest/configuration/policy.html List all available API versions. ```APIDOC ## GET / ### Description List all versions. ### Method GET ### Endpoint / ``` -------------------------------- ### Masakari Segment Delete Start Notification Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object signals the beginning of a segment deletion process in Masakari. It contains the segment's ID and other associated details. ```json { "event_type": "segment.delete.start", "message_id": "e6c32ecb-eacc-433d-ba8c-6390ea3da6d2", "payload": { "masakari_object.data": { "description": null, "fault": null, "id": 877, "name": "test2", "recovery_method": "auto", "service_type": "compute", "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" }, "masakari_object.name": "SegmentApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 14:36:07.442538" } ``` -------------------------------- ### Lint release notes documentation Source: https://docs.openstack.org/masakari/latest/contributor/release_notes.html Run this command to lint all documentation, including release notes, using 'doc8'. This helps ensure consistency and adherence to documentation standards. ```bash tox -e doc8 ``` -------------------------------- ### Masakari Segment Create Start Notification Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object signifies the initiation of a segment creation process in Masakari. It contains preliminary segment data and API payload details. ```json { "event_type": "segment.create.start", "message_id": "e44cb15b-dcba-409e-b0e1-9ee103b9a168", "payload": { "masakari_object.data": { "description": null, "fault": null, "name": "test", "recovery_method": "auto", "service_type": "compute" }, "masakari_object.name": "SegmentApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-22 09:25:12.393979" } ``` -------------------------------- ### Sample Masakari Policy Configuration Source: https://docs.openstack.org/masakari/latest/configuration/sample_policy.html This is a sample Masakari policy file in YAML format. It defines rules for API access, including context checks for administrators and specific permissions for various operations like managing hosts, segments, and notifications. Uncomment lines to enable specific rules. ```yaml # Decides what is required for the 'is_admin:True' check to succeed. #"context_is_admin": "role:admin" # Default rule for most non-Admin APIs. #"admin_or_owner": "is_admin:True or project_id:%(project_id)s" # Default rule for most Admin APIs. #"admin_api": "is_admin:True" # List available extensions. # GET /extensions #"os_masakari_api:extensions:index": "rule:admin_api" # Shows information for an extension. # GET /extensions/{extensions_id} #"os_masakari_api:extensions:detail": "rule:admin_api" # Extension Info API extensions to change the API. #"os_masakari_api:extensions:discoverable": "rule:admin_api" # Lists IDs, names, type, reserved, on_maintenance for all hosts. # GET /segments/{segment_id}/hosts #"os_masakari_api:os-hosts:index": "rule:admin_api" # Shows details for a host. # GET /segments/{segment_id}/hosts/{host_id} #"os_masakari_api:os-hosts:detail": "rule:admin_api" # Creates a host under given segment. # POST /segments/{segment_id}/hosts #"os_masakari_api:os-hosts:create": "rule:admin_api" # Updates the editable attributes of an existing host. # PUT /segments/{segment_id}/hosts/{host_id} #"os_masakari_api:os-hosts:update": "rule:admin_api" # Deletes a host from given segment. # DELETE /segments/{segment_id}/hosts/{host_id} #"os_masakari_api:os-hosts:delete": "rule:admin_api" # Host API extensions to change the API. #"os_masakari_api:os-hosts:discoverable": "rule:admin_api" # Lists IDs, notification types, host_name, generated_time, payload # and status for all notifications. # GET /notifications #"os_masakari_api:notifications:index": "rule:admin_api" # Shows details for a notification. # GET /notifications/{notification_id} #"os_masakari_api:notifications:detail": "rule:admin_api" # Creates a notification. # POST /notifications #"os_masakari_api:notifications:create": "rule:admin_api" # Notification API extensions to change the API. #"os_masakari_api:notifications:discoverable": "rule:admin_api" # Lists IDs, names, description, recovery_method, service_type for all # segments. # GET /segments #"os_masakari_api:segments:index": "rule:admin_api" # Shows details for a segment. # GET /segments/{segment_id} #"os_masakari_api:segments:detail": "rule:admin_api" # Creates a segment. # POST /segments #"os_masakari_api:segments:create": "rule:admin_api" # Updates the editable attributes of an existing host. # PUT /segments/{segment_id} #"os_masakari_api:segments:update": "rule:admin_api" # Deletes a segment. # DELETE /segments/{segment_id} #"os_masakari_api:segments:delete": "rule:admin_api" # Segment API extensions to change the API. #"os_masakari_api:segments:discoverable": "rule:admin_api" # List all versions. # GET / #"os_masakari_api:versions:index": "@" # Version API extensions to change the API. #"os_masakari_api:versions:discoverable": "@" # Lists IDs, notification_id, instance_id, source_host, dest_host, # status and type for all VM moves. # GET /notifications/{notification_id}/vmoves #"os_masakari_api:vmoves:index": "rule:admin_api" # Shows details for one VM move. # GET /notifications/{notification_id}/vmoves/{vmove_id} #"os_masakari_api:vmoves:detail": "rule:admin_api" # VM moves API extensions to change the API. #"os_masakari_api:vmoves:discoverable": "rule:admin_api" ``` -------------------------------- ### Masakari Process Notification Example Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object represents a notification for a process event within Masakari. It includes details about the event type, payload, priority, publisher, and timestamp. ```json { "event_type": "notification.process.end", "message_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "payload": { "masakari_object.data": { "fault": null, "generated_time": "2017-06-13T15:34:55Z", "id": 47, "notification_uuid": "15505a8c-8856-4f3d-9747-55b6e899c0f5", "payload": { "process_name": "nova-compute" }, "source_host_uuid": "6bfaf80d-7592-4ea8-ad12-60d45476d056", "status": "running", "type": "PROCESS" }, "masakari_object.name": "NotificationApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "ERROR", "publisher_id": "masakari-engine:fake-mini", "timestamp": "2018-12-20 06:21:19.315761" } ``` -------------------------------- ### Show VM move details Source: https://docs.openstack.org/masakari/latest/configuration/policy.html Shows details for a specific VM move. ```APIDOC ## GET /notifications/{notification_id}/vmoves/{vmove_id} ### Description Shows details for one VM move. ### Method GET ### Endpoint /notifications/{notification_id}/vmoves/{vmove_id} ``` -------------------------------- ### Sample Custom Task Class Source: https://docs.openstack.org/masakari/latest/configuration/recovery_workflow_custom_task.html Defines a sample custom task class that can be integrated into Masakari's recovery workflows. Ensure the Third Party Library is installed on the Masakari engine node. ```python from oslo_log import log as logging from taskflow import task LOG = logging.getLogger(__name__) class Noop(task.Task): def __init__(self, novaclient): self.novaclient = novaclient super(Noop, self).__init__() def execute(self, **kwargs): LOG.info("Custom task executed successfully..!!") return ``` -------------------------------- ### Configure Masakari Default Settings Source: https://docs.openstack.org/masakari/latest/configuration/sample_config.html Set authentication strategy, topic, and privileged user details in the [DEFAULT] section. ```ini [DEFAULT] auth_strategy = keystone masakari_topic = ha_engine os_privileged_user_tenant = service os_privileged_user_auth_url = http://controller/identity os_privileged_user_name = nova os_privileged_user_password = PRIVILEGED_USER_PASS ``` -------------------------------- ### Configure Masakari Coordination Backend Source: https://docs.openstack.org/masakari/latest/configuration/sample_config.html Set the 'backend_url' in the [coordination] section if using coordination for the Masakari-api service. Additional packages may be required based on the chosen Tooz backend. ```ini [coordination] backend_url = ``` -------------------------------- ### Segment Update Start Notification Payload Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object shows the payload for a 'segment.update.start' event notification. It contains Masakari object details, including its ID, name, and recovery method, along with metadata about the notification itself. ```json { "event_type": "segment.update.start", "message_id": "e6322900-025d-4dd6-a3a1-3e0e1e9badeb", "payload": { "masakari_object.data": { "description": null, "fault": null, "id": 877, "name": "test", "recovery_method": "auto", "service_type": "compute", "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" }, "masakari_object.name": "SegmentApiPayload", "masakari_object.namespace": "masakari", "masakari_object.version": "1.0" }, "priority": "INFO", "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 14:32:20.396940" } ``` -------------------------------- ### Create a new release note entry Source: https://docs.openstack.org/masakari/latest/contributor/release_notes.html Use this command to create a new release note file based on a summary line. The 'reno new' command scaffolds a new note, which can then be populated with details. ```bash tox -e venv -- reno new ``` -------------------------------- ### Example Versioned Notification Payload Source: https://docs.openstack.org/masakari/latest/user/notifications.html This JSON object represents a versioned notification payload for a Masakari API event. It includes details about the event type, message ID, payload data, priority, publisher ID, and timestamp. ```json { "publisher_id": "masakari-api:fake-mini", "timestamp": "2018-11-27 14:32:20.417745" } ```