Merge "Add support for Trilio 4.1"
This commit is contained in:
commit
88ebd38cdd
|
@ -2,4 +2,5 @@ includes: [
|
|||
'layer:openstack',
|
||||
'interface:rabbitmq',
|
||||
'interface:ceph-client',
|
||||
'interface:mysql-shared',
|
||||
]
|
||||
|
|
|
@ -21,15 +21,30 @@ import charms.reactive as reactive
|
|||
|
||||
import charms_openstack.charm
|
||||
import charms_openstack.plugins
|
||||
import charms_openstack.plugins.trilio
|
||||
import charms_openstack.adapters as os_adapters
|
||||
|
||||
# select the default release function
|
||||
charms_openstack.charm.use_defaults("charm.default-select-release")
|
||||
|
||||
charms_openstack.plugins.trilio.make_trilio_handlers()
|
||||
|
||||
|
||||
VALID_BACKUP_TARGETS = ["nfs"]
|
||||
TV_MOUNTS = "/var/triliovault-mounts"
|
||||
|
||||
|
||||
class DataMoverDBAdapter(os_adapters.DatabaseRelationAdapter):
|
||||
"""Get database URIs for the two nova databases"""
|
||||
|
||||
@property
|
||||
def driver(self):
|
||||
return 'mysql+pymysql'
|
||||
|
||||
@property
|
||||
def dmapi_uri(self):
|
||||
"""URI for dmapi DB"""
|
||||
return self.get_uri(prefix="dmapi")
|
||||
|
||||
|
||||
@os_adapters.config_property
|
||||
def ceph_dir(ceph):
|
||||
return os.path.join("/var/lib/charm", hookenv.service_name())
|
||||
|
@ -60,6 +75,7 @@ class DataMoverRelationAdapaters(os_adapters.OpenStackAPIRelationAdapters):
|
|||
relation_adapters = {
|
||||
"ceph": charms_openstack.plugins.CephRelationAdapter,
|
||||
"amqp": os_adapters.RabbitMQRelationAdapter,
|
||||
"shared_db": DataMoverDBAdapter,
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,6 +86,7 @@ class TrilioDataMoverBaseCharm(
|
|||
):
|
||||
|
||||
release = "queens"
|
||||
trilio_release = "4.0"
|
||||
|
||||
service_name = name = "trilio-data-mover"
|
||||
|
||||
|
@ -81,9 +98,9 @@ class TrilioDataMoverBaseCharm(
|
|||
service_type = "data-mover"
|
||||
default_service = "tvault-contego"
|
||||
|
||||
required_relations = ["amqp"]
|
||||
required_relations = ["amqp", "shared-db"]
|
||||
|
||||
packages = ["tvault-contego", "nfs-common"]
|
||||
packages = ["tvault-contego", "nfs-common", "contego"]
|
||||
|
||||
# configuration file permissions
|
||||
user = "root"
|
||||
|
@ -94,7 +111,7 @@ class TrilioDataMoverBaseCharm(
|
|||
source_config_key = ""
|
||||
|
||||
# Use nova-common package to drive OpenStack Release versioning.
|
||||
release_pkg = "nova-common"
|
||||
os_release_pkg = "nova-common"
|
||||
package_codenames = os_utils.PACKAGE_CODENAMES
|
||||
|
||||
# Set ceph keyring prefix to charm specific location
|
||||
|
@ -141,6 +158,15 @@ class TrilioDataMoverBaseCharm(
|
|||
def get_amqp_credentials(self):
|
||||
return ("datamover", "openstack")
|
||||
|
||||
def get_database_setup(self):
|
||||
return [
|
||||
{
|
||||
"database": "dmapi",
|
||||
"username": "dmapi",
|
||||
"prefix": "dmapi",
|
||||
},
|
||||
]
|
||||
|
||||
@property
|
||||
def services(self):
|
||||
if hookenv.config("backup-target-type") == "s3":
|
||||
|
@ -177,9 +203,18 @@ class TrilioDataMoverBaseCharm(
|
|||
permission="rwx",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def trilio_version_package(cls):
|
||||
return 'tvault-contego'
|
||||
|
||||
|
||||
class TrilioDataMoverRockyCharm(TrilioDataMoverBaseCharm):
|
||||
|
||||
release = "rocky"
|
||||
trilio_release = "4.0"
|
||||
|
||||
packages = ["python3-tvault-contego", "nfs-common"]
|
||||
packages = ["python3-tvault-contego", "nfs-common", "contego"]
|
||||
|
||||
@classmethod
|
||||
def trilio_version_package(cls):
|
||||
return 'python3-tvault-contego'
|
||||
|
|
|
@ -26,6 +26,8 @@ requires:
|
|||
scope: container
|
||||
ceph:
|
||||
interface: ceph-client
|
||||
shared-db:
|
||||
interface: mysql-shared
|
||||
provides:
|
||||
data-mover:
|
||||
interface: data-mover
|
||||
|
|
|
@ -19,9 +19,11 @@ import charm.openstack.trilio_dm as trilio_dm # noqa
|
|||
|
||||
charm.use_defaults(
|
||||
"charm.installed", "config.changed", "update-status",
|
||||
"shared-db.connected",
|
||||
)
|
||||
|
||||
|
||||
@reactive.when("shared-db.available")
|
||||
@reactive.when("amqp.available")
|
||||
def render_config(*args):
|
||||
"""Render the configuration for charm when all the interfaces are
|
||||
|
@ -36,6 +38,22 @@ def render_config(*args):
|
|||
reactive.set_state("config.rendered")
|
||||
|
||||
|
||||
@reactive.when('shared-db.connected')
|
||||
def default_setup_database(database):
|
||||
"""Handle the default database connection setup
|
||||
|
||||
This requires that the charm implements get_database_setup() to provide
|
||||
a list of dictionaries;
|
||||
[{'database': ..., 'username': ..., 'hostname': ..., 'prefix': ...}]
|
||||
|
||||
The prefix can be missing: it defaults to None.
|
||||
"""
|
||||
with charm.provide_charm_instance() as instance:
|
||||
for db in instance.get_database_setup():
|
||||
database.configure(**db)
|
||||
instance.assess_status()
|
||||
|
||||
|
||||
# NOTE(jamespage): default handler is in api layer which is to much
|
||||
@reactive.when("amqp.connected")
|
||||
def default_amqp_connection(amqp):
|
||||
|
|
|
@ -5,7 +5,11 @@ use_virt_qemu = False
|
|||
|
||||
{% if amqp.transport_url -%}
|
||||
# AMQP
|
||||
{% if options.trilio_properties.transport_type == "legacy" %}
|
||||
transport_url = {{ amqp.transport_url }}
|
||||
{% else %}
|
||||
dmapi_transport_url = {{ amqp.transport_url }}
|
||||
{% endif %}
|
||||
rabbit_virtual_host = {{ amqp.vhost }}
|
||||
{% endif -%}
|
||||
|
||||
|
@ -41,6 +45,11 @@ max_uploads_pending = {{ options.tv_datamover_max_uploads_pending }}
|
|||
max_commit_pending = {{ options.tv_datamover_max_commit_pending }}
|
||||
qemu_agent_ping_timeout = {{ options.tv_datamover_qemu_agent_ping_timeout }}
|
||||
|
||||
{% if options.trilio_properties.db_type == "dedicated" %}
|
||||
[dmapi_database]
|
||||
connection = {{ shared_db.dmapi_uri }}
|
||||
{% endif %}
|
||||
|
||||
# privsep
|
||||
[contego_sys_admin]
|
||||
helper_command = sudo /usr/bin/nova-rootwrap /etc/nova/rootwrap.conf privsep-helper
|
||||
|
|
|
@ -100,6 +100,8 @@ relations:
|
|||
- keystone:identity-service
|
||||
- - trilio-data-mover:ceph
|
||||
- ceph-mon:client
|
||||
- - trilio-data-mover:shared-db
|
||||
- mysql:shared-db
|
||||
applications:
|
||||
glance:
|
||||
charm: cs:~openstack-charmers-next/glance
|
||||
|
|
|
@ -100,6 +100,8 @@ relations:
|
|||
- keystone:identity-service
|
||||
- - trilio-data-mover:ceph
|
||||
- ceph-mon:client
|
||||
- - trilio-data-mover:shared-db
|
||||
- mysql:shared-db
|
||||
applications:
|
||||
glance:
|
||||
charm: cs:~openstack-charmers-next/glance
|
||||
|
|
|
@ -108,6 +108,8 @@ relations:
|
|||
- keystone:identity-service
|
||||
- - trilio-data-mover:ceph
|
||||
- ceph-mon:client
|
||||
- - trilio-data-mover:shared-db
|
||||
- mysql:shared-db
|
||||
applications:
|
||||
glance:
|
||||
charm: cs:~openstack-charmers-next/glance
|
||||
|
|
|
@ -27,10 +27,13 @@ target_deploy_status:
|
|||
workload-status-message: "Monitor bootstrapped but waiting for number of OSDs to reach expected-osd-count (3)"
|
||||
cinder-ceph:
|
||||
workload-status: waiting
|
||||
workload-status-message: "Incomplete relations: ceph"
|
||||
workload-status-message: "Ceph broker request incomplete"
|
||||
trilio-wlm:
|
||||
workload-status: blocked
|
||||
workload-status-message: "nfs-shares configuration not set"
|
||||
trilio-data-mover:
|
||||
workload-status: blocked
|
||||
workload-status-message: "nfs-shares configuration not set"
|
||||
glance:
|
||||
workload-status: waiting
|
||||
workload-status-message: "Incomplete relations: storage-backend"
|
||||
|
|
|
@ -81,8 +81,9 @@ class Test(test_utils.PatchHelper):
|
|||
# are meaningful for this interface: this is to handle regressions.
|
||||
# The keys are the function names that the hook attaches to.
|
||||
when_patterns = {
|
||||
"render_config": ("amqp.available",),
|
||||
"render_config": ("amqp.available", "shared-db.available"),
|
||||
"default_amqp_connection": ("amqp.connected",),
|
||||
"default_setup_database": ("shared-db.connected",),
|
||||
"install_source_changed": (
|
||||
"config.changed.triliovault-pkg-source",
|
||||
),
|
||||
|
|
|
@ -26,7 +26,8 @@ class TestTrilioDataMoverRockyCharms(Helper):
|
|||
def test_packages(self):
|
||||
dm_charm = trilio_dm.TrilioDataMoverRockyCharm()
|
||||
self.assertEqual(
|
||||
dm_charm.packages, ["python3-tvault-contego", "nfs-common"]
|
||||
dm_charm.packages,
|
||||
["python3-tvault-contego", "nfs-common", "contego"]
|
||||
)
|
||||
|
||||
def test_services_nfs(self):
|
||||
|
|
Loading…
Reference in New Issue