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: Rejected
Rejected by: James Page
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 Pending
OpenStack Charmers Pending
Billy Olsen Pending
Jorge Niedbalski Pending
Review via email: mp+287117@code.launchpad.net

This proposal supersedes a proposal from 2015-09-09.

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 : Posted in a previous version of this proposal

LGTM

review: Approve
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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

review: Needs Fixing
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #1168 percona-cluster-next for jillrouleau mp287117
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/1168/

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

charm_lint_check #1410 percona-cluster-next for jillrouleau mp287117
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/1410/

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

charm_amulet_test #520 percona-cluster-next for jillrouleau mp287117
    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/15195383/
Build: http://10.245.162.36:8080/job/charm_amulet_test/520/

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

#recheck

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

charm_unit_test #1227 percona-cluster-next for jillrouleau mp287117
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/1227/

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

charm_lint_check #1473 percona-cluster-next for jillrouleau mp287117
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/1473/

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

charm_amulet_test #527 percona-cluster-next for jillrouleau mp287117
    AMULET OK: passed

Build: http://10.245.162.36:8080/job/charm_amulet_test/527/

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

Migrated over to git/gerrit:

https://review.openstack.org/288342

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
1=== modified file 'actions.yaml'
2--- actions.yaml 2015-08-06 13:45:33 +0000
3+++ actions.yaml 2016-02-25 00:06:27 +0000
4@@ -1,4 +1,20 @@
5 pause:
6 description: Pause the MySQL service.
7 resume:
8- description: Resume the MySQL service.
9\ No newline at end of file
10+ description: Resume the MySQL service.
11+backup:
12+ description: Full database backup
13+ params:
14+ basedir:
15+ type: string
16+ default: "/opt/backups/mysql"
17+ description: The base directory for backups
18+ compress:
19+ type: boolean
20+ default: false
21+ description: Whether or not to compress the backup
22+ incremental:
23+ type: boolean
24+ default: false
25+ description: Make an incremental database backup
26+
27
28=== modified file 'actions/actions.py'
29--- actions/actions.py 2015-10-10 16:19:59 +0000
30+++ actions/actions.py 2016-02-25 00:06:27 +0000
31@@ -2,12 +2,21 @@
32
33 import os
34 import sys
35+import subprocess
36+import traceback
37+from time import gmtime, strftime
38
39 from charmhelpers.core.host import service_pause, service_resume
40-from charmhelpers.core.hookenv import action_fail, status_set
41+from charmhelpers.core.hookenv import (
42+ action_get,
43+ action_set,
44+ action_fail,
45+ status_set,
46+ config,
47+)
48+
49 from percona_utils import assess_status
50
51-
52 MYSQL_SERVICE = "mysql"
53
54
55@@ -32,9 +41,45 @@
56 assess_status()
57
58
59+def backup():
60+ basedir = (action_get("basedir")).lower()
61+ compress = (action_get("compress"))
62+ incremental = (action_get("incremental"))
63+ sstpw = config("sst-password")
64+ optionlist = []
65+
66+ # innobackupex will not create recursive dirs that do not already exist,
67+ # so help it along
68+ if not os.path.exists(basedir):
69+ os.makedirs(basedir)
70+
71+ # Build a list of options to pass to innobackupex
72+ if compress is "true":
73+ optionlist.append("--compress")
74+
75+ if incremental is "true":
76+ optionlist.append("--incremental")
77+
78+ try:
79+ subprocess.check_call(
80+ ['innobackupex', '--compact', '--galera-info', '--rsync',
81+ basedir, '--user=sstuser', '--password=' + sstpw] + optionlist)
82+ action_set({
83+ 'time-completed': (strftime("%Y-%m-%d %H:%M:%S", gmtime())),
84+ 'outcome': 'Success'}
85+ )
86+ except subprocess.CalledProcessError as e:
87+ action_set({
88+ 'time-completed': (strftime("%Y-%m-%d %H:%M:%S", gmtime())),
89+ 'output': e.output,
90+ 'return-code': e.returncode,
91+ 'traceback': traceback.format_exc()})
92+ action_fail("innobackupex failed, you should log on to the unit"
93+ "and check the status of the database")
94+
95 # A dictionary of all the defined actions to callables (which take
96 # parsed arguments).
97-ACTIONS = {"pause": pause, "resume": resume}
98+ACTIONS = {"pause": pause, "resume": resume, "backup": backup}
99
100
101 def main(args):
102
103=== added symlink 'actions/backup'
104=== target is u'actions.py'

Subscribers

People subscribed via source and target branches