summaryrefslogtreecommitdiff
path: root/sys-cluster/nova/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-cluster/nova/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-cluster/nova/files')
-rw-r--r--sys-cluster/nova/files/nova-compute.conf4
-rw-r--r--sys-cluster/nova/files/nova-sudoers3
-rw-r--r--sys-cluster/nova/files/nova.initd30
-rw-r--r--sys-cluster/nova/files/nova.initd-225
-rw-r--r--sys-cluster/nova/files/openstack-scsi-disk.rules2
-rw-r--r--sys-cluster/nova/files/scsi-openscsi-link.sh93
6 files changed, 157 insertions, 0 deletions
diff --git a/sys-cluster/nova/files/nova-compute.conf b/sys-cluster/nova/files/nova-compute.conf
new file mode 100644
index 000000000000..59c7aea2cd24
--- /dev/null
+++ b/sys-cluster/nova/files/nova-compute.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+# mkisofs_cmd is needed as the default provider for the binary was remvoed as
+# a package from Gentoo.
+mkisofs_cmd = /usr/bin/mkisofs
diff --git a/sys-cluster/nova/files/nova-sudoers b/sys-cluster/nova/files/nova-sudoers
new file mode 100644
index 000000000000..f15b3285b7d4
--- /dev/null
+++ b/sys-cluster/nova/files/nova-sudoers
@@ -0,0 +1,3 @@
+Defaults:nova !requiretty
+
+nova ALL = (root) NOPASSWD: /usr/bin/nova-rootwrap
diff --git a/sys-cluster/nova/files/nova.initd b/sys-cluster/nova/files/nova.initd
new file mode 100644
index 000000000000..7d679ed95fc9
--- /dev/null
+++ b/sys-cluster/nova/files/nova.initd
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Starts ${SVCNAME} service for OpenStack"
+
+command="/usr/bin/${SVCNAME} -- --config-file /etc/nova/nova.conf"
+pidfile=/var/run/nova/${SVCNAME}.pid
+required_files=/etc/nova/nova.conf
+start_stop_daemon_args="--quiet --user ${NOVA_USER:-nova}"
+if [ "$SVCNAME" == nova-compute ]; then
+ required_files="${required_files} /etc/nova/nova-compute.conf"
+ command="${command} --config-file /etc/nova/nova-compute.conf"
+fi
+
+
+depend() {
+ use net
+}
+
+start_pre() {
+ checkpath --directory --owner ${NOVA_USER:-nova}:${NOVA_GROUP:-nova} --mode 0775 ${NOVA_RUN:-/var/run/nova}
+ checkpath --directory --owner ${NOVA_USER:-nova}:${NOVA_GROUP:-nova} --mode 0775 ${NOVA_RUN:-/var/lock/nova}
+}
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon -S -b -m -p ${pidfile} -q -u ${NOVA_USER:-nova} -x ${command}
+ eend $?
+}
diff --git a/sys-cluster/nova/files/nova.initd-2 b/sys-cluster/nova/files/nova.initd-2
new file mode 100644
index 000000000000..cb82c947ddfe
--- /dev/null
+++ b/sys-cluster/nova/files/nova.initd-2
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Starts ${SVCNAME} service for OpenStack"
+
+command="/usr/bin/${SVCNAME}"
+command_args="--config-file /etc/nova/nova.conf"
+pidfile=/run/${SVCNAME}.pid
+command_background=true
+required_files=/etc/nova/nova.conf
+if [ "$SVCNAME" == nova-compute ]; then
+ required_files="${required_files} /etc/nova/nova-compute.conf"
+ command_args="${command_args} --config-file /etc/nova/nova-compute.conf"
+fi
+start_stop_daemon_args="-u ${NOVA_USER:-nova}"
+retry="SIGTERM/15"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ checkpath --directory --owner ${NOVA_USER:-nova}:${NOVA_GROUP:-nova} --mode 0775 ${NOVA_RUN:-/var/lock/nova}
+}
diff --git a/sys-cluster/nova/files/openstack-scsi-disk.rules b/sys-cluster/nova/files/openstack-scsi-disk.rules
new file mode 100644
index 000000000000..ee44d5066291
--- /dev/null
+++ b/sys-cluster/nova/files/openstack-scsi-disk.rules
@@ -0,0 +1,2 @@
+KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="scsi", PROGRAM="/etc/nova/scsi-openscsi-link.sh %b $id", SYMLINK+="disk/by-path/%c"
+
diff --git a/sys-cluster/nova/files/scsi-openscsi-link.sh b/sys-cluster/nova/files/scsi-openscsi-link.sh
new file mode 100644
index 000000000000..197eac4438e5
--- /dev/null
+++ b/sys-cluster/nova/files/scsi-openscsi-link.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+# Author: Geaaru
+# Date: October 23, 2014
+# Version: 0.1.0
+# License: GPL 2.0
+
+# Description: Script for udev symlink creation of
+# scsi disk attached and visible under
+# /dev/disk/by-path/ with name convention
+# used in openstack LVM iscsi driver.
+#
+# Requirements: lsscsi (for retrieve LUN ID, I don't know how can i do that from udev/iscsiadm)
+
+# Rules for UDEV must in this format:
+# KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/nova/scsi-openscsi-link.sh %b",SYMLINK+="disk/by-path/%c"
+
+# NOTE: it seems that input params %b or others are not passed to script.
+# I try to retrieve it from environment variables.
+
+if [[ -z "$DEVTYPE" || -z "$ID_BUS" ]] ; then
+ exit 1
+fi
+
+echo "--------------------" >> /tmp/udev.log
+echo "ENV => `env`" >> /tmp/udev.log
+echo "--------------------" >> /tmp/udev.log
+
+if [[ $DEVTYPE != "disk" || $ID_BUS != "scsi" ]]; then
+ echo "EXIT 1" >> /tmp/udev.log
+ exit 1
+fi
+
+# ID_SCSI variable what identify ?
+
+HOST=`echo "$DEVPATH" | awk '{ split($0, word, "/"); print substr(word[4], 5); }'`
+
+
+
+# Bins
+iscsiadm=/usr/sbin/iscsiadm
+lsscsi=/usr/bin/lsscsi
+
+[ -e /sys/class/iscsi_host ] || exit 1
+
+# Create file path like this:
+# /sys/class/iscsi_host/host11/device/session3/iscsi_session/session3/targetname
+file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/session*/targetname"
+
+target_iqn=$(cat ${file})
+
+if [ -z "${target_iqn}" ] ; then
+ echo "EXIT 2" >> /tmp/udev.log
+ exit 1
+fi
+
+# Retrieve target_port because I can't retrieve it with iscsi_id
+# /lib/udev/scsi_id -g -x /dev/sdg
+# ID_SCSI=1
+# ID_VENDOR=IET
+# ID_VENDOR_ENC=IET\x20\x20\x20\x20\x20
+# ID_MODEL=VIRTUAL-DISK
+# ID_MODEL_ENC=VIRTUAL-DISK
+# ID_REVISION=0001
+# ID_TYPE=disk
+# ID_SERIAL=1IET_00010001
+# ID_SERIAL_SHORT=IET_00010001
+# ID_SCSI_SERIAL= beaf11a
+
+# iscsiadm -m node | grep --colour=none iqn.2014-09.org.openstack:vol-cinder-f48f0a69-e871-4c47-9cd3-3ccb8c811363 | cut -d',' -f 1
+
+tp_ispresent=$(${iscsiadm} -m node | grep --colour=none ${target_iqn} | wc -l)
+if [ x$tp_ispresent = x0 ] ; then
+ # Target is not present. Ignore it.
+ echo "EXIT 3" >> /tmp/udev.log
+ exit 1
+fi
+
+target_portal=$(${iscsiadm} -m node | grep --colour=none ${target_iqn} | cut -d',' -f 1)
+#target=$(${iscsiadm} -m node | grep --colour=none ${target_iqn} | cut -d' ' -f 1)
+#target_portal=$(echo ${target} | cut -d',' -f 1)
+target_lun=$(${lsscsi} | grep $DEVNAME | sed 's/.[0-9]*:[0-9]*:[0-9]*:\([0-9]*\).*/\1/')
+
+echo "TARGET_PORTAL=$target_portal" >> /tmp/udev.log
+echo "TARGET_LUN=$target_lun" >> /tmp/udev.log
+
+linkname="ip-${target_portal}-iscsi-${target_iqn}-lun-${target_lun}"
+
+echo "RETURN ${linkname}" >> /tmp/udev.log
+
+echo "${linkname}"
+
+exit 0