3 # Copyright (C) 2015 Red Hat <contact@redhat.com>
5 # Author: Loic Dachary <loic@dachary.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Library Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Library Public License for more details.
18 #######################################################################
21 for package
in "$@" ; do
27 function install_one
() {
28 case $
(lsb_release
-si) in
30 sudo apt-get
install -y "$@"
32 CentOS|Fedora|RedHatEnterpriseServer
)
33 sudo yum
install -y "$@"
36 sudo zypper
--non-interactive install "$@"
39 echo "$(lsb_release -si) is unknown, $@ will have to be installed manually."
44 #######################################################################
46 function control_osd
() {
50 local init
=$
(ceph-detect-init
)
54 sudo service ceph-osd
$action id
=$id
57 sudo systemctl
$action ceph-osd@
$id
60 echo ceph-detect-init returned an unknown init system
: $init >&2
67 #######################################################################
69 function pool_read_write
() {
73 local test_pool
=test_pool
75 ceph osd pool delete
$test_pool $test_pool --yes-i-really-really-mean-it ||
return 1
76 ceph osd pool create
$test_pool 4 ||
return 1
77 ceph osd pool
set $test_pool size
$size ||
return 1
78 ceph osd pool
set $test_pool min_size
$size ||
return 1
79 ceph osd pool application
enable $test_pool rados
82 timeout
$timeout rados
--pool $test_pool put BAR
$dir/BAR ||
return 1
83 timeout
$timeout rados
--pool $test_pool get BAR
$dir/BAR.copy ||
return 1
84 diff $dir/BAR
$dir/BAR.copy ||
return 1
85 ceph osd pool delete
$test_pool $test_pool --yes-i-really-really-mean-it ||
return 1
88 #######################################################################