CephFS NFS shares can be created
This commit is contained in:
parent
58c0d8846d
commit
850f78ce67
|
@ -15,7 +15,7 @@ options:
|
|||
provide a later version of OpenStack will trigger a software
|
||||
upgrade.
|
||||
rabbit-user:
|
||||
default: manila
|
||||
default: manila-ganesha
|
||||
type: string
|
||||
description: Username used to access rabbitmq queue
|
||||
rabbit-vhost:
|
||||
|
@ -23,7 +23,7 @@ options:
|
|||
type: string
|
||||
description: Rabbitmq vhost
|
||||
database-user:
|
||||
default: manila
|
||||
default: manila-ganesha
|
||||
type: string
|
||||
description: Username for Manila database access
|
||||
database:
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
# import json
|
||||
import json
|
||||
|
||||
# import socket
|
||||
# import subprocess
|
||||
|
||||
|
@ -23,7 +24,12 @@ import charms_openstack.charm
|
|||
import charms_openstack.adapters
|
||||
import charms_openstack.plugins
|
||||
from charms_openstack.ip import resolve_address
|
||||
|
||||
from charmhelpers.core.hookenv import log
|
||||
from charmhelpers.contrib.storage.linux.ceph import (
|
||||
CephBrokerRq,
|
||||
is_request_complete,
|
||||
send_request_if_needed,
|
||||
)
|
||||
# import charmhelpers.core as ch_core
|
||||
|
||||
|
||||
|
@ -32,6 +38,15 @@ MANILA_CONF = MANILA_DIR + "manila.conf"
|
|||
MANILA_LOGGING_CONF = MANILA_DIR + "logging.conf"
|
||||
MANILA_API_PASTE_CONF = MANILA_DIR + "api-paste.ini"
|
||||
CEPH_CONF = '/etc/ceph/ceph.conf'
|
||||
CEPH_CAPABILITIES = [
|
||||
"mds", "allow *",
|
||||
"osd", "allow rw",
|
||||
"mon", "allow r, "
|
||||
"allow command \"auth del\", "
|
||||
"allow command \"auth caps\", "
|
||||
"allow command \"auth get\", "
|
||||
"allow command \"auth get-or-create\""]
|
||||
|
||||
|
||||
|
||||
@charms_openstack.adapters.config_property
|
||||
|
@ -134,9 +149,10 @@ class ManilaGaneshaCharm(charms_openstack.charm.HAOpenStackCharm,
|
|||
'identity-service',
|
||||
'shared-db',
|
||||
]
|
||||
group = 'manila'
|
||||
user = group = 'manila'
|
||||
|
||||
adapters_class = GaneshaCharmRelationAdapters
|
||||
ceph_key_per_unit_name = True
|
||||
# ceph_key_per_unit_name = True
|
||||
services = [
|
||||
'nfs-ganesha',
|
||||
'manila-share',
|
||||
|
@ -193,3 +209,22 @@ class ManilaGaneshaCharm(charms_openstack.charm.HAOpenStackCharm,
|
|||
database=self.options.database,
|
||||
username=self.options.database_user, )
|
||||
]
|
||||
|
||||
def request_ceph_permissions(self, ceph):
|
||||
rq = CephBrokerRq()
|
||||
|
||||
json_rq = ceph.get_local(key='broker_req')
|
||||
if json_rq:
|
||||
try:
|
||||
j = json.loads(json_rq)
|
||||
log("Json request: {}".format(json_rq))
|
||||
rq.set_ops(j['ops'])
|
||||
except ValueError as err:
|
||||
log("Unable to decode broker_req: {}. Error {}".format(
|
||||
json_rq, err))
|
||||
|
||||
rq.add_op({'op': 'set-key-permissions',
|
||||
'permissions': CEPH_CAPABILITIES,
|
||||
'client': 'manila-ganesha'})
|
||||
ceph.set_local(key='broker_req', value=rq.request)
|
||||
send_request_if_needed(rq, relation='ceph')
|
|
@ -26,7 +26,8 @@ charm.use_defaults(
|
|||
@reactive.when_not('ceph.available')
|
||||
def ceph_connected(ceph):
|
||||
ceph.create_pool(ch_core.hookenv.service_name())
|
||||
|
||||
with charm.provide_charm_instance() as charm_instance:
|
||||
charm_instance.request_ceph_permissions(ceph)
|
||||
|
||||
@reactive.when('manila-plugin.available')
|
||||
def setup_manila():
|
||||
|
|
|
@ -6,5 +6,12 @@
|
|||
[global]
|
||||
{% if ceph.auth -%}
|
||||
auth_supported = {{ ceph.auth }}
|
||||
keyring = /etc/ceph/$cluster.$name.keyring
|
||||
mon host = {{ ceph.monitors }}
|
||||
|
||||
|
||||
[client.manila-ganesha]
|
||||
client mount uid = 0
|
||||
client mount gid = 0
|
||||
log file = /var/log/ceph/ceph-client.manila.log
|
||||
{% endif -%}
|
|
@ -19,6 +19,9 @@ debug = {{ options.debug }}
|
|||
|
||||
{% include "parts/section-transport-url" %}
|
||||
|
||||
[oslo_concurrency]
|
||||
lock_path = /var/lib/manila/tmp
|
||||
|
||||
# parts/section-database includes the [database] section identifier
|
||||
{% include "parts/section-database" %}
|
||||
|
||||
|
@ -44,12 +47,12 @@ debug = {{ options.debug }}
|
|||
[cephfsnfs1]
|
||||
driver_handles_share_servers = False
|
||||
ganesha_rados_store_enable = True
|
||||
ganesha_rados_store_pool_name = manila_ganesha
|
||||
ganesha_rados_store_pool_name = manila-ganesha
|
||||
share_backend_name = CEPHFSNFS1
|
||||
share_driver = manila.share.drivers.cephfs.driver.CephFSDriver
|
||||
cephfs_protocol_helper_type = NFS
|
||||
cephfs_conf_path = /etc/ceph/ceph.conf
|
||||
cephfs_auth_id = manila
|
||||
cephfs_auth_id = manila-ganesha
|
||||
cephfs_cluster_name = ceph
|
||||
cephfs_enable_snapshots = False
|
||||
cephfs_ganesha_server_is_remote = False
|
||||
|
|
|
@ -9,7 +9,7 @@ services:
|
|||
options:
|
||||
openstack-origin: *source
|
||||
ceph-mon:
|
||||
charm: cs:~openstack-charmers-next/ceph-mon
|
||||
charm: /home/ubuntu/ceph-mon
|
||||
num_units: 3
|
||||
options:
|
||||
source: *source
|
||||
|
|
Loading…
Reference in New Issue