[PATCH] bash-completion: add missing options to lnst-ctl completion
by Jan Tluka
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
install/lnst-ctl.bash | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/install/lnst-ctl.bash b/install/lnst-ctl.bash
index 27b064b..c1dd9c8 100644
--- a/install/lnst-ctl.bash
+++ b/install/lnst-ctl.bash
@@ -12,15 +12,19 @@ _list_has_item()
_lnst_ctl()
{
- local SHORT_OPTS="-a -A -c -d -h -m -o -p -x -v"
- local LONG_OPTS="--define-alias --override-alias --config --debug \
- --help --no-colours --disable-pool-checks \
- --packet-capture --result --verbose"
+ local SHORT_OPTS="-a -A -c -C -d -h -m -o -p -r -u -x -v"
+ local LONG_OPTS="--define-alias --override-alias \
+ --config --config-override \
+ --debug --help --no-colours --disable-pool-checks \
+ --packet-capture --pools --reduce-sync \
+ --result --multi-match --verbose"
local REQUIRE_ARG="-a --define-alias \
-A --override-alias \
-c --config \
- -x --result"
- local ACTIONS="config_only match_setup run list_pools"
+ -C --config-override \
+ -x --result \
+ --pools"
+ local ACTIONS="config_only match_setup run list_pools deconfigure"
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
@@ -29,7 +33,7 @@ _lnst_ctl()
case "$prev" in
-a|--define-alias) return 0 ;;
-A|--override-alias) return 0 ;;
- -c|--config)
+ -c|--config|-C|--config-override)
_filedir
return 0
;;
@@ -37,6 +41,10 @@ _lnst_ctl()
_filedir
return 0
;;
+ --pools)
+ _filedir
+ return 0
+ ;;
esac
# Complete long and shor options
--
2.7.4
7 years
[PATCH] bash-completion: remove shebang from bash completion scripts
by Jan Tluka
This fixes rpmlint errors reported from automated testing on koji builds.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
install/lnst-ctl.bash | 2 --
install/lnst-pool-wizard.bash | 2 --
install/lnst-slave.bash | 2 --
3 files changed, 6 deletions(-)
diff --git a/install/lnst-ctl.bash b/install/lnst-ctl.bash
index 62aab66..27b064b 100644
--- a/install/lnst-ctl.bash
+++ b/install/lnst-ctl.bash
@@ -1,5 +1,3 @@
-#!/bin/bash
-
# Bash completion script for lnst-ctl command
# Author: Radek Pazdera <rpazdera(a)redhat.com>
diff --git a/install/lnst-pool-wizard.bash b/install/lnst-pool-wizard.bash
index 599b6fa..a2c083e 100644
--- a/install/lnst-pool-wizard.bash
+++ b/install/lnst-pool-wizard.bash
@@ -1,5 +1,3 @@
-#!/bin/bash
-
# Bash completion script for lnst-pool-wizard command
# Author: Jiri Prochazka <jprochaz(a)redhat.com>
diff --git a/install/lnst-slave.bash b/install/lnst-slave.bash
index d939d7a..19da8f3 100644
--- a/install/lnst-slave.bash
+++ b/install/lnst-slave.bash
@@ -1,5 +1,3 @@
-#!/bin/bash
-
# Bash completion script for lnst-slave command
# Author: Radek Pazdera <rpazdera(a)redhat.com>
--
2.7.4
7 years
[PATCH 2/2] InterfaceManager: avoid infinite recursion when
deconfiguring veth pair
by Jan Tluka
When a user configures veth pair with both veths under root namespace the
infinite recursion is triggered.
Each device of veth pair stores a reference to it's peer in Device's
_master["other"]. It means that LNST will have two veth devices each
referencing the peer as master:
(veth1) (veth2)
Device1._if_index == 10 Device2._if_index == 20
Device1._master["other"] = [20] Device2._master["other"] = [10]
On deconfiguration of the veth pair LNST will try to deconfigure
first veth but since it references second veth as master it will start
deconfiguring this master interface. The second interface references the
first interface as master so it will attempt to deconfigure the first veth
device again, and so on until max level of recursion is reached.
This patch adds a check if the device that is deconfigured is referenced by
it's 'other' master. If the reference exists the deconfiguration of master
device will be skipped.
Fixes #187
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/InterfaceManager.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index b3ef427..0d1e292 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -563,7 +563,7 @@ class Device(object):
for m_id in self._master["other"]:
m_dev = self._if_manager.get_device(m_id)
- if m_dev:
+ if m_dev and self._if_index not in m_dev.get_master(primary=False):
m_dev.clear_configuration()
if self._conf != None and self._configured:
@@ -641,7 +641,7 @@ class Device(object):
for m_id in self._master["other"]:
m_dev = self._if_manager.get_device(m_id)
- if m_dev:
+ if m_dev and self._if_index not in m_dev.get_master(primary=False):
m_dev.deconfigure()
if self._conf != None and self._configured:
--
2.7.4
7 years
[PATCH 1/2] InterfaceManager: add Device method get_master()
by Jan Tluka
Returns the Device's master. Takes one parameter to determine if primary
or other master should be returned.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/InterfaceManager.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 3d28070..b3ef427 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -593,6 +593,12 @@ class Device(object):
elif if_index not in self._master["other"]:
self._master["other"].append(if_index)
+ def get_master(self, primary=True):
+ if primary:
+ return self._master["primary"]
+ else:
+ return self._master["other"]
+
def del_master(self, if_index):
if self._master["primary"] == if_index:
self._master["primary"] = None
--
2.7.4
7 years