Skip to content

Commit

Permalink
CA-335178: Fix unitialized variable
Browse files Browse the repository at this point in the history
Signed-off-by: ben sims <ben.sims@citrix.com>
  • Loading branch information
BenSimsCitrix committed Feb 24, 2020
1 parent 1c4985b commit a9a7a4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/blktap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ def __init__(self, uuid, target, driver_info):
self.__o_direct = None
self.__o_direct_reason = None
self.lock = Lock("vdi", uuid)
self.tap = None

def get_o_direct_capability(self, options):
"""Returns True/False based on licensing and caching_params"""
Expand Down
6 changes: 6 additions & 0 deletions tests/test_blktap2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def test_get_tap_type_returns_aio_for_udev_device(self):
class NBDLinkForTest(blktap2.VDI.NBDLink):
__name__ = "bob"

@mock.patch('blktap2.VDI.NBDLink', autospec=NBDLinkForTest)
@mock.patch('blktap2.VDI.NBDLink', autospec=NBDLinkForTest)
def test_linknbd_not_called_for_no_tap(self, nbd_link2, nbd_link):
self.vdi.linkNBD("blahblah", "yadayada")
self.assertEquals(nbd_link.from_uuid.call_count, 0)

@mock.patch('blktap2.VDI.NBDLink', autospec=NBDLinkForTest)
@mock.patch('blktap2.VDI.NBDLink', autospec=NBDLinkForTest)
def test_linknbd(self, nbd_link2, nbd_link):
Expand Down

0 comments on commit a9a7a4c

Please sign in to comment.