Merge lp:~jillrouleau/charms/trusty/percona-cluster/add-backup-action into lp:~openstack-charmers-archive/charms/trusty/percona-cluster/next

Proposed by Jill Rouleau
Status: Superseded
Proposed branch: lp:~jillrouleau/charms/trusty/percona-cluster/add-backup-action
Merge into: lp:~openstack-charmers-archive/charms/trusty/percona-cluster/next
Diff against target: 104 lines (+65/-4)
2 files modified
actions.yaml (+17/-1)
actions/actions.py (+48/-3)
To merge this branch: bzr merge lp:~jillrouleau/charms/trusty/percona-cluster/add-backup-action
Reviewer Review Type Date Requested Status
James Page Needs Fixing
Billy Olsen Needs Fixing
Jorge Niedbalski (community) Approve
OpenStack Charmers Pending
Review via email: mp+270612@code.launchpad.net

This proposal has been superseded by a proposal from 2016-02-25.

Description of the change

Add actions for full and incremental backups.

To post a comment you must log in.
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

LGTM

review: Approve
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #8934 percona-cluster-next for jillrouleau mp270612
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8934/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #9712 percona-cluster-next for jillrouleau mp270612
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/9712/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6335 percona-cluster-next for jillrouleau mp270612
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6335/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

Jill, thanks for the submission! Some minor comments included inline.

review: Needs Fixing
75. By Jill Rouleau

correcting action to correctly set fail status, handle errors more gracefully

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10472 percona-cluster-next for jillrouleau mp270612
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/10472/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9663 percona-cluster-next for jillrouleau mp270612
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9663/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6615 percona-cluster-next for jillrouleau mp270612
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6615/

76. By Jill Rouleau

swapping bash-bashed backup action for a python one

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #14821 percona-cluster-next for jillrouleau mp270612
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/14821/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #15879 percona-cluster-next for jillrouleau mp270612
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/15879/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8389 percona-cluster-next for jillrouleau mp270612
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8389/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16580 percona-cluster-next for jillrouleau mp270612
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16580/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8505 percona-cluster-next for jillrouleau mp270612
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/14408041/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8505/

Revision history for this message
James Page (james-page) wrote :

Again sorry for the lag - you action looks great, but your branch needs a rebase/retest before we can land it.

Please set back to 'Needs review' once that is done.

Thanks!

review: Needs Fixing
77. By Jill Rouleau

Resync to /next, merge backup.py into new actions.py

78. By Jill Rouleau

Resync to /next

Unmerged revisions

78. By Jill Rouleau

Resync to /next

77. By Jill Rouleau

Resync to /next, merge backup.py into new actions.py

76. By Jill Rouleau

swapping bash-bashed backup action for a python one

75. By Jill Rouleau

correcting action to correctly set fail status, handle errors more gracefully

74. By Jill Rouleau

remove extraneous symlink

73. By Jill Rouleau

add backup actions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'actions.yaml'
--- actions.yaml 2015-08-06 13:45:33 +0000
+++ actions.yaml 2016-02-24 22:42:21 +0000
@@ -1,4 +1,20 @@
1pause:1pause:
2 description: Pause the MySQL service.2 description: Pause the MySQL service.
3resume:3resume:
4 description: Resume the MySQL service.
5\ No newline at end of file4\ No newline at end of file
5 description: Resume the MySQL service.
6backup:
7 description: Full database backup
8 params:
9 basedir:
10 type: string
11 default: "/opt/backups/mysql"
12 description: The base directory for backups
13 compress:
14 type: boolean
15 default: false
16 description: Whether or not to compress the backup
17 incremental:
18 type: boolean
19 default: false
20 description: Make an incremental database backup
21
622
=== modified file 'actions/actions.py'
--- actions/actions.py 2015-10-10 16:19:59 +0000
+++ actions/actions.py 2016-02-24 22:42:21 +0000
@@ -2,12 +2,21 @@
22
3import os3import os
4import sys4import sys
5import subprocess
6import traceback
7from time import gmtime, strftime
58
6from charmhelpers.core.host import service_pause, service_resume9from charmhelpers.core.host import service_pause, service_resume
7from charmhelpers.core.hookenv import action_fail, status_set10from charmhelpers.core.hookenv import (
11 action_get,
12 action_set,
13 action_fail,
14 status_set,
15 config,
16)
17
8from percona_utils import assess_status18from percona_utils import assess_status
919
10
11MYSQL_SERVICE = "mysql"20MYSQL_SERVICE = "mysql"
1221
1322
@@ -32,9 +41,45 @@
32 assess_status()41 assess_status()
3342
3443
44def backup():
45 basedir = (action_get("basedir")).lower()
46 compress = (action_get("compress"))
47 incremental = (action_get("incremental"))
48 sstpw = config("sst-password")
49 optionlist = []
50
51 # innobackupex will not create recursive dirs that do not already exist,
52 # so help it along
53 if not os.path.exists(basedir):
54 os.makedirs(basedir)
55
56 # Build a list of options to pass to innobackupex
57 if compress is "true":
58 optionlist.append("--compress")
59
60 if incremental is "true":
61 optionlist.append("--incremental")
62
63 try:
64 subprocess.check_call(
65 ['innobackupex', '--compact', '--galera-info', '--rsync',
66 basedir, '--user=sstuser', '--password=' + sstpw] + optionlist)
67 action_set({
68 'time-completed': (strftime("%Y-%m-%d %H:%M:%S", gmtime())),
69 'outcome': 'Success'}
70 )
71 except subprocess.CalledProcessError as e:
72 action_set({
73 'time-completed': (strftime("%Y-%m-%d %H:%M:%S", gmtime())),
74 'output': e.output,
75 'return-code': e.returncode,
76 'traceback': traceback.format_exc()})
77 action_fail("innobackupex failed, you should log on to the unit"
78 "and check the status of the database")
79
35# A dictionary of all the defined actions to callables (which take80# A dictionary of all the defined actions to callables (which take
36# parsed arguments).81# parsed arguments).
37ACTIONS = {"pause": pause, "resume": resume}82ACTIONS = {"pause": pause, "resume": resume, "backup": backup}
3883
3984
40def main(args):85def main(args):
4186
=== added symlink 'actions/backup'
=== target is u'actions.py'

Subscribers

People subscribed via source and target branches