Skip to content

Commit

Permalink
CP-48018: Update to systemd to manage services
Browse files Browse the repository at this point in the history
All existing living XS use systemd to manage services,
Update the service management command to systemd

Signed-off-by: Lin Liu <[email protected]>
  • Loading branch information
liulinC committed Feb 29, 2024
1 parent 5ebbc1f commit b7efcfd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions drivers/iscsilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,14 @@ def get_luns(targetIQN, portal):


def is_iscsi_daemon_running():
cmd = ["/sbin/pidof", "-s", "/sbin/iscsid"]
cmd = ["/usr/bin/systemctl", "is-active", "iscsid.service"]
(rc, stdout, stderr) = util.doexec(cmd)
return (rc == 0)


def stop_daemon():
if is_iscsi_daemon_running():
cmd = ["service", "iscsid", "stop"]
cmd = ["/usr/bin/systemctl", "stop", "iscsid"]
failuremessage = "Failed to stop iscsi daemon"
exn_on_failure(cmd, failuremessage)

Expand All @@ -401,7 +401,7 @@ def restart_daemon():
shutil.rmtree(os.path.join(_ISCSI_DB_PATH, 'send_targets'))
except:
pass
cmd = ["service", "iscsid", "start"]
cmd = ["/usr/bin/systemctl", "start", "iscsid"]
failuremessage = "Failed to start iscsi daemon"
exn_on_failure(cmd, failuremessage)

Expand Down
2 changes: 1 addition & 1 deletion drivers/mpath_dmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def activate():

if not _is_mpath_daemon_running():
util.SMlog("Warning: multipath daemon not running. Starting daemon!")
cmd = ["service", "multipathd", "start"]
cmd = ["/usr/bin/systemctl", "start", "multipathd"]
util.pread2(cmd)

for i in range(0, 120):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mpath_dmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_activate_noiscsi_start_mpath(

self.assertEqual(1, mock_util.pread2.call_count)
mock_util.pread2.assert_called_once_with(
['service', 'multipathd', 'start'])
['/usr/bin/systemctl', 'start', 'multipathd'])

@testlib.with_context
@mock.patch('mpath_dmp.iscsilib', autospec=True)
Expand Down

0 comments on commit b7efcfd

Please sign in to comment.