Skip to content

Commit bc8f14e

Browse files
ravanellialinefm
authored andcommitted
Issue #1264 : Libvirt check should only look for socket
1 parent 6823711 commit bc8f14e

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ do_substitution = \
116116
-e 's,[@]datadir[@],$(datadir),g' \
117117
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
118118
-e 's,[@]localstatedir[@],$(localstatedir),g' \
119+
-e 's,[@]runstatedir[@],$(runstatedir),g' \
119120
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
120121
-e 's,[@]wokdir[@],$(wokdir),g' \
121122
-e 's,[@]kimchidir[@],$(kimchidir),g' \

config.py.in

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ __release__ = "@kimchirelease@"
3737
# Storage pool constant for read-only pool types
3838
READONLY_POOL_TYPE = ['iscsi', 'scsi', 'mpath']
3939

40+
def get_libvirt_path():
41+
return os.path.join("@runstatedir@", 'libvirt')
4042

4143
def get_kimchi_version():
4244
return "-".join([__version__, __release__])

utils.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import re
2424
import sqlite3
25+
import stat
2526
import time
2627
import urllib
2728
from http.client import HTTPConnection
@@ -262,11 +263,17 @@ def get_next_clone_name(all_names, basename, name_suffix='', ts=False):
262263

263264
def is_libvirtd_up():
264265
"""
265-
Checks if libvirtd.service is up.
266+
Checks if libvirt is up.
266267
"""
267-
cmd = ['systemctl', 'is-active', 'libvirtd.service']
268-
output, error, rc = run_command(cmd, silent=True)
269-
return True if output == 'active\n' else False
268+
path = os.path.join(config.get_libvirt_path(), 'libvirt-sock')
269+
try:
270+
mode = os.stat(path).st_mode
271+
if stat.S_ISSOCK(mode):
272+
return True
273+
except:
274+
pass
275+
276+
return False
270277

271278

272279
def is_s390x():

0 commit comments

Comments
 (0)