Bug 1417707 - [RFE] add PERSISTENT_DHCLIENT=1 as default in host network
Summary: [RFE] add PERSISTENT_DHCLIENT=1 as default in host network
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: vdsm
Classification: oVirt
Component: General
Version: 4.18.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Edward Haas
QA Contact: Meni Yakove
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-30 17:39 UTC by exploit
Modified: 2018-06-06 07:55 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-06 07:55:59 UTC
oVirt Team: Network
Embargoed:
ylavi: ovirt-future?
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?


Attachments (Terms of Use)

Description exploit 2017-01-30 17:39:59 UTC
Description of problem:

I set my hosts on ovirtmgmt with DHCP. It happened several times that they lost their address for several reason, but never asked for a new lease, so the hosts become unreacheable.

Version-Release number of selected component (if applicable):


How reproducible:
choose dhcp as the default network access method on any host network

Steps to Reproduce:
1.
2.
3.

Actual results:
When a host lose its dhcp attributed address for any reason, the nic never asked for a new lease anymore, so the host become unreacheable.

Expected results:


Additional info:
What about adding the PERSISTENT_DHCLIENT=1 option as default for DHCP attribution in ifcfg file?

Comment 1 Dan Kenigsberg 2017-01-30 17:48:31 UTC
While we contemplate about this feature, I believe that it would be very easy to implement it as an ifcfg vdsm hook (bug 965929). Could you try it out and share the script here?

Comment 2 exploit 2017-01-31 14:17:23 UTC
(In reply to Dan Kenigsberg from comment #1)
> While we contemplate about this feature, I believe that it would be very
> easy to implement it as an ifcfg vdsm hook (bug 965929). Could you try it
> out and share the script here?

Thanks Dan, indeed very easy script to adapt from https://www.ovirt.org/blog/2016/05/modify-ifcfg-files/, it works on the first attempt:

#!/usr/bin/python

import os
import datetime
import sys
import json
import hooking

hook_data = hooking.read_json()

ifcfg_file = hook_data['ifcfg_file']
config_data = hook_data['config']
# adding to all ifcfg file: PERSISTENT_DHCLIENT=1"
config_data += "PERSISTENT_DHCLIENT=1\n"
hook_data['config'] = config_data
hooking.write_json(hook_data)
exit(0)

Now I have to deploy it on all of my hosts, that's why I asked for this parameter to be by default in ovirt, it could concern a lot of people. (even if ansible or puppet can do the same very easily)

Comment 3 exploit 2017-01-31 15:16:54 UTC
(In reply to exploit from comment #2)
> (In reply to Dan Kenigsberg from comment #1)
> > While we contemplate about this feature, I believe that it would be very
> > easy to implement it as an ifcfg vdsm hook (bug 965929). Could you try it
> > out and share the script here?
> 
> Thanks Dan, indeed very easy script to adapt from
> https://www.ovirt.org/blog/2016/05/modify-ifcfg-files/, it works on the
> first attempt:
> 
> #!/usr/bin/python
> 
> import os
> import datetime
> import sys
> import json
> import hooking
> 
> hook_data = hooking.read_json()
> 
> ifcfg_file = hook_data['ifcfg_file']
> config_data = hook_data['config']
> # adding to all ifcfg file: PERSISTENT_DHCLIENT=1"
> config_data += "PERSISTENT_DHCLIENT=1\n"
> hook_data['config'] = config_data
> hooking.write_json(hook_data)
> exit(0)
> 
> Now I have to deploy it on all of my hosts, that's why I asked for this
> parameter to be by default in ovirt, it could concern a lot of people. (even
> if ansible or puppet can do the same very easily)

I modified the hook to only write the option when dhcp is selected

#!/usr/bin/python

import os
import datetime
import sys
import json
import hooking

hook_data = hooking.read_json()

config_data = hook_data['config']
# adding to all ifcfg files containing dhcp: PERSISTENT_DHCLIENT=1"
if 'dhcp' in config_data:
    config_data += "PERSISTENT_DHCLIENT=1\n"
    hook_data['config'] = config_data
    hooking.write_json(hook_data)
exit(0)

Comment 4 Yaniv Lavi 2017-06-13 08:48:24 UTC
Can you share you thoughts as to why not make it the default?

Comment 5 Edward Haas 2017-07-03 14:14:26 UTC
(In reply to Yaniv Lavi from comment #4)
> Can you share you thoughts as to why not make it the default?

There is no real good reason against it, except for the complexity to detect that a request has failed to get a response and perhaps from the implication of choosing a non default behaviour.
When using PERSISTENT_DHCLIENT, the dhclient daemon is left forever (or until ifdown) running, which may or may not be trivial (or accepted) by the user.
In addition, the ifup will not return any error code if dhclient has failed to receive a response, it will be up to the user to handle such cases.

VDSM, in several cases, checks if a dhcp request has been answered or not, and takes actions accordingly. If we use now the PERSIST, it will complicate things.

Comment 6 Edward Haas 2017-07-04 05:15:13 UTC
As work is under way to move away from the ifcfg driver and use NetworkManager instead, the burden of monitoring and handling the dhclient is reduced to a minimum (if at all).
Therefore, we could re-examine this option and its need when we'll have NM driver operational.

Comment 7 Yaniv Lavi 2018-06-06 07:55:59 UTC
Closing old RFEs, please reopen if still needed.
Patches are always welcomed.
We are planning to transition to Network Manager based networking.


Note You need to log in before you can comment on or make changes to this bug.