Add ironic to anvil

Adds spec files and other components to have anvil build ironic.

Change-Id: Ie2f6a366a29838676143caa4c86c20203d93dea5
This commit is contained in:
Kris Lindgren 2014-06-17 13:21:40 -06:00 committed by Stig Telfer
parent 34b0be9650
commit 6463c39b40
10 changed files with 406 additions and 0 deletions

View File

@ -0,0 +1,36 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2014 GoDaddy Operating Company, LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from anvil import shell as sh
from anvil.components.configurators import base
API_CONF = 'ironic.conf'
PASTE_CONF = 'api-paste.ini'
POLICY_CONF = 'policy.json'
CONFIGS = [API_CONF, PASTE_CONF, POLICY_CONF]
class IronicConfigurator(base.Configurator):
DB_NAME = 'ironic'
def __init__(self, installer):
super(IronicConfigurator, self).__init__(installer, CONFIGS)
self.config_adjusters = {}
self.source_configs = {API_CONF: 'ironic.conf.sample'}
self.config_dir = sh.joinpths(self.installer.get_option('app_dir'),
'etc',
installer.name)

View File

@ -0,0 +1,45 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2014 GoDaddy Operating Company, LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from anvil import colorizer
from anvil import log as logging
from anvil import utils
from anvil.components import base_install as binstall
from anvil.components.configurators import ironic as iconf
LOG = logging.getLogger(__name__)
# Sync db command
SYNC_DB_CMD = ['sudo', '-u', 'ironic', '/usr/bin/ironic-dbsync',
'create_schema']
class IronicInstaller(binstall.PythonInstallComponent):
def __init__(self, *args, **kargs):
binstall.PythonInstallComponent.__init__(self, *args, **kargs)
self.configurator = iconf.IronicConfigurator(self)
def post_install(self):
binstall.PythonInstallComponent.post_install(self)
if self.get_bool_option('db-sync'):
self._sync_db()
def _sync_db(self):
LOG.info("Syncing ironic to database: %s", colorizer.quote(self.configurator.DB_NAME))
cmds = [{'cmd': SYNC_DB_CMD}]
utils.execute_template(*cmds, cwd=self.bin_dir)

View File

@ -0,0 +1,4 @@
# Settings for component ironic-client
---
...

View File

@ -0,0 +1,3 @@
# Settings for component ironic
---
...

View File

@ -329,4 +329,13 @@ components:
central: openstack-ceilometer-central
collector: openstack-ceilometer-collector
compute: openstack-ceilometer-compute
ironic:
python_entrypoints: True
action_classes:
install: anvil.components.ironic:IronicInstaller
daemon_to_package:
api: openstack-ironic-api
conductor: openstack-ironic-conductor
ironic-client:
python_entrypoints: True
...

View File

@ -29,6 +29,12 @@ heat-client:
horizon:
repo: git://github.com/openstack/horizon.git
tag: 2014.1
ironic:
repo: git://github.com/openstack/ironic.git
tag: 2014.1
ironic-client:
repo: git://github.com/openstack/python-ironicclient.git
tag: 0.1.4
keystone-client:
repo: git://github.com/openstack/python-keystoneclient.git
tag: 0.7.1

View File

@ -0,0 +1,111 @@
---
# Persona that includes all known components
components:
# Order matters here!
- general
- db
- rabbit-mq
# Oslo libraries
- oslo-config
- oslo-messaging
- pycadf
# Core components
- keystone
- glance
- ceilometer
- cinder
- heat
- horizon
- neutron
- nova
- trove
- ironic
# Client used by components
- ceilometer-client
- cinder-client
- glance-client
- heat-client
- keystone-client
- neutron-client
- nova-client
- swift-client
- trove-client
- ironic-client
# Additional libraries
- openvswitch
- django-openstack-auth
options:
general:
install-all-deps: false
nova:
db-sync: true
do-network-init: true
enable-cells: false
enable-spice: false
local-conductor: false
mq-type: rabbit
neutron-enabled: true
glance:
db-sync: true
load-images: true
keystone:
db-sync: true
do-init: true
enable-pki: false
heat: {}
ironic:
db-sync: true
ceilometer:
db-sync: true
horizon:
make-blackhole: true
cinder:
db-sync: true
mq-type: rabbit
neutron:
db-sync: true
mq-type: rabbit
subsystems:
glance:
- api
- registry
keystone:
- all
nova:
- api
- cert
- compute
- conductor
- scheduler
neutron:
- server
- agent
- l3-agent
- metadata-agent
- dhcp-agent
cinder:
- api
- scheduler
- volume
heat:
- api
- api-cfn
- api-cloudwatch
- engine
ceilometer:
- api
- collector
- compute
- central
ironic:
- api
- conductor
no-origin:
# These components don't need an origin to be enabled
- general
- db
- rabbit-mq
- openvswitch
supports:
- rhel
...

View File

@ -0,0 +1,3 @@
Defaults:ironic !requiretty
ironic ALL = (root) NOPASSWD: /usr/bin/ironic-rootwrap /etc/ironic/rootwrap.conf *

View File

