From 2fa6e23e9cefb8e45bd5a6cec36b1ac6b7ac65c3 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 28 Feb 2012 16:18:53 -0800 Subject: Allow xvd* to be supplied for volume in xenapi * Fixes bug 942880 Change-Id: I7d0817051b837e3ba17f4edd8c47fd2c730c9822 --- nova/tests/test_xenapi.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 4a971ff21..f8b0c1791 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -139,6 +139,28 @@ class XenAPIVolumeTestCase(test.TestCase): } } + def test_mountpoint_to_number(self): + cases = { + 'sda': 0, + 'sdp': 15, + 'hda': 0, + 'hdp': 15, + 'vda': 0, + 'xvda': 0, + '0': 0, + '10': 10, + 'vdq': -1, + 'sdq': -1, + 'hdq': -1, + 'xvdq': -1, + } + + for (input, expected) in cases.iteritems(): + func = volume_utils.VolumeHelper.mountpoint_to_number + actual = func(input) + self.assertEqual(actual, expected, + '%s yielded %s, not %s' % (input, actual, expected)) + def test_parse_volume_info_raise_exception(self): """This shows how to test helper classes' methods.""" stubs.stubout_session(self.stubs, stubs.FakeSessionForVolumeTests) -- cgit