VR reports a load balancer change as applied when haproxy.cfg cannot be replaced

未关闭 适合新手
#14,633 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

从 systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py 中的 CsLoadBalancer.process() 开始,追踪使用 haproxy -c 验证 haproxy.cfg.new 后如何处理 CsHelper.copy() 的结果。检查安装失败如何报告给配置运行过程,然后与现有的验证失败处理路径进行比较。完成的标准是安装失败会导致应用失败,从而让管理服务器能够回滚。

由索引模型根据 Issue 内容生成。

描述

problem

When a virtual router can't replace /etc/haproxy/haproxy.cfg, it still reports a load balancer config change as applied.

CsLoadBalancer.process() (systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py) writes the new config to haproxy.cfg.new, checks it with haproxy -c, and then installs it with CsHelper.copy(). CsHelper.copy() catches the IOError, logs Could not copy /etc/haproxy/haproxy.cfg.new to /etc/haproxy/haproxy.cfg, and returns. The router then reloads HAProxy, which reads the old file, and the config run ends successfully.

The management server therefore gets a successful answer, records the change as applied, and doesn't roll it back, while the router keeps serving the old configuration. A config that fails haproxy -c already makes the apply fail, so only this path is silent.

versions

4.22 (the code is the same on main).

The steps to reproduce the bug
  1. Create a load balancer rule on an isolated network or VPC served by a virtual router.
  2. On the router, make the config file unwritable, for example chattr +i /etc/haproxy/haproxy.cfg.
  3. Change the rule, for example updateLoadBalancerRule algorithm=leastconn, or add a rule.
  4. The API call succeeds and listLoadBalancerRules shows the new values. The router's /var/log/cloud.log has Could not copy /etc/haproxy/haproxy.cfg.new to /etc/haproxy/haproxy.cfg, and /etc/haproxy/haproxy.cfg still has the old config.
What to do about it?

Fail the apply when the new config can't be installed, the same way as when it fails haproxy -c, so that the management server sees the failure and rolls back.

主要语言
Java
星标
3.1k
派生
1.4k
平均合并
6 天 20 小时
30 天内合并 PR
17

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。