Add ceph_api
This commit is contained in:
parent
0fe84902e4
commit
55093d7e4b
|
@ -0,0 +1 @@
|
|||
.idea
|
|
@ -1,65 +0,0 @@
|
|||
# Overview
|
||||
|
||||
Describe the intended usage of this charm and anything unique about how this
|
||||
charm relates to others here.
|
||||
|
||||
This README will be displayed in the Charm Store, it should be either Markdown
|
||||
or RST. Ideal READMEs include instructions on how to use the charm, expected
|
||||
usage, and charm features that your audience might be interested in. For an
|
||||
example of a well written README check out Hadoop:
|
||||
http://jujucharms.com/charms/precise/hadoop
|
||||
|
||||
Use this as a Markdown reference if you need help with the formatting of this
|
||||
README: http://askubuntu.com/editing-help
|
||||
|
||||
This charm provides [service][]. Add a description here of what the service
|
||||
itself actually does.
|
||||
|
||||
Also remember to check the [icon guidelines][] so that your charm looks good
|
||||
in the Juju GUI.
|
||||
|
||||
# Usage
|
||||
|
||||
Step by step instructions on using the charm:
|
||||
|
||||
juju deploy servicename
|
||||
|
||||
and so on. If you're providing a web service or something that the end user
|
||||
needs to go to, tell them here, especially if you're deploying a service that
|
||||
might listen to a non-default port.
|
||||
|
||||
You can then browse to http://ip-address to configure the service.
|
||||
|
||||
## Scale out Usage
|
||||
|
||||
If the charm has any recommendations for running at scale, outline them in
|
||||
examples here. For example if you have a memcached relation that improves
|
||||
performance, mention it here.
|
||||
|
||||
## Known Limitations and Issues
|
||||
|
||||
This not only helps users but gives people a place to start if they want to help
|
||||
you add features to your charm.
|
||||
|
||||
# Configuration
|
||||
|
||||
The configuration options will be listed on the charm store, however If you're
|
||||
making assumptions or opinionated decisions in the charm (like setting a default
|
||||
administrator password), you should detail that here so the user knows how to
|
||||
change it immediately, etc.
|
||||
|
||||
# Contact Information
|
||||
|
||||
Though this will be listed in the charm store itself don't assume a user will
|
||||
know that, so include that information here:
|
||||
|
||||
## Upstream Project Name
|
||||
|
||||
- Upstream website
|
||||
- Upstream bug tracker
|
||||
- Upstream mailing list or contact information
|
||||
- Feel free to add things if it's useful for users
|
||||
|
||||
|
||||
[service]: http://example.com
|
||||
[icon guidelines]: https://jujucharms.com/docs/stable/authors-charm-icon
|
|
@ -0,0 +1,33 @@
|
|||
# CephFS Charm
|
||||
|
||||
# Overview
|
||||
|
||||
Ceph is a distributed storage and network file system designed to provide
|
||||
excellent performance, reliability, and scalability.
|
||||
|
||||
This charm deploys a Ceph MDS cluster.
|
||||
juju
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Boot things up by using::
|
||||
|
||||
juju deploy -n 3 --config ceph.yaml ceph-mon
|
||||
juju deploy -n 3 --config ceph.yaml ceph-osd
|
||||
|
||||
You can then deploy this charm by simply doing::
|
||||
|
||||
juju deploy -n 3 --config ceph.yaml ceph-fs
|
||||
juju add-relation ceph-fs ceph-mon
|
||||
|
||||
Once the ceph-mon and osd charms have bootstrapped the cluster, it will notify the ceph-fs charm.
|
||||
|
||||
Contact Information
|
||||
===================
|
||||
|
||||
## Ceph
|
||||
|
||||
- [Ceph website](http://ceph.com)
|
||||
- [Ceph mailing lists](http://ceph.com/resources/mailing-list-irc/)
|
||||
- [Ceph bug tracker](http://tracker.ceph.com/projects/ceph)
|
|
@ -0,0 +1,57 @@
|
|||
get-quota:
|
||||
description: View quota settings on a directory
|
||||
params:
|
||||
max-files:
|
||||
type: boolean
|
||||
description: |
|
||||
The limit of how many files can be written. Use either this or
|
||||
max-bytes but not both.
|
||||
max-bytes:
|
||||
type: integer
|
||||
description: |
|
||||
The maximum number of bytes that are allowed to be written. Use
|
||||
either this or max-files but not both.
|
||||
directory:
|
||||
type: string
|
||||
description: |
|
||||
The directory to query for quota information.
|
||||
required: [directory]
|
||||
additionalProperties: false
|
||||
remove-quota:
|
||||
description: Remove a quota on a directory
|
||||
params:
|
||||
max-files:
|
||||
type: boolean
|
||||
description: |
|
||||
The limit of how many files can be written. Use either this or
|
||||
max-bytes but not both.
|
||||
max-bytes:
|
||||
type: integer
|
||||
description: |
|
||||
The maximum number of bytes that are allowed to be written. Use
|
||||
either this or max-files but not both.
|
||||
directory:
|
||||
type: string
|
||||
description: |
|
||||
The directory to remove the quota from.
|
||||
required: [directory]
|
||||
additionalProperties: false
|
||||
set-quota:
|
||||
description: Create a new quota
|
||||
params:
|
||||
max-files:
|
||||
type: integer
|
||||
description: |
|
||||
The limit of how many files can be written. Use either this or
|
||||
max-bytes but not both.
|
||||
max-bytes:
|
||||
type: integer
|
||||
description: |
|
||||
The maximum number of bytes that are allowed to be written. Use
|
||||
either this or max-files but not both.
|
||||
directory:
|
||||
type: string
|
||||
description: |
|
||||
The directory to apply this quota to.
|
||||
required: [directory]
|
||||
additionalProperties: false
|
|
@ -1,13 +1,4 @@
|
|||
options:
|
||||
loglevel:
|
||||
default: 1
|
||||
type: int
|
||||
description: Mon and OSD debug level. Max is 20.
|
||||
use-syslog:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
If set to True, supporting services will log to syslog.
|
||||
ceph-public-network:
|
||||
type: string
|
||||
default:
|
||||
|
@ -25,4 +16,26 @@ options:
|
|||
192.168.0.0/24)
|
||||
.
|
||||
If multiple networks are to be used, a space-delimited list of a.b.c.d/x
|
||||
can be provided.
|
||||
can be provided.
|
||||
loglevel:
|
||||
default: 1
|
||||
type: int
|
||||
description: Mon and OSD debug level. Max is 20.
|
||||
source:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
Optional configuration to support use of additional sources such as:
|
||||
- ppa:myteam/ppa
|
||||
- cloud:trusty-proposed/kilo
|
||||
- http://my.archive.com/ubuntu main
|
||||
The last option should be used in conjunction with the key configuration
|
||||
option.
|
||||
Note that a minimum ceph version of 0.48.2 is required for use with this
|
||||
charm which is NOT provided by the packages in the main Ubuntu archive
|
||||
for precise but is provided in the Ubuntu cloud archive.
|
||||
use-syslog:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
If set to True, supporting services will log to syslog.
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
name: charm-ceph-fs
|
||||
summary: <Fill in summary here>
|
||||
maintainer: chris <chris@tesla>
|
||||
summary: Highly scalable distributed storage
|
||||
maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
|
||||
description: |
|
||||
<Multi-line description here>
|
||||
Ceph is a distributed storage and network file system designed to provide
|
||||
excellent performance, reliability, and scalability.
|
||||
tags:
|
||||
# Replace "misc" with one or more whitelisted tags from this list:
|
||||
# https://jujucharms.com/docs/stable/authors-charm-metadata
|
||||
- openstack
|
||||
- storage
|
||||
- file-servers
|
||||
- misc
|
||||
subordinate: false
|
||||
provides:
|
||||
provides-relation:
|
||||
interface: interface-name
|
||||
requires:
|
||||
requires-relation:
|
||||
interface: interface-name
|
||||
peers:
|
||||
peer-relation:
|
||||
interface: interface-name
|
||||
#provides:
|
||||
#requires:
|
||||
#ceph-mon-cephfs:
|
||||
#interface: ceph-mon-cephfs
|
||||
|
|
|
@ -1,17 +1,42 @@
|
|||
from charms.reactive import when, when_not, set_state
|
||||
from charms.reactive import when
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
config,
|
||||
)
|
||||
log, INFO, ERROR)
|
||||
|
||||
from charmhelpers.contrib.network.ip import (
|
||||
get_address_in_network
|
||||
)
|
||||
|
||||
@when('ceph.installed')
|
||||
@when('ceph-mon.available')
|
||||
# @when('ceph-mon.available')
|
||||
def setup_mds(mon):
|
||||
|
||||
log("I'm in setup_mds()")
|
||||
try:
|
||||
from rados import Error as RadosError
|
||||
from ceph_api import ceph_command
|
||||
except ImportError as err:
|
||||
log("rados is not installed yet: {}".format(err))
|
||||
return
|
||||
# TODO: Monitor needs a new CephFS relation
|
||||
# TODO: Update with the conf file location
|
||||
osd = ceph_command.OsdCommand('/etc/ceph/ceph.conf')
|
||||
mds = ceph_command.MdsCommand('/etc/ceph/ceph.conf')
|
||||
|
||||
try:
|
||||
log("Creating cephfs_data pool", level=INFO)
|
||||
# TODO: Update with better pg values
|
||||
osd.osd_pool_create('cephfs_data', 256)
|
||||
|
||||
log("Creating cephfs_metadata pool", level=INFO)
|
||||
# TODO: Update with better pg values
|
||||
osd.osd_pool_create('cephfs_metadata', 256)
|
||||
|
||||
log("Creating ceph fs", level=INFO)
|
||||
mds.mds_newfs(metadata='cephfs_metadata', data='cephfs_data', sure=["--yes-i-really-mean-it"])
|
||||
except RadosError as err:
|
||||
log(message='Error: {}'.format(err.message), level=ERROR)
|
||||
|
||||
|
||||
@when('config.changed', 'ceph-mon.available')
|
||||
def config_changed():
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ceph_api
|
41
tox.ini
41
tox.ini
|
@ -0,0 +1,41 @@
|
|||
[tox]
|
||||
envlist = pep8,py34
|
||||
skipsdist = True
|
||||
skip_missing_interpreters = True
|
||||
|
||||
[testenv]
|
||||
basepython = python2.7
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONHASHSEED=0
|
||||
TERM=linux
|
||||
INTERFACE_PATH={toxinidir}/interfaces
|
||||
LAYER_PATH={toxinidir}/layers
|
||||
JUJU_REPOSITORY={toxinidir}/build
|
||||
passenv = http_proxy https_proxy
|
||||
install_command =
|
||||
pip install {opts} {packages}
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
|
||||
[testenv:build]
|
||||
commands =
|
||||
charm-build --log-level DEBUG -o {toxinidir}/build --name ceph-mon src
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8 {posargs} reactive lib unit_tests
|
||||
|
||||
[testenv:py34]
|
||||
basepython = python3.4
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = ostestr -p {toxinidir}/build/trusty/ceph-mon {posargs}
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = ostestr -p {toxinidir}/build/trusty/ceph-mon {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = E402,E226
|
Loading…
Reference in New Issue