Skip to content

Conversation

@bradh352
Copy link

@bradh352 bradh352 commented Nov 3, 2025

Description

static routes that don't reference a private gateway don't have an ip_address and therefore will throw a key error:

root@r-359-VM:/var/cache/cloud# update_config.py ip_associations.json.7407b8bd-21c6-4d99-aae0-f2193412650c
Traceback (most recent call last):
  File "/opt/cloud/bin/update_config.py", line 147, in <module>
    process_file()
  File "/opt/cloud/bin/update_config.py", line 57, in process_file
    finish_config()
  File "/opt/cloud/bin/update_config.py", line 42, in finish_config
    returncode = configure.main(sys.argv)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/cloud/bin/configure.py", line 1647, in main
    config.address().process()
  File "/opt/cloud/bin/cs/CsAddress.py", line 138, in process
    ip.configure(address)
  File "/opt/cloud/bin/cs/CsAddress.py", line 348, in configure
    self.post_configure(address)
  File "/opt/cloud/bin/cs/CsAddress.py", line 370, in post_configure
    self.post_config_change("add")
  File "/opt/cloud/bin/cs/CsAddress.py", line 824, in post_config_change
    self.fw_vpcrouter()
  File "/opt/cloud/bin/cs/CsAddress.py", line 606, in fw_vpcrouter
    if static_route['ip_address'] == self.address['public_ip'] and not static_route['revoke']:
       ~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'ip_address'

Example static routes:

root@r-359-VM:/var/cache/cloud# cat /etc/cloudstack/staticroutes.json
{
  "10.10.48.0/20": {
    "gateway": "10.252.240.10",
    "network": "10.10.48.0/20",
    "revoke": false
  },
  "10.250.0.0/16": {
    "gateway": "10.252.240.10",
    "network": "10.250.0.0/16",
    "revoke": false
  },
  "id": "staticroutes"
}

Fixes #11965

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)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Tested in a production environment by manually editing the file and observe the changes no longer cause an exception.

How did you try to break this feature and the system with this change?

static routes that don't reference a private gateway don't have an
ip_address and therefore will throw a key error:
```
root@r-359-VM:/var/cache/cloud# update_config.py ip_associations.json.7407b8bd-21c6-4d99-aae0-f2193412650c
Traceback (most recent call last):
  File "/opt/cloud/bin/update_config.py", line 147, in <module>
    process_file()
  File "/opt/cloud/bin/update_config.py", line 57, in process_file
    finish_config()
  File "/opt/cloud/bin/update_config.py", line 42, in finish_config
    returncode = configure.main(sys.argv)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/cloud/bin/configure.py", line 1647, in main
    config.address().process()
  File "/opt/cloud/bin/cs/CsAddress.py", line 138, in process
    ip.configure(address)
  File "/opt/cloud/bin/cs/CsAddress.py", line 348, in configure
    self.post_configure(address)
  File "/opt/cloud/bin/cs/CsAddress.py", line 370, in post_configure
    self.post_config_change("add")
  File "/opt/cloud/bin/cs/CsAddress.py", line 824, in post_config_change
    self.fw_vpcrouter()
  File "/opt/cloud/bin/cs/CsAddress.py", line 606, in fw_vpcrouter
    if static_route['ip_address'] == self.address['public_ip'] and not static_route['revoke']:
       ~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'ip_address'
```

Example static routes:
```
root@r-359-VM:/var/cache/cloud# cat /etc/cloudstack/staticroutes.json
{
  "10.10.48.0/20": {
    "gateway": "10.252.240.10",
    "network": "10.10.48.0/20",
    "revoke": false
  },
  "10.250.0.0/16": {
    "gateway": "10.252.240.10",
    "network": "10.250.0.0/16",
    "revoke": false
  },
  "id": "staticroutes"
}
```
@weizhouapache
Copy link
Member

@bradh352
can you rebase with 4.22 branch ? so the fix will be in 4.22.1

@weizhouapache weizhouapache changed the title Python exception processing static routes VPC: fix Python exception processing static routes with next hop when private gateway is also present Nov 3, 2025
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.56%. Comparing base (2dbc86a) to head (836aecf).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11967   +/-   ##
=========================================
  Coverage     17.56%   17.56%           
- Complexity    15542    15545    +3     
=========================================
  Files          5909     5909           
  Lines        529058   529056    -2     
  Branches      64617    64617           
=========================================
+ Hits          92922    92948   +26     
+ Misses       425683   425654   -29     
- Partials      10453    10454    +1     
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests 18.63% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bradh352
Copy link
Author

bradh352 commented Nov 3, 2025

@bradh352 can you rebase with 4.22 branch ? so the fix will be in 4.22.1

I'm not actually seeing a 4.22 branch upstream unless I'm missing it. I see some release-candidate branches.

Is there any possibility in getting this into 4.22.0? This is actually a blocker for us.

@weizhouapache
Copy link
Member

@bradh352 can you rebase with 4.22 branch ? so the fix will be in 4.22.1

I'm not actually seeing a 4.22 branch upstream unless I'm missing it. I see some release-candidate branches.

Is there any possibility in getting this into 4.22.0? This is actually a blocker for us.

oh my bad. I thought there is already a 4.22 branch 🤦

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

@weizhouapache
Copy link
Member

@bradh352 can you rebase with 4.22 branch ? so the fix will be in 4.22.1

I'm not actually seeing a 4.22 branch upstream unless I'm missing it. I see some release-candidate branches.

Is there any possibility in getting this into 4.22.0? This is actually a blocker for us.

I am not sure if this is a blocker for 4.22.0.0 release
@harikrishna-patnala

if this will not be in 4.22.0.0, you can refer to #10184 (reply in thread) how to patch the kvm hosts.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@bradh352
Copy link
Author

bradh352 commented Nov 4, 2025

@bradh352 can you rebase with 4.22 branch ? so the fix will be in 4.22.1

I'm not actually seeing a 4.22 branch upstream unless I'm missing it. I see some release-candidate branches.
Is there any possibility in getting this into 4.22.0? This is actually a blocker for us.

I am not sure if this is a blocker for 4.22.0.0 release @harikrishna-patnala

if this will not be in 4.22.0.0, you can refer to #10184 (reply in thread) how to patch the kvm hosts.

pretty please? :)

@weizhouapache
Copy link
Member

weizhouapache commented Nov 4, 2025

@bradh352

you can download the tarball and save as /usr/share/cloudstack-common/vms/cloud-scripts.tgz on all kvm hosts and mgmt servers (if you use other hypervisor types)

cloud-scripts-4.22.0.0.zip

note: ACS 4.22.0.0 only

@DaanHoogland DaanHoogland changed the base branch from main to 4.22 November 5, 2025 15:25
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.

Private Gateway prevents VPC from starting (4.21.0)

3 participants