Jump to: navigation, search

Difference between revisions of "Trove/scheduled-tasks"

(Automated/Scheduled Backups Design)
m (Cp16net moved page Trove/automated-backup-design to Trove/scheduled-tasks: rename of page)
(No difference)

Revision as of 20:49, 19 August 2013

  • Created: 13 Aug 2013
  • Contributors: Craig Vyvial (cp16net)


Automated/Scheduled Backups Design

Overview

The goal of this blueprint is to implement capabilities in Trove to support automated/scheduled backups. This will be supported in the Trove API as well as the guest agent to use the existing snapshot-design in an automated way. The automated backups shall allow a user to restore or clone to a new instance at a point in time.

There are many different concerns when attempting to automate the backup of instances in a deployment, i.e. Stagger Backups, Maintenance Time Window, and others. In the design of this automated system each of these concerns should be capable of being addressed. This shall lead to a pluggable or configurable interface for allowing a deployer to chose what type of strategy they would like to use without a code change.

The user shall define a Maintenance Time Window of when the automated backup maintenance shall occur. The Maintenance Time Window can be generalized a maintenance window of when a user would like to have scheduled backups, updates or other maintenance related operations to occur.

In order for the strategy(s) of an automated backup to be handled in a pluggable way, it will require a trove scheduler that can determine the time from the general maintenance window when the backup must occur with simple or complex logic. The scheduler shall send a message to the guest agent to run the automated backup.

cp16net (talk) 15:07, 15 August 2013 (UTC) There is a debate on where the scheduled tasks will be run from. Sent from the scheduler to the guest or the guest handles the runs itself. Either way there will be messages sent back and forth on the bus.

Design Goals

The following are the design goals:

  • Pluggable interface to determine the type of strategy(s) to support. (Stagger Backups, Maintenance Time Window, and others)
    • Manage network bandwidth and connections from backups
  • Database support for the schedule set and listing of the backups
    • Maintenance window of when to run scheduled tasks like backups

Maintenance Time Window

The Maintenance Time Window can be set by the user for when they would like package updates to occur, backup or their data, restart of service, system maintenance, or other related tasks. This shall allow users to determine when a disruption of the service occurs rather than the deployer determining a time.

The user shall be able to create multiple time windows with different types that allow for specific types of maintenance or tasks to occur when the user specifies.

New Objects

API Spec

User shall be able to create a new scheudled task for an instance and have basic CRUD operations on the schueduled task.

Type of Scheduled Tasks

The Schedule type needs to be configurable from the mgmt side but visible to the user.

GET /instance/{id}/scheduledtasks/types

Response:

{
    "scheduledtasktypes": [
        {
            "id" : "1"
            "type" : "backup"
        },
        {
            "id" : "2"
            "type" : "restart"
        },
        {
            "id" : "3"
            "type" : "update"
        }
    ]
}

Create a Scheduled Task

User shall be able to create a new scheduled task on an instance.

POST /instance/{id}/scheduledtasks 

Creates a new scheduled task for an instance.

Parameters
name - optional - if a name is not specified one will be autopopulated
enabled - True if the task is enabled False if not.
type - ID of the type of schedule
frequency - Fequency of the task. (hourly|daily|weekly|monthly)
time_window - Time window of when task can occur
description - optional - description of the schedule
notifications: - optional
recepient - an email address to notify the user for success or failure
notifySuccess - True to send when task was successful in finishing False to not send notification
notifyFailure - True to send when task has a failure in finishing False to not send notification

Request:

{
    "scheduledtask" : {
        "name":"My Auto Backup",
        "enabled": "True|False",
        "type":"1",
        "frequency" : "hourly|daily|weekly|monthly",
        "time_window":"2012-03-28T22:00Z/2012-03-28T23:00Z",
        "description" : "Auto Backup for my production database."
        "retentionPeriod" : "7|14|21|28",
        "notifications" : {
            "recipient" : "email@openstack.org",
            "notifySuccess" : "true|false", # default to False
            "notifyFailure" : "true|false"  # default to False
        }
    }
}

Response:

{
    "scheduledtask": {
        "id" : "56b80958-cf34-4e9e-b5b0-b84fbe5e4ecc"
        "name":"My Auto Backup",
        "enabled": "True|False",
        "type":"1",
        "frequency" : "hourly|daily|weekly|monthly",
        "time_window":"2012-03-28T22:00Z/2012-03-28T23:00Z",
        "description" : "Auto Backup for my production database."
        "retentionPeriod" : "7|14|21|28",
        "notifications" : {
            "recipient" : "email@openstack.org",
            "notifySuccess" : "true|false",
            "notifyFailure" : "true|false"
        }
     }
}

Update a Scheduled Task

User shall be able to update an existing scheduled task on an instance. i.e.

POST /instance/{id}/scheduledtasks/{id} 

Updates an existing scheduled task for an instance.

