diff options
author | Vu Tran <vu.tran@windriver.com> | 2014-02-28 09:11:11 -0500 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-03-17 14:23:47 -0400 |
commit | b7527a3c0b5ab0849a0c669cb345c6494628da8f (patch) | |
tree | 23fcc12de79885d56acfa3a159127b0cafa2522b | |
parent | 386984449b5ba4ce3899950e7a3b1bded9b891d0 (diff) | |
download | meta-cloud-services-b7527a3c0b5ab0849a0c669cb345c6494628da8f.tar.gz |
cinder: enable nfs backend
This patch enables multi-backend support (lvm-iscsi and nfs) on
cinder-volume. This including changing cinder.conf, creating
missing nfs_shares config file, and adding mount.nfs into compute
node image.
Signed-off-by: Vu Tran <vu.tran@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
5 files changed, 51 insertions, 4 deletions
diff --git a/meta-openstack/README.setup b/meta-openstack/README.setup index ab0c261..8ad892e 100644 --- a/meta-openstack/README.setup +++ b/meta-openstack/README.setup | |||
@@ -152,6 +152,24 @@ following steps will validate a simple compute node guest launch: | |||
152 | % neutron net-create mynetwork | 152 | % neutron net-create mynetwork |
153 | % nova boot --image myFirstImage --flavor 1 myinstance | 153 | % nova boot --image myFirstImage --flavor 1 myinstance |
154 | 154 | ||
155 | * Cinder Multi-backend * | ||
156 | |||
157 | Cinder currently is configured to support multi-backend: lvm-iscsi and nfs backends. | ||
158 | When a Cinder volume is created, it's needed to be specified which backend its belong | ||
159 | to through "--volume_type" option passed in "cinder create" command. | ||
160 | |||
161 | The Cinder volume types for lvm-iscsi and nfs can be created as following steps: | ||
162 | |||
163 | % . /etc/nova/openrc | ||
164 | % cinder type-create lvm_iscsi | ||
165 | % cinder type-key lvm_iscsi set volume_backend_name=LVM_iSCSI | ||
166 | % cinder type-create nfs | ||
167 | % cinder type-key nfs set volume_backend_name=Generic_NFS | ||
168 | |||
169 | For example, to create 1G Cinder volume in lvm-iscsi backend: | ||
170 | |||
171 | % cinder create --volume_type lvm_iscsi --display_name=lvm_vol 1 | ||
172 | |||
155 | !! Hint !! | 173 | !! Hint !! |
156 | 174 | ||
157 | When using a multi-node setup it is recommended that each host have a different | 175 | When using a multi-node setup it is recommended that each host have a different |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf b/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf index d922e03..aa0eba5 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf +++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf | |||
@@ -1173,14 +1173,20 @@ rabbit_port=5672 | |||
1173 | 1173 | ||
1174 | # Define the names of the groups for multiple volume backends | 1174 | # Define the names of the groups for multiple volume backends |
1175 | #enabled_backends=fakedriver,lvmdriver | 1175 | #enabled_backends=fakedriver,lvmdriver |
1176 | enabled_backends=lvmdriver,nfsdriver | ||
1176 | 1177 | ||
1177 | # Define the groups as above | 1178 | # Define the groups as above |
1178 | #[lvmdriver] | ||
1179 | #volume_group=lvm-group-1 | ||
1180 | #volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver | ||
1181 | #volume_backend_name=LVM_iSCSI_unique1 | ||
1182 | #[fakedriver] | 1179 | #[fakedriver] |
1183 | #volume_driver=cinder.volume.driver.FakeISCSIDriver | 1180 | #volume_driver=cinder.volume.driver.FakeISCSIDriver |
1184 | 1181 | ||
1182 | [lvmdriver] | ||
1183 | volume_group=cinder-volumes | ||
1184 | volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver | ||
1185 | volume_backend_name=LVM_iSCSI | ||
1186 | |||
1187 | [nfsdriver] | ||
1188 | volume_group=nfs-group-1 | ||
1189 | volume_driver=cinder.volume.drivers.nfs.NfsDriver | ||
1190 | volume_backend_name=Generic_NFS | ||
1185 | 1191 | ||
1186 | # Total option count: 255 | 1192 | # Total option count: 255 |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh b/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh new file mode 100644 index 0000000..1d7c475 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #! /bin/bash | ||
2 | |||
3 | # Default setup | ||
4 | if [ "$1" == "1" ]; then | ||
5 | mkdir /etc/cinder/nfs_volumes | ||
6 | echo "/etc/cinder/nfs_volumes *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)" >> /etc/exports | ||
7 | fi | ||
diff --git a/meta-openstack/recipes-devtools/python/python-cinder_git.bb b/meta-openstack/recipes-devtools/python/python-cinder_git.bb index c1ca58c..e9cc27d 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder_git.bb +++ b/meta-openstack/recipes-devtools/python/python-cinder_git.bb | |||
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \ | |||
12 | file://cinder.init \ | 12 | file://cinder.init \ |
13 | file://cinder-volume \ | 13 | file://cinder-volume \ |
14 | file://0001-run_tests-respect-tools-dir.patch \ | 14 | file://0001-run_tests-respect-tools-dir.patch \ |
15 | file://nfs_setup.sh \ | ||
15 | " | 16 | " |
16 | 17 | ||
17 | SRCREV="8b5fb8409322f61d8b610c97c109a61bf48a940e" | 18 | SRCREV="8b5fb8409322f61d8b610c97c109a61bf48a940e" |
@@ -38,6 +39,9 @@ do_install_append() { | |||
38 | install -m 600 ${WORKDIR}/api-paste.ini ${CINDER_CONF_DIR}/ | 39 | install -m 600 ${WORKDIR}/api-paste.ini ${CINDER_CONF_DIR}/ |
39 | install -m 600 ${S}/etc/cinder/policy.json ${CINDER_CONF_DIR}/ | 40 | install -m 600 ${S}/etc/cinder/policy.json ${CINDER_CONF_DIR}/ |
40 | 41 | ||
42 | install -d ${CINDER_CONF_DIR}/drivers | ||
43 | install -m 600 ${WORKDIR}/nfs_setup.sh ${CINDER_CONF_DIR}/drivers/ | ||
44 | |||
41 | install -d ${D}${localstatedir}/log/${SRCNAME} | 45 | install -d ${D}${localstatedir}/log/${SRCNAME} |
42 | 46 | ||
43 | if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | 47 | if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
@@ -55,6 +59,8 @@ do_install_append() { | |||
55 | } | 59 | } |
56 | 60 | ||
57 | CINDER_LVM_VOLUME_BACKING_FILE_SIZE ?= "2G" | 61 | CINDER_LVM_VOLUME_BACKING_FILE_SIZE ?= "2G" |
62 | CINDER_NFS_VOLUME_SERVERS_DEFAULT = "controller:/etc/cinder/nfs_volumes" | ||
63 | CINDER_NFS_VOLUME_SERVERS ?= "${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" | ||
58 | 64 | ||
59 | pkg_postinst_${SRCNAME}-setup () { | 65 | pkg_postinst_${SRCNAME}-setup () { |
60 | if [ "x$D" != "x" ]; then | 66 | if [ "x$D" != "x" ]; then |
@@ -73,6 +79,14 @@ pkg_postinst_${SRCNAME}-setup () { | |||
73 | #Create cinder volume group backing file | 79 | #Create cinder volume group backing file |
74 | [[ -f /etc/cinder/volumes-backing ]] || truncate -s ${CINDER_LVM_VOLUME_BACKING_FILE_SIZE} /etc/cinder/volumes-backing | 80 | [[ -f /etc/cinder/volumes-backing ]] || truncate -s ${CINDER_LVM_VOLUME_BACKING_FILE_SIZE} /etc/cinder/volumes-backing |
75 | echo "include /etc/cinder/data/volumes/*" >> /etc/tgt/targets.conf | 81 | echo "include /etc/cinder/data/volumes/*" >> /etc/tgt/targets.conf |
82 | |||
83 | # Create Cinder nfs_share config file with default nfs server | ||
84 | if [ ! -f /etc/cinder/nfs_shares ]; then | ||
85 | echo "${CINDER_NFS_VOLUME_SERVERS}" > /etc/cinder/nfs_shares | ||
86 | sed 's/\s\+/\n/g' -i /etc/cinder/nfs_shares | ||
87 | [[ "x${CINDER_NFS_VOLUME_SERVERS}" == "x${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" ]] && is_default="1" || is_default="0" | ||
88 | /bin/bash /etc/cinder/drivers/nfs_setup.sh ${is_default} | ||
89 | fi | ||
76 | } | 90 | } |
77 | 91 | ||
78 | PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-volume ${SRCNAME}-scheduler" | 92 | PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-volume ${SRCNAME}-scheduler" |
@@ -95,6 +109,7 @@ FILES_${SRCNAME}-scheduler = "${bindir}/cinder-scheduler \ | |||
95 | FILES_${SRCNAME} = "${bindir}/* \ | 109 | FILES_${SRCNAME} = "${bindir}/* \ |
96 | ${sysconfdir}/${SRCNAME}/* \ | 110 | ${sysconfdir}/${SRCNAME}/* \ |
97 | ${localstatedir}/* \ | 111 | ${localstatedir}/* \ |
112 | ${sysconfdir}/${SRCNAME}/drivers/* \ | ||
98 | " | 113 | " |
99 | 114 | ||
100 | DEPENDS += " \ | 115 | DEPENDS += " \ |
diff --git a/meta-openstack/recipes-extended/packagegroups/packagegroup-cloud-compute.bb b/meta-openstack/recipes-extended/packagegroups/packagegroup-cloud-compute.bb index b7be27f..3787c3b 100644 --- a/meta-openstack/recipes-extended/packagegroups/packagegroup-cloud-compute.bb +++ b/meta-openstack/recipes-extended/packagegroups/packagegroup-cloud-compute.bb | |||
@@ -21,6 +21,7 @@ RDEPENDS_${PN} = " \ | |||
21 | openvswitch-switch \ | 21 | openvswitch-switch \ |
22 | ${@base_contains('CINDER_EXTRA_FEATURES', 'open-iscsi-user', 'open-iscsi-user', '', d)} \ | 22 | ${@base_contains('CINDER_EXTRA_FEATURES', 'open-iscsi-user', 'open-iscsi-user', '', d)} \ |
23 | ${@base_contains('CINDER_EXTRA_FEATURES', 'iscsi-initiator-utils', 'iscsi-initiator-utils', '', d)} \ | 23 | ${@base_contains('CINDER_EXTRA_FEATURES', 'iscsi-initiator-utils', 'iscsi-initiator-utils', '', d)} \ |
24 | nfs-utils-client \ | ||
24 | " | 25 | " |
25 | 26 | ||
26 | RRECOMMENDS_${PN} = " \ | 27 | RRECOMMENDS_${PN} = " \ |