]> review.fuel-infra Code Review - openstack-build/cinder-build.git/blob - trusty/debian/cinder-common.postinst
Recovery cinder-volume-vmware init files
[openstack-build/cinder-build.git] / trusty / debian / cinder-common.postinst
1 #!/bin/sh -e
2
3 if [ "$1" = "configure" ]; then
4     if ! getent group cinder > /dev/null 2>&1; then
5         addgroup --system cinder >/dev/null
6     fi
7
8     if ! getent passwd cinder > /dev/null 2>&1; then
9         adduser --system --home /var/lib/cinder --ingroup cinder --no-create-home \
10             --shell /usr/sbin/nologin cinder
11     fi
12
13     chown -R cinder:adm /var/log/cinder
14     chmod 0750 /var/log/cinder
15     chown -R cinder:cinder /var/lib/cinder /etc/cinder
16     chmod 0750 /etc/cinder
17     chown -R root:root /etc/cinder/rootwrap.d
18     chmod 0755 /etc/cinder/rootwrap.d
19     chown root:root /etc/cinder/rootwrap.conf
20
21     # generating cinder.conf.sample
22     python -m cinder.openstack.common.config.generator cinder/api/common.py cinder/api/middleware/auth.py \
23         cinder/api/middleware/sizelimit.py cinder/api/views/versions.py \
24         cinder/backup/chunkeddriver.py cinder/backup/driver.py \
25         cinder/backup/drivers/ceph.py cinder/backup/drivers/nfs.py \
26         cinder/backup/drivers/swift.py cinder/backup/drivers/tsm.py \
27         cinder/backup/manager.py cinder/cmd/manage.py cinder/cmd/volume.py \
28         cinder/cmd/volume_usage_audit.py cinder/common/config.py \
29         cinder/compute/__init__.py cinder/compute/nova.py cinder/db/api.py \
30         cinder/db/base.py cinder/exception.py cinder/image/glance.py \
31         cinder/image/image_utils.py cinder/keymgr/conf_key_mgr.py \
32         cinder/keymgr/__init__.py cinder/keymgr/key_mgr.py \
33         cinder/openstack/common/eventlet_backdoor.py \
34         cinder/openstack/common/periodic_task.py \
35         cinder/openstack/common/policy.py \
36         cinder/openstack/common/versionutils.py cinder/quota.py \
37         cinder/scheduler/driver.py cinder/scheduler/host_manager.py \
38         cinder/scheduler/manager.py cinder/scheduler/scheduler_options.py \
39         cinder/scheduler/simple.py cinder/scheduler/weights/capacity.py \
40         cinder/scheduler/weights/volume_number.py cinder/service.py \
41         cinder/ssh_utils.py cinder/transfer/api.py cinder/volume/api.py \
42         cinder/volume/driver.py cinder/volume/drivers/block_device.py \
43         cinder/volume/drivers/cloudbyte/options.py \
44         cinder/volume/drivers/datera.py \
45         cinder/volume/drivers/dell/dell_storagecenter_common.py \
46         cinder/volume/drivers/emc/emc_vmax_common.py \
47         cinder/volume/drivers/emc/emc_vnx_cli.py \
48         cinder/volume/drivers/emc/xtremio.py cinder/volume/drivers/eqlx.py \
49         cinder/volume/drivers/glusterfs.py cinder/volume/drivers/hds/hds.py \
50         cinder/volume/drivers/hds/iscsi.py cinder/volume/drivers/hds/nfs.py \
51         cinder/volume/drivers/hitachi/hbsd_common.py \
52         cinder/volume/drivers/hitachi/hbsd_fc.py \
53         cinder/volume/drivers/hitachi/hbsd_horcm.py \
54         cinder/volume/drivers/hitachi/hbsd_iscsi.py \
55         cinder/volume/drivers/huawei/__init__.py \
56         cinder/volume/drivers/ibm/flashsystem.py cinder/volume/drivers/ibm/gpfs.py \
57         cinder/volume/drivers/ibm/ibmnas.py \
58         cinder/volume/drivers/ibm/storwize_svc/__init__.py \
59         cinder/volume/drivers/ibm/xiv_ds8k.py cinder/volume/drivers/lvm.py \
60         cinder/volume/drivers/netapp/options.py cinder/volume/drivers/nfs.py \
61         cinder/volume/drivers/nimble.py cinder/volume/drivers/openvstorage.py \
62         cinder/volume/drivers/prophetstor/options.py cinder/volume/drivers/pure.py \
63         cinder/volume/drivers/quobyte.py cinder/volume/drivers/rbd.py \
64         cinder/volume/drivers/remotefs.py \
65         cinder/volume/drivers/san/hp/hp_3par_common.py \
66         cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py \
67         cinder/volume/drivers/san/san.py cinder/volume/drivers/scality.py \
68         cinder/volume/drivers/smbfs.py cinder/volume/drivers/solidfire.py \
69         cinder/volume/drivers/srb.py cinder/volume/drivers/violin/v6000_common.py \
70         cinder/volume/drivers/vmware/vmdk.py cinder/volume/drivers/windows/windows.py \
71         cinder/volume/drivers/xio.py cinder/volume/drivers/zfssa/zfssanfs.py \
72         cinder/volume/manager.py cinder/wsgi.py \
73         cinder/zonemanager/drivers/brocade/brcd_fabric_opts.py \
74         cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py \
75         cinder/zonemanager/drivers/cisco/cisco_fabric_opts.py \
76         cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py cinder/zonemanager/fc_zone_manager.py \
77         > /etc/cinder/cinder.conf.sample && \
78
79         oslo-config-generator \
80         --namespace oslo_concurrency --namespace oslo_db \
81         --namespace oslo_messaging --namespace policy \
82         --namespace keystonemiddleware.auth_token \
83         | sed '/^\[DEFAULT/d' >> /etc/cinder/cinder.conf.sample
84
85     if [ "$?" -ne 0 ]; then
86         echo "cinder sample configuration file generation fails!"
87     fi
88
89     if [ -e /var/lib/cinder/cinder.sqlite ]; then
90         chown cinder:cinder /var/lib/cinder/cinder.sqlite
91         chmod 0600 /var/lib/cinder/cinder.sqlite
92     fi
93 fi
94
95 #DEBHELPER#