Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-18 Thread phoracek
Petr Horáček has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 4: Code-Review+1

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-17 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 4:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-17 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 3:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-17 Thread osvoboda
Ondřej Svoboda has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/57151/2/lib/vdsm/network/configurators/dhclient.py
File lib/vdsm/network/configurators/dhclient.py:

Line 154: lease_file_names = [LEASE_FILE.format(dhclient_suffix, 
device_name)]
Line 155: lease_file_names.extend(
Line 156: iglob(NM_LEASE_FILE_GLOB.format(dhclient_suffix, 
device_name)))
Line 157: dated_lease_file_names = []
Line 158: for name in lease_file_names:
> define a helper function, and use max(key=) to find the newest file
Done
Line 159: try:
Line 160: modified_date = os.stat(name).st_mtime
Line 161: except OSError as e:
Line 162: if e.errno == errno.ENOENT:


-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-17 Thread danken
Dan Kenigsberg has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/57151/2/lib/vdsm/network/configurators/dhclient.py
File lib/vdsm/network/configurators/dhclient.py:

Line 154: lease_file_names = [LEASE_FILE.format(dhclient_suffix, 
device_name)]
Line 155: lease_file_names.extend(
Line 156: iglob(NM_LEASE_FILE_GLOB.format(dhclient_suffix, 
device_name)))
Line 157: dated_lease_file_names = []
Line 158: for name in lease_file_names:
define a helper function, and use max(key=) to find the newest file
Line 159: try:
Line 160: modified_date = os.stat(name).st_mtime
Line 161: except OSError as e:
Line 162: if e.errno == errno.ENOENT:


-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-16 Thread osvoboda
Ondřej Svoboda has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 2: Verified+1

Verified as a part of the whole branch: lease files written by NetworkManager 
are successfully found and used to inherit DUID.

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-16 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 2:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-12 Thread osvoboda
Ondřej Svoboda has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 1:

May 12 11:25:28 f23-host kernel: bond11: the permanent HWaddr of 
veth_T7jrD4ZBWw - 22:74:5c:be:66:b8 - is still in use by bond11 - set the 
HWaddr of veth_T7jrD4ZBWw to a different address to avoid conflicts

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-06 Thread osvoboda
Ondřej Svoboda has uploaded a new change for review.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..

dhclient: consider NetworkManager lease files for DUID too

If a device to be replaced by our bridge is owned by NetworkManager,
its lease file lies in /var/lib/NetworkManager. In that case dhclient
would not reuse DUID and get a different lease.

A new function now looks in /var/lib/dhclient for initscripts-written
ifcfg file, and in the above directory, and returns the name of a lease
file with the most recent DUID for the given device.

Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Signed-off-by: Ondřej Svoboda 
---
M lib/vdsm/network/configurators/dhclient.py
M lib/vdsm/network/configurators/ifcfg.py
2 files changed, 35 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/57151/1

diff --git a/lib/vdsm/network/configurators/dhclient.py 
b/lib/vdsm/network/configurators/dhclient.py
index eb4c99b..b7921b7 100644
--- a/lib/vdsm/network/configurators/dhclient.py
+++ b/lib/vdsm/network/configurators/dhclient.py
@@ -20,6 +20,7 @@
 
 from __future__ import absolute_import
 import errno
+from glob import iglob
 import logging
 import os
 import subprocess
@@ -35,6 +36,8 @@
 DHCLIENT_CGROUP = 'vdsm-dhclient'
 LEASE_DIR = '/var/lib/dhclient'
 LEASE_FILE = os.path.join(LEASE_DIR, 'dhclient{0}--{1}.lease')
+NM_LEASE_FILE_GLOB = os.path.join('/var/lib/NetworkManager',
+  'dhclient{0}-*-{1}.lease')
 
 
 class DhcpClient(object):
@@ -46,7 +49,7 @@
 self.family = family
 self.default_route = default_route
 self.duid_source_file = None if duid_source is None else (
-LEASE_FILE.format('' if family == 4 else '6', duid_source))
+find_newest_lease_file(duid_source, family))
 self.pidFile = self.PID_FILE % (family, self.iface)
 if not os.path.exists(LEASE_DIR):
 os.mkdir(LEASE_DIR)
@@ -138,3 +141,32 @@
 
 _, err = probe.communicate()
 return '-df' in err
+
+
+def find_newest_lease_file(device_name, ip_family):
+"""
+Return the path to the most recent lease file for a given device name and
+IP family.
+
+Lease files written both by initscripts and NetworkManager are considered.
+"""
+dhclient_suffix = '' if ip_family == 4 else '6'
+lease_file_names = [LEASE_FILE.format(dhclient_suffix, device_name)]
+lease_file_names.extend(
+iglob(NM_LEASE_FILE_GLOB.format(dhclient_suffix, device_name)))
+dated_lease_file_names = []
+for name in lease_file_names:
+try:
+modified_date = os.stat(name).st_mtime
+except OSError as e:
+if e.errno == errno.ENOENT:
+continue
+else:
+raise
+dated_lease_file_names.append((modified_date, name))
+
+if dated_lease_file_names:
+dated_lease_file_names.sort(reverse=True)
+return dated_lease_file_names[0][1]
+else:
+return None
diff --git a/lib/vdsm/network/configurators/ifcfg.py 
b/lib/vdsm/network/configurators/ifcfg.py
index baf3d8d..265c64b 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -562,8 +562,8 @@
 conf += 'STP=%s\n' % ('on' if bridge.stp else 'off')
 conf += 'ONBOOT=yes\n'
 if bridge.duid_source and dhclient.supports_duid_file():
-duid_source_file = dhclient.LEASE_FILE.format(
-'', bridge.duid_source)
+duid_source_file = dhclient.find_newest_lease_file(
+bridge.duid_source, 4)
 conf += 'DHCLIENTARGS="-df %s"\n' % duid_source_file
 
 if 'custom' in opts and 'bridge_opts' in opts['custom']:


-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: dhclient: consider NetworkManager lease files for DUID too

2016-05-06 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: dhclient: consider NetworkManager lease files for DUID too
..


Patch Set 1:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

-- 
To view, visit https://gerrit.ovirt.org/57151
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a102a2964ed5e5864ff516c71752a23c4c55cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches