[Kimchi-devel] [PATCH V3 1/2] Implement function to check if NM is running.
Jose Ricardo Ziviani
joserz at linux.vnet.ibm.com
Mon Apr 27 14:45:02 UTC 2015
- NetworkManager does not (fully) support bridges yet and there is no
portable/bullet-proof way to solve any possible issue that may happen
to libvirt bridge creation due to NM problems.
- This commit adds a new capability to inform the frontend whether the
NM is running or not, so the frontend could inform the user about it.
Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
src/kimchi/model/config.py | 1 +
src/kimchi/model/featuretests.py | 10 ++++++++++
tests/test_rest.py | 3 ++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py
index 1c43360..a417c9b 100644
--- a/src/kimchi/model/config.py
+++ b/src/kimchi/model/config.py
@@ -140,6 +140,7 @@ class CapabilitiesModel(object):
'federation': kconfig.get("server", "federation"),
'auth': kconfig.get("authentication", "method"),
'kernel_vfio': self.kernel_vfio,
+ 'nm_running': FeatureTests.is_nm_running(),
}
diff --git a/src/kimchi/model/featuretests.py b/src/kimchi/model/featuretests.py
index 4aac8ed..8cbe31d 100644
--- a/src/kimchi/model/featuretests.py
+++ b/src/kimchi/model/featuretests.py
@@ -223,3 +223,13 @@ class FeatureTests(object):
kimchi_log.warning("Unable to load Kernal module vfio-pci.")
return False
return True
+
+ @staticmethod
+ def is_nm_running():
+ '''Tries to determine whether NetworkManager is running.'''
+
+ out, err, rc = run_command(['nmcli', 'dev', 'status'])
+ if rc != 0:
+ return False
+
+ return True
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 4ade722..686d54c 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1025,7 +1025,8 @@ class RestTests(unittest.TestCase):
keys = [u'libvirt_stream_protocols', u'qemu_stream', u'qemu_spice',
u'screenshot', u'system_report_tool', u'update_tool',
- u'repo_mngt_tool', u'federation', u'kernel_vfio', u'auth']
+ u'repo_mngt_tool', u'federation', u'kernel_vfio', u'auth',
+ u'nm_running']
self.assertEquals(sorted(keys), sorted(conf.keys()))
def test_peers(self):
--
1.9.1
More information about the Kimchi-devel
mailing list