Skip to content

Commit

Permalink
Merge pull request hpe-storage#31 from hpe-storage/plugin_v2
Browse files Browse the repository at this point in the history
Plugin v2
  • Loading branch information
sonivi authored Sep 14, 2018
2 parents 5b7d273 + ce742ed commit df7acae
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 491 deletions.
12 changes: 10 additions & 2 deletions config/create_help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ Create Volume Options:
-o flash-cache=x x is a boolean value, hence x can have true or false. x specifies whether flash cache should be used or not.
Valid vaues are true or false.
-o qos-name=x x is name of existing VVset on 3PAR on which QoS rules are applied.
-o fsOwner=x x is the user id and group id that should own the root directory of the filesystem, in the form of
-o fsOwner=x x is the user id and group id that should own the root directory of the filesystem, in the form of
[userId:groupId]
-o fsMode=x x is 1 to 4 octal digits that represent the file mode to be applied to the root directory of the

-o fsMode=x x is 1 to 4 octal digits that represent the file mode to be applied to the root directory of the
filesystem

-o backend=x x is name of the backend identified by square brackets in hpe.conf, and the volume creation happens on this identified
backend. Default value of this option is DEFAULT when not given. This can be used in combination with other volume
create options along with -o importVol
Backend represents a group of configuration parameters for a particular 3PAR Array
Documentation: https://github.com/hpe-storage/python-hpedockerplugin/blob/plugin_v2/docs/multi-array-feature.md

-o replicationGroup=x x is name of the 3PAR replication group to which the newly created volume is added. If the replication
group doesn't exist on 3PAR array then it is created. Configuration parameter, 'replication_device',
must be defined in the hpe.conf file in conjunction with this option. Not doing so results in rejection
Expand Down
3 changes: 3 additions & 0 deletions hpedockerplugin/hpe/array_connection_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ def __getattr__(self, key):
object.__getattribute__(self, key)
except AttributeError:
return None

def is_param_present(self, param):
return param in dir(self)
5 changes: 3 additions & 2 deletions hpedockerplugin/hpe/hpe_3par_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def client_login(self):
raise exception.InvalidInput(reason=msg)

known_hosts_file = self._host_config.ssh_hosts_key_file

policy = "AutoAddPolicy"
if self._host_config.strict_ssh_host_key_policy:
policy = "RejectPolicy"
Expand Down Expand Up @@ -887,7 +888,7 @@ def delete_volume(self, volume, is_snapshot=False):
if volume.get('rcg_info'):
# this is replicated volume
self._do_volume_replication_destroy(volume)
LOG.info("Deletion of replicated volume:%s successfull"
LOG.info("Deletion of replicated volume:%s successful"
% volume)
return

Expand Down Expand Up @@ -1488,7 +1489,7 @@ def create_rcg(self, **kwargs):
src_config = self.src_bkend_config
tgt_config = self.tgt_bkend_config
bkend_replication_mode = self._get_backend_replication_mode(
src_config.replication_mode)
tgt_config.replication_mode)

cpg = tgt_config.hpe3par_cpg
if isinstance(cpg, list):
Expand Down
43 changes: 13 additions & 30 deletions hpedockerplugin/volume_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ def _initialize_configuration(self):
self.tgt_bkend_config = acp.ArrayConnectionParams(
self._hpepluginconfig.replication_device)
if self.tgt_bkend_config:
self.tgt_bkend_config.hpedockerplugin_driver = \
self.src_bkend_config.hpedockerplugin_driver

# Copy all the source configuration to target
hpeconf = self._hpepluginconfig
for key in hpeconf.keys():
if not self.tgt_bkend_config.is_param_present(key):
value = getattr(hpeconf, key)
self.tgt_bkend_config.__setattr__(key, value)

self.tgt_bkend_config.hpe3par_cpg = self._extract_remote_cpgs(
self.tgt_bkend_config.cpg_map)
if not self.tgt_bkend_config.hpe3par_cpg:
Expand All @@ -125,30 +131,14 @@ def _initialize_configuration(self):
self.tgt_bkend_config.hpe3par_iscsi_ips = iscsi_ips.split(
';')

# Post failover, user would want to mount the volume to
# target array. In which case, tgt_bkend_config would be
# used to mount the volume. Copy the parameters that are
# present with src_bkend_config and are applicable to
# tgt_bkend_config as well
self.tgt_bkend_config.hpe3par_iscsi_chap_enabled = \
self.src_bkend_config.hpe3par_iscsi_chap_enabled

# Additional information from target_device
self.src_bkend_config.replication_mode = \
self.tgt_bkend_config.replication_mode

def _get_src_bkend_config(self):
LOG.info("Getting source backend configuration...")
hpeconf = self._hpepluginconfig
config = acp.ArrayConnectionParams()
config.hpedockerplugin_driver = hpeconf.hpedockerplugin_driver
config.hpe3par_api_url = hpeconf.hpe3par_api_url
config.hpe3par_username = hpeconf.hpe3par_username
config.hpe3par_password = hpeconf.hpe3par_password
config.san_ip = hpeconf.san_ip
config.san_login = hpeconf.san_login
config.san_password = hpeconf.san_password
config.hpe3par_cpg = hpeconf.hpe3par_cpg
for key in hpeconf.keys():
value = getattr(hpeconf, key)
config.__setattr__(key, value)

if hpeconf.hpe3par_snapcpg:
config.hpe3par_snapcpg = hpeconf.hpe3par_snapcpg
else:
Expand All @@ -158,13 +148,6 @@ def _get_src_bkend_config(self):
# value given with '-o cpg'
config.hpe3par_snapcpg = []

if 'iscsi' in hpeconf.hpedockerplugin_driver:
config.hpe3par_iscsi_ips = hpeconf.hpe3par_iscsi_ips
config.iscsi_ip_address = hpeconf.iscsi_ip_address
config.iscsi_port = hpeconf.iscsi_port
config.hpe3par_iscsi_chap_enabled = \
hpeconf.hpe3par_iscsi_chap_enabled

LOG.info("Got source backend configuration!")
return config

Expand Down Expand Up @@ -259,7 +242,7 @@ def create_volume(self, volname, vol_size, vol_prov,
vol = volume.createvol(volname, vol_size, vol_prov,
vol_flash, compression_val, vol_qos,
mount_conflict_delay, False, cpg, snap_cpg,
False, current_backend, rcg_name)
False, current_backend)
try:
self._create_volume(vol, undo_steps)
self._apply_volume_specs(vol, undo_steps)
Expand Down
Loading

0 comments on commit df7acae

Please sign in to comment.