commit
11904aaa31
@ -10,9 +10,12 @@ charm.
|
|||||||
To use:
|
To use:
|
||||||
|
|
||||||
juju deploy cinder
|
juju deploy cinder
|
||||||
juju deploy cinder-purestorage
|
juju deploy cinder-purestorage --config driver-source="ppa:narindergupta/purestorage"
|
||||||
juju add-relation cinder-purestorage cinder
|
juju add-relation cinder-purestorage cinder
|
||||||
|
|
||||||
|
Until purestorage packages went into Canonical repository plese use the driver
|
||||||
|
source from PPA narindergupta/purestorage.
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import charms_openstack.charm
|
import charms_openstack.charm
|
||||||
import charmhelpers.core.hookenv as ch_hookenv
|
|
||||||
|
|
||||||
charms_openstack.charm.use_defaults('charm.default-select-release')
|
charms_openstack.charm.use_defaults('charm.default-select-release')
|
||||||
|
|
||||||
@ -14,20 +13,19 @@ class CinderpurestorageCharm(
|
|||||||
stateless = True
|
stateless = True
|
||||||
# Specify any config that the user *must* set.
|
# Specify any config that the user *must* set.
|
||||||
mandatory_config = [
|
mandatory_config = [
|
||||||
('san_ip', self.config.get('san-ip')),
|
'san-ip', 'pure-api-token', 'protocol', 'volume-backend-name']
|
||||||
('pure_api_token', self.config.get('pure-api-token'))
|
|
||||||
]
|
|
||||||
|
|
||||||
def cinder_configuration(self):
|
def cinder_configuration(self):
|
||||||
drivers = {
|
drivers = {
|
||||||
'iscsi': 'cinder.volume.drivers.pure.PureISCSIDriver',
|
'iscsi': 'cinder.volume.drivers.pure.PureISCSIDriver',
|
||||||
'fc': 'cinder.volume.drivers.pure.PureFCDriver',
|
'fc': 'cinder.volume.drivers.pure.PureFCDriver',
|
||||||
}
|
}
|
||||||
service = self.config.get('volume-backend-name') or service_name()
|
service = self.config.get('volume-backend-name')
|
||||||
|
volumedriver = drivers.get(self.config.get('protocol'))
|
||||||
driver_options = [
|
driver_options = [
|
||||||
('san_ip', self.config.get('san-ip')),
|
('san_ip', self.config.get('san-ip')),
|
||||||
('pure_api_token', self.config.get('pure-api-token')),
|
('pure_api_token', self.config.get('pure-api-token')),
|
||||||
('volume_driver', drivers[self.config.get('protocol').lower()]),
|
('volume_driver', volumedriver),
|
||||||
('volume_backend_name', service)]
|
('volume_backend_name', service)]
|
||||||
return driver_options
|
return driver_options
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@ import charms_openstack.charm
|
|||||||
import charms.reactive
|
import charms.reactive
|
||||||
|
|
||||||
# This charm's library contains all of the handler code associated with
|
# This charm's library contains all of the handler code associated with
|
||||||
# this charm -- we need to import it to get the definitions for the charm.
|
# this charm -- we will use the auto-discovery feature of charms.openstack
|
||||||
import charm.openstack.cinder_purestorage
|
# to get the definitions for the charm.
|
||||||
|
import charms_openstack.bus
|
||||||
|
charms_openstack.bus.discover()
|
||||||
|
|
||||||
charms_openstack.charm.use_defaults(
|
charms_openstack.charm.use_defaults(
|
||||||
'charm.installed',
|
'charm.installed',
|
||||||
@ -29,5 +31,5 @@ charms_openstack.charm.use_defaults(
|
|||||||
|
|
||||||
@charms.reactive.when('config.changed.driver-source')
|
@charms.reactive.when('config.changed.driver-source')
|
||||||
def reinstall():
|
def reinstall():
|
||||||
with charms_openstack.charm.provide_charm_instance() as charm:
|
with charms_openstack.charm.provide_charm_instance() as purestorage:
|
||||||
charm.install()
|
purestorage.install()
|
||||||
|
4
tox.ini
4
tox.ini
@ -9,7 +9,7 @@ envlist = pep8,py3
|
|||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
PYTHONHASHSEED=0
|
PYTHONHASHSEED=0
|
||||||
TERM=linux
|
TERM=linux
|
||||||
LAYER_PATH={toxinidir}/layers
|
CHARM_LAYERS_DIR={toxinidir}/layers
|
||||||
JUJU_REPOSITORY={toxinidir}/build
|
JUJU_REPOSITORY={toxinidir}/build
|
||||||
passenv = http_proxy https_proxy INTERFACE_PATH
|
passenv = http_proxy https_proxy INTERFACE_PATH
|
||||||
install_command =
|
install_command =
|
||||||
@ -76,4 +76,4 @@ commands = {posargs}
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# E402 ignore necessary for path append before sys module import in actions
|
# E402 ignore necessary for path append before sys module import in actions
|
||||||
ignore = E402
|
ignore = E402
|
||||||
|
@ -46,4 +46,7 @@ class TestCinderpurestorageCharm(test_utils.PatchHelper):
|
|||||||
charm = self._patch_config_and_charm({'a': 'b'})
|
charm = self._patch_config_and_charm({'a': 'b'})
|
||||||
config = charm.cinder_configuration()
|
config = charm.cinder_configuration()
|
||||||
# Add check here that configuration is as expected.
|
# Add check here that configuration is as expected.
|
||||||
# self.assertEqual(config, {})
|
self.assertEqual(config, [('san_ip', None),
|
||||||
|
('pure_api_token', None),
|
||||||
|
('volume_driver', None),
|
||||||
|
('volume_backend_name', None)])
|
||||||
|
Loading…
Reference in New Issue
Block a user