Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion chef/cookbooks/cinder/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
default[:cinder][:verbose] = false
default[:cinder][:max_header_line] = 16384
default[:cinder][:config_file] = "/etc/cinder/cinder.conf.d/100-cinder.conf"
default[:cinder][:config_file_cinder_volume] = "/etc/cinder/cinder-volume.conf.d/100-cinder-volume.conf"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we remove this file from the filesystem, for people who had deployed things before this patch?

override[:cinder][:user]="cinder"
override[:cinder][:group]="cinder"
Expand Down
9 changes: 9 additions & 0 deletions chef/cookbooks/cinder/recipes/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,21 @@
include_recipe "crowbar-openstack::common"
end

# set a backend_host override when volume-ha is enabled
if CrowbarPacemakerHelper.cluster_enabled?(node) &&
node[:cinder][:elements]["cinder-volume"].include?(
"cluster:#{CrowbarPacemakerHelper.cluster_name(node)}"
)
backend_host = CrowbarPacemakerHelper.cluster_vhostname(node)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to explicitly have backend_host set to nil. We can just rewrite:

backend_host = if CrowbarPacemakerHelper.cluster_enabled?(node) &&
    node[:cinder][:elements]["cinder-volume"].include?(
        "cluster:#{CrowbarPacemakerHelper.cluster_name(node)}"
    )
  CrowbarPacemakerHelper.cluster_vhostname(node)
end


template node[:cinder][:config_file] do
source "cinder.conf.erb"
owner "root"
group node[:cinder][:group]
mode 0640
variables(
backend_host: backend_host,
bind_host: bind_host,
bind_port: bind_port,
use_multi_backend: node[:cinder][:use_multi_backend],
Expand Down
26 changes: 3 additions & 23 deletions chef/cookbooks/cinder/recipes/volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,10 @@ def make_volume(node, backend_id, volume)
end
end

volume_elements = node[:cinder][:elements]["cinder-volume"]
ha_enabled = CrowbarPacemakerHelper.cluster_enabled?(node) &&
volume_elements.include?("cluster:#{CrowbarPacemakerHelper.cluster_name(node)}")
node[:cinder][:elements]["cinder-volume"].include?(
"cluster:#{CrowbarPacemakerHelper.cluster_name(node)}"
)

cinder_service "volume" do
use_pacemaker_provider ha_enabled
Expand All @@ -304,26 +305,5 @@ def make_volume(node, backend_id, volume)
if ha_enabled
log "HA support for cinder volume is enabled"

# Create cinder-volume HA specific config file
service_host = CrowbarPacemakerHelper.cluster_vhostname(node)

template node[:cinder][:config_file_cinder_volume] do
source "cinder-volume.conf.erb"
owner "root"
group node[:cinder][:group]
mode 0640
variables(
host: service_host
)
notifies :restart, "service[cinder-volume]"
end

include_recipe "cinder::volume_ha"
else
log "HA support for cinder volume is disabled"

file node[:cinder][:config_file_cinder_volume] do
action :delete
notifies :restart, "service[cinder-volume]"
end
end

This file was deleted.

5 changes: 5 additions & 0 deletions chef/cookbooks/cinder/templates/default/cinder.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ strict_ssh_host_key_policy = <%= @strict_ssh_host_key_policy ? 'true' : 'false'
<% if @use_multi_backend -%>
[<%= backend_id %>]
volume_backend_name = <%= volume['backend_name'] %>

<% if @backend_host -%>
backend_host = <%= @backend_host %>
<% end -%>

<% end -%>

<% if volume['backend_driver'] == 'blockbridge' -%><% end -%>
Expand Down