本文整理汇总了Python中nova.db.aggregate_host_get_all函数的典型用法代码示例。如果您正苦于以下问题:Python aggregate_host_get_all函数的具体用法?Python aggregate_host_get_all怎么用?Python aggregate_host_get_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了aggregate_host_get_all函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_aggregate_host_add_duplicate_works
def test_aggregate_host_add_duplicate_works(self):
"""Ensure we can add host to distinct aggregates."""
ctxt = context.get_admin_context()
r1 = _create_aggregate_with_hosts(context=ctxt, metadata=None)
r2 = _create_aggregate_with_hosts(
ctxt, values={"name": "fake_aggregate2", "availability_zone": "fake_avail_zone2"}, metadata=None
)
h1 = db.aggregate_host_get_all(ctxt, r1.id)
h2 = db.aggregate_host_get_all(ctxt, r2.id)
self.assertEqual(h1, h2)
示例2: test_aggregate_host_delete
def test_aggregate_host_delete(self):
"""Ensure we can add host to the aggregate."""
ctxt = context.get_admin_context()
result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
db.aggregate_host_delete(ctxt, result.id, _get_fake_aggr_hosts()[0])
expected = db.aggregate_host_get_all(ctxt, result.id)
self.assertEqual(0, len(expected))
示例3: test_aggregate_host_add_deleted
def test_aggregate_host_add_deleted(self):
"""Ensure we can add a host that was previously deleted."""
ctxt = context.get_admin_context()
result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
host = _get_fake_aggr_hosts()[0]
db.aggregate_host_delete(ctxt, result.id, host)
db.aggregate_host_add(ctxt, result.id, host)
expected = db.aggregate_host_get_all(ctxt, result.id)
self.assertEqual(len(expected), 1)