Move sm database files for ostree compatibility
Move the following sm database files to /etc/sm/<release> - sm.db - sm.hb.db update the paths in source code to point to the new database location added a static_assert to fail if SW_VERSION macro is not defined Test plan: PASS - AIO-SX: iso install verify database files are in the correct location - /var/lib/sm/... - /etc/sm/<rel>/... - /var/run/sm/... ensure sm is running smoothly after controller-0 unlock PASS - AIO-DX: iso install upto controller-1 unlock user host-swact uncontrolled swact by powering off active controller Story: 2010676 Task: 50649 Change-Id: I2195c420438135c9b109060de13765b0897d7dc9 Signed-off-by: Kyale, Eliud <Eliud.Kyale@windriver.com>
This commit is contained in:
@@ -3,6 +3,7 @@ Section: admin
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
build-info-dev,
|
||||
dh-python,
|
||||
python3-all,
|
||||
python3-setuptools,
|
||||
|
@@ -8,8 +8,9 @@ from __future__ import print_function
|
||||
|
||||
import time
|
||||
import socket
|
||||
|
||||
database_name = "/var/lib/sm/sm.db"
|
||||
import subprocess
|
||||
platform_release = subprocess.getoutput("source /etc/build.info; echo $SW_VERSION").strip()
|
||||
database_name = f"/etc/sm/{platform_release}/sm.db"
|
||||
database_running_name = "/var/run/sm/sm.db"
|
||||
|
||||
SM_API_SERVER_ADDR = "/tmp/.sm_server_api"
|
||||
|
@@ -6,6 +6,7 @@
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import argparse
|
||||
import subprocess
|
||||
import sqlite3
|
||||
from netaddr import IPNetwork
|
||||
from sm_tools.sm_api_msg_utils import database_name as database_name
|
||||
@@ -19,7 +20,8 @@ admin_if = 'admin-interface'
|
||||
ip_services_list = ['admin-ipv4', 'admin-ipv6', 'cluster-host-ipv4', 'cluster-host-ipv6']
|
||||
tor_connect = 'tor'
|
||||
dc_connect = 'dc'
|
||||
database_name = "/var/lib/sm/sm.db"
|
||||
platform_release = subprocess.getoutput("source /etc/build.info; echo $SW_VERSION").strip()
|
||||
database_name = f"/etc/sm/{platform_release}/sm.db"
|
||||
runtime_db_name = "/var/run/sm/sm.db"
|
||||
|
||||
|
||||
|
@@ -8,13 +8,14 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import subprocess
|
||||
import sqlite3
|
||||
from sm_tools.sm_api_msg_utils import provision_service
|
||||
from sm_tools.sm_api_msg_utils import deprovision_service
|
||||
from sm_tools.sm_api_msg_utils import provision_service_domain_interface
|
||||
from sm_tools.sm_api_msg_utils import deprovision_service_domain_interface
|
||||
|
||||
database_name = "/var/lib/sm/sm.db"
|
||||
platform_release = subprocess.getoutput("source /etc/build.info; echo $SW_VERSION").strip()
|
||||
database_name = f"/etc/sm/{platform_release}/sm.db"
|
||||
runtime_db_name = "/var/run/sm/sm.db"
|
||||
|
||||
|
||||
|
@@ -3,6 +3,7 @@ Section: admin
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper (>= 13),
|
||||
build-info-dev,
|
||||
libsqlite3-dev,
|
||||
libglib2.0-dev,
|
||||
uuid-dev,
|
||||
|
@@ -29,6 +29,7 @@ SRCS+=sm_util_types.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
CCFLAGS= -fPIC -g -O2 -Wall -Werror -Wno-restrict -Wno-format-truncation -std=c++11
|
||||
SW_VERSION="$(shell grep SW_VERSION /usr/include/build_info.h | cut -d ' ' -f 3)"
|
||||
EXTRACCFLAGS= -D__STDC_FORMAT_MACROS -DSW_VERSION=\"$(SW_VERSION)\"
|
||||
EXTRACCFLAGS+= -Wformat -Wformat-security
|
||||
LDLIBS= -lsqlite3 -lglib-2.0 -lgmodule-2.0 -luuid -lrt -lpthread
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#ifndef __SM_TYPES_H__
|
||||
#define __SM_TYPES_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
@@ -27,10 +28,14 @@ extern "C" {
|
||||
#define SM_RUN_SERVICES_DIRECTORY "/var/run/sm/services"
|
||||
#define SM_DATABASE_NAME "/var/run/sm/sm.db"
|
||||
#define SM_HEARTBEAT_DATABASE_NAME "/var/run/sm/sm.hb.db"
|
||||
#define SM_MASTER_DATABASE_NAME "/var/lib/sm/sm.db"
|
||||
#define SM_MASTER_HEARTBEAT_DATABASE_NAME "/var/lib/sm/sm.hb.db"
|
||||
#define SM_PATCH_SCRIPT "/var/lib/sm/patches/sm-patch.sql"
|
||||
|
||||
#ifndef SW_VERSION
|
||||
static_assert(false, "SW_VERSION is not defined!");
|
||||
#endif
|
||||
|
||||
#define SM_MASTER_DATABASE_NAME "/etc/sm/" SW_VERSION "/sm.db"
|
||||
#define SM_MASTER_HEARTBEAT_DATABASE_NAME "/etc/sm/" SW_VERSION "/sm.hb.db"
|
||||
#define SM_PATCH_SCRIPT "/var/lib/sm/patches/sm-patch.sql"
|
||||
#define SM_SERVICE_ACTION_PLUGIN_TYPE_LSB_SCRIPT "lsb-script"
|
||||
#ifdef __LSB_DIR
|
||||
#define SM_SERVICE_ACTION_PLUGIN_TYPE_LSB_DIR MAKE_STRING(__LSB_DIR)
|
||||
|
@@ -2,10 +2,12 @@
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
SW_VERSION="$(shell grep SW_VERSION /usr/include/build_info.h | cut -d ' ' -f 3)"
|
||||
|
||||
install:
|
||||
install -d ${DEST_DIR}/var/lib/sm
|
||||
install -d ${DEST_DIR}/etc/sm/${SW_VERSION}
|
||||
install -d ${DEST_DIR}/var/lib/sm/patches
|
||||
install -d ${DEST_DIR}/usr/share/sm/patches
|
||||
install sm.hb.db ${DEST_DIR}/var/lib/sm
|
||||
install sm.db ${DEST_DIR}/var/lib/sm
|
||||
install sm.hb.db ${DEST_DIR}/etc/sm/${SW_VERSION}
|
||||
install sm.db ${DEST_DIR}/etc/sm/${SW_VERSION}
|
||||
install -m 644 sm-patch.sql ${DEST_DIR}/usr/share/sm/patches
|
||||
|
@@ -3,6 +3,7 @@ Section: admin
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper (>= 13),
|
||||
build-info-dev,
|
||||
sm-common-dev,
|
||||
libglib2.0-dev,
|
||||
libsqlite3-dev,
|
||||
|
@@ -4,6 +4,7 @@ export ROOT = $(CURDIR)/debian/tmp
|
||||
export VER = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
|
||||
export VER_MJR = $(shell echo $(VER) | cut -d. -f1)
|
||||
|
||||
export SW_VERSION="$(shell grep SW_VERSION /usr/include/build_info.h | cut -d ' ' -f 3)"
|
||||
export DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null)
|
||||
|
||||
%:
|
||||
@@ -18,6 +19,7 @@ endif
|
||||
dh_auto_build
|
||||
|
||||
override_dh_install:
|
||||
install -v -d -m -755 $(ROOT)/etc/sm/${SW_VERSION}
|
||||
install -p -D -m 644 debian/tmpfiles.conf $(ROOT)/usr/lib/tmpfiles.d/sm-db.conf
|
||||
dh_install
|
||||
|
||||
@@ -31,4 +33,3 @@ override_dh_auto_install:
|
||||
override_dh_fixperms:
|
||||
dh_fixperms \
|
||||
-Xlibsm_db.so.*
|
||||
|
||||
|
@@ -3,5 +3,4 @@ usr/share/sm/patches/sm-patch.sql
|
||||
usr/lib/tmpfiles.d/sm-db.conf
|
||||
|
||||
# Marked on centos .spec file as "%config(noreplace)"
|
||||
var/lib/sm/sm.hb.db
|
||||
var/lib/sm/sm.db
|
||||
etc/sm/*
|
||||
|
@@ -30,7 +30,8 @@ SRCS+=sm_db_configuration.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
CCFLAGS= -fPIC -g -O2 -Wall -Werror -std=c++11 -Wformat -Wformat-security -Wno-stringop-truncation
|
||||
EXTRACCFLAGS= -D__STDC_FORMAT_MACROS
|
||||
SW_VERSION="$(shell grep SW_VERSION /usr/include/build_info.h | cut -d ' ' -f 3)"
|
||||
EXTRACCFLAGS= -D__STDC_FORMAT_MACROS -DSW_VERSION=\"$(SW_VERSION)\"
|
||||
LDLIBS= -lsqlite3 -lglib-2.0 -luuid -lrt -lsm_common
|
||||
LDFLAGS = -shared -rdynamic
|
||||
OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
|
||||
|
@@ -3,6 +3,7 @@ Section: admin
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper (>= 13),
|
||||
build-info-dev,
|
||||
fm-common-dev,
|
||||
sm-db-dev,
|
||||
sm-common-dev,
|
||||
|
@@ -122,7 +122,8 @@ SRCS+=sm_configure.cpp
|
||||
|
||||
OBJS= $(SRCS:.c=.o)
|
||||
CCFLAGS= -g -O2 -Wall -Werror -Wformat -Wno-stringop-truncation -Wno-format-truncation -Wno-format-overflow -std=c++11
|
||||
EXTRACCFLAGS= -D__STDC_FORMAT_MACROS -Wformat -Wformat-security
|
||||
SW_VERSION="$(shell grep SW_VERSION /usr/include/build_info.h | cut -d ' ' -f 3)"
|
||||
EXTRACCFLAGS= -D__STDC_FORMAT_MACROS -Wformat -Wformat-security -DSW_VERSION=\"$(SW_VERSION)\"
|
||||
LDLIBS= -lglib-2.0 -luuid -lpthread -lrt -lsm_common -lsm_db -lfmcommon -ljson-c -lcrypto -lssl -lsqlite3
|
||||
LDFLAGS = -rdynamic
|
||||
|
||||
|
Reference in New Issue
Block a user