1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

Add misc/py-cinder, Block Storage service for OpenStack

PR:		215850
Submitted by:	Alexander Nusov
This commit is contained in:
Roman Bogorodskiy 2017-01-14 16:25:23 +00:00
parent a189079c6f
commit db63b21bdb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=431474
14 changed files with 414 additions and 2 deletions

2
GIDs
View File

@ -144,7 +144,7 @@ mcserver:*:199:
sympa:*:200:
privoxy:*:201:
dspam:*:202:
# free: 203
cinder:*:203:
yate:*:204:
gnugk:*:205:
gini:*:206:

2
UIDs
View File

@ -149,7 +149,7 @@ mcserver:*:199:199::0:0:Minecraft Server:/nonexistent:/bin/sh
sympa:*:200:200::0:0:Sympa Owner:/nonexistent:/usr/sbin/nologin
privoxy:*:201:201::0:0:Privoxy proxy user:/nonexistent:/usr/sbin/nologin
dspam:*:202:202::0:0:Dspam:/nonexistent:/usr/sbin/nologin
# free: 203
cinder:*:203:203::0:0:Cinder daemon pseudo-user:/var/lib/cinder:/usr/sbin/nologin
yate:*:204:204::0:0:Yate:/nonexistent:/usr/sbin/nologin
gnugk:*:205:205::0:0:GNU GateKeeper pseudo-user:/nonexistent:/usr/sbin/nologin
gini:*:206:206::0:0:& streaming server:/var/log/gini:/usr/sbin/nologin

View File

@ -372,6 +372,7 @@
SUBDIR += pspresent
SUBDIR += py-YABT
SUBDIR += py-crudini
SUBDIR += py-cinder
SUBDIR += py-fuzzy
SUBDIR += py-glance
SUBDIR += py-osd

105
misc/py-cinder/Makefile Normal file
View File

