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

Attach floating IP to a VM in Elektra should filter out all clearly wrong FIPs #1304

Open
kayrus opened this issue Dec 13, 2023 · 0 comments

Comments

@kayrus
Copy link
Contributor

kayrus commented Dec 13, 2023

Screenshot_20231213_220754

A VM can have multiple interfaces, each interface can have its own set of FIPs to be assigned to avoid an error above.

Elektra should check available "port-FIP'-pairs in advance before putting them into the "Attach FIP" dropdown to avoid such messages.

Here is a script, which can list valid FIPs per each server's interface:

#!/bin/bash

os=openstack
server_id=$1
for port in `$os port list --device-id $server_id -f value -c id`; do
  for subnet_id in `$os port show $port -f json -c fixed_ips | jq -r '.fixed_ips[]|.subnet_id'`; do
    for router_port in `$os port list --fixed-ip subnet=$subnet_id --device-owner network:router_interface -f value -c id`; do
      router_id=$($os port show $router_port -f value -c device_id)
      for router_fip_subnet in `$os router show $router_id -f json -c external_gateway_info | jq -r '.external_gateway_info.external_fixed_ips[]|.subnet_id'`; do
        router_fip_network=$($os subnet show $router_fip_subnet -f value -c network_id)
        echo "The $server_id server's $port port can have the following FIPs:"
        $os floating ip list --network $router_fip_network -f json | jq -r '.[]|select(."Fixed IP Address"==null)|."Floating IP Address"'
      done
    done
  done
done
@kayrus kayrus changed the title Attach floating IP to a VM in Elektra should filter out all all clearly wrong FIPs Attach floating IP to a VM in Elektra should filter out all clearly wrong FIPs Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants