bug 929462: compile_diagnostics in xenapi erronously catch XenAPI.Failure
ensure we catch the right exception. Plus turn test_diagnostics into a more thorough unit test. Change-Id: I1aae28b9b3b942f08e419cd9cfa48dea003e96d9
This commit is contained in:
@@ -38,6 +38,7 @@ include nova/tests/api/ec2/public_key/*
|
|||||||
include nova/tests/db/nova.austin.sqlite
|
include nova/tests/db/nova.austin.sqlite
|
||||||
include nova/tests/image/*.tar.gz
|
include nova/tests/image/*.tar.gz
|
||||||
include nova/tests/policy.json
|
include nova/tests/policy.json
|
||||||
|
include nova/tests/xenapi/vm_rrd.xml
|
||||||
include plugins/xenapi/README
|
include plugins/xenapi/README
|
||||||
include plugins/xenapi/etc/xapi.d/plugins/objectstore
|
include plugins/xenapi/etc/xapi.d/plugins/objectstore
|
||||||
include plugins/xenapi/etc/xapi.d/plugins/pluginlib_nova.py
|
include plugins/xenapi/etc/xapi.d/plugins/pluginlib_nova.py
|
||||||
|
|||||||
@@ -243,8 +243,25 @@ class XenAPIVMTestCase(test.TestCase):
|
|||||||
self.assertEqual(server_info[1], 'myaddress')
|
self.assertEqual(server_info[1], 'myaddress')
|
||||||
|
|
||||||
def test_get_diagnostics(self):
|
def test_get_diagnostics(self):
|
||||||
|
def fake_get_rrd(host, vm_uuid):
|
||||||
|
with open('xenapi/vm_rrd.xml') as f:
|
||||||
|
return re.sub(r'\s', '', f.read())
|
||||||
|
self.stubs.Set(vm_utils, 'get_rrd', fake_get_rrd)
|
||||||
|
|
||||||
|
fake_diagnostics = {
|
||||||
|
'vbd_xvdb_write': '0.0',
|
||||||
|
'memory_target': '10961792000.0000',
|
||||||
|
'memory_internal_free': '3612860.6020',
|
||||||
|
'memory': '10961792000.0000',
|
||||||
|
'vbd_xvda_write': '0.0',
|
||||||
|
'cpu0': '0.0110',
|
||||||
|
'vif_0_tx': '752.4007',
|
||||||
|
'vbd_xvda_read': '0.0',
|
||||||
|
'vif_0_rx': '4837.8805'
|
||||||
|
}
|
||||||
instance = self._create_instance()
|
instance = self._create_instance()
|
||||||
self.conn.get_diagnostics(instance)
|
expected = self.conn.get_diagnostics(instance)
|
||||||
|
self.assertDictMatch(fake_diagnostics, expected)
|
||||||
|
|
||||||
def test_instance_snapshot_fails_with_no_primary_vdi(self):
|
def test_instance_snapshot_fails_with_no_primary_vdi(self):
|
||||||
def create_bad_vbd(vm_ref, vdi_ref):
|
def create_bad_vbd(vm_ref, vdi_ref):
|
||||||
|
|||||||
11293
nova/tests/xenapi/vm_rrd.xml
Normal file
11293
nova/tests/xenapi/vm_rrd.xml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user