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

Do not accept hostname from DHCP, use static one #2270

Closed

Conversation

mnowaksuse
Copy link

POO#15740

On Xen under svirt backend we don't have user-mode networking we have
for KVM and Qemu. If networking.service is restarted (explicitly or by
system restart) on Xen the system accepts new hostname different from
the static one.

This change prevents system to set as a hostname whatever comes from
DHCP and sticks with static hostname. Otherwise yast2_lan test fails:
https://openqa.suse.de/tests/692200.

Now hostname --fqdn fails on all systems but that's expected as domain
name is not set.

Verification runs:
Xen: http://assam.suse.cz/tests/4578
KVM: http://assam.suse.cz/tests/4575
Qemu: http://assam.suse.cz/tests/4577

@mnowaksuse
Copy link
Author

@okurz
Copy link
Member

okurz commented Jan 4, 2017

I am not sure about this one. Don't we want to test how the hostname is set by DHCP or does it not make sense to test this and why?

@mnowaksuse
Copy link
Author

My sense is that we avoid looking at hostname, if we feel it may came from DHCP, where possible - be it in needle matching in YaST, or on virtual console prompt -, because there's new name for every new VM. Couldn't find a test where we actually test hostname sent from DHCP.

I don't know why setting static hostname, then restarting network.service, and then getting that hostname from DHCP works for Qemu and KVM (both use usermode networking), but 1) looks like a hack to me, 2) it does not work with bridged interfaces. Can't use user mode networking on Xen.

Other approaches:

  1. Configure Xen host to provide similar behavior to Qemu user mode networking. - No idea how.
  2. Keep hostname.pm intact, but change needles for Xen and treat it as a special case.

(Though I prefer my original approach.)

@dzedro
Copy link
Contributor

dzedro commented Jan 4, 2017

I was thinking why is this not Xen/svirt specific, I had no good arguments to not set static hostname, so I didn't comment, but with this behavior we will avoid default settings.

@dzedro
Copy link
Contributor

dzedro commented Jan 4, 2017

e.g. with this all PUBLISH_HDD_1 will have static hostname, "custom setup".

@okurz
Copy link
Member

okurz commented Jan 4, 2017

yes, does not sound like a good idea

@mnowaksuse
Copy link
Author

This

assert_script_run("sed -ie '/DHCLIENT_SET_HOSTNAME=/s/=.*/=\"yes\"/' /etc/sysconfig/network/dhcp");

should avoid that "custom setup" issue as new SUT boot or later yast2 lan run would re-set to retrieving hostnames from DHCP.

@dzedro
Copy link
Contributor

dzedro commented Jan 5, 2017

exactly yast_lan is not running when disk image is created e.g. https://openqa.suse.de/tests/692578

@dzedro
Copy link
Contributor

dzedro commented Jan 5, 2017

I see you added that "yes" part, but now it is not "Do not accept hostname from DHCP, use static one" anymore :)

POO#15740

On Xen under svirt backend we don't have user-mode networking we have
for KVM and Qemu. If networking.service is restarted (explicitly or by
system restart) on Xen, the system accepts hostname different from the
former static one.

This change prevents system to set as a hostname whatever comes from
DHCP during `consoletest` base and sticks with static hostname.
Otherwise yast2_lan test fails: https://openqa.suse.de/tests/692200.

After yast2_lan test is run, hostname is re-set to whatever comes from
DHCP.

Now `hostname --fqdn` fails on all systems, but that's expected as
domain name is not set.

Verification runs:
* Xen:  http://assam.suse.cz/tests/4578
* KVM:  http://assam.suse.cz/tests/4575
* Qemu: http://assam.suse.cz/tests/4577
@mnowaksuse
Copy link
Author

This is somewhat messy approach. I should rather come up with different solution.

@mnowaksuse mnowaksuse closed this Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants