dbfa88f684
This commit moves conditionals based on values obtained from Facter inside code blocks that are only executed on agents and replaces the use of Facter['osfamily'].value with Facter.value:(:osfamily). Without this change we are returning values based off the master's facts, so if a Debian agent checks into a RedHat master then the type is currently making a decision based off of RedHat and not the actual OS of the agent running the catalog. Code ran outside blocks is evaluated on masters and inside a block is evaluated by the agent when the catalog is executed. We do not notice this because all our testing uses "puppet apply" and autorequire only matters when they find a matching resource name in the catalog. The latter results in no error because the relationship is simply ignored on the Debian agent if a package resource with the RedHat name is not found. This issue was found by running facter 3, the C++11 re-implementation under the jruby and clojure implemented puppetserver. The clojure jni shim written so that facter can be ran inside of puppetserver does not implement the [] method for the Facter module but the ruby shim does. So I noticed that the code had an issue when Facter['osfamily'].value was executed on the master, which returned a not method error. Once again, something we didn't notice becuase we do not test against a master. I decided to migrate to Facter.value(:osfamily) to simply keep to an API that is consistent across both puppet and puppetserver but fixing where the code runs does actually solve the not method found error. Change-Id: I24b0b20b2839c7bc33a76ac14849783f2285579f |
||
---|---|---|
ext | ||
files | ||
lib/puppet | ||
manifests | ||
spec | ||
templates | ||
tests | ||
.gemfile | ||
.gitignore | ||
.gitreview | ||
.sync.yml | ||
CHANGELOG.md | ||
Gemfile | ||
LICENSE | ||
metadata.json | ||
Rakefile | ||
README.md |
swift
6.1.0 - 2015.1 - Kilo
Table of Contents
- Overview - What is the swift module?
- Module Description - What does the module do?
- Setup - The basics of getting started with swift
- Reference - The classes, defines,functions and facts available in this module
- Implementation - An under-the-hood peek at what the module is doing
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
- Contributors - Those with commits
Overview
The swift module is a part of OpenStack, an effort by the Openstack infrastructure team to provide continuous integration testing and code review for Openstack and Openstack community projects as part of the core software. The module itself is used to flexibly configure and manage the object storage service for Openstack.
Module Description
The swift module is a thorough attempt to make Puppet capable of managing the entirety of swift. This includes manifests to provision such things as keystone, storage backends, proxies, and the ring. Types are shipped as part of the swift module to assist in manipulation of configuration files. The classes in this module will deploy Swift using best practices for a typical deployment.
This module is tested in combination with other modules needed to build and leverage an entire Openstack software stack. These modules can be found, all pulled together in the openstack module. In addition, this module requires Puppet's exported resources.
Setup
What the swift module affects
- Swift, the object storage service for Openstack.
Installing swift
puppet module install openstack/swift
Beginning with swift
You much first setup exported resources.
To utilize the swift module's functionality you will need to declare multiple resources. The following is a modified excerpt from the openstack module. This is not an exhaustive list of all the components needed, we recommend you consult and understand the openstack module and the core openstack documentation.
Defining a swift storage node
class { 'swift':
swift_hash_suffix => 'swift_secret',
}
swift::storage::loopback { ['1', '2']:
require => Class['swift'],
}
class { 'swift::storage::all':
storage_local_net_ip => $ipaddress_eth0
}
@@ring_object_device { "${ipaddress_eth0}:6000/1":
region => 1, # optional, defaults to 1
zone => 1,
weight => 1,
}
@@ring_container_device { "${ipaddress_eth0}:6001/1":
zone => 1,
weight => 1,
}
@@ring_account_device { "${ipaddress_eth0}:6002/1":
zone => 1,
weight => 1,
}
@@ring_object_device { "${ipaddress_eth0}:6000/2":
region => 2,
zone => 1,
weight => 1,
}
@@ring_container_device { "${ipaddress_eth0}:6001/2":
region => 2,
zone => 1,
weight => 1,
}
@@ring_account_device { "${ipaddress_eth0}:6002/2":
region => 2,
zone => 1,
weight => 1,
}
Swift::Ringsync<<||>>
Usage
Class: swift
Class that will set up the base packages and the base /etc/swift/swift.conf
class { 'swift': swift_hash_suffix => 'shared_secret', }
####swift_hash_suffix
The shared salt used when hashing ring mappings.
Class swift::proxy
Class that installs and configures the swift proxy server.
class { 'swift::proxy':
account_autocreate => true,
proxy_local_net_ip => $ipaddress_eth1,
port => '11211',
}
####account_autocreate
Specifies if the module should manage the automatic creation of the accounts needed for swift. This should be set to true if tempauth is also being used.
####proxy_local_net_ip
This is the ip that the proxy service will bind to when it starts.
####port
The port for which the proxy service will bind to when it starts.
Class swift::proxy::dlo
Configures DLO middleware for swift proxy.
class { '::swift::proxy::dlo':
rate_limit_after_segment => '10',
rate_limit_segments_per_sec => '1',
max_get_time => '86400'
}
####rate_limit_after_segment
Start rate-limiting DLO segment serving after the Nth segment of a segmented object.
####rate_limit_segments_per_sec
Once segment rate-limiting kicks in for an object, limit segments served to N per second.
0 means no rate-limiting.
####max_get_time
Time limit on GET requests (seconds).
Class: swift::storage
Class that sets up all of the configuration and dependencies for swift storage server instances.
class { 'swift::storage': storage_local_net_ip => $ipaddress_eth1, }
####storage_local_net_ip
This is the ip that the storage service will bind to when it starts.
Class: swift::ringbuilder
A class that knows how to build swift rings. Creates the initial ring via exported resources and rebalances the ring if it is updated.
class { 'swift::ringbuilder':
part_power => '18',
replicas => '3',
min_part_hours => '1',
}
####part_power
The number of partitions in the swift ring. (specified as the power of 2)
####replicas
The number of replicas to store.
####min_part_hours
Time before a partition can be moved.
Define: swift::storage::server
Defined resource type that can be used to create a swift storage server instance. If you keep the sever names unique it is possibly to create multiple swift servers on a single physical node.
This will configure an rsync server instance and swift storage instance to manage the all devices in the devices directory.
swift::storage::server { '6010':
type => 'object',
devices => '/srv/node',
storage_local_net_ip => '127.0.0.1'
}
####namevar
The namevar/title for this type will map to the port where the server is hosted.
####type
The type of device, e.g. account, object, or container.
####device
The directory where the physical storage device will be mounted.
####storage_local_net_ip
This is the ip that the storage service will bind to when it starts.
Define: swift::storage::loopback
This defined resource type was created to test swift by creating a loopback device that can be used a storage device in the absent of a dedicated block device.
It creates a partition of size [$seek
] at basedir/[$name
] using dd with [$byte_size
], formats is to be a xfs filesystem which is then mounted at [$mnt_base_dir
]/[$name
].
Then, it creates an instance of defined class for the xfs file system that will eventually lead the mounting of the device using the swift::storage::mount define.
swift::storage::loopback { '1':
base_dir => '/srv/loopback-device',
mnt_base_dir => '/srv/node',
byte_size => '1024',
seek => '25000',
}
####base_dir
The directory where the flat files will be stored that house the file system to be loop back mounted.
####mnt_base_dir
The directory where the flat files that store the file system to be loop back mounted are actually mounted at.
####byte_size
The byte size that dd uses when it creates the file system.
####seek
The size of the file system that will be created. Defaults to 25000.
Class: swift::objectexpirer
Class that will set Swift object expirer, for scheduled deletion of objects.
class { 'swift::objectexpirer': }
It is assumed that the object expirer service will usually be installed in a proxy node. On Red Hat-based distributions, if the class is included in a non-proxy node, the openstack-swift-proxy package will need to be installed.
Verifying installation
This modules ships with a simple Ruby script that validates whether or not your swift cluster is functional.
The script can be run as:
ruby $modulepath/swift/files/swift_tester.rb
Implementation
swift
swift is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers.
Types
swift_config
The swift_config
provider is a children of the ini_setting provider. It allows one to write an entry in the /etc/swift/swift.conf
file.
swift_config { 'DEFAULT/verbose' :
value => true,
}
This will write verbose=true
in the [DEFAULT]
section.
name
Section/setting name to manage from swift.conf
value
The value of the setting to be defined.
secret
Whether to hide the value from Puppet logs. Defaults to false
.
ensure_absent_val
If value is equal to ensure_absent_val then the resource will behave as if ensure => absent
was specified. Defaults to <SERVICE DEFAULT>
swift_account_config
Same as swift_config
, but path is /etc/swift/account-server.conf
swift_bench_config
Same as swift_config
, but path is /etc/swift/swift-bench.conf
swift_container_config
Same as swift_config
, but path is /etc/swift/container-server.conf
swift_dispersion_config
Same as swift_config
, but path is /etc/swift/dispersion.conf
swift_object_config
Same as swift_config
, but path is /etc/swift/object-server.conf
swift_proxy_config
Same as swift_config
, but path is /etc/swift/proxy-server.conf
Limitations
- No explicit support external NAS devices (i.e. Nexenta and LFS) to offload the ring replication requirements.
Beaker-Rspec
This module has beaker-rspec tests
To run:
shell bundle install bundle exec rspec spec/acceptance
Development
Developer documentation for the entire puppet-openstack project.