552
553
{'broadcast': '192.168.1.255',
553
554
'dns': ['192.168.1.4', '192.168.1.3'],
554
555
'gateway': '192.168.1.1',
555
'gateway_v6': 'fe80::def',
556
'gateway_v6': '2001:db8:0:1::1',
556
557
'ip6s': [{'enabled': '1',
557
558
'ip': '2001:db8:0:1::1',
559
'gateway': 'fe80::def'}],
560
'gateway': '2001:db8:0:1::1'}],
560
561
'ips': [{'enabled': '1',
561
562
'ip': '192.168.1.100',
562
563
'netmask': '255.255.255.0',
1614
1615
stats = self.conn.get_host_stats()
1615
1616
self.assertEquals("SOMERETURNVALUE", stats['supported_instances'])
1618
def test_update_stats_caches_hostname(self):
1619
self.mox.StubOutWithMock(host, 'call_xenhost')
1620
self.mox.StubOutWithMock(vm_utils, 'safe_find_sr')
1621
self.mox.StubOutWithMock(self.conn._session, 'call_xenapi')
1622
data = {'disk_total': 0,
1624
'disk_available': 0,
1625
'supported_instances': 0,
1626
'host_capabilities': [],
1627
'host_hostname': 'foo',
1631
'physical_utilisation': 0,
1635
host.call_xenhost(mox.IgnoreArg(), 'host_data', {}).AndReturn(data)
1636
vm_utils.safe_find_sr(self.conn._session).AndReturn(None)
1637
self.conn._session.call_xenapi('SR.scan', None)
1638
self.conn._session.call_xenapi('SR.get_record', None).AndReturn(
1641
# On the third call (the second below) change the hostname
1642
data = dict(data, host_hostname='bar')
1644
self.mox.ReplayAll()
1645
stats = self.conn.get_host_stats(refresh=True)
1646
self.assertEqual('foo', stats['hypervisor_hostname'])
1647
stats = self.conn.get_host_stats(refresh=True)
1648
self.assertEqual('foo', stats['hypervisor_hostname'])
1618
1651
class ToSupportedInstancesTestCase(test.TestCase):
1619
1652
def test_default_return_value(self):
2684
2717
# ensure method is present
2685
2718
stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests)
2686
2719
self.conn = xenapi_conn.XenAPIDriver(fake.FakeVirtAPI(), False)
2687
self.conn.pre_live_migration(None, None, None, None)
2720
self.conn.pre_live_migration(None, None, None, None, None)
2689
2722
def test_post_live_migration_at_destination(self):
2690
2723
# ensure method is present