summaryrefslogtreecommitdiff
path: root/devstack
diff options
context:
space:
mode:
authorGraham Hayes <graham.hayes@hpe.com>2016-12-07 15:42:27 +0000
committerGraham Hayes <graham.hayes@hpe.com>2016-12-07 16:20:34 +0000
commitf5a9fbe617adc50a61d6892e0feb21fe3f2f25ce (patch)
tree0a6e498f16ade46b631fa406e4583b3cf350949f /devstack
parent13ee3fbc3fd3f95d0baaa773052cfa266414591a (diff)
Add pGSQL support for pdns4 driver in devstack
Notes
Notes (review): Code-Review+2: Kiall Mac Innes <kiall@macinnes.ie> Code-Review+2: Tim Simmons <tim.simmons@rackspace.com> Workflow+1: Tim Simmons <tim.simmons@rackspace.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 07 Dec 2016 20:22:25 +0000 Reviewed-on: https://review.openstack.org/408183 Project: openstack/designate Branch: refs/heads/master
Diffstat (limited to 'devstack')
-rw-r--r--devstack/designate_plugins/backend-pdns420
-rw-r--r--devstack/designate_plugins/backend-pdns4-pgsql-db.sql95
2 files changed, 113 insertions, 2 deletions
diff --git a/devstack/designate_plugins/backend-pdns4 b/devstack/designate_plugins/backend-pdns4
index 37247b8..010157f 100644
--- a/devstack/designate_plugins/backend-pdns4
+++ b/devstack/designate_plugins/backend-pdns4
@@ -56,8 +56,10 @@ EOF
56 56
57 if is_service_enabled mysql; then 57 if is_service_enabled mysql; then
58 PDNS+=" pdns-backend-mysql" 58 PDNS+=" pdns-backend-mysql"
59 elif is_service_enabled postgresql; then
60 PDNS+=" pdns-backend-pgsql"
59 else 61 else
60 die $LINENO "PDNS4 backend only supports MySQL" 62 die $LINENO "PDNS4 backend only supports MySQL / pgSQL"
61 fi 63 fi
62 64
63 install_package $PDNS 65 install_package $PDNS
@@ -132,8 +134,20 @@ gmysql-password=$DATABASE_PASSWORD
132gmysql-dbname=designate_pdns 134gmysql-dbname=designate_pdns
133gmysql-dnssec=yes 135gmysql-dnssec=yes
134EOF 136EOF
137 elif is_service_enabled postgresql; then
138 sudo tee -a $POWERDNS_CFG_DIR/pdns.conf > /dev/null <<EOF
139# Launch gpgsql backend
140launch=gpgsql
141
142# gmysql parameters
143gpgsql-host=$DATABASE_HOST
144gpgsql-user=$DATABASE_USER
145gpgsql-password=$DATABASE_PASSWORD
146gpgsql-dbname=designate_pdns
147gpgsql-dnssec=yes
148EOF
135 else 149 else
136 die $LINENO "PDNS4 backend only supports MySQL" 150 die $LINENO "PDNS4 backend only supports MySQL / pgSQL"
137 fi 151 fi
138 restart_service pdns 152 restart_service pdns
139} 153}
@@ -150,6 +164,8 @@ function init_designate_backend {
150 recreate_database designate_pdns utf8 164 recreate_database designate_pdns utf8
151 if is_service_enabled mysql; then 165 if is_service_enabled mysql; then
152 sudo mysql -u root designate_pdns < $DESIGNATE_PLUGINS/backend-pdns4-mysql-db.sql 166 sudo mysql -u root designate_pdns < $DESIGNATE_PLUGINS/backend-pdns4-mysql-db.sql
167 elif is_service_enabled postgresql; then
168 sudo psql -U root -d designate_pdns -f $DESIGNATE_PLUGINS/backend-pdns4-pgsql-db.sql
153 else 169 else
154 die $LINENO "PDNS4 backend only supports MySQL" 170 die $LINENO "PDNS4 backend only supports MySQL"
155 fi 171 fi
diff --git a/devstack/designate_plugins/backend-pdns4-pgsql-db.sql b/devstack/designate_plugins/backend-pdns4-pgsql-db.sql
new file mode 100644
index 0000000..e14395b
--- /dev/null
+++ b/devstack/designate_plugins/backend-pdns4-pgsql-db.sql
@@ -0,0 +1,95 @@
1CREATE TABLE domains (
2 id SERIAL PRIMARY KEY,
3 name VARCHAR(255) NOT NULL,
4 master VARCHAR(128) DEFAULT NULL,
5 last_check INT DEFAULT NULL,
6 type VARCHAR(6) NOT NULL,
7 notified_serial INT DEFAULT NULL,
8 account VARCHAR(40) DEFAULT NULL,
9 CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
10);
11
12CREATE UNIQUE INDEX name_index ON domains(name);
13
14
15CREATE TABLE records (
16 id SERIAL PRIMARY KEY,
17 domain_id INT DEFAULT NULL,
18 name VARCHAR(255) DEFAULT NULL,
19 type VARCHAR(10) DEFAULT NULL,
20 content VARCHAR(65535) DEFAULT NULL,
21 ttl INT DEFAULT NULL,
22 prio INT DEFAULT NULL,
23 change_date INT DEFAULT NULL,
24 disabled BOOL DEFAULT 'f',
25 ordername VARCHAR(255),
26 auth BOOL DEFAULT 't',
27 CONSTRAINT domain_exists
28 FOREIGN KEY(domain_id) REFERENCES domains(id)
29 ON DELETE CASCADE,
30 CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
31);
32
33CREATE INDEX rec_name_index ON records(name);
34CREATE INDEX nametype_index ON records(name,type);
35CREATE INDEX domain_id ON records(domain_id);
36CREATE INDEX recordorder ON records (domain_id, ordername text_pattern_ops);
37
38
39CREATE TABLE supermasters (
40 ip INET NOT NULL,
41 nameserver VARCHAR(255) NOT NULL,
42 account VARCHAR(40) NOT NULL,
43 PRIMARY KEY(ip, nameserver)
44);
45
46
47CREATE TABLE comments (
48 id SERIAL PRIMARY KEY,
49 domain_id INT NOT NULL,
50 name VARCHAR(255) NOT NULL,
51 type VARCHAR(10) NOT NULL,
52 modified_at INT NOT NULL,
53 account VARCHAR(40) DEFAULT NULL,
54 comment VARCHAR(65535) NOT NULL,
55 CONSTRAINT domain_exists
56 FOREIGN KEY(domain_id) REFERENCES domains(id)
57 ON DELETE CASCADE,
58 CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
59);
60
61CREATE INDEX comments_domain_id_idx ON comments (domain_id);
62CREATE INDEX comments_name_type_idx ON comments (name, type);
63CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
64
65
66CREATE TABLE domainmetadata (
67 id SERIAL PRIMARY KEY,
68 domain_id INT REFERENCES domains(id) ON DELETE CASCADE,
69 kind VARCHAR(32),
70 content TEXT
71);
72
73CREATE INDEX domainidmetaindex ON domainmetadata(domain_id);
74
75
76CREATE TABLE cryptokeys (
77 id SERIAL PRIMARY KEY,
78 domain_id INT REFERENCES domains(id) ON DELETE CASCADE,
79 flags INT NOT NULL,
80 active BOOL,
81 content TEXT
82);
83
84CREATE INDEX domainidindex ON cryptokeys(domain_id);
85
86
87CREATE TABLE tsigkeys (
88 id SERIAL PRIMARY KEY,
89 name VARCHAR(255),
90 algorithm VARCHAR(50),
91 secret VARCHAR(255),
92 CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
93);
94
95CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);