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


Python ProvisionRequest.cpu_overcommit方法代码示例

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


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

示例1: test_config_change

# 需要导入模块: from gen.agent.ttypes import ProvisionRequest [as 别名]
# 或者: from gen.agent.ttypes.ProvisionRequest import cpu_overcommit [as 别名]
    def test_config_change(self):
        # Test chairman config change
        chairman_callback1 = mock.MagicMock()
        chairman_callback2 = mock.MagicMock()

        chairman_server = [
            ServerAddress("192.168.0.1", 8835),
            ServerAddress("192.168.0.2", 8835),
        ]
        self.agent.on_config_change(self.agent.CHAIRMAN, chairman_callback1)
        self.agent.on_config_change(self.agent.CHAIRMAN, chairman_callback2)
        provision = ProvisionRequest(chairman_server=chairman_server)
        self.agent.update_config(provision)
        chairman_callback1.assert_called_once_with(chairman_server)
        chairman_callback2.assert_called_once_with(chairman_server)
        self.assertFalse(self.agent.reboot_required)

        # Test cpu_overcommit and memory_overcommit config change
        cpu_callback = mock.MagicMock()
        mem_callback = mock.MagicMock()

        provision.cpu_overcommit = 5.0
        provision.memory_overcommit = 6.0
        self.agent.on_config_change(self.agent.CPU_OVERCOMMIT, cpu_callback)
        self.agent.on_config_change(self.agent.MEMORY_OVERCOMMIT, mem_callback)
        self.agent.update_config(provision)
        cpu_callback.assert_called_once_with(5.0)
        mem_callback.assert_called_once_with(6.0)
开发者ID:tomzhang,项目名称:photon-controller,代码行数:30,代码来源:test_agent_config.py

示例2: test_config_change

# 需要导入模块: from gen.agent.ttypes import ProvisionRequest [as 别名]
# 或者: from gen.agent.ttypes.ProvisionRequest import cpu_overcommit [as 别名]
    def test_config_change(self):
        # Test cpu_overcommit and memory_overcommit config change
        cpu_callback = mock.MagicMock()
        mem_callback = mock.MagicMock()

        provision = ProvisionRequest()
        provision.cpu_overcommit = 5.0
        provision.memory_overcommit = 6.0
        self.agent.on_config_change(self.agent.CPU_OVERCOMMIT, cpu_callback)
        self.agent.on_config_change(self.agent.MEMORY_OVERCOMMIT, mem_callback)
        self.agent.provision(provision)
        cpu_callback.assert_called_once_with(5.0)
        mem_callback.assert_called_once_with(6.0)
开发者ID:vmware,项目名称:photon-controller,代码行数:15,代码来源:test_agent_config.py


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