Merge pull request #2 from lmlg/netapp-curated

Curate charm
This commit is contained in:
Aurelien Lourot 2021-09-24 16:56:31 +02:00 committed by GitHub
commit dfe0795429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 1127 additions and 331 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
build
layers
.tox
interfaces
.testrepository
.stestr
*__pycache__*
*.pyc
*.swp

View File

@ -1,5 +0,0 @@
- project:
templates:
- python35-charm-jobs
- openstack-python3-ussuri-jobs
- openstack-cover-jobs

View File

@ -1,22 +0,0 @@
# Overview
This is a "source" charm, which is intended to be strictly the top
layer of a built charm. This structure declares that any included
layer assets are not intended to be consumed as a layer from a
functional or design standpoint.
# Test and Build
Building, pushing and publishing to the charm store is automated
by CI to ensure consistent flow. Manually building is useful for
development and testing, however.
```
tox -e pep8
tox -e py35 # or py36
tox -e build
```
# Contact Information
Freenode IRC: #openstack-charms

1
README.md Symbolic link
View File

@ -0,0 +1 @@
src/README.md

16
copyright Normal file
View File

@ -0,0 +1,16 @@
Format: http://dep.debian.net/deps/dep5/
Files: *
Copyright: Copyright 2021, Canonical Ltd., All Rights Reserved.
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

18
pip.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
#
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of tox.ini for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# setuptools 58.0 dropped the support for use_2to3=true which is needed to
# install blessings (an indirect dependency of charm-tools).
#
# More details on the beahvior of tox and virtualenv creation can be found at
# https://github.com/tox-dev/tox/issues/448
#
# This script is wrapper to force the use of the pinned versions early in the
# process when the virtualenv was created and upgraded before installing the
# depedencies declared in the target.
pip install 'pip<20.3' 'setuptools<50.0.0'
pip "$@"

View File

@ -3,19 +3,20 @@
# choices of *requirements.txt files for OpenStack Charms: # choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools # https://github.com/openstack-charmers/release-tools
# #
# TODO: Distill the func test requirements from the lint/unit test # NOTE(lourot): This might look like a duplication of test-requirements.txt but
# requirements. They are intertwined. Also, Zaza itself should specify # some tox targets use only test-requirements.txt whereas charm-build uses only
# all of its own requirements and if it doesn't, fix it there. # requirements.txt
# setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
pbr>=1.8.0,<1.9.0
simplejson>=2.2.0
netifaces>=0.10.4
netaddr>=0.7.12,!=0.7.16
Jinja2>=2.6 # BSD License (3 clause)
six>=1.9.0
# dnspython 2.0.0 dropped py3.5 support # Build requirements
dnspython<2.0.0; python_version < '3.6' charm-tools==2.8.3
dnspython; python_version >= '3.6'
psutil>=1.1.1,<2.0.0 simplejson
# Newer versions use keywords that didn't exist in python 3.5 yet (e.g.
# "ModuleNotFoundError")
# NOTE(lourot): This might look like a duplication of test-requirements.txt but
# some tox targets use only test-requirements.txt whereas charm-build uses only
# requirements.txt
importlib-metadata<3.0.0; python_version < '3.6'
importlib-resources<3.0.0; python_version < '3.6'

View File

