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

Fix restart network error when set host name in pure ipv6 network #256

Merged
merged 1 commit into from
Aug 17, 2017

Conversation

ailisp
Copy link
Member

@ailisp ailisp commented Aug 8, 2017

ISSUE: In pure ipv6 network, after set hostname, appliance console will restart network. Currently we're using systemctl restart network, which can't successfully start network after stop it and cause appliance console crushed. But using NetworkManager is fine. As in https://access.redhat.com/solutions/783533 , network is considered as depreicate and we can update to use NetworkManager instead

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1475804

\cc @gtanzillo @yrudman

@miq-bot add-label wip, bug

@miq-bot miq-bot changed the title Fix restart network error when set host name in pure ipv6 network [WIP] Fix restart network error when set host name in pure ipv6 network Aug 8, 2017
@yrudman
Copy link
Contributor

yrudman commented Aug 8, 2017

@bdunne could you review

Copy link
Member

@bdunne bdunne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay, is there any reason it's marked as [WIP]?

@ailisp
Copy link
Member Author

ailisp commented Aug 11, 2017 via email

@ailisp
Copy link
Member Author

ailisp commented Aug 11, 2017

@miq-bot remove-label wip

@ailisp ailisp changed the title [WIP] Fix restart network error when set host name in pure ipv6 network Fix restart network error when set host name in pure ipv6 network Aug 11, 2017
@miq-bot miq-bot removed the wip label Aug 11, 2017
@ailisp
Copy link
Member Author

ailisp commented Aug 14, 2017

@carbonin Can we merge this? Thanks.

@carbonin
Copy link
Member

I don't think we have NetworkManager installed on the appliance. I remember doing some things to explicitly disable it so that we use the network service directly.

Can you pin down why the restart is failing when we are not using NetworkManager?

@ailisp
Copy link
Member Author

ailisp commented Aug 14, 2017

@carbonin I've find the error log for systemctl network restart. Let me find it. For NetworkManager, I think it's installed because I've tried in that appliance.

@@ -307,7 +307,7 @@ module ApplianceConsole
system_hosts.hostname = new_host
system_hosts.set_loopback_hostname(new_host)
system_hosts.save
LinuxAdmin::Service.new("network").restart
LinuxAdmin::Service.new("NetworkManager").restart
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm not sure why this restart is here. Can we just remove it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my search, some documents said we need to restart the machine, while some docs require to at least restart network service to make hostname change take effect: https://www.howtogeek.com/50631/how-to-change-your-linux-hostname-without-rebooting/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hostnamectl command which we're running seems to take care of everything and not require a reboot.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec_Configuring_Host_Names_Using_hostnamectl.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdunne Thanks. hostnamectl set-hostname name works. And it's much faster than systemctl restart network. But the bug disappear today, systemctl restart network works and set hostname in ap won't crash. Do we still want to change that to hostnamectl? @carbonin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ailisp We are already using hostnamectl in LinuxAdmin::Hosts#hostname=. That's why @bdunne suggested just getting rid of this line.

Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably squash the two commits here, looks good otherwise 👍

@carbonin carbonin self-assigned this Aug 17, 2017
@ailisp ailisp force-pushed the ipv6-set-hostname branch from 3e161c7 to b5d991f Compare August 17, 2017 13:27
@miq-bot
Copy link
Member

miq-bot commented Aug 17, 2017

Checked commit ailisp@b5d991f with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🍪

@carbonin carbonin added this to the Sprint 67 Ending Aug 21, 2017 milestone Aug 17, 2017
@carbonin carbonin merged commit cbc714f into ManageIQ:master Aug 17, 2017
simaishi pushed a commit that referenced this pull request Aug 17, 2017
Fix restart network error when set host name in pure ipv6 network
(cherry picked from commit cbc714f)

https://bugzilla.redhat.com/show_bug.cgi?id=1482669
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 0fb020cfec87b51eec36ebc82a8c8d0e2431fa7c
Author: Nick Carboni <[email protected]>
Date:   Thu Aug 17 09:38:18 2017 -0400

    Merge pull request #256 from ailisp/ipv6-set-hostname
    
    Fix restart network error when set host name in pure ipv6 network
    (cherry picked from commit cbc714fa4235bfb34436e4ce7344a4200194a2e9)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1482669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants