~hopem/charms/precise/cinder/tls-ha

« back to all changes in this revision

Viewing changes to hooks/cinder-hooks

  • Committer: Adam Gandelman
  • Date: 2013-09-24 18:18:44 UTC
  • mfrom: (21.1.5 cinder.lp1226823)
  • Revision ID: adamg@canonical.com-20130924181844-d9h9s4gvlhl0u2gl
[hopem] Added ceph-osd-replication-count config and pg settings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
  if eligible_leader 'res_cinder_vip'; then
203
203
    # Create the cinder pool if it does not already exist
204
204
    if ! rados --id $SERVICE_NAME lspools | grep -q cinder; then
205
 
      rados --id $SERVICE_NAME mkpool cinder
 
205
      local num_osds=$(ceph --id $SERVICE_NAME osd ls| egrep "[^\s]"| wc -l)
 
206
      local cfg_key='ceph-osd-replication-count'
 
207
      local rep_count="$(config-get $cfg_key)"
 
208
      if [ -z "$rep_count" ]
 
209
      then
 
210
          rep_count=2
 
211
          juju-log "config returned empty string for $cfg_key - using value of 2"
 
212
      fi
 
213
      local num_pgs=$(((num_osds*100)/rep_count))
 
214
      ceph --id $SERVICE_NAME osd pool create cinder $num_pgs $num_pgs
 
215
      ceph --id $SERVICE_NAME osd pool set cinder size $rep_count
 
216
      # TODO: set appropriate crush ruleset
206
217
    fi
207
218
  fi
208
219