@ -1,19 +1,101 @@
netapp Storage Backend for Cinder # Overview
-------------------------------
Overview The cinder charm is the Openstack block storage (i.e: Volume) service, whereas the cinder-netapp charm works as a subordinate of cinder, implementing a backend based on NetApp.
========
This charm provides a netapp storage backend for use with the Cinder > **Note**: The cinder-netapp charm is supported starting with Openstack Queens.
charm.
To use: # Usage
juju deploy cinder ## Configuration
juju deploy cinder-netapp
juju add-relation cinder-netapp cinder
Configuration This section covers common and/or important configuration options. See file `config.yaml` for the full list of options, along with their descriptions and default values. See the [Juju documentation][juju-docs-config-apps] for details on configuring applications.
=============
See config.yaml for details of configuration options. ### `netapp-storage-family`
The storage family type that is used for the storage system. Can be `ontap_cluster` for clustering data ONTAP, or `eseries`.
### `netapp-storage-protocol`
The SAN protocol to use. Can be either `iscsi` or `NFS`.
### `netapp-vserver`
Specifies the virtual storage server name on the storage cluster.
### `netapp-server-hostname`
The hostname or IP address for the storage server (can alternatively specify a proxy server).
### `netapp-server-port`
The TCP port used to communicate with the storage server or proxy.
If it's not specified, it will be deduced: For ONTAP drivers, it will be 80 for HTTP and 443 for HTTPS; for E-series, it will be 8080 and 8443, respectively.
### `netapp-login`
The username used to access the storage server or proxy.
### `netapp-password`
The password used to authenticate the `login` option.
### `netapp-nfs-shares-config`
Specifies a file that contains a list of NFS shares, each on its own line, to which the driver will attempt to provision
Cinder volumes.
### `netapp-controller-ips`
If the storage family is `eseries`, this option specifies a comma-separated list of controller hostnames or IP addresses
to be used for provisioning.
### `netapp-array-password`
The password for the NetApp E-series storage array.
### `netapp-storage-pools`
Specifies a comma-separated list of pool names to use.
### `use-multipath`
Whether to use multipath for image transfer.
### `netapp-enable-multiattach`
Specifies whether the driver should allow operations that involve multiple attachments to a volume.
### `volume-backend-name`
The service name to present to Cinder.
## Deployment
This charm's primary use is as a backend for the cinder charm. To do so, add a relation betweeen both charms:
juju add-relation cinder-netapp:storage-backend cinder:storage-backend
## Actions
This section lists Juju [actions][juju-docs-actions] supported by the charm. Actions allow specific operations to be performed on a per-unit basis. To display action descriptions run `juju actions --schema cinder-netapp`. If the charm is not deployed then see file `actions.yaml`.
* `pause`
* `resume`
* `restart-services`
# Documentation
The OpenStack Charms project maintains two documentation guides:
* [OpenStack Charm Guide][cg]: for project information, including development
and support notes
* [OpenStack Charms Deployment Guide][cdg]: for charm usage information
# Bugs
Please report bugs on [Launchpad][lp-bugs-charm-cinder-netapp].
[cg]: https://docs.openstack.org/charm-guide
[cdg]: https://docs.openstack.org/project-deploy-guide/charm-deployment-guide
[lp-bugs-charm-cinder-netapp]: https://bugs.launchpad.net/charm-cinder-netapp/+filebug

View File

@ -1,24 +1,11 @@
"includes": includes: ['layer:openstack', 'interface:cinder-backend']
- "layer:options" config:
- "layer:basic" deletes:
- "interface:tls-certificates" - debug
- "layer:openstack" - verbose
- "interface:cinder-backend" - use-syslog
"exclude": [".travis.yml", "tests", "tox.ini", "test-requirements.txt", "unit_tests", - use-internal-endpoints
".gitignore", ".gitreview", ".zuul.yaml", "README.md", "requirements.txt"] - ssl_ca
"options": - ssl_cert
"basic": - ssl_key
"use_venv": !!bool "true" repo: https://github.com/lmlg/charm-cinder-netapp
"packages": []
"python_packages": []
"include_system_packages": !!bool "false"
"openstack": {}
"cinder-netapp": {}
"repo": "https://github.com/openstack-charmers/cinder-storage-backend-template"
"config":
"deletes":
- "debug"
- "verbose"
- "use-syslog"
- "use-internal-endpoints"
"is": "cinder-netapp"

View File

