Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1264 : Libvirt check should only look for socket #1288

Merged
merged 1 commit into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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