Defaults to LVM

Creates an LVM developer mode volume group.
This commit is contained in:
John Dewey 2012-12-12 23:20:07 -08:00
parent 4263d09070
commit 4cb27a4e6c
6 changed files with 43 additions and 7 deletions

View File

@ -48,6 +48,7 @@ volume
----
- Installs the cinder-volume service and sets up the iscsi helper
Defaults to the ISCSI (LVM) Driver, and creates a LVM volume group named `cinder["volume"]["volume_group"]` while in developer\_mode. This volume group is not intended for production use.
Attributes
==========
@ -62,7 +63,11 @@ Attributes
* `cinder["syslog"]["config_facility"]`
* `cinder["platform"]` - hash of platform specific package/service names and options
* `cinder["volume"]["state_path"]` - Top-level directory for maintaining cinder's state
* `cinder["volume"]["volume_driver"]` - Driver to use for volume creation
* `cinder["volume"]["volume_group"]` - Name for the VG that will contain exported volumes
* `cinder["volume"]["iscsi_helper"]` - ISCSI target user-land tool to use
* `cinder["volume"]["lvm"]["image_file"]` - Path to the sparse file to create
* `cinder["volume"]["lvm"]["image_size"]` - Size of the sparse file to create
Templates
=====

View File

@ -70,7 +70,11 @@ default["cinder"]["syslog"]["config_facility"] = "local2"
default["cinder"]["api"]["ratelimit"] = "True"
default["cinder"]["volume"]["state_path"] = "/var/lib/cinder"
default["cinder"]["volume"]["volume_driver"] = "nova.volume.driver.ISCSIDriver"
default["cinder"]["volume"]["volume_group"] = "cinder-volumes"
default["cinder"]["volume"]["iscsi_helper"] = "tgtadm"
default["cinder"]["volume"]["lvm"]["image_file"] = "/var/lib/cinder/cinder-volumes.img"
default["cinder"]["volume"]["lvm"]["image_size"] = "20G"
case platform
when "fedora", "redhat", "centos"

View File

@ -55,6 +55,30 @@ glance_api_role = node["cinder"]["glance_api_chef_role"]
glance = config_by_role glance_api_role, "glance"
glance_api_endpoint = endpoint "image-api"
if node["developer_mode"]
execute "creating cinder disk image" do
image_file = node["cinder"]["volume"]["lvm"]["image_file"]
image_size = node["cinder"]["volume"]["lvm"]["image_size"]
user = node["cinder"]["group"]
group = node["cinder"]["user"]
command <<-EOF
truncate -s #{image_size} #{image_file}
chown #{user}:#{group} #{image_file}
EOF
not_if { ::File.exists? node["cinder"]["volume"]["lvm"]["image"] }
end
execute "creating cinder LVM volume group" do
image_file = node["cinder"]["volume"]["lvm"]["image_file"]
volume_group = node["cinder"]["volume"]["volume_group"]
command "vgcreate #{volume_group} $(losetup --show -f #{image_file})"
not_if "vgdisplay #{volume_group}"
end
end
service "cinder-volume" do
service_name platform_options["cinder_volume_service"]
supports :status => true, :restart => true

View File

@ -1,3 +1,5 @@
<%= node["cinder"]["custom_template_banner"] %>
#############
# Openstack #
#############

View File

@ -1,4 +1,5 @@
<%= node["cinder"]["custom_template_banner"] %>
[DEFAULT]
######## defined in cinder.openstack.common.cfg:CommonConfigOpts ########
@ -36,10 +37,10 @@ verbose=<%= node["cinder"]["verbose"] %>
# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
use_syslog = <%= node["cinder"]["syslog"]["use"] %>
use_syslog=<%= node["cinder"]["syslog"]["use"] %>
# Facility to use. If unset defaults to LOG_USER.
syslog_log_facility = <%= node["cinder"]["syslog"]["facility"]%>
syslog_log_facility=<%= node["cinder"]["syslog"]["facility"]%>
######## defined in cinder.flags ########
@ -65,7 +66,6 @@ sql_connection=<%= @sql_connection %>
# bindir=$pybasedir/bin
#### (StrOpt) Directory where cinder binaries are installed
# state_path=$pybasedir
state_path=<%= node["cinder"]["volume"]["state_path"] %>
#### (StrOpt) Top-level directory for maintaining cinder's state
@ -515,7 +515,6 @@ rabbit_port=<%= @rabbit_port %>
######## defined in cinder.volume.driver ########
# volume_group=cinder-volumes
volume_group=<%= node["cinder"]["volume"]["volume_group"] %>
#### (StrOpt) Name for the VG that will contain exported volumes
@ -553,7 +552,7 @@ volume_group=<%= node["cinder"]["volume"]["volume_group"] %>
######## defined in cinder.volume.iscsi ########
# iscsi_helper=tgtadm
iscsi_helper=<%= node["cinder"]["volume"]["iscsi_helper"] %>
#### (StrOpt) iscsi target user-land tool to use
# volumes_dir=$state_path/volumes
@ -562,7 +561,7 @@ volume_group=<%= node["cinder"]["volume"]["volume_group"] %>
######## defined in cinder.volume.manager ########
# volume_driver=cinder.volume.driver.ISCSIDriver
volume_driver=<%= node["cinder"]["volume"]["volume_driver"] %>
#### (StrOpt) Driver to use for volume creation
# use_local_volumes=true
@ -812,4 +811,4 @@ volume_group=<%= node["cinder"]["volume"]["volume_group"] %>
#### (BoolOpt) Don't halt on deletion of non-existing volumes
[keystone_authtoken]
signing_dirname = /tmp/keystone-signing-cinder
signing_dirname=/tmp/keystone-signing-cinder

View File

@ -1,3 +1,5 @@
<%= node["cinder"]["custom_template_banner"] %>
<% if %w{redhat centos fedora}.include?(node["platform"]) %>
include /var/lib/cinder/volumes/*
<% end %>