@ -1,3 +1,18 @@
# Copyright 2021 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import charms_openstack.charm import charms_openstack.charm
charms_openstack.charm.use_defaults('charm.default-select-release') charms_openstack.charm.use_defaults('charm.default-select-release')
@ -14,42 +29,45 @@ class CinderNetAppCharm(
stateless = True stateless = True
# Specify any config that the user *must* set. # Specify any config that the user *must* set.
mandatory_config = [ mandatory_config = [
'netapp-storage-family', 'netapp-storage-protocol', 'netapp-server-hostname', 'netapp-storage-family', 'netapp-storage-protocol',
'volume-backend-name'] 'netapp-server-hostname', 'volume-backend-name']
def cinder_configuration(self): def cinder_configuration(self):
service = self.config.get('volume-backend-name') cget = self.config.get
service = cget('volume-backend-name')
volumedriver = 'cinder.volume.drivers.netapp.common.NetAppDriver' volumedriver = 'cinder.volume.drivers.netapp.common.NetAppDriver'
driver_options_extension = [] driver_options_extension = []
driver_transport = [] driver_transport = []
driver_options_common = [ driver_options_common = [
('netapp_storage_family', self.config.get('netapp-storage-family')), ('netapp_storage_family', cget('netapp-storage-family')),
('netapp_storage_protocol', self.config.get('netapp-storage-protocol')), ('netapp_storage_protocol', cget('netapp-storage-protocol')),
('netapp_vserver', self.config.get('netapp-vserver')), ('netapp_vserver', cget('netapp-vserver')),
('netapp_server_hostname', self.config.get('netapp-server-hostname')), ('netapp_server_hostname', cget('netapp-server-hostname')),
('netapp_server_port', self.config.get('netapp-server-port')), ('netapp_server_port', cget('netapp-server-port')),
('use_multipath_for_image_xfer', self.config.get('use-multipath')), ('use_multipath_for_image_xfer', cget('use-multipath')),
('netapp_login', self.config.get('netapp-login')), ('netapp_login', cget('netapp-login')),
('netapp_password', self.config.get('netapp-password')), ('netapp_password', cget('netapp-password')),
('volume_driver', volumedriver), ('volume_driver', volumedriver),
('volume_backend_name', service)] ('volume_backend_name', service)]
if self.config.get('netapp-server-port') == 443: if cget('netapp-server-port') == 443:
driver_transport = [ driver_transport = [
('netapp_transport_type', "https")] ('netapp_transport_type', "https")]
if self.config.get('netapp-storage-family') == "eseries": if cget('netapp-storage-family') == "eseries":
driver_options_extension = [ driver_options_extension = [
('netapp_controller_ips', self.config.get('netapp-controller-ips')), ('netapp_controller_ips', cget('netapp-controller-ips')),
('netapp_sa_password', self.config.get('netapp-array-password')), ('netapp_sa_password', cget('netapp-array-password')),
('netapp_storage_pools', self.config.get('netapp-storage-pools')), ('netapp_storage_pools', cget('netapp-storage-pools')),
('use_multipath_for_image_xfer', self.config.get('use-multipath'))] ('use_multipath_for_image_xfer', cget('use-multipath'))]
if self.config.get('netapp-storage-protocol') == "nfs": if cget('netapp-storage-protocol') == "nfs":
driver_options_extension = [ driver_options_extension = [
('nfs_shares_config', self.config.get('netapp-nfs-shares-config'))] ('nfs_shares_config', cget('netapp-nfs-shares-config'))]
return driver_options_common + driver_transport + \
driver_options_extension
return driver_options_common + driver_transport + driver_options_extension
class CinderNetAppCharmRocky(CinderNetAppCharm): class CinderNetAppCharmRocky(CinderNetAppCharm):
@ -57,4 +75,3 @@ class CinderNetAppCharmRocky(CinderNetAppCharm):
release = 'rocky' release = 'rocky'
version_package = 'cinder-common' version_package = 'cinder-common'
packages = [] packages = []

View File

@ -13,6 +13,9 @@ tags:
series: series:
- bionic - bionic
- focal - focal
- groovy
- hirsute
- impish
subordinate: true subordinate: true
provides: provides:
storage-backend: storage-backend:

View File

@ -1,3 +1,9 @@
# zaza # This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!)
git+https://github.com/openstack-charmers/zaza.git#egg=zaza git+https://github.com/openstack-charmers/zaza.git#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack

View File

@ -0,0 +1,52 @@
series: bionic
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
'2':
constraints: mem=4G root-disk=16G
'3':
relations:
- - keystone:shared-db
- mysql:shared-db
- - cinder:shared-db
- mysql:shared-db
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
to:
- '0'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
to:
- '1'
cinder:
charm: cs:~openstack-charmers-next/cinder
num_units: 1
options:
block-device: /dev/vdb
overwrite: "true"
ephemeral-unmount: /mnt
to:
- '2'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
to:
- '3'

View File

@ -0,0 +1,55 @@
series: bionic
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
'2':
constraints: mem=4G root-disk=16G
'3':
relations:
- - keystone:shared-db
- mysql:shared-db
- - cinder:shared-db
- mysql:shared-db
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
to:
- '0'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: cloud:bionic-rocky
num_units: 1
to:
- '1'
cinder:
charm: cs:~openstack-charmers-next/cinder
num_units: 1
options:
openstack-origin: cloud:bionic-rocky
block-device: /dev/vdb
overwrite: "true"
ephemeral-unmount: /mnt
to:
- '2'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
to:
- '3'

View File

@ -0,0 +1,55 @@
series: bionic
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
'2':
constraints: mem=4G root-disk=16G
'3':
relations:
- - keystone:shared-db
- mysql:shared-db
- - cinder:shared-db
- mysql:shared-db
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
to:
- '0'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: cloud:bionic-stein
num_units: 1
to:
- '1'
cinder:
charm: cs:~openstack-charmers-next/cinder
num_units: 1
options:
openstack-origin: cloud:bionic-stein
block-device: /dev/vdb
overwrite: "true"
ephemeral-unmount: /mnt
to:
- '2'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
to:
- '3'

View File

@ -0,0 +1,56 @@
series: bionic
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
'2':
constraints: mem=4G root-disk=16G
'3':
relations:
- - keystone:shared-db
- mysql:shared-db
- - cinder:shared-db
- mysql:shared-db
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
to:
- '0'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: cloud:bionic-train
num_units: 1
to:
- '1'
cinder:
charm: cs:~openstack-charmers-next/cinder
num_units: 1
storage:
block-devices: '40G'
options:
openstack-origin: cloud:bionic-train
block-device: None
overwrite: "true"
to:
- '2'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
to:
- '3'

View File

@ -6,6 +6,7 @@ machines:
constraints: mem=3072M constraints: mem=3072M
'1': '1':
'2': '2':
constraints: mem=4G root-disk=16G
'3': '3':
relations: relations:
- - keystone:shared-db - - keystone:shared-db
@ -26,23 +27,29 @@ applications:
- '0' - '0'
keystone: keystone:
charm: cs:~openstack-charmers-next/keystone charm: cs:~openstack-charmers-next/keystone
num_units: 1
options: options:
openstack-origin: cloud:bionic-ussuri openstack-origin: cloud:bionic-ussuri
num_units: 1
to: to:
- '1' - '1'
cinder: cinder:
charm: cs:~openstack-charmers-next/cinder charm: cs:~openstack-charmers-next/cinder
num_units: 1 num_units: 1
storage:
block-devices: '40G'
options: options:
openstack-origin: cloud:bionic-ussuri openstack-origin: cloud:bionic-ussuri
block-device: None
overwrite: "true"
ephemeral-unmount: /mnt
to: to:
- '2' - '2'
cinder-netapp: cinder-netapp:
series: bionic
charm: cinder-netapp charm: cinder-netapp
options: options:
# Add config options here netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
rabbitmq-server: rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1 num_units: 1

View File

@ -1,59 +1,76 @@
series: focal series: focal
variables:
openstack-origin: &openstack-origin distro
comment: comment:
- 'machines section to decide order of deployment. database sooner = faster' - 'machines section to decide order of deployment. database sooner = faster'
machines: machines:
'0': '0':
constraints: mem=3072M constraints: mem=3072M
'1': '1':
constraints: mem=3072M
'2': '2':
constraints: mem=3072M
'3': '3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations: relations:
- - keystone:shared-db - - keystone:shared-db
- mysql:shared-db - keystone-mysql-router:shared-db
- - cinder:shared-db - - keystone-mysql-router:db-router
- mysql:shared-db - mysql-innodb-cluster:db-router
- - cinder:identity-service - - cinder:shared-db
- keystone:identity-service - cinder-mysql-router:shared-db
- - cinder:amqp - - cinder-mysql-router:db-router
- rabbitmq-server:amqp - mysql-innodb-cluster:db-router
- - cinder:storage-backend - - cinder:identity-service
- cinder-netapp:storage-backend - keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications: applications:
mysql: mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/percona-cluster charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 1 num_units: 3
options:
source: *openstack-origin
to: to:
- '0' - '0'
keystone: - '1'
charm: cs:~openstack-charmers-next/keystone - '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1 num_units: 1
options: options:
openstack-origin: distro source: *openstack-origin
to: to:
- '1' - '3'
keystone:
charm: cs:~openstack-charmers/keystone
options:
openstack-origin: *openstack-origin
num_units: 1
to:
- '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder: cinder:
charm: cs:~openstack-charmers-next/cinder charm: cs:~openstack-charmers-next/cinder
num_units: 1 num_units: 1
storage:
block-devices: '40G'
options: options:
openstack-origin: distro openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to: to:
- '2' - '5'
cinder-netapp: cinder-netapp:
series: focal
charm: cinder-netapp charm: cinder-netapp
options: options:
netapp-storage-family: ontap_cluster netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi netapp-storage-protocol: iscsi
netapp-vserver: 'hou-cloud' volume-backend-name: NETAPP
netapp-server-hostname: '10.10.10.10' cinder-mysql-router:
volume-backend-name: cinder-netapp charm: cs:~openstack-charmers-next/mysql-router
netapp-server-port: 80
netapp-login: admin
netapp-password: Passw0rd
use-multipath: True
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
to:
- '3'

View File

@ -1,58 +1,76 @@
series: focal series: focal
variables:
openstack-origin: &openstack-origin cloud:focal-victoria
comment: comment:
- 'machines section to decide order of deployment. database sooner = faster' - 'machines section to decide order of deployment. database sooner = faster'
machines: machines:
'0': '0':
constraints: mem=3072M constraints: mem=3072M
'1': '1':
constraints: mem=3072M
'2': '2':
constraints: mem=3072M
'3': '3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations: relations:
- - keystone:shared-db - - keystone:shared-db
- mysql:shared-db - keystone-mysql-router:shared-db
- - cinder:shared-db - - keystone-mysql-router:db-router
- mysql:shared-db - mysql-innodb-cluster:db-router
- - cinder:identity-service - - cinder:shared-db
- keystone:identity-service - cinder-mysql-router:shared-db
- - cinder:amqp - - cinder-mysql-router:db-router
- rabbitmq-server:amqp - mysql-innodb-cluster:db-router
- - cinder:storage-backend - - cinder:identity-service
- cinder-netapp:storage-backend - keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications: applications:
mysql: mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/percona-cluster charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 1 num_units: 3
options:
source: *openstack-origin
to: to:
- '0' - '0'
- '1'
- '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '3'
keystone: keystone:
charm: cs:~openstack-charmers-next/keystone charm: cs:~openstack-charmers-next/keystone
num_units: 1
options: options:
openstack-origin: distro openstack-origin: *openstack-origin
num_units: 1
to: to:
- '1' - '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder: cinder:
charm: cs:~openstack-charmers-next/cinder charm: cs:~openstack-charmers-next/cinder
storage:
block-devices: '40G'
num_units: 1 num_units: 1
options: options:
openstack-origin: distro openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to: to:
- '2' - '5'
cinder-netapp: cinder-netapp:
series: focal
charm: cinder-netapp charm: cinder-netapp
options: options:
netapp-storage-family: ontap_cluster netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi netapp-storage-protocol: iscsi
netapp-vserver: 'hou-cloud' volume-backend-name: NETAPP
netapp-server-hostname: '10.10.10.10' cinder-mysql-router:
volume-backend-name: cinder-netapp charm: cs:~openstack-charmers-next/mysql-router
netapp-server-port: 80
netapp-login: admin
netapp-password: Passw0rd
use-multipath: True
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
to:
- '3'

View File

@ -0,0 +1,76 @@
series: focal
variables:
openstack-origin: &openstack-origin cloud:focal-wallaby
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
constraints: mem=3072M
'2':
constraints: mem=3072M
'3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations:
- - keystone:shared-db
- keystone-mysql-router:shared-db
- - keystone-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:shared-db
- cinder-mysql-router:shared-db
- - cinder-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 3
options:
source: *openstack-origin
to:
- '0'
- '1'
- '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '3'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: *openstack-origin
num_units: 1
to:
- '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder:
charm: cs:~openstack-charmers-next/cinder
storage:
block-devices: '40G'
num_units: 1
options:
openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to:
- '5'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
cinder-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router

View File

@ -0,0 +1,76 @@
series: focal
variables:
openstack-origin: &openstack-origin cloud:focal-xena
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
constraints: mem=3072M
'2':
constraints: mem=3072M
'3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations:
- - keystone:shared-db
- keystone-mysql-router:shared-db
- - keystone-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:shared-db
- cinder-mysql-router:shared-db
- - cinder-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 3
options:
source: *openstack-origin
to:
- '0'
- '1'
- '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '3'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: *openstack-origin
num_units: 1
to:
- '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder:
charm: cs:~openstack-charmers-next/cinder
storage:
block-devices: '40G'
num_units: 1
options:
openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to:
- '5'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
cinder-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router

View File

@ -0,0 +1,76 @@
series: groovy
variables:
openstack-origin: &openstack-origin distro
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
constraints: mem=3072M
'2':
constraints: mem=3072M
'3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations:
- - keystone:shared-db
- keystone-mysql-router:shared-db
- - keystone-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:shared-db
- cinder-mysql-router:shared-db
- - cinder-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 3
options:
source: *openstack-origin
to:
- '0'
- '1'
- '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '3'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: *openstack-origin
num_units: 1
to:
- '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder:
charm: cs:~openstack-charmers-next/cinder
storage:
block-devices: '40G'
num_units: 1
options:
openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to:
- '5'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
cinder-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router

View File

@ -0,0 +1,76 @@
series: hirsute
variables:
openstack-origin: &openstack-origin distro
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
constraints: mem=3072M
'2':
constraints: mem=3072M
'3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations:
- - keystone:shared-db
- keystone-mysql-router:shared-db
- - keystone-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:shared-db
- cinder-mysql-router:shared-db
- - cinder-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 3
options:
source: *openstack-origin
to:
- '0'
- '1'
- '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '3'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: *openstack-origin
num_units: 1
to:
- '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder:
charm: cs:~openstack-charmers-next/cinder
storage:
block-devices: '40G'
num_units: 1
options:
openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to:
- '5'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
cinder-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router

View File

@ -0,0 +1,76 @@
series: impish
variables:
openstack-origin: &openstack-origin distro
comment:
- 'machines section to decide order of deployment. database sooner = faster'
machines:
'0':
constraints: mem=3072M
'1':
constraints: mem=3072M
'2':
constraints: mem=3072M
'3':
'4':
'5':
constraints: mem=4G root-disk=16G
relations:
- - keystone:shared-db
- keystone-mysql-router:shared-db
- - keystone-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:shared-db
- cinder-mysql-router:shared-db
- - cinder-mysql-router:db-router
- mysql-innodb-cluster:db-router
- - cinder:identity-service
- keystone:identity-service
- - cinder:amqp
- rabbitmq-server:amqp
- - cinder:storage-backend
- cinder-netapp:storage-backend
applications:
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 3
options:
source: *openstack-origin
to:
- '0'
- '1'
- '2'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '3'
keystone:
charm: cs:~openstack-charmers-next/keystone
options:
openstack-origin: *openstack-origin
num_units: 1
to:
- '4'
keystone-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
cinder:
charm: cs:~openstack-charmers-next/cinder
storage:
block-devices: '40G'
num_units: 1
options:
openstack-origin: *openstack-origin
block-device: None
overwrite: "true"
to:
- '5'
cinder-netapp:
charm: cinder-netapp
options:
netapp-storage-family: ontap_cluster
netapp-storage-protocol: iscsi
volume-backend-name: NETAPP
cinder-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router

View File

@ -0,0 +1,8 @@
applications:
cinder-netapp:
options:
netapp-vserver: {{ NETAPP_VSERVER }}
netapp-server-hostname: {{ NETAPP_SERVER_HOSTNAME }}
netapp-server-port: {{ NETAPP_SERVER_PORT }}
netapp-login: {{ NETAPP_LOGIN }}
netapp-password: {{ NETAPP_PASSWORD }}

View File

@ -1,9 +1,24 @@
charm_name: cinder-netapp charm_name: cinder-netapp
tests: tests:
- tests.tests_cinder_netapp.CindernetappTest - zaza.openstack.charm_tests.cinder_netapp.tests.CinderNetAppTest
configure: configure:
- zaza.openstack.charm_tests.keystone.setup.add_demo_user - zaza.openstack.charm_tests.keystone.setup.add_demo_user
gate_bundles: gate_bundles:
- xenial-stein - bionic-queens
- bionic-rocky
- bionic-stein
- bionic-train
- bionic-ussuri
- focal-ussuri
- focal-victoria
- focal-wallaby
- focal-xena
- groovy-victoria
- hirsute-wallaby
smoke_bundles: smoke_bundles:
- xenial-stein - bionic-ussuri
dev_bundles:
- impish-xena
test_options:
force_deploy:
- impish-xena

View File

@ -1,70 +0,0 @@
#!/usr/bin/env python3
# Copyright 2019 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Encapsulate cinder-netapp testing."""
import logging
import uuid
import zaza.model
import zaza.openstack.charm_tests.test_utils as test_utils
import zaza.openstack.utilities.openstack as openstack_utils
class CindernetappTest(test_utils.OpenStackBaseTest):
"""Encapsulate netapp tests."""
@classmethod
def setUpClass(cls):
"""Run class setup for running tests."""
super(CindernetappTest, cls).setUpClass()
cls.keystone_session = openstack_utils.get_overcloud_keystone_session()
cls.model_name = zaza.model.get_juju_model()
cls.cinder_client = openstack_utils.get_cinder_session_client(
cls.keystone_session)
def test_cinder_config(self):
logging.info('netapp')
expected_contents = {
'cinder-netapp': {
'iscsi_helper': ['tgtadm'],
'volume_dd_blocksize': ['512']}}
zaza.model.run_on_leader(
'cinder',
'sudo cp /etc/cinder/cinder.conf /tmp/',
model_name=self.model_name)
zaza.model.block_until_oslo_config_entries_match(
'cinder',
'/tmp/cinder.conf',
expected_contents,
model_name=self.model_name,
timeout=2)
def test_create_volume(self):
test_vol_name = "zaza{}".format(uuid.uuid1().fields[0])
vol_new = self.cinder_client.volumes.create(
name=test_vol_name,
size=2)
openstack_utils.resource_reaches_status(
self.cinder_client.volumes,
vol_new.id,
expected_status='available')
test_vol = self.cinder_client.volumes.find(name=test_vol_name)
self.assertEqual(
getattr(test_vol, 'os-vol-host-attr:host').split('#')[0],
'cinder@cinder-netapp')
self.cinder_client.volumes.delete(vol_new)

View File

@ -1,25 +1,46 @@
# Source charm (with zaza): ./src/tox.ini
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of tox.ini for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
[tox] [tox]
envlist = pep8 envlist = pep8
skipsdist = True skipsdist = True
# NOTE: Avoid build/test env pollution by not enabling sitepackages.
sitepackages = False
# NOTE: Avoid false positives by not skipping missing interpreters.
skip_missing_interpreters = False
# NOTES:
# * We avoid the new dependency resolver by pinning pip < 20.3, see
# https://github.com/pypa/pip/issues/9187
# * Pinning dependencies requires tox >= 3.2.0, see
# https://tox.readthedocs.io/en/latest/config.html#conf-requires
# * It is also necessary to pin virtualenv as a newer virtualenv would still
# lead to fetching the latest pip in the func* tox targets, see
# https://stackoverflow.com/a/38133283
requires = pip < 20.3
virtualenv < 20.0
# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci
minversion = 3.18.0
[testenv] [testenv]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0 PYTHONHASHSEED=0
whitelist_externals = juju allowlist_externals = juju
passenv = HOME TERM CS_API_* OS_* AMULET_* passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
install_command = install_command =
pip install {opts} {packages} pip install {opts} {packages}
[testenv:pep8] [testenv:pep8]
basepython = python3 basepython = python3
deps=charm-tools
commands = charm-proof commands = charm-proof
[testenv:func-noop] [testenv:func-noop]
basepython = python3 basepython = python3
commands = commands =
true functest-run-suite --help
[testenv:func] [testenv:func]
basepython = python3 basepython = python3
@ -31,5 +52,10 @@ basepython = python3
commands = commands =
functest-run-suite --keep-model --smoke functest-run-suite --keep-model --smoke
[testenv:func-target]
basepython = python3
commands =
functest-run-suite --keep-model --bundle {posargs}
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}

