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 #######################################################################
20 function distro_id
() {
21 source /etc
/os-release
26 for package
in "$@" ; do
31 function install_one
() {
34 sudo env DEBIAN_FRONTEND
=noninteractive apt-get
install -y "$@"
37 sudo yum
install -y "$@"
40 sudo zypper
--non-interactive install "$@"
43 echo "$(distro_id) is unknown, $@ will have to be installed manually."
48 #######################################################################
50 function control_osd
() {
54 sudo systemctl
$action ceph-osd@
$id
59 #######################################################################
61 function pool_read_write
() {
65 local test_pool
=test_pool
67 ceph osd pool delete
$test_pool $test_pool --yes-i-really-really-mean-it ||
return 1
68 ceph osd pool create
$test_pool 4 ||
return 1
69 ceph osd pool
set $test_pool size
$size ||
return 1
70 ceph osd pool
set $test_pool min_size
$size ||
return 1
71 ceph osd pool application
enable $test_pool rados
74 timeout
$timeout rados
--pool $test_pool put BAR
$dir/BAR ||
return 1
75 timeout
$timeout rados
--pool $test_pool get BAR
$dir/BAR.copy ||
return 1
76 diff $dir/BAR
$dir/BAR.copy ||
return 1
77 ceph osd pool delete
$test_pool $test_pool --yes-i-really-really-mean-it ||
return 1
80 #######################################################################