[devstack] inventory service in stx-metal

Install and cleanup utility inventory-dbsync,
inventory-dnsmasq-lease-update and services
inventory-api, inventory-conductor, inventory-agent

Task: 29245
Story: 2003161

Depends-on: https://review.openstack.org/#/c/642305/

Change-Id: I62867f95285df9a6e5bb8c429e88d007f6db0f02
Signed-off-by: Martin, Chen <haochuan.z.chen@intel.com>
This commit is contained in:
Martin, Chen 2019-03-09 01:13:59 +08:00
parent 64f9dd20cf
commit 6ccf0b68c0
2 changed files with 81 additions and 0 deletions

View File

@ -41,6 +41,9 @@
mtce-compute: true
mtce-control: true
mtce-storage: true
inventory-api: true
inventory-conductor: true
inventory-agent: true
fsmon: true
hbs: true
hwmon: true

View File

@ -94,6 +94,14 @@ function build_mtce_common {
popd
}
function build_inventory {
pushd ${STX_METAL_DIR}/inventory/inventory
python setup.py build
popd
}
function install_maintenance {
install_mtce_common
# components could be seperately installed if
@ -109,6 +117,10 @@ function install_maintenance {
if is_service_enabled mtce-storage; then
install_mtce_storage
fi
if is_service_enabled inventory-api || is_service_enabled inventory-conductor || is_service_enabled inventory-agent; then
install_inventory
fi
}
function install_mtce_common {
@ -232,6 +244,46 @@ function install_mtce_control {
popd
}
function install_inventory {
local lib_dir=${PREFIX}/lib
local unit_dir=${PREFIX}/lib/systemd/system
local lib64_dir=${PREFIX}/lib64
local pythonroot=${lib64_dir}/python2.7/site-packages
local sysconf_dir=${SYSCONFDIR}
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
local local_etc_inventory=${SYSCONFDIR}/inventory
local local_etc_motdd=${SYSCONFDIR}/motd.d
build_inventory
pushd ${STX_METAL_DIR}/inventory/inventory
sudo python setup.py install \
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
sudo install -d -m 755 ${local_etc_goenabledd}
sudo install -p -D -m 755 etc/inventory/inventory_goenabled_check.sh ${local_etc_goenabledd}/inventory_goenabled_check.sh
sudo install -d -m 755 ${local_etc_inventory}
sudo install -p -D -m 755 etc/inventory/policy.json ${local_etc_inventory}/policy.json
sudo install -d -m 755 ${local_etc_motdd}
sudo install -p -D -m 755 etc/inventory/motd-system ${local_etc_motdd}/10-system-config
sudo install -m 755 -p -D scripts/inventory-api ${lib_dir}/ocf/resource.d/platform/inventory-api
sudo install -m 755 -p -D scripts/inventory-conductor ${lib_dir}/ocf/resource.d/platform/inventory-conductor
sudo install -m 644 -p -D scripts/inventory-api.service ${unit_dir}/inventory-api.service
sudo install -m 644 -p -D scripts/inventory-conductor.service ${unit_dir}/inventory-conductor.service
popd
}
function install_mtce_storage {
local sysconf_dir=${SYSCONFDIR}
local unit_dir=${SYSCONFDIR}/systemd/system
@ -968,6 +1020,32 @@ function cleanup_metal {
# Storage-Only Init Scripts
sudo rm -rf ${sysconf_dir}/init.d/goenabledStorage
fi
if is_service_enabled inventory-api || is_service_enabled inventory-conductor || is_service_enabled inventory-agent; then
cleanup_inventory
fi
}
function cleanup_inventory {
local lib_dir=${PREFIX}/lib
local unit_dir=${PREFIX}/lib/systemd/system
local lib64_dir=${PREFIX}/lib64
local pythonroot=${lib64_dir}/python2.7/site-packages
local sysconf_dir=${SYSCONFDIR}
local local_etc_goenabledd=${SYSCONFDIR}/goenabled.d
local local_etc_inventory=${SYSCONFDIR}/inventory
local local_etc_motdd=${SYSCONFDIR}/motd.d
sudo pip uninstall -y inventory
sudo rm -rf ${local_etc_goenabledd}/inventory_goenabled_check.sh
sudo rm -rf ${local_etc_inventory}/policy.json
sudo rm -rf ${local_etc_motdd}/10-system-config
sudo rm -rf ${lib_dir}/ocf/resource.d/platform/inventory-api
sudo rm -rf ${lib_dir}/ocf/resource.d/platform/inventory-conductor
sudo rm -rf ${unit_dir}/inventory-api.service
sudo rm -rf ${unit_dir}/inventory-conductor.service
}
function uninstall_files {