Needs to accept UUID as ID of Floating IP

Bug #1052561 reported by Akihiro Motoki
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Akihiro Motoki
Folsom
Fix Released
Medium
Akihiro Motoki

Bug Description

In Quanutm, Floating IPs are identified by UUID instead of integer ID.

The current Horizon accepts only an integer ID for Floating IP.
To use Quantum floating IP via Nova, Horizon also needs to accept UUID style of ID for Floating IP.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/13212

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress
Changed in horizon:
importance: Undecided → High
milestone: none → grizzly-1
Changed in horizon:
milestone: grizzly-1 → grizzly-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/13212
Committed: http://github.com/openstack/horizon/commit/7ab5ace768797f56bf7e1c846fca0f1d40ed6086
Submitter: Jenkins
Branch: master

commit 7ab5ace768797f56bf7e1c846fca0f1d40ed6086
Author: Akihiro MOTOKI <email address hidden>
Date: Tue Nov 13 21:45:03 2012 +0900

    Accepts UUID as an ID of Floating IP

    Fixes bug 1052561.

    In Quanutm, Floating IPs are identified by UUID instead of integer ID.
    After quantum-nova integration for FLoating IP has been implemented,
    Horizon also needs to accept UUID style of ID for Floating IP.

    Change-Id: I6ed919cbbc818c97cecef2fe3a91c8e5a7ac76e0

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
Tomoe Sugihara (tomoe) wrote :

Could this be a cause of getting 'Select a valid choice' error in the folsom version of horizon?
If so, by any chance this would be merged to folsom?

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Thanks for reminding it. Are you using Folsom 2012.2.1 or later version of nova?

Quantum Floating IP proxy support in Nova was implemented after Folsom release and was backported in Folsom 2012.2.1 update. Thus issue occurs in Folsom release in 2012.2.1 or later.

I think it is a good idea to backport it to stable/folsom.

Revision history for this message
Tomoe Sugihara (tomoe) wrote :

I'm running nova and horizon from source code with devstack on stable/folsom branch.
Yes, I'd definitely like it to be backported.

Revision history for this message
Tomoe Sugihara (tomoe) wrote :
Download full text (3.7 KiB)

Hi Akihiro,

Just wanted to let you know that I tailored your patch for Folsom as follows and it fixed the problem.

diff --git a/horizon/dashboards/nova/access_and_security/floating_ips/tables.py b/horizon/dashboards/nova/access_and_security/floating_ips/tables.py
index e032e00..d12a38f 100644
--- a/horizon/dashboards/nova/access_and_security/floating_ips/tables.py
+++ b/horizon/dashboards/nova/access_and_security/floating_ips/tables.py
@@ -27,6 +27,7 @@ from horizon import exceptions
 from horizon import messages
 from horizon import tables

+from utils import get_int_or_uuid

 LOG = logging.getLogger(__name__)

@@ -82,7 +83,8 @@ class DisassociateIP(tables.Action):

     def single(self, table, request, obj_id):
         try:
- fip = table.get_object_by_id(int(obj_id))
+ fip = table.get_object_by_id(get_int_or_uuid(obj_id))
+
             api.server_remove_floating_ip(request, fip.instance_id, fip.id)
             LOG.info('Disassociating Floating IP "%s".' % obj_id)
             messages.success(request,
@@ -117,7 +119,7 @@ class FloatingIPsTable(tables.DataTable):
                          empty_value="-")

     def sanitize_id(self, obj_id):
- return int(obj_id)
+ return get_int_or_uuid(obj_id)

     def get_object_display(self, datum):
         return datum.ip
diff --git a/horizon/dashboards/nova/access_and_security/floating_ips/utils.py b/horizon/dashboards/nova/access_and_security/floating_ips/utils.py
new file mode 100644
index 0000000..b61b8b3
--- /dev/null
+++ b/horizon/dashboards/nova/access_and_security/floating_ips/utils.py
@@ -0,0 +1,32 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 NEC Corporation All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+
+def get_int_or_uuid(value):
+ """Check if a value is valid as UUID or an integer.
+
+ This method is mainly used to convert floating IP id to the
+ appropriate type. For floating IP id, integer is used in Nova's
+ original implementation, but UUID is used in Quantum based one.
+ """
+ try:
+ uuid.UUID(value)
+ return value
+ except (ValueError, AttributeError):
+ return int(value)
+
diff --git a/horizon/dashboards/nova/access_and_security/floating_ips/workflows.py b/horizon/dashboards/nova/access_and_security/floating_ips/workflows.py
index 58dd989..dbec798 100644
--- a/horizon/dashboards/nova/access_and_security/floating_ips/workflows.py
+++ b/horizon/dashboards/nova/access_and_security/floating_ips/workflows.py
@@ -23,13 +23,15 @@ from horizon import exceptions
 from horizon import workflows
 from horizon import...

Read more...

Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Revision history for this message
Dude4Linux (dude4linux) wrote :

Still not backported to stable/folsom. My attempt to create a patch failed.

ValueError at /nova/access_and_security/

invalid literal for int() with base 10: '43c362c9-6f88-4099-b83c-75acbbcb7dbf'

Request Method: POST
Request URL: http://ostack/nova/access_and_security/
Django Version: 1.4.3
Exception Type: ValueError
Exception Value:

invalid literal for int() with base 10: '43c362c9-6f88-4099-b83c-75acbbcb7dbf'

Exception Location: /opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/dashboards/nova/access_and_security/floating_ips/tables.py in sanitize_id, line 120
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:

['/opt/stack/horizon/openstack_dashboard/wsgi/../..',
 '/opt/stack/python-keystoneclient',
 '/opt/stack/python-novaclient',
 '/opt/stack/python-openstackclient',
 '/opt/stack/keystone',
 '/opt/stack/glance',
 '/opt/stack/python-glanceclient/setuptools_git-1.0b1-py2.7.egg',
 '/opt/stack/python-glanceclient',
 '/opt/stack/nova',
 '/opt/stack/horizon',
 '/opt/stack/python-quantumclient',
 '/opt/stack/quantum',
 '/opt/stack/cinder',
 '/opt/stack/python-cinderclient',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PIL',
 '/usr/lib/pymodules/python2.7',
 '/opt/stack/horizon/openstack_dashboard']

Server time: Thu, 31 Jan 2013 12:03:51 -0600

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/21005

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/folsom)

Reviewed: https://review.openstack.org/21005
Committed: http://github.com/openstack/horizon/commit/1d3ecfce22e990a3c55959aef73fb417ce562408
Submitter: Jenkins
Branch: stable/folsom

commit 1d3ecfce22e990a3c55959aef73fb417ce562408
Author: Akihiro MOTOKI <email address hidden>
Date: Tue Nov 13 21:45:03 2012 +0900

    Accepts UUID as an ID of Floating IP

    Fixes bug 1052561.

    In Quanutm, Floating IPs are identified by UUID instead of integer ID.
    After quantum-nova integration for FLoating IP has been implemented,
    Horizon also needs to accept UUID style of ID for Floating IP.

    Change-Id: I6ed919cbbc818c97cecef2fe3a91c8e5a7ac76e0
    (cherry picked from commit 7ab5ace768797f56bf7e1c846fca0f1d40ed6086)

Thierry Carrez (ttx)
Changed in horizon:
milestone: grizzly-2 → 2013.1
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.