Merge "Xenapi: Handle missing aggregate metadata on startup"
This commit is contained in:
commit
4614c4b8cb
|
@ -1501,6 +1501,19 @@ iface eth0 inet6 static
|
|||
self.conn._session._get_host_uuid)
|
||||
self.assertTrue(was['called'])
|
||||
|
||||
def test_session_handles_aggregate_metadata(self):
|
||||
def fake_aggregate_get(context, host, key):
|
||||
agg = copy.copy(test_aggregate.fake_aggregate)
|
||||
agg['metadetails'][CONF.host] = 'this_should_be_metadata'
|
||||
return [agg]
|
||||
self.stubs.Set(db, 'aggregate_get_by_host',
|
||||
fake_aggregate_get)
|
||||
|
||||
self.stubs.Set(self.conn._session, "is_slave", True)
|
||||
|
||||
self.assertEqual('this_should_be_metadata',
|
||||
self.conn._session._get_host_uuid())
|
||||
|
||||
def test_per_instance_usage_running(self):
|
||||
instance = self._create_instance(spawn=True)
|
||||
flavor = flavors.get_flavor(3)
|
||||
|
|
|
@ -154,7 +154,7 @@ class XenAPISession(object):
|
|||
LOG.error(_LE('Host is member of a pool, but DB '
|
||||
'says otherwise'))
|
||||
raise exception.AggregateHostNotFound()
|
||||
return aggr.metadetails[CONF.host]
|
||||
return aggr.metadata[CONF.host]
|
||||
else:
|
||||
with self._get_session() as session:
|
||||
host_ref = session.xenapi.session.get_this_host(session.handle)
|
||||
|
|
Loading…
Reference in New Issue