Merge pull request #33869 from mgfritch/cephadm-osd-create-test

qa/workunits/cephadm/test_cephadm.sh: move osd test to ceph-volume

Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com>
This commit is contained in:
Kefu Chai 2020-03-21 14:30:23 +08:00 committed by GitHub
commit 11b8e974a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 13 deletions

View File

@ -273,11 +273,33 @@ loop_dev=$($SUDO losetup -f)
$SUDO vgremove -f $OSD_VG_NAME || true
$SUDO losetup $loop_dev $TMPDIR/$OSD_IMAGE_NAME
$SUDO pvcreate $loop_dev && $SUDO vgcreate $OSD_VG_NAME $loop_dev
# osd boostrap keyring
$CEPHADM shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \
ceph auth get client.bootstrap-osd > $TMPDIR/keyring.bootstrap.osd
for id in `seq 0 $((--OSD_TO_CREATE))`; do
$SUDO lvcreate -l $((100/$OSD_TO_CREATE))%VG -n $OSD_LV_NAME.$id $OSD_VG_NAME
$CEPHADM shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \
ceph orch daemon add osd \
$(hostname):/dev/$OSD_VG_NAME/$OSD_LV_NAME.$id
device_name=/dev/$OSD_VG_NAME/$OSD_LV_NAME.$id
# prepare the osd
$CEPHADM ceph-volume --config $CONFIG --keyring $TMPDIR/keyring.bootstrap.osd -- \
lvm prepare --bluestore --data $device_name --no-systemd
$CEPHADM ceph-volume --config $CONFIG --keyring $TMPDIR/keyring.bootstrap.osd -- \
lvm batch --no-auto $device_name --yes --no-systemd
# osd id and osd fsid
$CEPHADM ceph-volume --config $CONFIG --keyring $TMPDIR/keyring.bootstrap.osd -- \
lvm list --format json $device_name > $TMPDIR/osd.map
osd_id=$($SUDO cat $TMPDIR/osd.map | jq -cr '.. | ."ceph.osd_id"? | select(.)')
osd_fsid=$($SUDO cat $TMPDIR/osd.map | jq -cr '.. | ."ceph.osd_fsid"? | select(.)')
# deploy the osd
$CEPHADM deploy --name osd.$osd_id \
--fsid $FSID \
--keyring $TMPDIR/keyring.bootstrap.osd \
--config $CONFIG \
--osd-fsid $osd_fsid
done
# add node-exporter

View File

@ -2600,19 +2600,16 @@ def command_ceph_volume():
tmp_config = None
tmp_keyring = None
if args.config_json:
# note: this will always pull from args.config_json (we
# require it) and never args.config or args.keyring.
(config, keyring) = get_config_and_keyring()
(config, keyring) = get_config_and_keyring()
# tmp keyring file
tmp_keyring = write_tmp(keyring, uid, gid)
# tmp keyring file
tmp_keyring = write_tmp(keyring, uid, gid)
# tmp config file
tmp_config = write_tmp(config, uid, gid)
# tmp config file
tmp_config = write_tmp(config, uid, gid)
mounts[tmp_config.name] = '/etc/ceph/ceph.conf:z'
mounts[tmp_keyring.name] = '/var/lib/ceph/bootstrap-osd/ceph.keyring:z'
mounts[tmp_config.name] = '/etc/ceph/ceph.conf:z'
mounts[tmp_keyring.name] = '/var/lib/ceph/bootstrap-osd/ceph.keyring:z'
c = CephContainer(
image=args.image,
@ -3949,6 +3946,12 @@ def _get_parser():
parser_ceph_volume.add_argument(
'--config-json',
help='JSON file with config and (client.bootrap-osd) key')
parser_ceph_volume.add_argument(
'--config', '-c',
help='ceph conf file')
parser_ceph_volume.add_argument(
'--keyring', '-k',
help='ceph.keyring to pass through to the container')
parser_ceph_volume.add_argument(
'command', nargs='+',
help='command')