Skip to content

systemvm: FIX haproxy is not reloaded but restarted in VR#4384

Closed
ustcweizhou wants to merge 1 commit into
apache:4.14from
ustcweizhou:4.14-fix-restart-haproxy
Closed

systemvm: FIX haproxy is not reloaded but restarted in VR#4384
ustcweizhou wants to merge 1 commit into
apache:4.14from
ustcweizhou:4.14-fix-restart-haproxy

Conversation

@ustcweizhou
Copy link
Copy Markdown
Contributor

Description

when upgrade to cloudstack 4.14 or 4.15, there is no process ends with "/run/haproxy.pid" after reload haproxy.
so haproxy is reloaded -> restarted -> reloaded -> restarted -> and so on

After restarting haproxy

root@r-2040-VM:~# ps aux |grep /usr/sbin/haproxy
root     24894  0.3  1.3  20492 13352 ?        Ss   09:14   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
root     24895  0.1  1.1  22332 11372 ?        Ss   09:14   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid

After reloading haproxy

root@r-2040-VM:~# systemctl reload haproxy
root@r-2040-VM:~# ps aux |grep /usr/sbin/haproxy
root     24894  0.0  1.3  20492 13300 ?        Ss   09:14   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -sf 24895
root     26694  0.0  0.9  22196  9488 ?        Ss   09:16   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -sf 24895

so use 'grep' to find if haproxy is running.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

when upgrade to cloudstack 4.14 or 4.15, there is no process ends with "/run/haproxy.pid" after reload haproxy.
so haproxy is reloaded -> restarted -> reloaded -> restarted -> and so on

After restarting haproxy
```
root@r-2040-VM:~# ps aux |grep /usr/sbin/haproxy
root     24894  0.3  1.3  20492 13352 ?        Ss   09:14   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
root     24895  0.1  1.1  22332 11372 ?        Ss   09:14   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
```

After reloading haproxy
```
root@r-2040-VM:~# systemctl reload haproxy
root@r-2040-VM:~# ps aux |grep /usr/sbin/haproxy
root     24894  0.0  1.3  20492 13300 ?        Ss   09:14   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -sf 24895
root     26694  0.0  0.9  22196  9488 ?        Ss   09:16   0:00 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -sf 24895
```

so use 'grep' to find if haproxy is running.
@yadvr yadvr added this to the 4.14.1.0 milestone Oct 14, 2020

proc = CsProcess(['/run/haproxy.pid'])
if not proc.find():
if proc.grep("/usr/sbin/haproxy") == -1:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

haven't tested this, should this be !=0 instead @ustcweizhou ?


proc = CsProcess(['/run/haproxy.pid'])
if not proc.find():
if proc.grep("/usr/sbin/haproxy") == -1:
Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti Oct 15, 2020

Choose a reason for hiding this comment

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

@ustcweizhou this is the same fix done in the PR: #4386, changes in "CsRedundant.py" for keepalived process. As I've commented in that PR, on a broader view, other processes might have similar issue. can this be fixed in CsProcess.py ? else slowly at some point, we'll end up replacing all proc.find() with proc.grep().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@sureshanaparti I will make change on proc.find

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan package

@apache apache deleted a comment from yadvr Oct 15, 2020
@apache apache deleted a comment from blueorangutan Oct 15, 2020
@apache apache deleted a comment from blueorangutan Oct 15, 2020
@apache apache deleted a comment from blueorangutan Oct 15, 2020
@blueorangutan
Copy link
Copy Markdown

@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2186

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.

6 participants