View File

@ -1,2 +1,3 @@
#layer-basic uses wheelhouse to install python dependencies #layer-basic uses wheelhouse to install python dependencies
psutil psutil
git+https://github.com/juju/charm-helpers.git#egg=charmhelpers

View File

@ -3,16 +3,49 @@
# choices of *requirements.txt files for OpenStack Charms: # choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools # https://github.com/openstack-charmers/release-tools
# #
# TODO: Distill the func test requirements from the lint/unit test setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
# requirements. They are intertwined. Also, Zaza itself should specify
# all of its own requirements and if it doesn't, fix it there.
#
charm-tools>=2.4.4
requests>=2.18.4
mock>=1.2
flake8>=2.2.4,<=2.4.1
stestr>=2.2.0 stestr>=2.2.0
coverage>=4.5.2
pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking) # Dependency of stestr. Workaround for
git+https://github.com/openstack-charmers/zaza.git#egg=zaza;python_version>='3.0' # https://github.com/mtreinish/stestr/issues/145
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack cliff<3.0.0
# Dependencies of stestr. Newer versions use keywords that didn't exist in
# python 3.5 yet (e.g. "ModuleNotFoundError")
importlib-metadata<3.0.0; python_version < '3.6'
importlib-resources<3.0.0; python_version < '3.6'
# Some Zuul nodes sometimes pull newer versions of these dependencies which
# dropped support for python 3.5:
osprofiler<2.7.0;python_version<'3.6'
stevedore<1.31.0;python_version<'3.6'
debtcollector<1.22.0;python_version<'3.6'
oslo.utils<=3.41.0;python_version<'3.6'
requests>=2.18.4
charms.reactive
# Newer mock seems to have some syntax which is newer than python3.5 (e.g.
# f'{something}'
mock>=1.2,<4.0.0; python_version < '3.6'
mock>=1.2; python_version >= '3.6'
nose>=1.3.7
coverage>=3.6
git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack
#
# Revisit for removal / mock improvement:
#
# NOTE(lourot): newer versions of cryptography require a Rust compiler to build,
# see
# * https://github.com/openstack-charmers/zaza/issues/421
# * https://mail.python.org/pipermail/cryptography-dev/2021-January/001003.html
#
netifaces # vault
psycopg2-binary # vault
tenacity # vault
pbr==5.6.0 # vault
cryptography<3.4 # vault, keystone-saml-mellon
lxml # keystone-saml-mellon
hvac # vault, barbican-vault

