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


Python Vm.set_powerState方法代码示例

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


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

示例1: _createCache

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import set_powerState [as 别名]
 def _createCache(self):
     self.mox.StubOutWithMock(api, "vm_host_get_all")
     vmhost = VmHost()
     vmhost.set_id("vmhost1")
     vmhost1 = VmHost()
     vmhost1.set_id("vmhost2")
     vm = Vm()
     vm.set_id("vm1")
     vm.set_powerState(Constants.VM_POWER_STATES[1])
     vm.set_vmHostId("vmhost1")
     vm1 = Vm()
     vm1.set_id("vm2")
     vm1.set_powerState(Constants.VM_POWER_STATES[1])
     vm1.set_vmHostId("vmhost2")
     vmhost.set_virtualMachineIds(["vm1", "vm2"])
     stPool = StorageVolume()
     stPool.set_id("stpool1")
     subNet = Subnet()
     subNet.set_id("net1")
     api.vm_host_get_all(mox.IgnoreArg()).AndReturn([vmhost, vmhost1])
     self.mox.StubOutWithMock(api, "vm_get_all")
     api.vm_get_all(mox.IgnoreArg()).AndReturn([vm, vm1])
     self.mox.StubOutWithMock(api, "storage_volume_get_all")
     api.storage_volume_get_all(mox.IgnoreArg()).AndReturn([stPool])
     self.mox.StubOutWithMock(api, "subnet_get_all")
     api.subnet_get_all(mox.IgnoreArg()).AndReturn([subNet])
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:28,代码来源:test_inventory_manager.py

示例2: createInvCache

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import set_powerState [as 别名]
 def createInvCache(self, vmrunning, hostconnection='Connected'):
     vmhost = VmHost()
     vmhost.set_id(self.vmhost_id)
     vmhost.set_connectionState(hostconnection)
     vm = Vm()
     vm.set_id(self.vm_id)
     if vmrunning:
         vm.set_powerState(Constants.VM_POWER_STATES[1])
     else:
         vm.set_powerState(Constants.VM_POWER_STATES[0])
     vm.set_vmHostId(self.vmhost_id)
     vmhost.set_virtualMachineIds([self.vm_id
                                   ])
     vmhost.set_processorSpeedMhz(2100)
     vmhost.set_processorCoresCount(4)
     vmhost.set_processorCount('2')
     vmhost.set_memorySize(2097152)
     vmhost.set_memoryConsumed(2097152)
     InventoryCacheManager.update_object_in_cache(self.vmhost_id, vmhost)
     InventoryCacheManager.update_object_in_cache(
         self.vm_id,
         vm)
开发者ID:emonty,项目名称:healthnmon,代码行数:24,代码来源:test_libvirt_perfdata.py


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