diff --git a/hpedockerplugin/file_manager.py b/hpedockerplugin/file_manager.py index a180e707..8ccb5e1f 100644 --- a/hpedockerplugin/file_manager.py +++ b/hpedockerplugin/file_manager.py @@ -754,7 +754,11 @@ def mount_share(self, share_name, share, mount_id): self._create_mount_dir(mount_dir) LOG.info("Mounting share path %s to %s" % (share_path, mount_dir)) - sh.mount('-t', 'nfs', share_path, mount_dir) + if utils.is_host_os_rhel(): + sh.mount('-o', 'context="system_u:object_r:nfs_t:s0"', + '-t', 'nfs', share_path, mount_dir) + else: + sh.mount('-t', 'nfs', share_path, mount_dir) LOG.debug('Device: %(path)s successfully mounted on %(mount)s', {'path': share_path, 'mount': mount_dir}) diff --git a/hpedockerplugin/hpe/utils.py b/hpedockerplugin/hpe/utils.py index c2798fad..1ca68274 100644 --- a/hpedockerplugin/hpe/utils.py +++ b/hpedockerplugin/hpe/utils.py @@ -17,6 +17,7 @@ import six import string import uuid +import platform from Crypto.Cipher import AES from Crypto.Random import random @@ -156,6 +157,14 @@ def get_remote3par_rcg_name(id, array_id): six.text_type(array_id)) +def is_host_os_rhel(): + platform_type = list(platform.linux_distribution()) + if 'Red Hat Enterprise Linux Server' in platform_type: + return True + else: + return False + + class PasswordDecryptor(object): def __init__(self, backend_name, etcd): self._backend_name = backend_name