diff options
| author | Walter A. Boring IV <walter.boring@hp.com> | 2013-05-15 14:15:15 -0700 |
|---|---|---|
| committer | Walter A. Boring IV <walter.boring@hp.com> | 2013-05-15 15:33:00 -0700 |
| commit | 565dfc65fbab1df4ec5e83be627805c313aab04b (patch) | |
| tree | 20a52213672de9a7245eb34203f6757557d410f0 /nova/tests | |
| parent | e2636ff5b8191b1b0338d28ecc7e389d7e357561 (diff) | |
Fix for missing multipath device name
Due to formatting changes in the multipath -l output
we were sometimes missing the device name for each of the
multipath devices which gave us a device of '/dev/'. This
causes problems on detach.
Fixes Bug: #1180497
Change-Id: I6017dda149776624fac452140d3d0f5df3f5fd5a
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_linuxscsi.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/nova/tests/test_linuxscsi.py b/nova/tests/test_linuxscsi.py new file mode 100644 index 000000000..7f66974d0 --- /dev/null +++ b/nova/tests/test_linuxscsi.py @@ -0,0 +1,66 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# +# Copyright 2010 OpenStack Foundation +# (c) Copyright 2012-2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo.config import cfg + +from nova.openstack.common import log as logging +from nova.storage import linuxscsi +from nova import test +from nova import utils + +LOG = logging.getLogger(__name__) + +CONF = cfg.CONF + + +class StorageLinuxSCSITestCase(test.TestCase): + def setUp(self): + super(StorageLinuxSCSITestCase, self).setUp() + self.executes = [] + + def fake_execute(*cmd, **kwargs): + self.executes.append(cmd) + return None, None + + self.stubs.Set(utils, 'execute', fake_execute) + + def test_find_multipath_device(self): + def fake_execute(*cmd, **kwargs): + out = ("mpath6 (350002ac20398383d) dm-3 3PARdata,VV\n" + "size=2.0G features='0' hwhandler='0' wp=rw\n" + "`-+- policy='round-robin 0' prio=-1 status=active\n" + " |- 0:0:0:1 sde 8:64 active undef running\n" + " `- 2:0:0:1 sdf 8:80 active undef running\n" + ) + return out, None + + self.stubs.Set(utils, 'execute', fake_execute) + + info = linuxscsi.find_multipath_device('/dev/sde') + LOG.error("info = %s" % info) + self.assertEqual("/dev/dm-3", info["device"]) + self.assertEqual("/dev/sde", info['devices'][0]['device']) + self.assertEqual("0", info['devices'][0]['host']) + self.assertEqual("0", info['devices'][0]['id']) + self.assertEqual("0", info['devices'][0]['channel']) + self.assertEqual("1", info['devices'][0]['lun']) + + self.assertEqual("/dev/sdf", info['devices'][1]['device']) + self.assertEqual("2", info['devices'][1]['host']) + self.assertEqual("0", info['devices'][1]['id']) + self.assertEqual("0", info['devices'][1]['channel']) + self.assertEqual("1", info['devices'][1]['lun']) |
