some commands fails if securitygroup is created with UTF character present in it

Bug #934081 reported by Satya Sanjibani Routray
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Medium
Eric Harney

Bug Description

1. Create a Security group with name having UTF character in it example "öa"
2. Try to list the security groups

observation:

routray@ubuntu:~/Desktop/st1$ nova secgroup-list
Server Error, please try again later. (HTTP 500)

3. Try to add rules to the security group

Observation:
routray@ubuntu:~/Desktop/st1$ nova secgroup-add-rule öa tcp 22 22 0.0.0.0/0
Server Error, please try again later. (HTTP 500)

4. Create a VM using the security group created using UTF character
5. try to list the servers

Observation:
routray@ubuntu:~/Desktop/st1$ euca-describe-instances
UnknownError: An unknown error has occurred. Please try your request again

6. Try to delete the security group

Observation:
routray@ubuntu:~/Desktop/st1$ nova secgroup-delete öa
Server Error, please try again later. (HTTP 500)

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Sateesh Bodla (sateesh-bodla) wrote :

Hi,

I am trying to reproduce the bug, but getting the exception "ERROR: 'utf8' codec can't decode byte 0xf6 in position 0: invalid start byte" when the name has UTF character. I am testing this in Essex version.

Observation:
root@vmessex198:~# nova secgroup-create öa UTFtest
ERROR: 'utf8' codec can't decode byte 0xf6 in position 0: invalid start byte
root@vmessex198:~# nova secgroup-create aöa UTFtest
ERROR: 'utf8' codec can't decode byte 0xf6 in position 1: invalid start byte
root@vmessex198:~# nova secgroup-create aa UTFtest
+------+-------------+
| Name | Description |
+------+-------------+
| aa | UTFtest |
+------+-------------+
root@vmessex198:~# nova secgroup-create "öa" UTFtestagain
ERROR: 'utf8' codec can't decode byte 0xf6 in position 0: invalid start byte

Probably this bug is fixed in Essex version or please let me know if I need to add the security group in any other way.

Thanks,
Sateesh B.

Revision history for this message
Sateesh Bodla (sateesh-bodla) wrote :

when I tried to add this using command it is thrown the exception "ERROR: 'utf8' codec can't decode byte 0xf6 in position 0: invalid start byte". So, I have manually updated the name in the table "security_groups". Then I tried to run the command, it showed me the exception that is mentioned above. Please find the trace below.

root@vmessex198:~# nova secgroup-list
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500)
root@vmessex198:~# nova secgroup-add-rule öa tcp 22 22 0.0.0.0/0
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500)

I guess this is fixed in Essex version. Please correct me if I am wrong.

Thanks,
Sateesh B.

Changed in nova:
assignee: nobody → Sateesh Bodla (sateesh-bodla)
Eric Harney (eharney)
Changed in nova:
assignee: Sateesh Bodla (sateesh-bodla) → Eric Harney (eharney)
Revision history for this message
Eric Harney (eharney) wrote :

Observed behavior:
$ nova secgroup-list
+---------+-------------+
| Name | Description |
+---------+-------------+
| default | default |
+---------+-------------+
$ nova secgroup-create öa UTFtest
+------+-------------+
| Name | Description |
+------+-------------+
| öa | UTFtest |
+------+-------------+
$ nova secgroup-delete öa
/opt/stack/python-novaclient/novaclient/v1_1/shell.py:1461: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if secgroup == s.name:
ERROR: Secgroup öa not found

The failure occurs because the secgroup name (s.name) inside of _get_secgroup is in Unicode, but the command-line argument is not. A conversion must be done to compare the two.

A fix to novaclient/shell.py is also required because error messages that print Unicode secgroup names cause a UnicodeEncodeError error to be displayed rather than the error message.

For example, if you try to create "öa" twice:
$ nova secgroup-create öa UTFtest
Traceback (most recent call last):
  File "/bin/nova", line 9, in <module>
    load_entry_point('python-novaclient==2.8.0.11', 'console_scripts', 'nova')()
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 536, in main
    print >> sys.stderr, "ERROR: %s" % str(e)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 15: ordinal not in range(128)

With the fix, you will see the normal "ERROR: Security group öa already exists (HTTP 400) (Request-ID: req-...)"

Proposed change at https://review.openstack.org/#/c/12972/ .

Eric Harney (eharney)
affects: nova → python-novaclient
Eric Harney (eharney)
Changed in python-novaclient:
status: Confirmed → Fix Committed
Changed in python-novaclient:
status: Fix Committed → Fix Released
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.