UUID field setting in InstanceMapping

Bug #1647345 reported by jichenjc
This bug report is a duplicate of:  Bug #1742760: InstanceMapping uses invalid UUID. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Undecided
Unassigned

Bug Description

see this warning in unit test

    /home/jichen/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/fields.py:352: FutureWarning: 46d5efdf 540b 4657 850b 28c5024a8ce5 is an invalid UUID. Using UUIDFields with invalid UUIDs is no longer supported, and will be removed in a future release. Please update your code to input valid UUIDs or accept ValueErrors for invalid UUIDs. See http://docs.openstack.org/developer/oslo.versionedobjects/api/fields.html#oslo_versionedobjects.fields.UUIDField for further details
      "for further details" % value, FutureWarning)

the problem is bigger than a warning when the code change, as we have some code here in nova/cmd/manage.py , this will make the instance uuid not acceptable in the real code

1365 # Don't judge me. There's already an InstanceMapping with this UUID
1366 # so the marker needs to be non destructively modified.
1367 next_marker = next_marker.replace('-', ' ')
1368 objects.InstanceMapping(ctxt, instance_uuid=next_marker,
1369 project_id=marker_project_id).create()
1370 return 1

jichenjc (jichenjc)
Changed in nova:
assignee: nobody → jichenjc (jichenjc)
Revision history for this message
Matt Riedemann (mriedem) wrote :

We have these all over the unit tests in nova, there is some other bug for them I think that people were working in newton, so not sure we need a bug for this, it could just be fixed, but this is fine.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Oh I see, this will break once the UUIDField starts validating real UUIDs:

https://github.com/openstack/nova/blob/a67af1f110f160861f5cbbff987766c46d60198a/nova/cmd/manage.py#L1367

Changed in nova:
status: New → Confirmed
Revision history for this message
Matt Riedemann (mriedem) wrote :

Yup:

>>> import uuid
>>> marker = str(uuid.uuid4())
>>> marker
'bb4409d6-1cdf-46bd-a604-56fbd851590e'
>>> no_dash_marker = marker.replace('-', ' ')
>>> no_dash_marker
'bb4409d6 1cdf 46bd a604 56fbd851590e'
>>> uuid.UUID(no_dash_marker)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\uuid.py", line 136, in __init__
    raise ValueError('badly formed hexadecimal UUID string')
ValueError: badly formed hexadecimal UUID string
>>> uuid.UUID(marker)
UUID('bb4409d6-1cdf-46bd-a604-56fbd851590e')
>>>

Revision history for this message
jichenjc (jichenjc) wrote :

yes, this is exactly what I mean... I will see what kind of changes we can do here

Sean Dague (sdague)
Changed in nova:
assignee: jichenjc (jichenjc) → nobody
Revision history for this message
Surya Seetharaman (tssurya) wrote :

Marking this as a duplicate of https://bugs.launchpad.net/nova/+bug/1742760, although this is older because there is already a patch on for review in bug 1742760 that will fix this bug.

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.