]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Fix range check for NFS used ratio
authorTom Barron <tpb@dyncloud.net>
Sat, 18 Apr 2015 13:42:10 +0000 (09:42 -0400)
committerTom Barron <tpb@dyncloud.net>
Fri, 1 May 2015 21:30:17 +0000 (21:30 +0000)
commit9a1e146849f6aa88784e2d8a224ef8e86e06a749
treeee6bf111a0b0a18f677c20b7302420c8a7cf9060
parent5df1f2190434af6ab1e09d922dca961ca4f09c23
Fix range check for NFS used ratio

The nfs_used_ratio configuration parameter is supposed to be
greater than zero and less than or equal to one.  However,
current configuration checks actually allow values greater
than one because of a logic error.  Unit tests fail to detect
this issue because they find the exception that they expect
to find, but it is actually being thrown for another reason.

This commit fixes the logic error in the nfs driver code.

It also reworks all the unit tests for the do_setup method since
they suffer from the same issue that led to failure to detect
this error in the first place - they fail to do proper mocks of
submethods, and when these run the expected exception gets triggered
for the wrong reason.  We have moved these tests into their own test
class, where mock is used rather than mox.  Over time it is likely
that new tests will be implemented, or old tests reworked, with mock
instead of mox.  These can go in the new test class, which can be
renamed if that is appropriate.

Change-Id: I19ab396057fb6f60ad8e7d10944384db7e95ece6
Fixes-bug: 1445786
cinder/tests/unit/test_nfs.py
cinder/volume/drivers/nfs.py