From 2434b03f7da195b65946976b822aa14597a7e349 Mon Sep 17 00:00:00 2001 From: Jan Klare Date: Thu, 5 Apr 2018 16:38:31 +0200 Subject: [PATCH] remove all ceph related attributes,recipes,specs and the cookbook dependency Change-Id: I24f9976ed57a90cb7062ed990e758fd9707d04b4 --- README.md | 7 --- attributes/default.rb | 10 ----- attributes/nova_conf.rb | 7 --- metadata.rb | 2 - recipes/libvirt_rbd.rb | 75 -------------------------------- spec/libvirt_rbd_spec.rb | 46 -------------------- spec/libvirt_spec.rb | 11 ----- spec/nova-common_spec.rb | 40 ----------------- spec/spec_helper.rb | 9 ---- templates/default/secret.xml.erb | 6 --- 10 files changed, 213 deletions(-) delete mode 100644 recipes/libvirt_rbd.rb delete mode 100644 spec/libvirt_rbd_spec.rb delete mode 100644 templates/default/secret.xml.erb diff --git a/README.md b/README.md index bfe08ff4..added59a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ Cookbooks The following cookbooks are dependencies: -- 'ceph', '>= 0.8.1' - 'openstack-common', '>= 14.0.0' - 'openstack-identity', '>= 14.0.0' - 'openstack-image', '>= 14.0.0' @@ -80,12 +79,6 @@ Recipes - Installs libvirt, used by nova compute for management of the virtual machine environment -## openstack-compute::libvirt_rbd -- Prepares the compute node for interaction with a Ceph cluster for block - storage (RBD) -- Depends on `ceph::_common`, `ceph::install`, and `ceph::conf` for packages and - cluster connectivity (i.e. a proper `/etc/ceph/ceph.conf`) - ## openstack-compute::nova-cert - Installs nova-cert service diff --git a/attributes/default.rb b/attributes/default.rb index 73ee8658..c65987d2 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -64,15 +64,7 @@ default['openstack']['compute']['libvirt']['max_client_requests'] = 5 default['openstack']['compute']['libvirt']['group'] = 'libvirt' default['openstack']['compute']['libvirt']['unix_sock_rw_perms'] = '0770' default['openstack']['compute']['libvirt']['libvirt_inject_key'] = true -# rbd -default['openstack']['compute']['libvirt']['rbd']['ceph_conf'] = '/etc/ceph/ceph.conf' -# use a different backend for volumes, allowed options: rbd default['openstack']['compute']['libvirt']['volume_backend'] = nil -default['openstack']['compute']['libvirt']['rbd']['cinder']['pool'] = 'volumes' -default['openstack']['compute']['libvirt']['rbd']['glance']['pool'] = 'images' -default['openstack']['compute']['libvirt']['rbd']['nova']['pool'] = 'instances' -default['openstack']['compute']['libvirt']['rbd']['cinder']['user'] = 'cinder' -default['openstack']['compute']['libvirt']['rbd']['cinder']['secret_uuid'] = '00000000-0000-0000-0000-000000000000' # Base URL that will be presented to users in links # to the OpenStack Compute API @@ -161,7 +153,6 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this 'compute_serialproxy_service' => 'openstack-nova-serialproxy', 'libvirt_packages' => ['libvirt', 'device-mapper', 'python-libguestfs'], 'libvirt_service' => 'libvirtd', - 'libvirt_ceph_packages' => ['ceph-common'], 'dbus_service' => 'messagebus', 'compute_cert_packages' => ['openstack-nova-cert'], 'compute_cert_service' => 'openstack-nova-cert', @@ -197,7 +188,6 @@ when 'debian' 'compute_serialproxy_service' => 'nova-serialproxy', 'libvirt_packages' => ['libvirt-bin', 'python-guestfs'], 'libvirt_service' => 'libvirt-bin', - 'libvirt_ceph_packages' => ['ceph-common'], 'dbus_service' => 'dbus', 'compute_cert_packages' => ['nova-cert'], 'compute_cert_service' => 'nova-cert', diff --git a/attributes/nova_conf.rb b/attributes/nova_conf.rb index 63031969..76dac591 100644 --- a/attributes/nova_conf.rb +++ b/attributes/nova_conf.rb @@ -29,13 +29,6 @@ default['openstack']['compute']['conf'].tap do |conf| if node['openstack']['compute']['conf']['libvirt']['images_type'] == 'lvm' conf['libvirt']['images_volume_group'] = nil conf['libvirt']['sparse_logical_volumes'] = false - - elsif node['openstack']['compute']['conf']['libvirt']['images_type'] == 'rbd' - conf['libvirt']['images_rbd_pool'] = 'instances' - conf['libvirt']['images_rbd_ceph_conf'] = '/etc/ceph/ceph.conf' # nil - conf['libvirt']['rbd_user'] = 'cinder' # none - conf['libvirt']['rbd_secret_uuid'] = node['openstack']['compute']['libvirt']['rbd']['cinder']['secret_uuid'] - end # [neutron] diff --git a/metadata.rb b/metadata.rb index f6ed0dab..18f92b21 100644 --- a/metadata.rb +++ b/metadata.rb @@ -16,7 +16,6 @@ recipe 'openstack-compute::compute', 'Installs/Configures nova compute service' recipe 'openstack-compute::conductor', 'Installs/configures nova conductor service' recipe 'openstack-compute::identity_registration', 'Identity registration' recipe 'openstack-compute::libvirt', 'Installs/Configures libvirt' -recipe 'openstack-compute::libvirt_rbd', 'Installs/Configures libvirt_rbd' recipe 'openstack-compute::nova-common', 'Common recipe for nova' recipe 'openstack-compute::_nova_cell', 'Helper recipe for configuring nova cells' recipe 'openstack-compute::nova-setup.rb', 'Nova setup recipe' @@ -29,7 +28,6 @@ recipe 'openstack-compute::vncproxy', 'Installs/Configures nova vnc proxy' supports os end -depends 'ceph' depends 'openstack-common', '>= 17.0.0' depends 'openstack-identity', '>= 17.0.0' depends 'openstack-image', '>= 17.0.0' diff --git a/recipes/libvirt_rbd.rb b/recipes/libvirt_rbd.rb deleted file mode 100644 index 20aefe5b..00000000 --- a/recipes/libvirt_rbd.rb +++ /dev/null @@ -1,75 +0,0 @@ -# encoding: UTF-8 -# -# Cookbook Name:: openstack-compute -# Recipe:: libvirt_rbd -# -# Copyright 2014, x-ion GmbH -# -# 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. -# - -class ::Chef::Recipe - include ::Openstack -end - -include_recipe 'ceph' - -ceph_user = node['openstack']['compute']['libvirt']['rbd']['cinder']['user'] # ['conf']['libvirt']['rbd_user'] -cinder_pool = node['openstack']['compute']['libvirt']['rbd']['cinder']['pool'] -nova_pool = node['openstack']['compute']['conf']['DEFAULT']['images_rbd_pool'] -glance_pool = node['openstack']['compute']['libvirt']['rbd']['glance']['pool'] - -secret_uuid = node['openstack']['compute']['libvirt']['rbd']['cinder']['secret_uuid'] -ceph_keyname = "client.#{ceph_user}" -ceph_keyring = "/etc/ceph/ceph.#{ceph_keyname}.keyring" - -caps = { 'mon' => 'allow r', - 'osd' => "allow class-read object_prefix rbd_children, allow rwx pool=#{cinder_pool}, allow rwx pool=#{nova_pool}, allow rx pool=#{glance_pool}" } - -ceph_client ceph_user do - name ceph_user - caps caps - keyname ceph_keyname - filename ceph_keyring - owner node['openstack']['compute']['user'] - group node['openstack']['compute']['group'] - - action :add -end - -Chef::Log.info("rbd_secret_name: #{secret_uuid}") - -template '/tmp/secret.xml' do - source 'secret.xml.erb' - user 'root' - group 'root' - mode '00600' - variables( - uuid: secret_uuid, - client_name: ceph_user - ) - not_if "virsh secret-list | grep #{secret_uuid}" -end - -execute 'virsh secret-define --file /tmp/secret.xml' do - not_if "virsh secret-list | grep #{secret_uuid}" -end - -# this will update the key if necessary -execute "virsh secret-set-value --secret #{secret_uuid} --base64 $(ceph-authtool -p -n client.#{ceph_user} #{ceph_keyring})" do - not_if "virsh secret-get-value #{secret_uuid} | grep $(ceph-authtool -p -n #{ceph_keyname} #{ceph_keyring})" -end - -file '/tmp/secret.xml' do - action :delete -end diff --git a/spec/libvirt_rbd_spec.rb b/spec/libvirt_rbd_spec.rb deleted file mode 100644 index dff21c20..00000000 --- a/spec/libvirt_rbd_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -# encoding: UTF-8 - -require_relative 'spec_helper' - -describe 'openstack-compute::libvirt_rbd' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - let(:chef_run) do - node.set['ceph']['config']['fsid'] = '00000000-0000-0000-0000-000000000000' - node.set['openstack']['compute']['libvirt']['volume_backend'] = 'rbd' - - runner.converge(described_recipe) - end - - include_context 'compute_stubs' - - it 'includes the ceph recipe' do - expect(chef_run).to include_recipe('ceph') - end - - describe 'if there was no secret with this uuid defined' do - let(:file) { chef_run.template('/tmp/secret.xml') } - - it 'defines the secret' do - expect(chef_run).to run_execute('virsh secret-define --file /tmp/secret.xml') - end - - it 'sets the secret value to the password' do - expect(chef_run).to run_execute('virsh secret-set-value --secret 00000000-0000-0000-0000-000000000000 --base64 $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)') - end - - it 'creates the temporary secret xml file' do - expect(chef_run).to create_template('/tmp/secret.xml').with( - owner: 'root', - group: 'root', - mode: '00600' - ) - end - - it 'deletes the temporary secret xml file' do - expect(chef_run).to delete_file('/tmp/secret.xml') - end - end - end -end diff --git a/spec/libvirt_spec.rb b/spec/libvirt_spec.rb index 1fcbf6f4..c7a6339d 100644 --- a/spec/libvirt_spec.rb +++ b/spec/libvirt_spec.rb @@ -44,17 +44,6 @@ describe 'openstack-compute::libvirt' do expect(chef_run).to run_execute('virsh net-destroy default') end - describe 'rbd/ceph volume storage' do - before do - node.set['openstack']['compute']['libvirt']['volume_backend'] = 'rbd' - end - - it 'includes the libvirt_rbd recipe if it is the selected volume backend' do - node.set['ceph']['config']['fsid'] = '00000000-0000-0000-0000-000000000000' - expect(chef_run).to include_recipe('openstack-compute::libvirt_rbd') - end - end - describe '/etc/libvirt/libvirtd.conf' do let(:file) { chef_run.template('/etc/libvirt/libvirtd.conf') } diff --git a/spec/nova-common_spec.rb b/spec/nova-common_spec.rb index f490f6dc..80ca857b 100644 --- a/spec/nova-common_spec.rb +++ b/spec/nova-common_spec.rb @@ -267,46 +267,6 @@ describe 'openstack-compute::nova-common' do ) end - context 'rbd backend' do - before do - node.set['openstack']['compute']['conf']['libvirt']['images_type'] = 'rbd' - end - - describe 'default rbd settings' do - it 'sets the libvirt * options correctly' do - [ - /^images_type = rbd$/, - /^images_rbd_pool = instances$/, - %r{^images_rbd_ceph_conf = /etc/ceph/ceph.conf$}, - /^rbd_user = cinder$/, - /^rbd_secret_uuid = 00000000-0000-0000-0000-000000000000$/, - ].each do |line| - expect(chef_run).to render_config_file(file.name)\ - .with_section_content('libvirt', line) - end - end - end - - describe 'override rbd settings' do - before do - node.set['openstack']['compute']['conf']['libvirt']['images_type'] = 'rbd' - node.set['openstack']['compute']['conf']['libvirt']['images_rbd_pool'] = 'myrbd' - node.set['openstack']['compute']['conf']['libvirt']['images_rbd_ceph_conf'] = '/etc/myceph/ceph.conf' - end - - it 'sets the overridden libvirt options correctly' do - [ - /^images_type = rbd$/, - /^images_rbd_pool = myrbd$/, - %r{^images_rbd_ceph_conf = /etc/myceph/ceph.conf$}, - ].each do |line| - expect(chef_run).to render_config_file(file.name)\ - .with_section_content('libvirt', line) - end - end - end - end - context 'lvm backend' do before do node.set['openstack']['compute']['conf']['libvirt']['images_type'] = 'lvm' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 339cec34..bda922b1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -46,9 +46,6 @@ shared_context 'compute_stubs' do allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('token', 'neutron_metadata_secret') .and_return('metadata-secret') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) # this is the rbd_uuid default name - .with('token', 'rbd_secret_uuid') - .and_return '00000000-0000-0000-0000-000000000000' allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('token', 'openstack_vmware_secret_name') .and_return 'vmware_secret_name' @@ -76,9 +73,6 @@ shared_context 'compute_stubs' do allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('service', 'openstack-placement') .and_return('placement-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('service', 'rbd_block_storage') - .and_return 'cinder-rbd-pass' allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) .with('compute') .and_return('rabbit://guest:mypass@127.0.0.1:5672') @@ -92,9 +86,6 @@ shared_context 'compute_stubs' do stub_command('virsh net-list | grep -q default').and_return(true) stub_command('ovs-vsctl br-exists br-int').and_return(true) stub_command('ovs-vsctl br-exists br-tun').and_return(true) - stub_command('virsh secret-list | grep 00000000-0000-0000-0000-000000000000').and_return(false) - stub_command('virsh secret-set-value --secret 00000000-0000-0000-0000-000000000000 --base64 $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)').and_return(false) - stub_command('virsh secret-get-value 00000000-0000-0000-0000-000000000000 | grep $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)').and_return(false) stub_command('nova-manage api_db sync').and_return(true) stub_command('nova-manage cell_v2 map_cell0 --database_connection mysql+pymysql://nova_cell0:mypass@127.0.0.1/nova_cell0?charset=utf8').and_return(true) stub_command('nova-manage cell_v2 create_cell --verbose --name cell1').and_return(true) diff --git a/templates/default/secret.xml.erb b/templates/default/secret.xml.erb deleted file mode 100644 index adc099d4..00000000 --- a/templates/default/secret.xml.erb +++ /dev/null @@ -1,6 +0,0 @@ - - <%= @uuid -%> - - client.<%= @client_name -%> secret - -