Skip to content

Commit

Permalink
Issue #1264 : Libvirt check should only look for socket
Browse files Browse the repository at this point in the history
  • Loading branch information
ravanelli authored and alinefm committed Dec 19, 2019
1 parent 6823711 commit bc8f14e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ do_substitution = \
-e 's,[@]datadir[@],$(datadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]runstatedir[@],$(runstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]wokdir[@],$(wokdir),g' \
-e 's,[@]kimchidir[@],$(kimchidir),g' \
Expand Down
2 changes: 2 additions & 0 deletions config.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ __release__ = "@kimchirelease@"
# Storage pool constant for read-only pool types
READONLY_POOL_TYPE = ['iscsi', 'scsi', 'mpath']

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

def get_kimchi_version():
return "-".join([__version__, __release__])
Expand Down
15 changes: 11 additions & 4 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import os
import re
import sqlite3
import stat
import time
import urllib
from http.client import HTTPConnection
Expand Down Expand Up @@ -262,11 +263,17 @@ def get_next_clone_name(all_names, basename, name_suffix='', ts=False):

def is_libvirtd_up():
"""
Checks if libvirtd.service is up.
Checks if libvirt is up.
"""
cmd = ['systemctl', 'is-active', 'libvirtd.service']
output, error, rc = run_command(cmd, silent=True)
return True if output == 'active\n' else False
path = os.path.join(config.get_libvirt_path(), 'libvirt-sock')
try:
mode = os.stat(path).st_mode
if stat.S_ISSOCK(mode):
return True
except:
pass

return False


def is_s390x():
Expand Down

0 comments on commit bc8f14e

Please sign in to comment.