diff --git a/lib/ceph b/lib/ceph index 910b4275af..6af4b3a139 100644 --- a/lib/ceph +++ b/lib/ceph @@ -176,7 +176,9 @@ function configure_ceph { sudo mkdir -p ${CEPH_DATA_DIR}/{bootstrap-mds,bootstrap-osd,mds,mon,osd,tmp} # create ceph monitor initial key and directory - sudo ceph-authtool /var/lib/ceph/tmp/keyring.mon.$(hostname) --create-keyring --name=mon. --add-key=$(ceph-authtool --gen-print-key) --cap mon 'allow *' + sudo ceph-authtool /var/lib/ceph/tmp/keyring.mon.$(hostname) \ + --create-keyring --name=mon. --add-key=$(ceph-authtool --gen-print-key) \ + --cap mon 'allow *' sudo mkdir /var/lib/ceph/mon/ceph-$(hostname) # create a default ceph configuration file @@ -194,12 +196,14 @@ osd journal size = 100 EOF # bootstrap the ceph monitor - sudo ceph-mon -c ${CEPH_CONF_FILE} --mkfs -i $(hostname) --keyring /var/lib/ceph/tmp/keyring.mon.$(hostname) + sudo ceph-mon -c ${CEPH_CONF_FILE} --mkfs -i $(hostname) \ + --keyring /var/lib/ceph/tmp/keyring.mon.$(hostname) + if is_ubuntu; then - sudo touch /var/lib/ceph/mon/ceph-$(hostname)/upstart + sudo touch /var/lib/ceph/mon/ceph-$(hostname)/upstart sudo initctl emit ceph-mon id=$(hostname) else - sudo touch /var/lib/ceph/mon/ceph-$(hostname)/sysvinit + sudo touch /var/lib/ceph/mon/ceph-$(hostname)/sysvinit sudo service ceph start mon.$(hostname) fi @@ -240,7 +244,9 @@ EOF OSD_ID=$(sudo ceph -c ${CEPH_CONF_FILE} osd create) sudo mkdir -p ${CEPH_DATA_DIR}/osd/ceph-${OSD_ID} sudo ceph-osd -c ${CEPH_CONF_FILE} -i ${OSD_ID} --mkfs - sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create osd.${OSD_ID} mon 'allow profile osd ' osd 'allow *' | sudo tee ${CEPH_DATA_DIR}/osd/ceph-${OSD_ID}/keyring + sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create osd.${OSD_ID} \ + mon 'allow profile osd ' osd 'allow *' | \ + sudo tee ${CEPH_DATA_DIR}/osd/ceph-${OSD_ID}/keyring # ceph's init script is parsing ${CEPH_DATA_DIR}/osd/ceph-${OSD_ID}/ and looking for a file # 'upstart' or 'sysinitv', thanks to these 'touches' we are able to control OSDs daemons @@ -264,7 +270,10 @@ function configure_ceph_embedded_glance { # configure_ceph_glance() - Glance config needs to come after Glance is set up function configure_ceph_glance { sudo ceph -c ${CEPH_CONF_FILE} osd pool create ${GLANCE_CEPH_POOL} ${GLANCE_CEPH_POOL_PG} ${GLANCE_CEPH_POOL_PGP} - sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${GLANCE_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring + sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${GLANCE_CEPH_USER} \ + mon "allow r" \ + osd "allow class-read object_prefix rbd_children, allow rwx pool=${GLANCE_CEPH_POOL}" | \ + sudo tee ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring iniset $GLANCE_API_CONF DEFAULT show_image_direct_url True @@ -296,7 +305,10 @@ function configure_ceph_nova { iniset $NOVA_CONF libvirt images_rbd_ceph_conf ${CEPH_CONF_FILE} if ! is_service_enabled cinder; then - sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rwx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring > /dev/null + sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} \ + mon "allow r" \ + osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rwx pool=${GLANCE_CEPH_POOL}" | \ + sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring > /dev/null sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring fi } @@ -312,7 +324,10 @@ function configure_ceph_embedded_cinder { # configure_ceph_cinder() - Cinder config needs to come after Cinder is set up function configure_ceph_cinder { sudo ceph -c ${CEPH_CONF_FILE} osd pool create ${CINDER_CEPH_POOL} ${CINDER_CEPH_POOL_PG} ${CINDER_CEPH_POOL_PGP} - sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring + sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} \ + mon "allow r" \ + osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rx pool=${GLANCE_CEPH_POOL}" | \ + sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring }