Skip to content

Commit

Permalink
fix(LVHDoISCSISR): disable restart of ISCSI daemon
Browse files Browse the repository at this point in the history
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.fr>
  • Loading branch information
Wescoeur committed Apr 29, 2024
1 parent 2c50709 commit f36a7a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 51 deletions.
2 changes: 2 additions & 0 deletions drivers/LVHDoISCSISR.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ def probe(self):
return out

def check_sr(self, sr_uuid):
# Disable to prevent daemon restart.
return
"""Hook to check SR health"""
pbdref = util.find_my_pbd(self.session, self.host_ref, self.sr_ref)
if pbdref:
Expand Down
51 changes: 0 additions & 51 deletions tests/test_LVHDoISCSISR.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,6 @@ def deepcopy(to_copy):

super(TestLVHDoISCSISR, self).setUp()

@property
def mock_baseiscsi(self):
assert len(self.base_srs) == 1
single_sr = None
for sr in self.base_srs:
single_sr = sr

return single_sr

def baseiscsi(self, srcmd, sr_uuid):
new_baseiscsi = mock.create_autospec(BaseISCSISR)
local_iqn = srcmd.dconf['localIQN']
Expand All @@ -199,48 +190,6 @@ def create_test_sr(self, sr_cmd):
self.subject = LVHDoISCSISR.LVHDoISCSISR(
sr_cmd, self.sr_uuid)

def test_check_sr_pbd_not_found(self):
# Arrange
self.mock_util.find_my_pbd.return_value = None
self.create_test_sr(self.create_sr_command())

# Act
self.subject.check_sr(TEST_SR_UUID)

# Assert
self.mock_util.find_my_pbd.assert_called_with(
self.mock_session, 'test_host', 'sr_ref')

def test_check_sr_correct_sessions_count(self):
# Arrange
self.mock_util.find_my_pbd.return_value = 'my_pbd'
self.mock_session.xenapi.PBD.get_other_config.return_value = {
'iscsi_sessions': 2
}
self.create_test_sr(self.create_sr_command())

# Act
self.subject.check_sr(TEST_SR_UUID)

# Assert
self.mock_session.xenapi.PBD.get_other_config.assert_called_with('my_pbd')

def test_check_sr_not_enough_sessions(self):
# Arrange
self.mock_util.find_my_pbd.return_value = 'my_pbd'
self.mock_session.xenapi.PBD.get_other_config.return_value = {
'iscsi_sessions': 1
}
self.create_test_sr(self.create_sr_command())

# Act
self.subject.check_sr(TEST_SR_UUID)

# Assert
self.mock_baseiscsi.attach.assert_called_with(
TEST_SR_UUID
)

def test_sr_attach_multi_session(self):
# Arrange
self.mock_util.find_my_pbd.return_value = 'my_pbd'
Expand Down

0 comments on commit f36a7a2

Please sign in to comment.