本文整理汇总了Python中nova.db.compute_node_search_by_hypervisor函数的典型用法代码示例。如果您正苦于以下问题:Python compute_node_search_by_hypervisor函数的具体用法?Python compute_node_search_by_hypervisor怎么用?Python compute_node_search_by_hypervisor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compute_node_search_by_hypervisor函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_by_hypervisor
def test_get_by_hypervisor(self):
self.mox.StubOutWithMock(db, "compute_node_search_by_hypervisor")
db.compute_node_search_by_hypervisor(self.context, "hyper").AndReturn([fake_compute_node])
self.mox.ReplayAll()
computes = compute_node.ComputeNodeList.get_by_hypervisor(self.context, "hyper")
self.assertEqual(1, len(computes))
self.compare_obj(computes[0], fake_compute_node, subs=self.subs(), comparators=self.comparators())
示例2: test_get_by_hypervisor
def test_get_by_hypervisor(self):
self.mox.StubOutWithMock(db, 'compute_node_search_by_hypervisor')
db.compute_node_search_by_hypervisor(self.context, 'hyper').AndReturn(
[fake_compute_node])
self.mox.ReplayAll()
computes = compute_node.ComputeNodeList.get_by_hypervisor(self.context,
'hyper')
self.assertEqual(1, len(computes))
self.compare_obj(computes[0], fake_compute_node)
示例3: search
def search(self, req, id):
context = req.environ['nova.context']
authorize(context)
hypervisors = db.compute_node_search_by_hypervisor(context, id)
if hypervisors:
return dict(hypervisors=[self._view_hypervisor(hyp, False)
for hyp in hypervisors])
else:
msg = _("No hypervisor matching '%s' could be found.") % id
raise webob.exc.HTTPNotFound(explanation=msg)
示例4: get_by_hypervisor
def get_by_hypervisor(cls, context, hypervisor_match):
db_computes = db.compute_node_search_by_hypervisor(context, hypervisor_match)
return base.obj_make_list(context, ComputeNodeList(), ComputeNode, db_computes)