docs: def ensure_ceph_storage(service, pool, rbd_img, sizemb, mount_point,
                          blk_device, fstype, system_services=[],
                          replicas=3):
      """NOTE: This function must only be called from a single service unit for
      the same rbd_img otherwise data loss will occur.
  
      Ensures given pool and RBD image exists, is mapped to a block device,
      and the device is formatted and mounted at the given mount_point.
  
      If formatting a device for the first time, data existing at mount_point
      will be migrated to the RBD device before being re-mounted.
  
      All services listed in system_services will be stopped prior to data
      migration and restarted when complete.
      """
      # Ensure pool, RBD image, RBD mappings are in place.
      if not pool_exists(service, pool):
          log('Creating new pool {}.'.format(pool), level=INFO)
          create_pool(service, pool, replicas=replicas)
  
      if not rbd_exists(service, pool, rbd_img):
          log('Creating RBD image ({}).'.format(rbd_img), level=INFO)
          create_rbd_image(service, pool, rbd_img, sizemb)
  
      if not image_mapped(rbd_img):
          log('Mapping RBD Image {} as a Block Device.'.format(rbd_img),
              level=INFO)
          map_block_storage(service, pool, rbd_img)
  
      # make file system
      # TODO: What happens if for whatever reason this is run again and
      # the data is already in the rbd device and/or is mounted??
      # When it is mounted already, it will fail to make the fs
      # XXX: This is really sketchy!  Need to at least add an fstab entry
      #      otherwise this hook will blow away existing data if its executed
      #      after a reboot.
      if not filesystem_mounted(mount_point):
          make_filesystem(blk_device, fstype)
  
          for svc in system_services:
              if service_running(svc):
                  log('Stopping services {} prior to migrating data.'
                      .format(svc), level=DEBUG)
                  service_stop(svc)
  
          place_data_on_block_device(blk_device, mount_point)
  
          for svc in system_services:
              log('Starting service {} after migrating data.'
                  .format(svc), level=DEBUG)
              service_start(svc)