Parameters
name - optional - if a name is not specified one will be autopopulated
enabled - True if the task is enabled False if not.
type - ID of the type of schedule
frequency - Fequency of the task. (hourly|daily|weekly|monthly)
time_window - Time window of when task can occur
description - optional - description of the schedule
notifications: - optional
recepient - an email address to notify the user for success or failure
notifySuccess - True to send when task was successful in finishing False to not send notification
notifyFailure - True to send when task has a failure in finishing False to not send notification

Request:

{
    "scheduledtask" : {
        "name":"My Auto Backup",
        "enabled": "True|False",
        "type":"1",
        "frequency" : "hourly|daily|weekly|monthly",
        "time_window":"2012-03-28T22:00Z/2012-03-28T23:00Z",
        "description" : "Auto Backup for my production database."
        "retentionPeriod" : "7|14|21|28",
        "notifications" : {
            "recipient" : "email@openstack.org",
            "notifySuccess" : "true|false", # default to False
            "notifyFailure" : "true|false"  # default to False
        }
    }
}

Response:

{
    "scheduledtask": {
        "id" : "56b80958-cf34-4e9e-b5b0-b84fbe5e4ecc"
        "name":"My Auto Backup",
        "enabled": "True|False",
        "type":"1",
        "frequency" : "hourly|daily|weekly|monthly",
        "time_window":"2012-03-28T22:00Z/2012-03-28T23:00Z",
        "description" : "Auto Backup for my production database."
        "retentionPeriod" : "7|14|21|28",
        "notifications" : {
            "recipient" : "email@openstack.org",
            "notifySuccess" : "true|false",
            "notifyFailure" : "true|false"
        }
     }
}

Get a Scheduled Task

User shall be able to get details of a scheduled task on an instance.

GET /instance/{id}/scheduledtasks/{id}  

Shows the scheduled task for an instance.

Response:

{
    "scheduledtask": {
        "id" : "56b80958-cf34-4e9e-b5b0-b84fbe5e4ecc"
        "name":"My Auto Backup",
        "enabled": "True|False",
        "type":"1",
        "frequency" : "hourly|daily|weekly|monthly",
        "time_window":"2012-03-28T22:00Z/2012-03-28T23:00Z",
        "description" : "Auto Backup for my production database."
        "retentionPeriod" : "7|14|21|28",
        "notifications" : {
            "recipient" : "email@openstack.org",
            "notifySuccess" : "true|false",
            "notifyFailure" : "true|false"
        }
     }
}

Get list of Scheduled Tasks

User shall be able to list all of the scheduled tasks on an instance.

GET /instance/{id}/scheduledtasks  

Shows a list of scheduled task for an instance.

Response:

{
    "scheduledtasks": [
        {
            "id" : "11111111-cf34-4e9e-b5b0-b84fbe5e4ecc",
            "name":"My Auto Backup",
            "enabled": "True|False",
            "type":"1",
            "frequency" : "hourly|daily|weekly|monthly",
            "time_window":"2012-03-28T22:00Z/2012-03-28T23:00Z",
            "description" : "Auto Backup for my production database."
            "retentionPeriod" : "7|14|21|28",
            "notifications" : {
                   "recipient" : "email@openstack.org",
                   "notifySuccess" : "true|false",
                   "notifyFailure" : "true|false"
            }
        },
        {
            "id" : "22222222-cf34-4e9e-b5b0-b84fbe5e4ecc",
            "name":"My Update Period",
            "enabled": "True|False",
            "type":"3",
            "frequency" : "hourly|daily|weekly|monthly",
            "time_window":"2012-03-28T23:00Z/2012-03-28T24:00Z",
            "description" : "Updates can be applied to my production database."
            "notifications" : {
                   "recipient" : "email@openstack.org",
                   "notifySuccess" : "true|false",
                   "notifyFailure" : "true|false"
            }
        }
    ]
}

Delete a Scheduled Task

User shall be able to delete a scheduled task on an instance.

DELETE /instance/{id}/scheduledtasks/{id}  

Deletes a scheduled task for an instance.

Response: 202 Accepted

RPC Message Communication

This is the contract defined that the scheduler will have with the guest to run tasks and get replies from the guest on tasks being run.

Backup

Run a Backup

This is the message payload that will be sent to the guest to excute a backup job.

{
    "backup": {
        "id" : "11111111-cf34-4e9e-b5b0-b84fbe5e4ecc",
        "auth_token": "0a9sdf809sdu09sjfaisduf098ublahblahblah",
        "destination_url": "customerbackupdir",
        "type": "xtrabackup|mysqldump|other"
    }
}

Guest Update on Backup

{
     "backup": {
        "id" : "11111111-cf34-4e9e-b5b0-b84fbe5e4ecc",
        "status": "(Success|Failure)",
        "reason": "Some explaination of the failure or success",
        "size_mb": 123,
        "md5": "some-md5-check-sum"
    }
}

Update

Run an Update

This is the message payload that will be sent to the guest to excute a backup job.

{
    "update": {
        "type": "packages"
    }
}

Guest Update on Update

{
     "update": {
        "status": "(Success|Failure)",
        "reason": "Some explaination of the failure or success"
    }
}