CLI: trove cluster-grow fails with mongodb/cluster

Bug #1705412 reported by Javier Castillo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Medium
Fan Zhang

Bug Description

Trying to grow a mongodb/cluster from CLI, fails with this weird error:

trove cluster-grow baca7b0f-a68f-4fdd-b1bf-79c3d11d70fb --instance "name=extra1,flavor=2x2048x25,volume=1,type=replica,related_to=rs1"

ERROR: b"The value [u'replica'] for key type is invalid. Allowed values are ['replica', 'query_router']. (HTTP 400)"

Revision history for this message
Trevor McCasland (twm2016) wrote :

Looks like a python3 vs python2 issue. explanation https://stackoverflow.com/questions/16471332/how-can-i-compare-a-unicode-type-to-a-string-in-python

We just need to change:
"if valid_values and value not in valid_values:"
to
"if valid_values and value.encode('utf-8') not in valid_values:"
from
http://git.openstack.org/cgit/openstack/trove/tree/trove/common/strategies/cluster/experimental/mongodb/api.py#n188

Changed in trove:
status: New → Confirmed
Changed in trove:
assignee: nobody → Trevor McCasland (twm2016)
Revision history for this message
Trevor McCasland (twm2016) wrote :

I don't think I can propose a patch for this.. I can't get a mongodb image to be kick-start by the integration project.. I get errors saying there are missing elements. I would recommend using python2 for the client and see if that helps.. my proposed fix was to add the unicode characters to the string literals in the list or what I mentioned above but I think the former is preferred.

Changed in trove:
assignee: Trevor McCasland (twm2016) → nobody
Revision history for this message
Javier Castillo (javcasalc) wrote :

value.encode('utf-8') is not valid.

AttributeError: 'list' object has no attribute 'encode'

Revision history for this message
Javier Castillo (javcasalc) wrote :

value[0].encode('utf-8') looks better.

But now, I get another issue :(

DEBUG (session:375) REQ: curl -g -i -X POST <..url..> -H "Accept: application/json" -H "X-Auth-Token: {SHA1}8411af0785eee6916c9298dc8a96d3d1f6d25ba4" -H "User-Agent: trove keystoneauth1/3.0.0 python-requests/2.18.1 CPython/3.6.2" -H "Content-Type: application/json" -d '{"grow": [{"flavorRef": "32e5654f-6295-4e5a-9b66-eaac71b5946d", "volume": {"size": "1"}, "type": ["replica"], "related_to": "rs1", "name": "extra1"}]}'
DEBUG (connectionpool:395) <..url..> HTTP/1.1" 400 110
DEBUG (session:423) RESP: [400] Content-Length: 110 Content-Type: application/json; charset=UTF-8 Date: Fri, 21 Jul 2017 11:59:17 GMT
RESP BODY: {"badRequest": {"message": "Instance type [u'replica'] not supported for MongoDB cluster grow.", "code": 400}}

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

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

Changed in trove:
assignee: nobody → Javier Castillo (javcasalc)
status: Confirmed → In Progress
Revision history for this message
Trevor McCasland (twm2016) wrote :

Hey sorry for the delay, I just saw you were working on this! :( I made a comment in review.

Changed in trove:
importance: Undecided → Medium
Changed in trove:
assignee: Javier Castillo (javcasalc) → Fan Zhang (fanzhang)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to trove (master)

Reviewed: https://review.openstack.org/486118
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=9b390cc3ac450d46014668915d0e3c0c624b564e
Submitter: Zuul
Branch: master

commit 9b390cc3ac450d46014668915d0e3c0c624b564e
Author: Javier Castillo Alcíbar <email address hidden>
Date: Fri Jul 21 14:16:38 2017 +0200

    Fix python2/unicode/string issue in mongodb/cluster

    Trying to grow a mongodb/cluster fails because there is an issue
    comparing unicode and strings

    Change-Id: Id4b28ad5ffbe5309f9bad7de2efd434d11099f2f
    Closes-Bug: #1705412

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

This issue was fixed in the openstack/trove 9.0.0.0b3 development milestone.

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.