當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。