Initial set of configs
This commit is contained in:
parent
bedabaaa27
commit
1381290f3d
@ -16,4 +16,25 @@ options:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
SAN protocol to use. Choose between iscsi or fc.
|
||||
SAN protocol to use. Choose between iSCSI or FC.
|
||||
san-ip:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
PowerStore REST IP.
|
||||
san-login:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
PowerStore REST username.
|
||||
san-password:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
PowerStore REST password.
|
||||
powerstore-ports:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
Allowed ports. Comma separated list of PowerStore iSCSI IPs or FC
|
||||
WWNs to be used. If option is not set all ports are allowed.
|
||||
|
@ -35,7 +35,7 @@ class CinderDellEMCPowerStoreCharm(
|
||||
stateless = True
|
||||
|
||||
# Specify any config that the user *must* set.
|
||||
mandatory_config = ["protocol"]
|
||||
mandatory_config = ["protocol", "san-ip", "san-login", "san-password"]
|
||||
|
||||
def cinder_configuration(self):
|
||||
mandatory_config_values = map(self.config.get, self.mandatory_config)
|
||||
@ -47,12 +47,17 @@ class CinderDellEMCPowerStoreCharm(
|
||||
else:
|
||||
volume_backend_name = self.service_name
|
||||
|
||||
volume_driver = ""
|
||||
volume_driver = (
|
||||
"cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver"
|
||||
)
|
||||
|
||||
driver_options = [
|
||||
("volume_backend_name", volume_backend_name),
|
||||
("volume_driver", volume_driver),
|
||||
# Add config options that needs setting on cinder.conf
|
||||
("storage_protocol", self.config.get("protocol")),
|
||||
("san_ip", self.config.get("san-ip")),
|
||||
("san_login", self.config.get("san-login")),
|
||||
("san_password", self.config.get("san-password")),
|
||||
]
|
||||
|
||||
if self.config.get("use-multipath"):
|
||||
@ -63,4 +68,9 @@ class CinderDellEMCPowerStoreCharm(
|
||||
]
|
||||
)
|
||||
|
||||
if self.config.get("powerstore-ports"):
|
||||
driver_options.extend(
|
||||
[("powerstore_ports", self.config.get("powerstore-ports"))]
|
||||
)
|
||||
|
||||
return driver_options
|
||||
|
@ -45,8 +45,10 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
charm = self._patch_config_and_charm(
|
||||
{
|
||||
"volume-backend-name": "my_backend_name",
|
||||
"protocol": "iscsi",
|
||||
# more options to test
|
||||
"protocol": "iSCSI",
|
||||
"san-ip": "192.0.2.1",
|
||||
"san-login": "superuser",
|
||||
"san-password": "my-password",
|
||||
}
|
||||
)
|
||||
config = charm.cinder_configuration()
|
||||
@ -55,7 +57,45 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
config,
|
||||
[
|
||||
("volume_backend_name", "my_backend_name"),
|
||||
("volume_driver", ""),
|
||||
(
|
||||
"volume_driver",
|
||||
"cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver", # noqa
|
||||
),
|
||||
("storage_protocol", "iSCSI"),
|
||||
("san_ip", "192.0.2.1"),
|
||||
("san_login", "superuser"),
|
||||
("san_password", "my-password"),
|
||||
],
|
||||
)
|
||||
|
||||
def test_cinder_configuration_fc(self):
|
||||
charm = self._patch_config_and_charm(
|
||||
{
|
||||
"volume-backend-name": "my_backend_name",
|
||||
"protocol": "FC",
|
||||
"san-ip": "192.0.2.1",
|
||||
"san-login": "superuser",
|
||||
"san-password": "my-password",
|
||||
"powerstore-ports": "58:cc:f0:98:49:22:07:02,58:cc:f0:98:49:23:07:02", # noqa
|
||||
}
|
||||
)
|
||||
config = charm.cinder_configuration()
|
||||
self.assertEqual(
|
||||
config,
|
||||
[
|
||||
("volume_backend_name", "my_backend_name"),
|
||||
(
|
||||
"volume_driver",
|
||||
"cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver", # noqa
|
||||
),
|
||||
("storage_protocol", "FC"),
|
||||
("san_ip", "192.0.2.1"),
|
||||
("san_login", "superuser"),
|
||||
("san_password", "my-password"),
|
||||
(
|
||||
"powerstore_ports",
|
||||
"58:cc:f0:98:49:22:07:02,58:cc:f0:98:49:23:07:02",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@ -64,7 +104,10 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
self.service_name.return_value = "cinder-myapp-name"
|
||||
charm = self._patch_config_and_charm(
|
||||
{
|
||||
"protocol": None,
|
||||
"protocol": "iSCSI",
|
||||
"san-ip": "192.0.2.1",
|
||||
"san-login": "superuser",
|
||||
"san-password": None,
|
||||
}
|
||||
)
|
||||
config = charm.cinder_configuration()
|
||||
@ -75,8 +118,11 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
self.service_name.return_value = "cinder-myapp-name"
|
||||
charm = self._patch_config_and_charm(
|
||||
{
|
||||
"protocol": "iscsi",
|
||||
"protocol": "iSCSI",
|
||||
"volume-backend-name": None,
|
||||
"san-ip": "192.0.2.1",
|
||||
"san-login": "superuser",
|
||||
"san-password": "my-password",
|
||||
}
|
||||
)
|
||||
config = charm.cinder_configuration()
|
||||
@ -84,7 +130,14 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
config,
|
||||
[
|
||||
("volume_backend_name", "cinder-myapp-name"),
|
||||
("volume_driver", ""),
|
||||
(
|
||||
"volume_driver",
|
||||
"cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver", # noqa
|
||||
),
|
||||
("storage_protocol", "iSCSI"),
|
||||
("san_ip", "192.0.2.1"),
|
||||
("san_login", "superuser"),
|
||||
("san_password", "my-password"),
|
||||
],
|
||||
)
|
||||
|
||||
@ -93,7 +146,10 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
{
|
||||
"volume-backend-name": "my_backend_name",
|
||||
"use-multipath": True,
|
||||
"protocol": "iscsi",
|
||||
"protocol": "iSCSI",
|
||||
"san-ip": "192.0.2.1",
|
||||
"san-login": "superuser",
|
||||
"san-password": "my-password",
|
||||
}
|
||||
)
|
||||
config = charm.cinder_configuration()
|
||||
@ -101,7 +157,14 @@ class TestCinderDellEMCPowerStoreCharm(test_utils.PatchHelper):
|
||||
config,
|
||||
[
|
||||
("volume_backend_name", "my_backend_name"),
|
||||
("volume_driver", ""),
|
||||
(
|
||||
"volume_driver",
|
||||
"cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver", # noqa
|
||||
),
|
||||
("storage_protocol", "iSCSI"),
|
||||
("san_ip", "192.0.2.1"),
|
||||
("san_login", "superuser"),
|
||||
("san_password", "my-password"),
|
||||
("use_multipath_for_image_xfer", True),
|
||||
("enforce_multipath_for_image_xfer", True),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user