Unable to add classless-static-route in extra_dhcp_opt extension

Bug #1605421 reported by Shih-Hao Li
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Shih-Hao Li

Bug Description

When adding classless-static-route in extra_dhcp_opt for a port, neutron client
complains syntax error. For example,

$ neutron port-update --extra-dhcp-opt opt_name="classless-static-route",opt_value="169.254.169.254/32,20.20.20.1" port1
usage: neutron port-update [-h] [--request-format {json}] [--name NAME]
                           [--description DESCRIPTION]
                           [--fixed-ip subnet_id=SUBNET,ip_address=IP_ADDR]
                           [--device-id DEVICE_ID]
                           [--device-owner DEVICE_OWNER]
                           [--admin-state-up {True,False}]
                           [--security-group SECURITY_GROUP | --no-security-groups]
                           [--extra-dhcp-opt EXTRA_DHCP_OPTS]
                           [--qos-policy QOS_POLICY | --no-qos-policy]
                           [--allowed-address-pair ip_address=IP_ADDR[,mac_address=MAC_ADDR]
                           | --no-allowed-address-pairs]
                           [--dns-name DNS_NAME | --no-dns-name]
                           PORT
neutron port-update: error: argument --extra-dhcp-opt: invalid key-value '20.20.20.1', expected format: key=value
Try 'neutron help port-update' for more information.

The reason is neutron client interprets the "," inside the opt_value as
a delimiter of key-value pairs for --extra-dhcp-opt.

The comma in the opt_value for classless-static-route is required because
the format of DHCP options in the opts file for dnsmasq is like:

tag:<tag_id_or_port_uuid>,option:classless-static-route,169.254.169.254/32,20.20.20.1

Shih-Hao Li (shihli)
description: updated
Revision history for this message
Shih-Hao Li (shihli) wrote :

Here are two possible solutions.

(1) Allow users to use spaces in the opt_value, such as
    opt_value="169.254.169.254/32 20.20.20.1"

    Then edit _generate_opts_per_port() in dhcp.py to convert
    spaces to commas when writing them to opts file.

(2) Modify neutron client to allow commas inside opt_value.

Revision history for this message
Shih-Hao Li (shihli) wrote :

The patch for solution (1) is in
https://review.openstack.org/345720

The patch for solution (2) is in
https://review.openstack.org/345717

affects: openstack-manuals → neutron
affects: neutron → python-neutronclient
Changed in python-neutronclient:
status: New → Confirmed
assignee: nobody → Shih-Hao Li (shihli)
Changed in python-neutronclient:
importance: Undecided → Medium
Changed in python-neutronclient:
status: Confirmed → In Progress
Revision history for this message
Bartek Żurawski (bartekzurawski1) wrote :

What is the status of this bug ? Is it still in progress ?

Revision history for this message
Shih-Hao Li (shihli) wrote :

The patch is done and waiting for approval
https://review.openstack.org/345717

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/345717
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=494b283eed095346a62ee7024d6099d134aa8144
Submitter: Jenkins
Branch: master

commit 494b283eed095346a62ee7024d6099d134aa8144
Author: Shih-Hao Li <email address hidden>
Date: Wed Aug 24 14:56:49 2016 -0700

    Unable to add classless-static-route in extra_dhcp_opt extension

    When adding classless-static-route in extra_dhcp_opt for a port,
    neutron client complains syntax error. The reason is neutron client
    interprets the "," inside the opt_value as a delimiter of key-value
    pairs for --extra-dhcp-opt.

    This patch modifies neutron client to allow commas inside opt_value.

    This is one of two proposed solutions described in #1605421.

    Change-Id: I8ade427885d11f86d594cecaed96fcb82e38798f
    Closes-Bug: #1605421

Changed in python-neutronclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-neutronclient 6.2.0

This issue was fixed in the openstack/python-neutronclient 6.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.