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


Python Vm.name方法代码示例

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


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

示例1: test_vm_save

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import name [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")
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:28,代码来源:test_vm_db_api.py

示例2: testGet_long_desc

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import name [as 别名]
 def testGet_long_desc(self):
     testVm = Vm()
     testVm.name = 'TestVm'
     test_arg = 'TestArg'
     long_desc = self.metadata.get_long_desc(testVm,
                                             test_arg=test_arg)
     self.assertEquals(long_desc, self.long_desc_tmpl
                       % {'name': testVm.name, 'test_arg': test_arg})
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:10,代码来源:test_event_metadata.py

示例3: test_vm_get_all

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import name [as 别名]
    def test_vm_get_all(self):
        '''
        Inserts more than one vm object and
        try to get them all and validates the values
        '''
        vm = Vm()
        vm.id = 'VM1-id'
        vm.name = 'VM1-Name'
        healthnmon_db_api.vm_save(get_admin_context(), vm)

        vm = Vm()
        vm.id = 'VM2-id'
        vm.name = 'VM2-Name'
        healthnmon_db_api.vm_save(get_admin_context(), vm)

        vms = healthnmon_db_api.vm_get_all(get_admin_context())
        self.assertFalse(vms is None, 'vm_get_all returned None')
        self.assertTrue(len(vms) == 2,
                        'vm_get_all does not returned expected number of vms')
        self.assertEqual(vms[0].get_id(), 'VM1-id', "VM id is not same")
        self.assertEqual(vms[1].get_id(), 'VM2-id', "VM id is not same")
        self.assertEqual(vms[0].get_name(), 'VM1-Name', "VM Name is not same")
        self.assertEqual(vms[1].get_name(), 'VM2-Name', "VM Name is not same")
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:25,代码来源:test_vm_db_api.py

示例4: testVmPayloadGenerator

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import name [as 别名]
 def testVmPayloadGenerator(self):
     metadata = \
         event_metadata.get_EventMetaData(
             event_metadata.EVENT_TYPE_VM_CREATED)
     obj = Vm()
     obj.name = 'TestVm'
     ipProfile = IpProfile()
     ipProfile.ipAddress = '10.10.10.1'
     obj.add_ipAddresses(ipProfile)
     payload = payload_generator.generate_payload(metadata, obj)
     self.assertEquals(payload['entity_type'],
                       obj.__class__.__name__)
     self.assertEquals(payload['name'], obj.name)
     self.assertEquals(payload['ipAddresses'],
                       ipProfile.ipAddress)
开发者ID:rakrup,项目名称:healthnmon,代码行数:17,代码来源:test_payload_generator.py

示例5: testGet_short_desc

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import Vm [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.Vm import name [as 别名]
 def testGet_short_desc(self):
     testVm = Vm()
     testVm.name = 'TestVm'
     short_desc = self.metadata.get_short_desc(testVm)
     self.assertEquals(short_desc, self.short_desc_tmpl
                       % {'name': testVm.name})
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:8,代码来源:test_event_metadata.py


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