hpe_plugin_service.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:python-hpedockerplugin 作者: hpe-storage 项目源码 文件源码
def setupservice(self):
        # TODO: Remove this line when Python Klein pull request #103 is
        # released
        # NOTE: Docker 1.9 will fail without this line. Docker 1.10 will
        # fail as it no longer includes the Host as part of the http header.
        # Therefore, we need to remove this line altogether.
        # 4/6/16 Removing this line as it's causing problems for testers on
        # Docker 1.10. If you're running 1.9, you can apply the Klein fix
        # here https://github.com/twisted/klein.git to fix.
        UNIXAddress.port = 0
        UNIXAddress.host = b"127.0.0.1"

        # Turnoff use of parameterized hpe.conf and use bind mounted
        # configuration file
        # CONFIG = ['--config-file', self._config_file]
        CONFIG = ['--config-file', CONFIG_FILE]

        # Setup the default, hpe3parconfig, and hpelefthandconfig
        # configuration objects.
        try:
            hpedefaultconfig = getdefaultconfig(CONFIG)
        except Exception as ex:
            msg = (_('hpe3pardocker setupservice failed, error is: %s'),
                   six.text_type(ex))
            LOG.error(msg)
            raise exception.HPEPluginStartPluginException(reason=msg)

        # Set Logging level
        logging_level = hpedefaultconfig.logging
        setup_logging('hpe_storage_api', logging_level)

        self._create_listening_directory(PLUGIN_PATH.parent())
        endpoint = serverFromString(self._reactor, "unix:{}:mode=600".
                                    format(PLUGIN_PATH.path))
        servicename = StreamServerEndpointService(endpoint, Site(
            VolumePlugin(self._reactor, hpedefaultconfig).app.resource()))
        return servicename
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号