← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1277393] [NEW] unable to transform an old object into a new one with changed types of fields

 

Public bug reported:

Object Model only considers downgrade and missing some work in upgrade part, so it is  unable to transform an old object into a new one with changed types of fields.
This problem is related to https://review.openstack.org/#/c/67693/

Metrics is a string field in computeNode before version 1.3. And we make it to be an object field. Then the problem is when
the old node still sends a string-based set of metrics, it will throw a exception in obj_from_primitive due to the type changes.

AUDIT [nova.service] Starting conductor node (version 2014.1)
}}}
Traceback (most recent call last):
  File "nova/tests/objects/test_compute_node.py", line 165, in test_metrics_compat_upgrade
    compute = base.NovaObject.obj_from_primitive(primitive)
  File "nova/objects/base.py", line 246, in obj_from_primitive
    objdata[name]))
  File "nova/objects/fields.py", line 183, in from_primitive
    return self._type.from_primitive(obj, attr, value)
  File "nova/objects/fields.py", line 374, in from_primitive
    return obj_base.NovaObject.obj_from_primitive(value, obj._context)
  File "nova/objects/base.py", line 230, in obj_from_primitive
    if primitive['nova_object.namespace'] != 'nova':
TypeError: string indices must be integers, not str

The reason is in version 1.2, the primitive of metrics in compute node is str
'[{"timestamp": "2014-02-07T08:12:16Z", "name": "cpu.frequency", "value": 1600.0, "source": "libvirt.LibvirtDriver"}]'
But it should be an object after version 1.3.

The easiest way to reappear the bug is downloading the patch  https://review.openstack.org/#/c/67693/ and run  
python -m unittest nova.tests.objects.test_compute_node.TestRemoteComputeNodeObject.test_metrics_compat_upgrade

The test case transforms a new compute_node object into an old one and
then transforms it into a new one again.

** Affects: nova
     Importance: Undecided
         Status: New

** Summary changed:

- unable to transform an old object to a new one with changed types of fields
+ unable to transform an old object into a new one with changed types of fields

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1277393

Title:
  unable to transform an old object into a new one with changed types of
  fields

Status in OpenStack Compute (Nova):
  New

Bug description:
  Object Model only considers downgrade and missing some work in upgrade part, so it is  unable to transform an old object into a new one with changed types of fields.
  This problem is related to https://review.openstack.org/#/c/67693/

  Metrics is a string field in computeNode before version 1.3. And we make it to be an object field. Then the problem is when
  the old node still sends a string-based set of metrics, it will throw a exception in obj_from_primitive due to the type changes.

  AUDIT [nova.service] Starting conductor node (version 2014.1)
  }}}
  Traceback (most recent call last):
    File "nova/tests/objects/test_compute_node.py", line 165, in test_metrics_compat_upgrade
      compute = base.NovaObject.obj_from_primitive(primitive)
    File "nova/objects/base.py", line 246, in obj_from_primitive
      objdata[name]))
    File "nova/objects/fields.py", line 183, in from_primitive
      return self._type.from_primitive(obj, attr, value)
    File "nova/objects/fields.py", line 374, in from_primitive
      return obj_base.NovaObject.obj_from_primitive(value, obj._context)
    File "nova/objects/base.py", line 230, in obj_from_primitive
      if primitive['nova_object.namespace'] != 'nova':
  TypeError: string indices must be integers, not str

  The reason is in version 1.2, the primitive of metrics in compute node is str
  '[{"timestamp": "2014-02-07T08:12:16Z", "name": "cpu.frequency", "value": 1600.0, "source": "libvirt.LibvirtDriver"}]'
  But it should be an object after version 1.3.

  The easiest way to reappear the bug is downloading the patch  https://review.openstack.org/#/c/67693/ and run  
  python -m unittest nova.tests.objects.test_compute_node.TestRemoteComputeNodeObject.test_metrics_compat_upgrade

  The test case transforms a new compute_node object into an old one and
  then transforms it into a new one again.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1277393/+subscriptions


Follow ups

References