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
25 function distro_version
() {
26 source /etc
/os-release
31 for package
in "$@" ; do
36 function install_one
() {
38 ubuntu|debian|devuan|softiron
)
39 sudo env DEBIAN_FRONTEND
=noninteractive apt-get
install -y "$@"
42 sudo yum
install -y "$@"
45 sudo zypper
--non-interactive install "$@"
48 echo "$(distro_id) is unknown, $@ will have to be installed manually."
53 function install_pkg_on_ubuntu
{
64 if [ $force = "force" ]; then
68 if ! dpkg
-s $pkg &> /dev
/null
; then
73 if test -n "$missing_pkgs"; then
74 local shaman_url
="https://shaman.ceph.com/api/repos/${project}/master/${sha1}/ubuntu/${codename}/repo"
75 sudo curl
--silent --location $shaman_url --output /etc
/apt
/sources.list.d
/$project.list
76 sudo env DEBIAN_FRONTEND
=noninteractive apt-get update
-y -o Acquire
::Languages
=none
-o Acquire
::Translation
=none || true
77 sudo env DEBIAN_FRONTEND
=noninteractive apt-get
install --allow-unauthenticated -y $missing_pkgs
81 #######################################################################
83 function control_osd
() {
87 sudo systemctl
$action ceph-osd@
$id
92 #######################################################################
94 function pool_read_write
() {
98 local test_pool
=test_pool
100 ceph osd pool delete
$test_pool $test_pool --yes-i-really-really-mean-it ||
return 1
101 ceph osd pool create
$test_pool 4 ||
return 1
102 ceph osd pool
set $test_pool size
$size --yes-i-really-mean-it ||
return 1
103 ceph osd pool
set $test_pool min_size
$size ||
return 1
104 ceph osd pool application
enable $test_pool rados
107 timeout
$timeout rados
--pool $test_pool put BAR
$dir/BAR ||
return 1
108 timeout
$timeout rados
--pool $test_pool get BAR
$dir/BAR.copy ||
return 1
109 diff $dir/BAR
$dir/BAR.copy ||
return 1
110 ceph osd pool delete
$test_pool $test_pool --yes-i-really-really-mean-it ||
return 1
113 #######################################################################