[PATCH V2 0/2] Warn users about NetworkManager instability

V2: - Change is_nm_running to use a 'cross distro' command. - Update the warning message NetworkManager might have some instability when managing the bridges created by libvirt. There some bugs against NM about it and there is no much we can do more than warn the users about it. So, this patchset checks if NM is running and, if so, will display a message to users. Jose Ricardo Ziviani (2): Implement function to check if NM is running. Add a warn about NM running in the system. src/kimchi/model/config.py | 1 + src/kimchi/model/featuretests.py | 10 ++++++++++ tests/test_rest.py | 3 ++- ui/js/src/kimchi.network.js | 5 +++++ ui/pages/i18n.json.tmpl | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) -- 1.9.1

- 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@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 16ff41d..603e531 100644 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -1098,7 +1098,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

- If NetworkManager is running when user is trying to create a bridge, it will warn about problems that could happen, asking the user to turn NM service off while dealing with bridge creation. Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- ui/js/src/kimchi.network.js | 5 +++++ ui/pages/i18n.json.tmpl | 1 + 2 files changed, 6 insertions(+) diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js index 90fb62b..be140e8 100644 --- a/ui/js/src/kimchi.network.js +++ b/ui/js/src/kimchi.network.js @@ -323,6 +323,11 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail) { kimchi.enableBridgeOptions(false); $("#networkBriDisabledLabel").show(); } else { + kimchi.getCapabilities(function(result) { + if (result && result.nm_running) { + kimchi.message.warn(i18n['KCHNET6001W']); + } + }); $("#bridgeOptions").slideDown(100); $("#networkVlanID").toggle(false); $("#labelNetworkVlanID").toggle(false); diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index a7f9daf..a6e3f5b 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -153,6 +153,7 @@ "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", "KCHNET6003M": "$_("Create a network")", "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")", + "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")", "KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")", "KCHPOOL6002M": "$_("This storage pool is empty.")", -- 1.9.1

On 20/04/2015 16:43, Jose Ricardo Ziviani wrote:
- If NetworkManager is running when user is trying to create a bridge, it will warn about problems that could happen, asking the user to turn NM service off while dealing with bridge creation.
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- ui/js/src/kimchi.network.js | 5 +++++ ui/pages/i18n.json.tmpl | 1 + 2 files changed, 6 insertions(+)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js index 90fb62b..be140e8 100644 --- a/ui/js/src/kimchi.network.js +++ b/ui/js/src/kimchi.network.js @@ -323,6 +323,11 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail) { kimchi.enableBridgeOptions(false); $("#networkBriDisabledLabel").show(); } else {
+ kimchi.getCapabilities(function(result) { + if (result && result.nm_running) { + kimchi.message.warn(i18n['KCHNET6001W']); + } + });
The kimchi.getCapabilities() result is cached on UI. So we just need to call it once (check on ui/js/src/kimchi.main.js) And then you can see an use of the cached value in ui/js/src/kimchi.host.js, ui/js/src/kimchi.repository_edit_main.js, ui/js/src/kimchi.template_add_main.js, etc
$("#bridgeOptions").slideDown(100); $("#networkVlanID").toggle(false); $("#labelNetworkVlanID").toggle(false); diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index a7f9daf..a6e3f5b 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -153,6 +153,7 @@ "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", "KCHNET6003M": "$_("Create a network")", "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")", + "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")",
"KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")", "KCHPOOL6002M": "$_("This storage pool is empty.")",

On 27-04-2015 09:43, Aline Manera wrote:
On 20/04/2015 16:43, Jose Ricardo Ziviani wrote:
- If NetworkManager is running when user is trying to create a bridge, it will warn about problems that could happen, asking the user to turn NM service off while dealing with bridge creation.
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- ui/js/src/kimchi.network.js | 5 +++++ ui/pages/i18n.json.tmpl | 1 + 2 files changed, 6 insertions(+)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js index 90fb62b..be140e8 100644 --- a/ui/js/src/kimchi.network.js +++ b/ui/js/src/kimchi.network.js @@ -323,6 +323,11 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail) { kimchi.enableBridgeOptions(false); $("#networkBriDisabledLabel").show(); } else {
+ kimchi.getCapabilities(function(result) { + if (result && result.nm_running) { + kimchi.message.warn(i18n['KCHNET6001W']); + } + });
The kimchi.getCapabilities() result is cached on UI. So we just need to call it once (check on ui/js/src/kimchi.main.js)
And then you can see an use of the cached value in ui/js/src/kimchi.host.js, ui/js/src/kimchi.repository_edit_main.js, ui/js/src/kimchi.template_add_main.js, etc
The problem with using a cached value is that it won't be updated if users turn NM off. Suppose you see the warning, then you turn NM off. If you go back to Kimchi you certainly don't expect to see that warning again. If I use a cached value, the warning will display anyway.
$("#bridgeOptions").slideDown(100); $("#networkVlanID").toggle(false); $("#labelNetworkVlanID").toggle(false); diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index a7f9daf..a6e3f5b 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -153,6 +153,7 @@ "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", "KCHNET6003M": "$_("Create a network")", "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")", + "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")",
"KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")", "KCHPOOL6002M": "$_("This storage pool is empty.")",
-- Jose Ricardo Ziviani ----------------------------- Software Engineer Linux Technology Center - IBM

On 27/04/2015 10:06, Jose Ricardo Ziviani wrote:
On 27-04-2015 09:43, Aline Manera wrote:
On 20/04/2015 16:43, Jose Ricardo Ziviani wrote:
- If NetworkManager is running when user is trying to create a bridge, it will warn about problems that could happen, asking the user to turn NM service off while dealing with bridge creation.
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- ui/js/src/kimchi.network.js | 5 +++++ ui/pages/i18n.json.tmpl | 1 + 2 files changed, 6 insertions(+)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js index 90fb62b..be140e8 100644 --- a/ui/js/src/kimchi.network.js +++ b/ui/js/src/kimchi.network.js @@ -323,6 +323,11 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail) { kimchi.enableBridgeOptions(false); $("#networkBriDisabledLabel").show(); } else {
+ kimchi.getCapabilities(function(result) { + if (result && result.nm_running) { + kimchi.message.warn(i18n['KCHNET6001W']); + } + });
The kimchi.getCapabilities() result is cached on UI. So we just need to call it once (check on ui/js/src/kimchi.main.js)
And then you can see an use of the cached value in ui/js/src/kimchi.host.js, ui/js/src/kimchi.repository_edit_main.js, ui/js/src/kimchi.template_add_main.js, etc
The problem with using a cached value is that it won't be updated if users turn NM off.
Suppose you see the warning, then you turn NM off. If you go back to Kimchi you certainly don't expect to see that warning again. If I use a cached value, the warning will display anyway.
You just need to refresh the browser to get the new values. I don't think it turns on a bad user experience.
$("#bridgeOptions").slideDown(100); $("#networkVlanID").toggle(false); $("#labelNetworkVlanID").toggle(false); diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index a7f9daf..a6e3f5b 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -153,6 +153,7 @@ "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", "KCHNET6003M": "$_("Create a network")", "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")", + "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")",
"KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")", "KCHPOOL6002M": "$_("This storage pool is empty.")",
participants (3)
-
Aline Manera
-
Jose Ricardo Ziviani
-
Ramon Medeiros