F5Networks / f5-openstack-image-prep

Contains scripts to prepare an F5® BIG-IP® VE image file to boot in OpenStack.
Apache License 2.0
0 stars 13 forks source link

Feature Request: Allow for mgmt IP to be static setting #73

Open thomsonjames opened 7 years ago

thomsonjames commented 7 years ago

Currently, the Openstack-network.sh has settings for the tmm interfaces and you can set dhcp to false. We'd like to request a feature be added whereby the mgmt interface could have the same options along with the settings for IP address and netmask. command-wise, the global setting for dhcp_mgmt would need to be set to disabled and then a static IP defined.

Please let me know if you need any more information or if the setting exists and I just can't find it.

grmarxer commented 7 years ago

My customer does not use DHCP on the mgmt interface and would also benefit from this request.

prabhatkarki commented 7 years ago

Lines can be added in the os-network.sh script in order for it to find the mgmt IP addresses and other parameters such as default GW and eth0 MTU from the json user-data file in the config-drive and use those values to configure mgmt where DHCP is not being used on mgmt interface.

The json file portion for network parameteres}, "network": { "mgmt_routes": { "mtu": "mgmt_mtu", "gateway": "mgmt_gateway" }, "interfaces": { "mgmt": { "dhcp": "false", "address": "mgmt_address", "netmask": "mgmt_netmask" }

When VM is instantiated this is how user-data looks with values populated. Active:Standalone] ~ # mount /dev/hdd /mnt

cat /mnt/openstack/latest/user_data },

    "network": {
        "mgmt_routes": {
               "mtu": "1400",
               "gateway": "11.0.0.1"
            },
         "interfaces": {
            "mgmt": {
        "dhcp": "false",
        "address": "11.0.0.166",
                "netmask": "255.255.255.0" 
            }

Lines added in os-network.sh . Shows the line numbers 306 function configure_mgmt_if { 307 log "About to assign IP to mgmt" 308 local dhcp_enabled=$(get_user_data_value {bigip}{network}{interfaces}{mgmt}{dhcp}) 309 if [[ $dhcp_enabled == false ]]; then 310
311 tmsh modify sys db dhclient.mgmt { value disable } 312
313 local address 314 local netmask 315 local destination 316 local gateway 317
318 address=$(get_user_data_value {bigip}{network}{interfaces}{mgmt}{address}) 319 netmask=$(get_user_data_value {bigip}{network}{interfaces}{mgmt}{netmask}) 320 mtu=$(get_user_data_value {bigip}{network}{mgmt_routes}{mtu}) 321 gateway=$(get_user_data_value {bigip}{network}{mgmt_routes}{gateway}) 322
323 if [[ -n $address && -n $netmask ]]; then 324 log "DHCP is disabled for the mgmt interface, setting to $address/$netmask" 325 tmsh create sys management-ip $address/$netmask 326 log "Adding default Gateway on management interface as $gateway" 327 tmsh create /sys management-route default gateway $gateway 328 log "Assigning the MTU for mgmt route at $mtu" 329 tmsh modify sys management-route all mtu $mtu 330 else
331 log "DHCP is disabled and no static address could be located for mgmt, skipping..." 332 fi 333
334 fi 335 }