Remove retired codes populated “V1” tables

the old source code which populate "V1" tables are no longer being used
in the current stx-ha design architecture.

Remove list:
  service-mgmt/sm-db-1.0.0/upgrades/
  service-mgmt/sm-db-1.0.0/scripts/sm-db-populate.script
  service-mgmt/sm-db-1.0.0/patches/*install.patch
  service-mgmt/sm-db-1.0.0/database/sm_database.xlsb
  service-mgmt-tools/sm-tools/sm-tools/sm-patch.py

Story: 2004752
Task: 28842

Change-Id: I9f230f900baafcb8495d8f7ed739bf8e182abae5
Signed-off-by: SidneyAn <ran1.an@intel.com>
This commit is contained in:
SidneyAn 2019-01-16 23:20:26 +08:00
parent 6306f76223
commit 729a8e7f36
11 changed files with 1 additions and 343 deletions

View File

@ -19,7 +19,6 @@ setuptools.setup(
'sm-deprovision = sm_tools.sm_provision:main ',
'sm-dump = sm_tools.sm_dump:main',
'sm-query = sm_tools.sm_query:main',
'sm-patch = sm_tools.sm_patch:main',
'sm-manage = sm_tools.sm_action:main',
'sm-unmanage = sm_tools.sm_action:main ',
'sm-restart-safe = sm_tools.sm_action:main ',

View File

@ -1,59 +0,0 @@
#
# Copyright (c) 2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import os
import sys
import argparse
import sqlite3
database_patches_dir = "/var/lib/sm/patches/"
database_master_name = "/var/lib/sm/sm.db"
database_running_name = "/var/run/sm/sm.db"
def main():
try:
parser = argparse.ArgumentParser(description='SM Patch')
subparsers = parser.add_subparsers(help='types')
db_parser = subparsers.add_parser('database', help='Database')
db_parser.set_defaults(which='database')
db_parser.add_argument('which_database', help='master or running')
db_parser.add_argument('patch_name', help='patch name')
args = parser.parse_args()
if args.which == 'database':
if args.which_database == 'master':
if not os.path.exists(database_master_name):
print("%s not available." % database_master_name)
sys.exit()
database = sqlite3.connect(database_master_name)
else:
if not os.path.exists(database_running_name):
print("%s not available." % database_running_name)
sys.exit()
database = sqlite3.connect(database_running_name)
cursor = database.cursor()
with open(database_patches_dir + args.patch_name) as patch_file:
for line in patch_file:
if not line.startswith('#'):
cursor.execute(line)
database.commit()
database.close()
sys.exit(0)
except KeyboardInterrupt:
sys.exit()
except Exception as e:
print(e)
sys.exit(-1)

View File

@ -3,8 +3,7 @@ create_sm_db.sql -> sm.db
create_sm_hb_db.sql -> sm.db.hb
Instructions:
1. Update the SM excel spreadsheet (sm_database.xlsb) with your changes,
2. Update the corresponding SQL script i.e, create_sm_db.sql or create_sm_hb_db.sql:
1. Update the corresponding SQL script i.e, create_sm_db.sql or create_sm_hb_db.sql:
Add proper SQL statement(s) (insert, update, delete) to the sql file.

View File

@ -1,31 +0,0 @@
#
# Copyright (c) 2014 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
#
#
#
#
# Description: installs the ceph-rest-api and ceph-alarm-manager on the controllers.
#
# ceph-rest-api
INSERT INTO "SERVICE_DOMAIN_MEMBERS_V1" VALUES(7,'controller','storage-services','N',2,0,'','');
INSERT INTO "SERVICE_GROUPS_V1" VALUES(7,'storage-services','no','no','initial','initial','none','none',120000,'yes');
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(55,'storage-services','ceph-rest-api','critical');
INSERT INTO "SERVICES_V1" VALUES(55,'ceph-rest-api','initial','initial','none','none',2,1,60000,4,16,'/var/run/ceph/ceph-rest-api.pid');
INSERT INTO "SERVICE_INSTANCES_V1" VALUES(59,'ceph-rest-api','ceph-rest-api','');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-rest-api','enable','lsb-script','','ceph-rest-api','start','',2,2,2,10,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-rest-api','disable','lsb-script','','ceph-rest-api','stop','',1,1,1,10,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-rest-api','audit-enabled','lsb-script','','ceph-rest-api','status','',2,2,2,10,40);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-rest-api','audit-disabled','lsb-script','','ceph-rest-api','status','',0,0,0,10,40);
# ceph-alarm-manager
INSERT INTO "SERVICE_DOMAIN_MEMBERS_V1" VALUES(8,'controller','storage-monitoring-services','N + M',1,1,'','');
INSERT INTO "SERVICE_GROUPS_V1" VALUES(8,'storage-monitoring-services','no','no','initial','initial','none','none',120000,'no');
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(56,'storage-monitoring-services','ceph-alarm-manager','critical');
INSERT INTO "SERVICES_V1" VALUES(56,'ceph-alarm-manager','initial','initial','none','none',2,1,60000,4,16,'/var/run/ceph/ceph-alarm-manager.pid');
INSERT INTO "SERVICE_INSTANCES_V1" VALUES(60,'ceph-alarm-manager','ceph-alarm-manager','');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','ceph-alarm-manager','not-applicable','enable','ceph-rest-api','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','ceph-rest-api','not-applicable','disable','ceph-alarm-manager','disabled');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-alarm-manager','enable','lsb-script','','ceph-alarm-manager','start','',2,2,2,10,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-alarm-manager','disable','lsb-script','','ceph-alarm-manager','stop','',1,1,1,10,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-alarm-manager','audit-enabled','lsb-script','','ceph-alarm-manager','status','',2,2,2,10,40);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('ceph-alarm-manager','audit-disabled','lsb-script','','ceph-alarm-manager','status','',0,0,0,10,40);

View File

@ -1,60 +0,0 @@
#
# Copyright (c) 2014 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
#
#
#
#
# Description: installs the services for the cinder LVM backend on the controllers.
#
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(57,'controller-services','drbd-cinder','critical');
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(58,'controller-services','cinder-lvm','critical');
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(59,'controller-services','tgtd','critical');
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(60,'controller-services','cinder-ip','critical');
INSERT INTO "SERVICES_V1" VALUES(57,'drbd-cinder','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICES_V1" VALUES(58,'cinder-lvm','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICES_V1" VALUES(59,'tgtd','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICES_V1" VALUES(60,'cinder-ip','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','drbd-cinder','not-applicable','go-active','management-ip','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','cinder-lvm','not-applicable','enable','drbd-cinder','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','tgtd','not-applicable','enable','cinder-lvm','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','tgtd','not-applicable','enable','drbd-cgcs','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','cinder-ip','not-applicable','enable','tgtd','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','cinder-volume','not-applicable','enable','cinder-ip','enabled-active');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','cinder-ip','not-applicable','disable','cgcs-nfs-ip','disabled');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','cinder-ip','not-applicable','disable','cinder-volume','disabled');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','tgtd','not-applicable','disable','cinder-ip','disabled');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','drbd-cgcs','not-applicable','disable','tgtd','disabled');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','cinder-lvm','not-applicable','disable','tgtd','disabled');
INSERT INTO "SERVICE_DEPENDENCY_V1" VALUES('action','drbd-cinder','not-applicable','go-standby','cinder-lvm','disabled');
# drbd_cinder service
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('drbd-cinder','enable','ocf-script','linbit','drbd','start','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,90,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('drbd-cinder','disable','ocf-script','linbit','drbd','stop','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',1,1,1,180,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('drbd-cinder','go-active','ocf-script','linbit','drbd','promote','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,180,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('drbd-cinder','go-standby','ocf-script','linbit','drbd','demote','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,180,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('drbd-cinder','audit-enabled','ocf-script','linbit','drbd','monitor','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,20,30);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('drbd-cinder','audit-disabled','ocf-script','linbit','drbd','monitor','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',0,0,0,20,28);
# cinder_lvm service
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-lvm','enable','ocf-script','heartbeat','LVM','start','',2,2,2,30,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-lvm','disable','ocf-script','heartbeat','LVM','stop','',1,1,1,30,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-lvm','audit-enabled','ocf-script','heartbeat','LVM','monitor','',2,2,2,30,10);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-lvm','audit-disabled','ocf-script','heartbeat','LVM','monitor','',0,0,0,30,10);
# tgtd service
# The tgtd init script blocks until it exports all the existing targets. Using
# a very long timeout to ensure that it is never killed while doing this.
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('tgtd','enable','lsb-script','','tgtd','start','',2,2,2,180,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('tgtd','disable','lsb-script','','tgtd','forcedstop','',1,1,1,10,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('tgtd','audit-enabled','lsb-script','','tgtd','status','',2,2,2,10,5);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('tgtd','audit-disabled','lsb-script','','tgtd','status','',0,0,0,10,5);
# cinder_ip service
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-ip','enable','ocf-script','heartbeat','IPaddr2','start','',2,2,2,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-ip','disable','ocf-script','heartbeat','IPaddr2','stop','',1,1,1,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-ip','audit-enabled','ocf-script','heartbeat','IPaddr2','monitor','',2,2,2,20,5);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('cinder-ip','audit-disabled','ocf-script','heartbeat','IPaddr2','monitor','',0,0,0,20,5);

View File

@ -1,17 +0,0 @@
#
# Copyright (c) 2015 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
#
#
#
#
# Description: installs the services for the PXEBoot network
#
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(67,'controller-services','pxeboot-ip','critical');
INSERT INTO "SERVICES_V1" VALUES(67,'pxeboot-ip','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('pxeboot-ip','enable','ocf-script','heartbeat','IPaddr2','start','',2,2,2,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('pxeboot-ip','disable','ocf-script','heartbeat','IPaddr2','stop','',1,1,1,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('pxeboot-ip','audit-enabled','ocf-script','heartbeat','IPaddr2','monitor','',2,2,2,20,5);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('pxeboot-ip','audit-disabled','ocf-script','heartbeat','IPaddr2','monitor','',0,0,0,20,5);

View File

@ -1,47 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
DATABASE=sm.db.v1
HEARTBEAT_DATABASE=sm.hb.db.v1
CSV_DIR=./
sm-db-build
mv sm.db.main ${DATABASE}
mv sm.db.hb ${HEARTBEAT_DATABASE}
echo -e "Populate SERVICE_DOMAINS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDomains.csv SERVICE_DOMAINS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_DOMAIN_INTERFACES_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDomainInterfaces.csv SERVICE_DOMAIN_INTERFACES_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_DOMAIN_MEMBERS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDomainMembers.csv SERVICE_DOMAIN_MEMBERS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_GROUPS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceGroups.csv SERVICE_GROUPS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_GROUP_MEMBERS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceGroupMembers.csv SERVICE_GROUP_MEMBERS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICES_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/Services.csv SERVICES_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_INSTANCES_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceInstances.csv SERVICE_INSTANCES_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_DEPENDENCY_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDependency.csv SERVICE_DEPENDENCY_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_ACTIONS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceActions.csv SERVICE_ACTIONS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_ACTION_RESULTS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceActionResults.csv SERVICE_ACTION_RESULTS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_HEARTBEAT_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceHeartbeat.csv SERVICE_HEARTBEAT_V1 \n" | /usr/bin/sqlite3 ${HEARTBEAT_DATABASE}

View File

@ -1,31 +0,0 @@
The SM database can be generated off of an excel spreadsheet
(cgcs-root/stx/stx-ha/service-mgmt/sm-db-1.0.0/database/sm_database.xlsb)
Instructions:
1. Update the SM excel spreadsheet (sm_database.xlsb) with your changes,
2. Update the SM database (sm.db.v1) with your changes:
sqlite3 sm.db.v1
.tables
apply our changes using SQL statements
record the SQL statements for Crucible review (i.e. in commit.txt and in Crucible)
.quit
3. Update Packstack "sm-configure" calls were appropriate.
4. Update Packstack "sm-provision" and "sm-deprovision" calls were appropriate.
5. If your service runs during Packstack manifest apply, you may need to make
sure it is stopped before SM takes over.
See packstack/puppet/templates/platform_sm_stopresources.pp
See packstack/puppet/templates/platform_sm_stopservice.pp
OBSOLETE:
CONTROLLER=192.168.204.4
mkdir -p /var/lib/sm/patches/
scp new-service root@${CONTROLLER}:/etc/init.d
scp sm_db_upgrade.patch root@${CONTROLLER}:/var/lib/sm/patches/
chmod 777 /etc/init.d/new-service
sm-patch database running sm_db_upgrade.patch

View File

@ -1,33 +0,0 @@
#! /bin/bash
#
# Copyright (c) 2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
DAEMON_PID_FILE="/var/run/new-service.pid"
case "$1" in
start)
touch ${DAEMON_PID_FILE}
exit 0
;;
stop)
rm -f ${DAEMON_PID_FILE}
exit 0
;;
status)
if [ -e ${DAEMON_PID_FILE} ]
then
exit 0
else
exit 3
fi
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
exit 0

View File

@ -1,62 +0,0 @@
#
# Copyright (c) 2015 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
#
#
#
#
UPDATE "SERVICE_DOMAINS_V1" SET GENERATION = 2;
# Add a new service to an existing service-group
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(100,'yes','controller-services','new-service','critical');
INSERT INTO "SERVICES_V1" VALUES(100,'yes','new-service','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service','enable','lsb-script','','new-service','start','',2,2,2,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service','disable','lsb-script','','new-service','stop','',1,1,1,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service','audit-enabled','lsb-script','','new-service','status','',2,2,2,20,5);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service','audit-disabled','lsb-script','','new-service','status','',0,0,0,20,5);
INSERT INTO "SERVICE_INSTANCES_V1" VALUES(100,'new-service','new-service','');
# Add a new service-group and service
INSERT INTO "SERVICE_DOMAIN_MEMBERS_V1" VALUES(101,'yes','controller','new-services2','N + M',1,1,'controller-aggregate','directory-services');
INSERT INTO "SERVICE_GROUPS_V1" VALUES(101,'yes','new-services2','no','no','initial','initial','none','none',300000,'yes');
INSERT INTO "SERVICE_GROUP_MEMBERS_V1" VALUES(101,'yes','new-services2','new-service2','critical');
INSERT INTO "SERVICES_V1" VALUES(101,'yes','new-service2','initial','initial','none','none',2,1,60000,4,16,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service2','enable','lsb-script','','new-service','start','',2,2,2,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service2','disable','lsb-script','','new-service','stop','',1,1,1,20,'');
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service2','audit-enabled','lsb-script','','new-service','status','',2,2,2,20,5);
INSERT INTO "SERVICE_ACTIONS_V1" VALUES('new-service2','audit-disabled','lsb-script','','new-service','status','',0,0,0,20,5);
INSERT INTO "SERVICE_INSTANCES_V1" VALUES(101,'new-service2','new-service2','');
#
# sqlite3 /var/run/sm/sm.db.v1
# UPDATE "SERVICE_DOMAINS_V1" SET GENERATION = 1;
# .quit
#
#
# sqlite3 /var/run/sm/sm.db.v1
# DELETE FROM "SERVICE_GROUP_MEMBERS_V1" WHERE NAME = 'controller-services' AND SERVICE_NAME = 'new-service';
# DELETE FROM "SERVICES_V1" WHERE NAME = 'new-service';
# DELETE FROM "SERVICE_ACTIONS_V1" WHERE SERVICE_NAME = 'new-service';
# DELETE FROM "SERVICE_INSTANCES_V1" WHERE SERVICE_NAME = 'new-service';
# .quit
#
#
# sqlite3 /var/run/sm/sm.db.v1
# DELETE FROM "SERVICE_DOMAIN_ASSIGNMENTS_V1" WHERE NAME = 'controller' AND SERVICE_GROUP_NAME = 'new-services2';
# DELETE FROM "SERVICE_DOMAIN_MEMBERS_V1" WHERE NAME = 'controller' AND SERVICE_GROUP_NAME = 'new-services2';
# DELETE FROM "SERVICE_GROUPS_V1" WHERE NAME = 'new-services2';
# DELETE FROM "SERVICE_GROUP_MEMBERS_V1" WHERE NAME = 'new-services2' AND SERVICE_NAME = 'new-service2';
# DELETE FROM "SERVICES_V1" WHERE NAME = 'new-service2';
# DELETE FROM "SERVICE_ACTIONS_V1" WHERE SERVICE_NAME = 'new-service2';
# DELETE FROM "SERVICE_INSTANCES_V1" WHERE SERVICE_NAME = 'new-service2';
# .quit
#