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


Python db.instance_fault_get_by_instance_uuids函数代码示例

本文整理汇总了Python中nova.db.instance_fault_get_by_instance_uuids函数的典型用法代码示例。如果您正苦于以下问题:Python instance_fault_get_by_instance_uuids函数的具体用法?Python instance_fault_get_by_instance_uuids怎么用?Python instance_fault_get_by_instance_uuids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_get_latest_for_instance

 def test_get_latest_for_instance(self):
     self.mox.StubOutWithMock(db, "instance_fault_get_by_instance_uuids")
     db.instance_fault_get_by_instance_uuids(self.context, ["fake-uuid"]).AndReturn(fake_faults)
     self.mox.ReplayAll()
     fault = instance_fault.InstanceFault.get_latest_for_instance(self.context, "fake-uuid")
     for key in fake_faults["fake-uuid"][0]:
         self.assertEqual(fake_faults["fake-uuid"][0][key], fault[key])
开发者ID:lyarwood,项目名称:nova,代码行数:7,代码来源:test_instance_fault.py

示例2: test_get_latest_for_instance_with_none

 def test_get_latest_for_instance_with_none(self):
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_fault_get_by_instance_uuids(self.context, ['fake-uuid']
                                             ).AndReturn({})
     self.mox.ReplayAll()
     fault = instance_fault.InstanceFault.get_latest_for_instance(
         self.context, 'fake-uuid')
     self.assertIsNone(fault)
开发者ID:Francis-Liu,项目名称:animated-broccoli,代码行数:8,代码来源:test_instance_fault.py

示例3: test_get_by_instance_with_none

 def test_get_by_instance_with_none(self):
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_fault_get_by_instance_uuids(self.context, ['fake-uuid']
                                             ).AndReturn({})
     self.mox.ReplayAll()
     faults = instance_fault.InstanceFaultList.get_by_instance_uuids(
         self.context, ['fake-uuid'])
     self.assertEqual(0, len(faults))
开发者ID:Francis-Liu,项目名称:animated-broccoli,代码行数:8,代码来源:test_instance_fault.py

示例4: test_get_by_instance

 def test_get_by_instance(self):
     self.mox.StubOutWithMock(db, "instance_fault_get_by_instance_uuids")
     db.instance_fault_get_by_instance_uuids(self.context, ["fake-uuid"]).AndReturn(fake_faults)
     self.mox.ReplayAll()
     faults = instance_fault.InstanceFaultList.get_by_instance_uuids(self.context, ["fake-uuid"])
     for index, db_fault in enumerate(fake_faults["fake-uuid"]):
         for key in db_fault:
             self.assertEqual(fake_faults["fake-uuid"][index][key], faults[index][key])
开发者ID:lyarwood,项目名称:nova,代码行数:8,代码来源:test_instance_fault.py

