Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ifcfg script name in case DEVICE parameter is not specified on redhat network_config provider #90

Merged
merged 1 commit into from
Mar 10, 2015

Conversation

stzilli
Copy link
Contributor

@stzilli stzilli commented Jan 5, 2015

In network_config redhat provider, if DEVICE is not present in a ifcfg script file, filemapper
will fail to parse that file. With this change, if the parameter is not present, the name of
the ifcfg file itself is used.

@adrienthebo
Copy link
Member

@jhoblitt @igalic thoughts?

@jhoblitt
Copy link
Member

jhoblitt commented Feb 4, 2015

In terms of the proposed feature, this is consistent with how /etc/init.d/network determines interface names. It uses a name derived from the configuration file name if DEVICE isn't declared in the file. Eg.

    if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi

At first glance, I don't think the fixture network-scripts/ifcfg-eth4 added by this PR is used at all. I'm not sure what virbonding/eth4 is demonstrating since it includes the DEVICE name. This feature should have explicit test coverage before merging.

I suspect the other test failures will be resolved by rebasing on the current master.

@stzilli
Copy link
Contributor Author

stzilli commented Feb 4, 2015

I agree, the fixture is not testing anything at all ... I don't remember why I wrote it this way. I will rewrite the test to actually do something.

@jhoblitt
Copy link
Member

jhoblitt commented Feb 4, 2015

Another issue occurred to me, which is how should flushing behave if the interface file doesn't already have DEVICE declared in it? Do we flush them as per normal and insert DEVICE into all configuration files where it was missing or try to preserve the original format? Do we strip DEVICE if it can be inferred from the filename? If a new configuration file is being written, does or doesn't it contain the DEVICE declaration?

@stzilli
Copy link
Contributor Author

stzilli commented Feb 5, 2015

For now the device is always flushed but maybe we can leave this decision to the user. I don't have a strong opinion but maybe we can have something like this as default behaviour: if the DEVICE is not there, don't insert it; if the DEVICE is there, leave it. In case of new configuration I really don't know what would be the best behaviour. Probably, to be consistent with the previous two cases it would be better not to add it? In addition we could have a new parameter "force_device" that will force the device to be always inserted.

…dhat network_config provider

In network_config redhat provider, if DEVICE is not present in a ifcfg script file, filemapper
will fail to parse that file. With this change, if the parameter is not present, the name of
the ifcfg file itself is used.

Fixes #89
@jhoblitt
Copy link
Member

jhoblitt commented Feb 5, 2015

Is there any use case where the DEVICE declaration must be omitted?

@stzilli
Copy link
Contributor Author

stzilli commented Feb 6, 2015

For what I can see these files without DEVICE are generated by anaconda. In case an ifcfg file is missing for a certain device anaconda dumps the corresponding connection from networkmanager after renaming it using the device name. I don't really know how this works exactly but I think that for connections regarding disconnected devices the DEVICE field is not configured.

[root@xxxx ~]# nmcli con
NAME      UUID                                  TYPE            DEVICE   
enp5s0f1  71b76e88-9a4d-4916-86b1-30b2ec54ee53  802-3-ethernet  --       
enp5s0f0  4a0c2374-086f-484e-a3a2-5944f97a0603  802-3-ethernet  enp5s0f0 

[root@xxxx ~]# nmcli dev
DEVICE    TYPE      STATE         CONNECTION 
enp5s0f0  ethernet  connected     enp5s0f0   
enp5s0f1  ethernet  disconnected  --         
lo        loopback  unmanaged     --         

I don't think there is a use case where it's mandatory to omit DEVICE. Setting it and reloading the configuration seems not to change anything.

adrienthebo added a commit that referenced this pull request Mar 10, 2015
Use ifcfg script name in case DEVICE parameter is not specified on redhat network_config provider
@adrienthebo adrienthebo merged commit a3cc633 into voxpupuli:master Mar 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants