本文整理汇总了Python中healthnmon.resourcemodel.healthnmonResourceModel.Vm.add_vmScsiControllers方法的典型用法代码示例。如果您正苦于以下问题:Python Vm.add_vmScsiControllers方法的具体用法?Python Vm.add_vmScsiControllers怎么用?Python Vm.add_vmScsiControllers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类healthnmon.resourcemodel.healthnmonResourceModel.Vm
的用法示例。
在下文中一共展示了Vm.add_vmScsiControllers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_vm_save
# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import add_vmScsiControllers [as 别名]
def test_vm_save(self):
'''
Insert a vm object into db and check
whether we are getting proper values after retrieval
'''
vm = Vm()
vm.id = 'VM1-id'
vm.name = 'VM1-Name'
vmScsiController = VmScsiController()
vmScsiController.set_id('VM_CTRL_1')
vmScsiController.set_id('some_type')
vm.add_vmScsiControllers(vmScsiController)
healthnmon_db_api.vm_save(get_admin_context(), vm)
vms = healthnmon_db_api.vm_get_by_ids(get_admin_context(), [vm.id])
self.assertTrue(vms is not None)
self.assertTrue(len(vms) == 1)
self.assertEqual(vms[0].get_id(), 'VM1-id', "VM id is not same")
self.assertEqual(vms[0].get_name(), 'VM1-Name', "VM name is not same")
self.assert_(len(vms[0].get_vmScsiControllers(
)) == 1, "vmScsiController len mismatch")
self.assert_(vms[0].get_vmScsiControllers()[0].get_id(
) == vmScsiController.get_id(), "vmScsiController id mismatch")
self.assert_(vms[0].get_vmScsiControllers()[0].get_type() ==
vmScsiController.get_type(),
"vmScsiController type mismatch")