示例5: test_get_latest_for_instance_with_none

 def test_get_latest_for_instance_with_none(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_fault_get_by_instance_uuids(ctxt, ['fake-uuid']).AndReturn(
         {})
     self.mox.ReplayAll()
     fault = instance_fault.InstanceFault.get_latest_for_instance(
         ctxt, 'fake-uuid')
     self.assertEqual(None, fault)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:9,代码来源:test_instance_fault.py

示例6: test_get_latest_for_instance

 def test_get_latest_for_instance(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_fault_get_by_instance_uuids(ctxt, ['fake-uuid']).AndReturn(
         fake_faults)
     self.mox.ReplayAll()
     fault = instance_fault.InstanceFault.get_latest_for_instance(
         ctxt, 'fake-uuid')
     for key in fake_faults['fake-uuid'][0]:
         self.assertEqual(fake_faults['fake-uuid'][0][key], fault[key])
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:10,代码来源:test_instance_fault.py

示例7: test_with_fault

 def test_with_fault(self):
     fake_inst = dict(self.fake_instance)
     fake_uuid = fake_inst["uuid"]
     fake_faults = [dict(x, instance_uuid=fake_uuid) for x in test_instance_fault.fake_faults["fake-uuid"]]
     self.mox.StubOutWithMock(db, "instance_get_by_uuid")
     self.mox.StubOutWithMock(db, "instance_fault_get_by_instance_uuids")
     db.instance_get_by_uuid(self.context, fake_uuid, columns_to_join=[]).AndReturn(self.fake_instance)
     db.instance_fault_get_by_instance_uuids(self.context, [fake_uuid]).AndReturn({fake_uuid: fake_faults})
     self.mox.ReplayAll()
     inst = instance.Instance.get_by_uuid(self.context, fake_uuid, expected_attrs=["fault"])
     self.assertEqual(fake_faults[0], dict(inst.fault.items()))
     self.assertRemotes()
开发者ID:ReVolly,项目名称:nova,代码行数:12,代码来源:test_instance.py

示例8: test_get_by_instance

 def test_get_by_instance(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_fault_get_by_instance_uuids(ctxt, ['fake-uuid']).AndReturn(
         fake_faults)
     self.mox.ReplayAll()
     faults = instance_fault.InstanceFaultList.get_by_instance_uuids(
         ctxt, ['fake-uuid'])
     for index, db_fault in enumerate(fake_faults['fake-uuid']):
         for key in db_fault:
             self.assertEqual(fake_faults['fake-uuid'][index][key],
                              faults[index][key])
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Nova,代码行数:12,代码来源:test_instance_fault.py

示例9: test_with_fault

 def test_with_fault(self):
     fake_insts = [
         fake_instance.fake_db_instance(uuid="fake-uuid", host="host"),
         fake_instance.fake_db_instance(uuid="fake-inst2", host="host"),
     ]
     fake_faults = test_instance_fault.fake_faults
     self.mox.StubOutWithMock(db, "instance_get_all_by_host")
     self.mox.StubOutWithMock(db, "instance_fault_get_by_instance_uuids")
     db.instance_get_all_by_host(self.context, "host", columns_to_join=[], use_slave=False).AndReturn(fake_insts)
     db.instance_fault_get_by_instance_uuids(self.context, [x["uuid"] for x in fake_insts]).AndReturn(fake_faults)
     self.mox.ReplayAll()
     instances = instance.InstanceList.get_by_host(self.context, "host", expected_attrs=["fault"], use_slave=False)
     self.assertEqual(2, len(instances))
     self.assertEqual(fake_faults["fake-uuid"][0], dict(instances[0].fault.iteritems()))
     self.assertEqual(None, instances[1].fault)
开发者ID:ZelinIO,项目名称:nova,代码行数:15,代码来源:test_instance.py

示例10: test_instance_fault_get_by_instance

    def test_instance_fault_get_by_instance(self):
        """ ensure we can retrieve an instance fault by  instance UUID """
        ctxt = context.get_admin_context()
        instance1 = db.instance_create(ctxt, {})
        instance2 = db.instance_create(ctxt, {})
        uuids = [instance1["uuid"], instance2["uuid"]]

        # Create faults
        fault_values = {"message": "message", "details": "detail", "instance_uuid": uuids[0], "code": 404}
        fault1 = db.instance_fault_create(ctxt, fault_values)

        fault_values = {"message": "message", "details": "detail", "instance_uuid": uuids[0], "code": 500}
        fault2 = db.instance_fault_create(ctxt, fault_values)

        fault_values = {"message": "message", "details": "detail", "instance_uuid": uuids[1], "code": 404}
        fault3 = db.instance_fault_create(ctxt, fault_values)

        fault_values = {"message": "message", "details": "detail", "instance_uuid": uuids[1], "code": 500}
        fault4 = db.instance_fault_create(ctxt, fault_values)

        instance_faults = db.instance_fault_get_by_instance_uuids(ctxt, uuids)

        expected = {uuids[0]: [fault2, fault1], uuids[1]: [fault4, fault3]}

        self.assertEqual(instance_faults, expected)
开发者ID:hiteshwadekar,项目名称:nova,代码行数:25,代码来源:test_db_api.py

示例11: get_latest_by_instance_uuids

 def get_latest_by_instance_uuids(cls, context, instance_uuids):
     db_faultdict = db.instance_fault_get_by_instance_uuids(context,
                                                            instance_uuids,
                                                            latest=True)
     db_faultlist = itertools.chain(*db_faultdict.values())
     return base.obj_make_list(context, cls(context), objects.InstanceFault,
                               db_faultlist)
开发者ID:Juniper,项目名称:nova,代码行数:7,代码来源:instance_fault.py

示例12: test_get_with_expected

    def test_get_with_expected(self):
        self.mox.StubOutWithMock(db, "instance_get_by_uuid")
        self.mox.StubOutWithMock(db, "instance_fault_get_by_instance_uuids")

        exp_cols = instance.INSTANCE_OPTIONAL_ATTRS[:]
        exp_cols.remove("fault")

        db.instance_get_by_uuid(self.context, "uuid", columns_to_join=exp_cols).AndReturn(self.fake_instance)
        fake_faults = test_instance_fault.fake_faults
        db.instance_fault_get_by_instance_uuids(self.context, [self.fake_instance["uuid"]]).AndReturn(fake_faults)

        self.mox.ReplayAll()
        inst = instance.Instance.get_by_uuid(self.context, "uuid", expected_attrs=instance.INSTANCE_OPTIONAL_ATTRS)
        for attr in instance.INSTANCE_OPTIONAL_ATTRS:
            self.assertTrue(inst.obj_attr_is_set(attr))
        self.assertRemotes()
开发者ID:ReVolly,项目名称:nova,代码行数:16,代码来源:test_instance.py

示例13: test_with_fault

 def test_with_fault(self):
     ctxt = context.get_admin_context()
     fake_inst = dict(self.fake_instance)
     fake_uuid = fake_inst['uuid']
     fake_faults = [dict(x, instance_uuid=fake_uuid)
                    for x in test_instance_fault.fake_faults['fake-uuid']]
     self.mox.StubOutWithMock(db, 'instance_get_by_uuid')
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_get_by_uuid(ctxt, fake_uuid, columns_to_join=[]
                             ).AndReturn(self.fake_instance)
     db.instance_fault_get_by_instance_uuids(ctxt, [fake_uuid]).AndReturn(
         {fake_uuid: fake_faults})
     self.mox.ReplayAll()
     inst = instance.Instance.get_by_uuid(ctxt, fake_uuid,
                                          expected_attrs=['fault'])
     self.assertEqual(fake_faults[0], dict(inst.fault.items()))
     self.assertRemotes()
开发者ID:ammonite,项目名称:nova,代码行数:17,代码来源:test_instance.py

示例14: test_instance_faults_get_by_instance_uuids_no_faults

 def test_instance_faults_get_by_instance_uuids_no_faults(self):
     """None should be returned when no faults exist"""
     ctxt = context.get_admin_context()
     instance1 = db.instance_create(ctxt, {})
     instance2 = db.instance_create(ctxt, {})
     uuids = [instance1['uuid'], instance2['uuid']]
     instance_faults = db.instance_fault_get_by_instance_uuids(ctxt, uuids)
     expected = {uuids[0]: [], uuids[1]: []}
     self.assertEqual(expected, instance_faults)
开发者ID:matiu2,项目名称:nova,代码行数:9,代码来源:test_db_api.py

示例15: test_with_fault

 def test_with_fault(self):
     fake_insts = [
         fake_instance.fake_db_instance(uuid='fake-uuid', host='host'),
         fake_instance.fake_db_instance(uuid='fake-inst2', host='host'),
         ]
     fake_faults = test_instance_fault.fake_faults
     self.mox.StubOutWithMock(db, 'instance_get_all_by_host')
     self.mox.StubOutWithMock(db, 'instance_fault_get_by_instance_uuids')
     db.instance_get_all_by_host(self.context, 'host', columns_to_join=[]
                                 ).AndReturn(fake_insts)
     db.instance_fault_get_by_instance_uuids(
         self.context, [x['uuid'] for x in fake_insts]
         ).AndReturn(fake_faults)
     self.mox.ReplayAll()
     instances = instance.InstanceList.get_by_host(self.context, 'host',
                                                   expected_attrs=['fault'])
     self.assertEqual(2, len(instances))
     self.assertEqual(fake_faults['fake-uuid'][0],
                      dict(instances[0].fault.iteritems()))
     self.assertEqual(None, instances[1].fault)
开发者ID:slagle,项目名称:nova,代码行数:20,代码来源:test_instance.py


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