Files
cookbook-openstack-object-s…/recipes/disks.rb
Christopher H. Laco e817a7623e Upgrade rubocop
Rubocop 0.18.1 has been released, which includes the reported
inconsistent class documentation cop triggering fix. This release also
contains some new cops and fixes others, triggering new violations on
existing rubocopped code.

- Upgrade rubocop to 0.18.1
- Fix new/corrected violations

Change-Id: Ia66ce8521c06a94bc28928784161d657da50f215
Addresses: blueprint rubocop-for-object-storage
2014-02-04 11:25:49 -05:00

67 lines
1.9 KiB
Ruby

# encoding: UTF-8
#
# Cookbook Name:: openstack-object-storage
# Recipe:: disks
#
# Copyright 2012, Rackspace US, Inc.
#
# 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.
#
# Author: Ron Pedde <ron.pedde@rackspace.com>
# Inspired by: Andi Abes @ Dell
class Chef::Recipe # rubocop:disable Documentation
include IPUtils
include DriveUtils
end
platform_options = node['swift']['platform']
package 'xfsprogs' do
action :install
only_if { platform?(%w{ubuntu debian fedora centos}) }
end
%w(parted util-linux).each do |pkg|
package pkg do
action :install
end
end
disk_enum_expr = node['swift']['disk_enum_expr']
disk_test_filter = node['swift']['disk_test_filter']
disks = locate_disks(disk_enum_expr, disk_test_filter)
disks.each do |disk|
openstack_object_storage_disk "/dev/#{disk}" do
part [{ type: platform_options['disk_format'] , size: :remaining }]
action :ensure_exists
end
end
# FIXME: "#{x}1" is only really valid for {v,s,h}dx. Doesn't
# work for loop or probably for hp-style /dev/cciss/c0d0p1x0t0g0m1whatever
#
# additionally, there is an implicit assumption that bind ports
# for all object/container/account services are on the same net
disk_ip = locate_ip_in_cidr(node['swift']['network']['object-cidr'], node)
openstack_object_storage_mounts '/srv/node' do
action :ensure_exists
publish_attributes 'swift/state/devs'
devices disks.map { |x| "#{x}1" }
ip disk_ip
format platform_options['disk_format']
end