Dan Kenigsberg has uploaded a new change for review.
Change subject: tc: retire ifconfig ......................................................................
tc: retire ifconfig
ifconfig was deprecated quite a few years ago, and some modern distribution do not ship it by default.
In this patch, we dump its only use, by setting promisc flag directly. We implement set_flags() in hope to see ethtool add it.
Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Signed-off-by: Dan Kenigsberg danken@redhat.com --- M configure.ac M vdsm/constants.py.in M vdsm/tc.py M vdsm_reg/deployUtil.py.in 4 files changed, 30 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/9370/1
diff --git a/configure.ac b/configure.ac index 5d8b238..b8f1825 100644 --- a/configure.ac +++ b/configure.ac @@ -144,7 +144,6 @@ AC_PATH_PROG([FUSER_PATH], [fuser], [/sbin/fuser]) AC_PATH_PROG([GRUBBY_PATH], [grubby], [/sbin/grubby]) AC_PATH_PROG([HWCLOCK_PATH], [hwclock], [/usr/sbin/hwclock]) -AC_PATH_PROG([IFCONFIG_PATH], [ifconfig], [/sbin/ifconfig]) AC_PATH_PROG([IFDOWN_PATH], [ifdown], [/sbin/ifdown]) AC_PATH_PROG([IFUP_PATH], [ifup], [/sbin/ifup]) AC_PATH_PROG([IONICE_PATH], [ionice], [/usr/bin/ionice]) diff --git a/vdsm/constants.py.in b/vdsm/constants.py.in index 2e9eb99..07dd431 100644 --- a/vdsm/constants.py.in +++ b/vdsm/constants.py.in @@ -97,7 +97,6 @@ EXT_FSCK = '@FSCK_PATH@' EXT_FUSER = '@FUSER_PATH@'
-EXT_IFCONFIG = '@IFCONFIG_PATH@' EXT_IFDOWN = '@IFDOWN_PATH@' EXT_IFUP = '@IFUP_PATH@' EXT_IONICE = '@IONICE_PATH@' diff --git a/vdsm/tc.py b/vdsm/tc.py index a0a612f..7630b9b 100644 --- a/vdsm/tc.py +++ b/vdsm/tc.py @@ -19,11 +19,15 @@ #
from collections import namedtuple +from contextlib import closing +import ctypes +import fcntl +import socket
import ethtool
import storage.misc -from vdsm.constants import EXT_TC, EXT_IFCONFIG +from vdsm.constants import EXT_TC
ERR_DEV_NOEXIST = 2
@@ -155,12 +159,32 @@ raise
+def set_flags(dev, flags): + "Set device flags. We need this local definition until ethtool has it" + + SIOCSIFFLAGS = 0x8914 + + class ifreq(ctypes.Structure): + _fields_ = [("ifr_ifrn", ctypes.c_char * 16), + ("ifr_flags", ctypes.c_short)] + + with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s: + ifr = ifreq() + ifr.ifr_ifrn = dev + ifr.ifr_flags = flags + + fcntl.ioctl(s.fileno(), SIOCSIFFLAGS, ifr) + + def set_promisc(dev, on=True): - promisc = 'promisc' - if not on: - promisc = '-promisc' - command = [EXT_IFCONFIG, dev, promisc] - _process_request(command) + flags = ethtool.get_flags(dev) + + if on: + flags |= ethtool.IFF_PROMISC + else: + flags &= ~ethtool.IFF_PROMISC + + set_flags(dev, flags)
Filter = namedtuple('Filter', 'prio handle actions') diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in index dec03c2..0fe1275 100644 --- a/vdsm_reg/deployUtil.py.in +++ b/vdsm_reg/deployUtil.py.in @@ -65,7 +65,6 @@ EX_ECHO = '@ECHO_PATH@' EX_GRUBBY = '@GRUBBY_PATH@' EX_HWCLOCK = '@HWCLOCK_PATH@' -EX_IFCONFIG = '@IFCONFIG_PATH@' EX_NTPQ = '@NTPQ_PATH@' EX_OPENSSL = '@OPENSSL_PATH@' EX_REBOOT = '@REBOOT_PATH@'
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/111/ (2/2)
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/77/ (1/2)
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/77/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/111/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
I like it. Removing a deprecated dependency is always nice. I guess I would prefer if we would use the newer and preferred netlink interface, but this patch is a worthy advancement. I will try to verify it tomorrow.
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Hunt Xu has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Hunt Xu mhuntxu@gmail.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Mark Wu has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Hunt Xu mhuntxu@gmail.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Igor Lvovsky has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1: Looks good to me, approved
If your already started this, you should continue with removing
vdsm/vdsmd.init.in: if ! LC_ALL=C /sbin/ifconfig lo | /bin/grep -q UP;
:)
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Hunt Xu mhuntxu@gmail.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: tc: retire ifconfig ......................................................................
Patch Set 1: Verified
Ok Igor, in a future patch.
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Hunt Xu mhuntxu@gmail.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: tc: retire ifconfig ......................................................................
tc: retire ifconfig
ifconfig was deprecated quite a few years ago, and some modern distribution do not ship it by default.
In this patch, we dump its only use, by setting promisc flag directly. We implement set_flags() in hope to see ethtool add it.
Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Signed-off-by: Dan Kenigsberg danken@redhat.com --- M configure.ac M vdsm/constants.py.in M vdsm/tc.py M vdsm_reg/deployUtil.py.in 4 files changed, 30 insertions(+), 9 deletions(-)
Approvals: Hunt Xu: Looks good to me, but someone else must approve Antoni Segura Puimedon: Looks good to me, but someone else must approve Mark Wu: Looks good to me, but someone else must approve Dan Kenigsberg: Verified Igor Lvovsky: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/9370 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: Ifb4f289efb5754d7c49ac0a08e3a9adc09b12bb7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Hunt Xu mhuntxu@gmail.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org