@ -0,0 +1,9 @@
compress
/var/log/ironic/*.log {
weekly
rotate 4
missingok
compress
minsize 100k
}

View File

@ -0,0 +1,180 @@
#encoding UTF-8
%global python_name ironic
%global daemon_prefix openstack-ironic
%global os_version ${version}
%global with_doc %{!?_without_doc:1}%{?_without_doc:0}
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
Name: openstack-ironic
Summary: OpenStack Baremetal Hypervisor API (ironic)
Version: %{os_version}$version_suffix
Release: $release%{?dist}
License: ASL 2.0
Group: System Environment/Base
URL: http://www.openstack.org
Source0: %{python_name}-%{os_version}.tar.gz
Source10: openstack-ironic-api.init
Source11: openstack-ironic-conductor.init
Source20: ironic.logrotate
Source53: ironic-sudoers
#for $idx, $fn in enumerate($patches)
Patch$idx: $fn
#end for
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
# Requirements needed to build this thing
BuildRequires: python-devel
BuildRequires: python-pbr
BuildRequires: python-setuptools
BuildRequires: python-sphinx
%prep
%setup -q -n %{python_name}-%{os_version}
#for $idx, $fn in enumerate($patches)
%patch$idx -p1
#end for
#raw
%build
%{__python2} setup.py build
%install
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
#end raw
# install init files
mkdir -p %{buildroot}%{_unitdir}
install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-ironic-api
install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-ironic-conductor
install -d -m 755 %{buildroot}%{_sharedstatedir}/ironic/
install -d -m 755 %{buildroot}%{_sysconfdir}/ironic/rootwrap.d
#Populate the conf dir
install -p -D -m 640 etc/ironic/ironic.conf.sample %{buildroot}/%{_sysconfdir}/ironic/ironic.conf
install -p -D -m 640 etc/ironic/policy.json %{buildroot}/%{_sysconfdir}/ironic/policy.json
install -p -D -m 640 etc/ironic/rootwrap.conf %{buildroot}/%{_sysconfdir}/ironic/rootwrap.conf
install -p -D -m 640 etc/ironic/rootwrap.d/* %{buildroot}/%{_sysconfdir}/ironic/rootwrap.d/
# Install logrotate
install -p -D -m 644 %{SOURCE20} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-ironic
# Install sudoers
install -p -D -m 440 %{SOURCE53} %{buildroot}%{_sysconfdir}/sudoers.d/ironic
# Runtime directories
install -d -m 755 %{buildroot}%{_sharedstatedir}/ironic
install -p -D -m 644 ironic/drivers/modules/pxe_config.template %{buildroot}%{_sharedstatedir}/ironic
# Other runtime directories
install -d -m 755 %{buildroot}%{_localstatedir}/log/ironic
install -d -m 755 %{buildroot}%{_localstatedir}/run/ironic
%description
Ironic provides an API for management and provisioning of physical machines
%package -n python-%{python_name}
Summary: Ironic Python libraries
Group: Applications/System
#for $i in $requires
Requires: ${i}
#end for
%description -n python-%{python_name}
This package contains the %{name} Python library.
%files -n python-%{python_name}
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/ironic*
%exclude %{python_sitelib}/%{python_name}/tests
%package common
Summary: Ironic common
Group: System Environment/Base
#for $i in $requires
Requires: ${i}
#end for
%description common
Components common to all OpenStack Ironic services
%files common
%doc README.rst LICENSE
%{_bindir}/ironic-dbsync
%{_bindir}/ironic-rootwrap
#if $newer_than_eq('2014.2')
%{_bindir}/ironic-nova-bm-migrate
#end if
%attr(-,ironic,ironic) %{_sharedstatedir}/ironic
%config(noreplace) %{_sharedstatedir}/ironic/pxe_config.template
%dir %attr(0755, ironic, ironic) %{_localstatedir}/log/ironic
%dir %attr(0755, ironic, ironic) %{_localstatedir}/run/ironic
%config(noreplace) %attr(-,root,ironic) %{_sysconfdir}/ironic
%config(noreplace) %attr(0640, root, ironic) %{_sysconfdir}/ironic/policy.json
%config(noreplace) %attr(0640, root, ironic) %{_sysconfdir}/ironic/ironic.conf
%config(noreplace) %{_sysconfdir}/ironic/rootwrap.conf
%config(noreplace) %{_sysconfdir}/ironic/rootwrap.d/*
%config(noreplace) %{_sysconfdir}/logrotate.d/*
%config(noreplace) %{_sysconfdir}/sudoers.d/ironic
%pre common
#raw
getent group ironic >/dev/null || groupadd -r ironic
getent passwd ironic >/dev/null || \
useradd -r -g ironic -d %{_sharedstatedir}/ironic -s /sbin/nologin \
-c "OpenStack Ironic Daemons" ironic
exit 0
#end raw
%package api
Summary: The Ironic API
Group: System Environment/Base
Requires: %{name}-common = %{version}-%{release}
Requires: python-%{python_name} = %{version}-%{release}
%description api
Ironic API for management and provisioning of physical machines
%files api
%doc LICENSE
%{_bindir}/ironic-api
%{_initrddir}/openstack-ironic-api
%package conductor
Summary: The Ironic Conductor
Group: System Environment/Base
Requires: %{name}-common = %{version}-%{release}
Requires: python-%{python_name} = %{version}-%{release}
%description conductor
Ironic Conductor for management and provisioning of physical machines
%files conductor
%doc LICENSE
%{_bindir}/ironic-conductor
%{_initrddir}/openstack-ironic-conductor
%changelog