本文整理汇总了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])
示例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)