124
tox.ini
View File

@ -1,62 +1,85 @@
# Classic charm (with zaza): ./tox.ini # Source charm: ./tox.ini
# This file is managed centrally by release-tools and should not be modified # This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available # within individual charm repos. See the 'global' dir contents for available
# choices of tox.ini for OpenStack Charms: # choices of tox.ini for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools # https://github.com/openstack-charmers/release-tools
#
# TODO: Distill the func test requirements from the lint/unit test
# requirements. They are intertwined. Also, Zaza itself should specify
# all of its own requirements and if it doesn't, fix it there.
[tox] [tox]
envlist = pep8,py3
skipsdist = True skipsdist = True
envlist = pep8,py3
# NOTE: Avoid build/test env pollution by not enabling sitepackages. # NOTE: Avoid build/test env pollution by not enabling sitepackages.
sitepackages = False sitepackages = False
# NOTE: Avoid false positives by not skipping missing interpreters. # NOTE: Avoid false positives by not skipping missing interpreters.
skip_missing_interpreters = False skip_missing_interpreters = False
# NOTES:
# * We avoid the new dependency resolver by pinning pip < 20.3, see
# https://github.com/pypa/pip/issues/9187
# * Pinning dependencies requires tox >= 3.2.0, see
# https://tox.readthedocs.io/en/latest/config.html#conf-requires
# * It is also necessary to pin virtualenv as a newer virtualenv would still
# lead to fetching the latest pip in the func* tox targets, see
# https://stackoverflow.com/a/38133283
requires =
pip < 20.3
virtualenv < 20.0
setuptools<50.0.0
# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci
minversion = 3.18.0
[testenv] [testenv]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0 PYTHONHASHSEED=0
CHARM_DIR={envdir} TERM=linux
LAYER_PATH={toxinidir}/layers
INTERFACE_PATH={toxinidir}/interfaces
JUJU_REPOSITORY={toxinidir}/build
passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY
install_command = install_command =
pip install {opts} {packages} {toxinidir}/pip.sh install {opts} {packages}
commands = stestr run --slowest {posargs} deps =
whitelist_externals = juju -r{toxinidir}/requirements.txt
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
[testenv:py35] [testenv:build]
basepython = python3.5 basepython = python3
deps = -r{toxinidir}/requirements.txt commands =
-r{toxinidir}/test-requirements.txt charm-build --log-level DEBUG --use-lock-file-branches -o {toxinidir}/build/builds src {posargs}
[testenv:py36] [testenv:add-build-lock-file]
basepython = python3.6 basepython = python3
deps = -r{toxinidir}/requirements.txt commands =
-r{toxinidir}/test-requirements.txt charm-build --log-level DEBUG --write-lock-file -o {toxinidir}/build/builds src {posargs}
[testenv:py37]
basepython = python3.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py38]
basepython = python3.8
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py3] [testenv:py3]
basepython = python3 basepython = python3
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/test-requirements.txt commands = stestr run --slowest {posargs}
[testenv:py35]
basepython = python3.5
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py36]
basepython = python3.6
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py37]
basepython = python3.7
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py38]
basepython = python3.8
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:pep8] [testenv:pep8]
basepython = python3 basepython = python3
deps = -r{toxinidir}/requirements.txt deps = flake8==3.9.2
-r{toxinidir}/test-requirements.txt charm-tools==2.8.3
commands = flake8 {posargs} hooks unit_tests tests actions lib files commands = flake8 {posargs} src unit_tests
charm-proof
[testenv:cover] [testenv:cover]
# Technique based heavily upon # Technique based heavily upon
@ -90,31 +113,6 @@ omit =
basepython = python3 basepython = python3
commands = {posargs} commands = {posargs}
[testenv:func-noop]
basepython = python3
commands =
functest-run-suite --help
[testenv:func]
basepython = python3
commands =
functest-run-suite --keep-model
[testenv:func-smoke]
basepython = python3
commands =
functest-run-suite --keep-model --smoke
[testenv:func-dev]
basepython = python3
commands =
functest-run-suite --keep-model --dev
[testenv:func-target]
basepython = python3
commands =
functest-run-suite --keep-model --bundle {posargs}
[flake8] [flake8]
ignore = E402,E226 # E402 ignore necessary for path append before sys module import in actions
exclude = */charmhelpers ignore = E402,W503,W504

