当前位置: 首页>>代码示例>>Python>>正文


Python PluginManager.get_volumes_metadata方法代码示例

本文整理汇总了Python中nailgun.plugins.manager.PluginManager.get_volumes_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.get_volumes_metadata方法的具体用法?Python PluginManager.get_volumes_metadata怎么用?Python PluginManager.get_volumes_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nailgun.plugins.manager.PluginManager的用法示例。


在下文中一共展示了PluginManager.get_volumes_metadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_raise_exception_when_plugin_overlap_release_volumes

# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_volumes_metadata [as 别名]
    def test_raise_exception_when_plugin_overlap_release_volumes(self):
        cluster = self.env.create_cluster(api=False)
        plugin_name = 'test_plugin_3'
        volumes_metadata = {
            'volumes_roles_mapping': {
                plugin_name: [
                    {'allocate_size': 'min', 'id': plugin_name}
                ]
            },
            'volumes': [
                {'id': 'os', 'type': 'vg'},
                {'id': plugin_name, 'type': 'vg'}
            ]
        }
        self.env.create_plugin(
            api=True,
            cluster=cluster,
            name=plugin_name,
            package_version='3.0.0',
            fuel_version=['7.0'],
            volumes_metadata=volumes_metadata
        )

        expected_message = (
            'Plugin test_plugin_3-0.1.0 is overlapping with release '
            'by introducing the same volume with id "os"')

        with self.assertRaisesRegexp(errors.AlreadyExists,
                                     expected_message):
            PluginManager.get_volumes_metadata(cluster)
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:32,代码来源:test_plugin_manager.py

示例2: test_raise_exception_when_plugin_overlap_another_plugin_volumes

# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_volumes_metadata [as 别名]
    def test_raise_exception_when_plugin_overlap_another_plugin_volumes(self):
        plugin_name = 'test_plugin_4'
        volumes_metadata = {
            'volumes_roles_mapping': {
                plugin_name: [
                    {'allocate_size': 'min', 'id': plugin_name}
                ]
            },
            'volumes': [
                {'id': 'test_plugin_2', 'type': 'vg'},
                {'id': plugin_name, 'type': 'vg'}
            ]
        }
        self.env.create_plugin(
            cluster=self.cluster,
            name=plugin_name,
            package_version='3.0.0',
            fuel_version=['7.0'],
            volumes_metadata=volumes_metadata
        )

        expected_message = (
            'Plugin test_plugin_4-0.1.0 is overlapping with plugin '
            'test_plugin_2-0.1.0 by introducing the same volume '
            'with id "test_plugin_2"')

        with self.assertRaisesRegexp(errors.AlreadyExists,
                                     expected_message):
            PluginManager.get_volumes_metadata(self.cluster)
开发者ID:sebrandon1,项目名称:fuel-web,代码行数:31,代码来源:test_plugin_manager.py

示例3: test_get_empty_plugin_volumes_metadata_for_cluster

# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_volumes_metadata [as 别名]
    def test_get_empty_plugin_volumes_metadata_for_cluster(self):
        cluster = self.env.create_cluster(api=False)
        self.env.create_plugin(
            cluster=cluster,
            package_version='3.0.0'
        )
        volumes_metadata = PluginManager.get_volumes_metadata(cluster)
        expected_volumes_metadata = {
            'volumes_roles_mapping': {}, 'volumes': []}

        self.assertEqual(
            volumes_metadata, expected_volumes_metadata)
开发者ID:ogelbukh,项目名称:fuel-web,代码行数:14,代码来源:test_plugin_manager.py

示例4: get_volumes_metadata

# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_volumes_metadata [as 别名]
    def get_volumes_metadata(cls, instance):
        """Return proper volumes metadata for cluster and consists
        with general volumes metadata from release and volumes
        metadata from plugins which releated to this cluster

        :param instance: Cluster DB instance
        :returns: dict -- object with merged volumes metadata
        """
        volumes_metadata = copy.deepcopy(instance.release.volumes_metadata)
        plugin_volumes = PluginManager.get_volumes_metadata(instance)

        volumes_metadata["volumes_roles_mapping"].update(plugin_volumes["volumes_roles_mapping"])

        volumes_metadata["volumes"].extend(plugin_volumes["volumes"])

        return volumes_metadata
开发者ID:anbangr,项目名称:fuel-web,代码行数:18,代码来源:cluster.py

示例5: test_get_plugin_volumes_metadata_for_cluster

# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import get_volumes_metadata [as 别名]
    def test_get_plugin_volumes_metadata_for_cluster(self):
        volumes_metadata = PluginManager.get_volumes_metadata(
            self.cluster)
        expected_volumes_metadata = {
            'volumes_roles_mapping': {
                'test_plugin_1': [
                    {'allocate_size': 'min', 'id': 'test_plugin_1'}
                ],
                'test_plugin_2': [
                    {'allocate_size': 'min', 'id': 'test_plugin_2'}
                ],
            },
            'volumes': [
                {'id': 'test_plugin_1', 'type': 'vg'},
                {'id': 'test_plugin_2', 'type': 'vg'}
            ]
        }

        self.assertEqual(
            volumes_metadata['volumes_roles_mapping'],
            expected_volumes_metadata['volumes_roles_mapping'])
        self.assertItemsEqual(
            volumes_metadata['volumes'],
            expected_volumes_metadata['volumes'])
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:26,代码来源:test_plugin_manager.py


注:本文中的nailgun.plugins.manager.PluginManager.get_volumes_metadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。