@ -0,0 +1,105 @@
# Created by: Alexander Nusov <alexander.nusov@nfvexpress.com>
# $FreeBSD$
PORTNAME= cinder
PORTVERSION= 9.1.1
CATEGORIES= misc python
MASTER_SITES= https://fossies.org/linux/misc/openstack/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= alexander.nusov@nfvexpress.com
COMMENT= OpenStack Storage Service (Cinder)
LICENSE= APACHE20
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pbr>=1.6:devel/py-pbr
RUN_DEPENDS:= ${BUILD_DEPENDS}
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}Babel>=2.3.4:devel/py-babel \
${PYTHON_PKGNAMEPREFIX}decorator>=3.4.0:devel/py-decorator \
${PYTHON_PKGNAMEPREFIX}enum34>=0:devel/py-enum34 \
${PYTHON_PKGNAMEPREFIX}eventlet>=0:net/py-eventlet \
${PYTHON_PKGNAMEPREFIX}greenlet>=0.3.2:devel/py-greenlet \
${PYTHON_PKGNAMEPREFIX}httplib2>=0.7.5:www/py-httplib2 \
${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601 \
${PYTHON_PKGNAMEPREFIX}ipaddress>=1.0.7:net/py-ipaddress \
${PYTHON_PKGNAMEPREFIX}keystoneauth1>=2.10.0:devel/py-keystoneauth1 \
${PYTHON_PKGNAMEPREFIX}keystonemiddleware>=0:devel/py-keystonemiddleware \
${PYTHON_PKGNAMEPREFIX}lxml>=2.3:devel/py-lxml \
${PYTHON_PKGNAMEPREFIX}oauth2client>=1.5.0:security/py-oauth2client \
${PYTHON_PKGNAMEPREFIX}oslo.config>=3.14.0:devel/py-oslo.config \
${PYTHON_PKGNAMEPREFIX}oslo.concurrency>=3.8.0:devel/py-oslo.concurrency \
${PYTHON_PKGNAMEPREFIX}oslo.context>=2.9.0:devel/py-oslo.context \
${PYTHON_PKGNAMEPREFIX}oslo.db>=0:devel/py-oslo.db \
${PYTHON_PKGNAMEPREFIX}oslo.log>=1.14.0:devel/py-oslo.log \
${PYTHON_PKGNAMEPREFIX}oslo.messaging>=5.2.0:devel/py-oslo.messaging \
${PYTHON_PKGNAMEPREFIX}oslo.middleware>=3.0.0:devel/py-oslo.middleware \
${PYTHON_PKGNAMEPREFIX}oslo.policy>=1.9.0:devel/py-oslo.policy \
${PYTHON_PKGNAMEPREFIX}oslo.privsep>=1.9.0:devel/py-oslo.privsep \
${PYTHON_PKGNAMEPREFIX}oslo.reports>=0.6.0:devel/py-oslo.reports \
${PYTHON_PKGNAMEPREFIX}oslo.rootwrap>=5.0.0:devel/py-oslo.rootwrap \
${PYTHON_PKGNAMEPREFIX}oslo.serialization>=1.10.0:devel/py-oslo.serialization \
${PYTHON_PKGNAMEPREFIX}oslo.service>=1.10.0:devel/py-oslo.service \
${PYTHON_PKGNAMEPREFIX}oslo.utils>=3.16.0:devel/py-oslo.utils \
${PYTHON_PKGNAMEPREFIX}oslo.versionedobjects>=1.13.0:devel/py-oslo.versionedobjects \
${PYTHON_PKGNAMEPREFIX}osprofiler>=1.4.0:devel/py-osprofiler \
${PYTHON_PKGNAMEPREFIX}paramiko>=2.0:security/py-paramiko \
${PYTHON_PKGNAMEPREFIX}Paste>=0:www/py-paste \
${PYTHON_PKGNAMEPREFIX}PasteDeploy>=1.5.0:www/py-pastedeploy \
${PYTHON_PKGNAMEPREFIX}pycrypto>=2.6:security/py-pycrypto \
${PYTHON_PKGNAMEPREFIX}pyparsing>=2.0.1:devel/py-pyparsing \
${PYTHON_PKGNAMEPREFIX}python-barbicanclient>=4.0.0:net/py-python-barbicanclient \
${PYTHON_PKGNAMEPREFIX}python-glanceclient>=0:net/py-python-glanceclient \
${PYTHON_PKGNAMEPREFIX}python-keystoneclient>=0:net/py-python-keystoneclient \
${PYTHON_PKGNAMEPREFIX}python-novaclient>=0:net/py-python-novaclient \
${PYTHON_PKGNAMEPREFIX}python-swiftclient>=2.2.0:databases/py-python-swiftclient \
${PYTHON_PKGNAMEPREFIX}pytz>=2013.6:devel/py-pytz \
${PYTHON_PKGNAMEPREFIX}requests>=2.10.0:www/py-requests \
${PYTHON_PKGNAMEPREFIX}retrying>=0:devel/py-retrying \
${PYTHON_PKGNAMEPREFIX}routes>=0:www/py-routes \
${PYTHON_PKGNAMEPREFIX}taskflow>=1.26.0:devel/py-taskflow \
${PYTHON_PKGNAMEPREFIX}rtslib-fb>=0:devel/py-rtslib-fb \
${PYTHON_PKGNAMEPREFIX}simplejson>=2.2.0:devel/py-simplejson \
${PYTHON_PKGNAMEPREFIX}six>=1.9.0:devel/py-six \
${PYTHON_PKGNAMEPREFIX}sqlalchemy10>=0:databases/py-sqlalchemy10 \
${PYTHON_PKGNAMEPREFIX}sqlalchemy-migrate>=0.9.6:databases/py-sqlalchemy-migrate \
${PYTHON_PKGNAMEPREFIX}stevedore>=1.16.0:devel/py-stevedore \
${PYTHON_PKGNAMEPREFIX}webob>=1.2.3:www/py-webob \
${PYTHON_PKGNAMEPREFIX}oslo.i18n>=2.1.0:devel/py-oslo.i18n \
${PYTHON_PKGNAMEPREFIX}oslo.vmware>=2.11.0:devel/py-oslo.vmware \
${PYTHON_PKGNAMEPREFIX}os-brick>=1.6.1:devel/py-os-brick \
${PYTHON_PKGNAMEPREFIX}os-win>=0.2.3:devel/py-os-win \
${PYTHON_PKGNAMEPREFIX}tooz>=1.28.0:devel/py-tooz \
${PYTHON_PKGNAMEPREFIX}google-api-python-client>=1.4.1:www/py-google-api-python-client \
${PYTHON_PKGNAMEPREFIX}castellan>=0.4.0:devel/py-castellan
EXTRA_PATCHES= ${FILESDIR}/01-remotefs.patch:-p1 \
${FILESDIR}/02-nfs.patch:-p1
NO_ARCH= yes
USES= python
USE_PYTHON= autoplist distutils
USE_RC_SUBR= cinder-api \
cinder-scheduler \
cinder-volume
USERS= cinder
GROUPS= cinder
post-extract:
@(cd ${WRKSRC}/etc/cinder; ${MV} logging_sample.conf logging.conf.sample)
@(cd ${WRKSRC}/etc/cinder; for f in *.conf; \
do ${MV} $${f} $${f}.sample; done)
# No need to ship this README becuase it tells how to generate sample config
# file using tox, but we ship FreeBSD-friendly sample config already
@${RM} ${WRKSRC}/etc/cinder/README-cinder.conf.sample
post-patch:
${CP} ${FILESDIR}/cinder.conf.sample \
${WRKSRC}/etc/cinder/cinder.conf.sample
post-install:
${MKDIR} ${STAGEDIR}${ETCDIR}
${CP} -R ${WRKSRC}/etc/cinder/ ${STAGEDIR}${ETCDIR}
.include <bsd.port.mk>

3
misc/py-cinder/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1483236622
SHA256 (cinder-9.1.1.tar.gz) = 455831c90ac6eafde83bb7b57d0c8ee0caf19a419bf760b2451aa7164cc9627d
SIZE (cinder-9.1.1.tar.gz) = 4201222

View File

@ -0,0 +1,45 @@
From 6c320b98634aa4d3d7b1e9f58b6ca19073cd0b32 Mon Sep 17 00:00:00 2001
From: Alexander Nusov <alexander.nusov@nfvexpress.com>
Date: Mon, 12 Dec 2016 13:49:04 +0300
Subject: [PATCH] fix remotefs
---
cinder/volume/drivers/remotefs.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py
index 0160b0a..d263bf3 100644
--- a/cinder/volume/drivers/remotefs.py
+++ b/cinder/volume/drivers/remotefs.py
@@ -208,9 +208,9 @@ class RemoteFSDriver(driver.LocalVD, driver.TransferVD, driver.BaseVD):
provisioned_size = 0.0
for share in self.shares.keys():
mount_path = self._get_mount_point_for_share(share)
- out, _ = self._execute('du', '--bytes', mount_path,
+ out, _ = self._execute('du', '-k', mount_path,
run_as_root=True)
- provisioned_size += int(out.split()[0])
+ provisioned_size += int(out.split()[0]) * 1024
return round(provisioned_size / units.Gi, 2)
def _get_mount_point_base(self):
@@ -824,13 +824,12 @@ class RemoteFSSnapDriverBase(RemoteFSDriver, driver.SnapshotVD):
"""
mount_point = self._get_mount_point_for_share(share)
- out, _ = self._execute('df', '--portability', '--block-size', '1',
- mount_point,
+ out, _ = self._execute('df', '-k', mount_point,
run_as_root=self._execute_as_root)
out = out.splitlines()[1]
- size = int(out.split()[1])
- available = int(out.split()[3])
+ size = int(out.split()[1]) * 1024
+ available = int(out.split()[3]) * 1024
return available, size
--
2.8.1

View File

@ -0,0 +1,41 @@
diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py
index d495b4a..0fb33c6 100644
--- a/cinder/volume/drivers/nfs.py
+++ b/cinder/volume/drivers/nfs.py
@@ -139,10 +139,10 @@ class NfsDriver(driver.ExtendVD, remotefs.RemoteFSDriver):
self.shares = {} # address : options
- # Check if mount.nfs is installed on this system; note that we
+ # Check if mount_nfs is installed on this system; note that we
# need to be root, to also find mount.nfs on distributions, where
# it is not located in an unprivileged users PATH (e.g. /sbin).
- package = 'mount.nfs'
+ package = 'mount_nfs'
try:
self._execute(package, check_exit_code=False,
run_as_root=True)
@@ -299,16 +299,16 @@ class NfsDriver(driver.ExtendVD, remotefs.RemoteFSDriver):
mount_point = self._get_mount_point_for_share(nfs_share)
- df, _ = self._execute('stat', '-f', '-c', '%S %b %a', mount_point,
+ df, _ = self._execute('df', '-k', mount_point,
run_as_root=run_as_root)
- block_size, blocks_total, blocks_avail = map(float, df.split())
- total_available = block_size * blocks_avail
- total_size = block_size * blocks_total
+ df = df.splitlines()[1]
+ block_size = 1024
+ total_available = block_size * int(df.split()[3])
+ total_size = block_size * int(df.split()[1])
- du, _ = self._execute('du', '-sb', '--apparent-size', '--exclude',
- '*snapshot*', mount_point,
+ du, _ = self._execute('du', '-Aks', mount_point,
run_as_root=run_as_root)
- total_allocated = float(du.split()[0])
+ total_allocated = float(du.split()[0]) * 1024
return total_size, total_available, total_allocated
def _get_mount_point_base(self):

View File

@ -0,0 +1,53 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: cinder_api
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable cinder_api:
#
# cinder_api_enable="YES"
#
# cinder_api_enable (bool):
# Set it to "YES" to enable cinder_api.
# Default is "NO".
#
# cinder_api_logdir (str):
# Set it to chagge log directory
# Default is "/var/log/cinder"
#
# cinder_api_args (str):
# Set it to change command line arguments.
# Default is "--log-file ${cinder_api_logdir}/cinder-api.log"
#
. /etc/rc.subr
name=cinder_api
rcvar=cinder_api_enable
PATH=%%PREFIX%%/bin:%%PREFIX%%/sbin:$PATH
pidfile="/var/run/cinder-api.pid"
procname="%%PREFIX%%/bin/python2.7"
start_precmd=cinder_precmd
load_rc_config $name
: ${cinder_api_enable:="NO"}
: ${cinder_api_logdir:="/var/log/cinder"}
: ${cinder_api_args:="--log-file ${cinder_api_logdir}/cinder-api.log"}
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} cinder-api ${cinder_api_args}"
cinder_precmd() {
mkdir -p ${cinder_api_logdir}
}
run_rc_command "$1"

View File

@ -0,0 +1,53 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: cinder_scheduler
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable cinder_scheduler:
#
# cinder_scheduler_enable="YES"
#
# cinder_scheduler_enable (bool):
# Set it to "YES" to enable cinder_scheduler.
# Default is "NO".
#
# cinder_scheduler_logdir (str):
# Set it to chagge log directory
# Default is "/var/log/cinder"
#
# cinder_scheduler_args (str):
# Set it to change command line arguments.
# Default is "--log-file ${cinder_scheduler_logdir}/cinder-scheduler.log"
#
. /etc/rc.subr
name=cinder_scheduler
rcvar=cinder_scheduler_enable
PATH=%%PREFIX%%/bin:%%PREFIX%%/sbin:$PATH
pidfile="/var/run/cinder-scheduler.pid"
procname="%%PREFIX%%/bin/python2.7"
start_precmd=cinder_precmd
load_rc_config $name
: ${cinder_scheduler_enable:="NO"}
: ${cinder_scheduler_logdir:="/var/log/cinder"}
: ${cinder_scheduler_args:="--log-file ${cinder_scheduler_logdir}/cinder-scheduler.log"}
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} cinder-scheduler ${cinder_scheduler_args}"
cinder_precmd() {
mkdir -p ${cinder_scheduler_logdir}
}
run_rc_command "$1"

View File

@ -0,0 +1,53 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: cinder_volume
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable cinder_volume:
#
# cinder_volume_enable="YES"
#
# cinder_volume_enable (bool):
# Set it to "YES" to enable cinder_volume.
# Default is "NO".
#
# cinder_volume_logdir (str):
# Set it to chagge log directory
# Default is "/var/log/cinder"
#
# cinder_volume_args (str):
# Set it to change command line arguments.
# Default is "--log-file ${cinder_volume_logdir}/cinder-volume.log"
#
. /etc/rc.subr
name=cinder_volume
rcvar=cinder_volume_enable
PATH=%%PREFIX%%/bin:%%PREFIX%%/sbin:$PATH
pidfile="/var/run/cinder-volume.pid"
procname="%%PREFIX%%/bin/python2.7"
start_precmd=cinder_precmd
load_rc_config $name
: ${cinder_volume_enable:="NO"}
: ${cinder_volume_logdir:="/var/log/cinder"}
: ${cinder_volume_args:="--log-file ${cinder_volume_logdir}/cinder-volume.log"}
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} cinder-volume ${cinder_volume_args}"
cinder_precmd() {
mkdir -p ${cinder_volume_logdir}
}
run_rc_command "$1"

View File

@ -0,0 +1,32 @@
[DEFAULT]
rootwrap_config = /usr/local/etc/cinder/rootwrap.conf
api_paste_confg = /usr/local/etc/cinder/api-paste.ini
iscsi_helper = tgtadm
volume_name_template = volume-%s
volume_group = cinder-volumes
verbose = True
auth_strategy = keystone
state_path = /var/lib/cinder
lock_path = /var/lock/cinder
volumes_dir = /var/lib/cinder/volumes
transport_url = rabbit://openstack:RABBIT_PASS@controller
my_ip = 192.168.1.30
nfs_shares_config = /usr/local/etc/cinder/nfsshares
volume_driver = cinder.volume.drivers.nfs.NfsDriver
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

10
misc/py-cinder/pkg-descr Normal file
View File

@ -0,0 +1,10 @@
Cinder is a Block Storage service for OpenStack. It's designed to present
storage resources to end users that can be consumed by the OpenStack Compute
Project (Nova). This is done through the use of either a reference
implementation (LVM) or plugin drivers for other storage. The short
description of Cinder is that it virtualizes the management of block storage
devices and provides end users with a self service API to request and consume
those resources without requiring any knowledge of where their storage is
actually deployed or on what type of device.
WWW: http://openstack.org/cinder

View File

@ -0,0 +1,5 @@
Please note that this is a development version.
Only initial NFS support was added.
Enable NFS client in rc.conf
# sysrc nfs_client_enable="YES"

11
misc/py-cinder/pkg-plist Normal file
View File

@ -0,0 +1,11 @@
@owner cinder
@dir %%ETCDIR%%
@sample %%ETCDIR%%/api-httpd.conf.sample
@sample %%ETCDIR%%/logging.conf.sample
@sample %%ETCDIR%%/cinder.conf.sample
%%ETCDIR%%/api-paste.ini
%%ETCDIR%%/policy.json
@owner root
@sample %%ETCDIR%%/rootwrap.conf.sample
@dir etc/cinder/rootwrap.d
%%ETCDIR%%/rootwrap.d/volume.filters