View File

@ -1,4 +1,4 @@
# Copyright 2016 Canonical Ltd # Copyright 2021 Canonical Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -36,13 +36,45 @@ class TestCinderNetAppCharm(test_utils.PatchHelper):
def test_cinder_base(self): def test_cinder_base(self):
charm = self._patch_config_and_charm({}) charm = self._patch_config_and_charm({})
self.assertEqual(charm.name, 'cinder_netapp') self.assertEqual(charm.name, 'cinder_netapp')
self.assertTrue(charm.stateless)
config = {k: v for (k, v) in charm.cinder_configuration()}
self.assertIn('netapp_storage_family', config)
self.assertIsNone(config['netapp_storage_family'])
self.assertIn('netapp_storage_protocol', config)
self.assertIsNone(config['netapp_storage_protocol'])
self.assertIn('netapp_server_hostname', config)
self.assertIsNone(config['netapp_server_hostname'])
self.assertIn('volume_backend_name', config)
self.assertIsNone(config['volume_backend_name'])
self.assertEqual(config.get('volume_driver'),
'cinder.volume.drivers.netapp.common.NetAppDriver')
def test_cinder_configuration(self): def test_cinder_https(self):
charm = self._patch_config_and_charm({'a': 'b'}) charm = self._patch_config_and_charm({'netapp-server-port': 443})
config = charm.cinder_configuration() config = charm.cinder_configuration()
# Add check here that configuration is as expected. self.assertIn(('netapp_transport_type', 'https'), config)
self.assertEqual(config, [('netapp_hostname', None),
('netapp_login', None), def test_cinder_eseries(self):
('netapp_password', None), econfig = {'netapp-storage-family': 'eseries',
('volume_driver', None), 'netapp-controller-ips': '10.0.0.1',
('volume_backend_name', None)]) 'netapp-array-password': 'abc123',
'netapp-storage-pools': 'somePool',
'use-multipath': True}
charm = self._patch_config_and_charm(econfig)
config = charm.cinder_configuration()
self.assertIn(('netapp_controller_ips',
econfig['netapp-controller-ips']), config)
self.assertIn(('netapp_sa_password',
econfig['netapp-array-password']), config)
self.assertIn(('netapp_storage_pools',
econfig['netapp-storage-pools']), config)
self.assertIn(('use_multipath_for_image_xfer',
econfig['use-multipath']), config)
self.assertFalse(any(q[0] == 'nfs_shares_config' for q in config))
econfig = {'netapp-storage-protocol': 'nfs',
'netapp-nfs-shares-config': 'NFSCONFIG'}
charm = self._patch_config_and_charm(econfig)
config = charm.cinder_configuration()
self.assertIn(('nfs_shares_config',
econfig['netapp-nfs-shares-config']), config)