openvstorage/framework

VDisk - Failed to retrieve vdisk after creating snapshot with infinite nr

Closed this issue · 2 comments

Create a snapshot with the label 9e83471310
python will consider this infinite which will fail to serialize

In [3]: vdisk.snapshots

OverflowError Traceback (most recent call last)
in ()
----> 1 vdisk.snapshots

/opt/OpenvStorage/ovs/dal/dataobject.pyc in (s)
346 """
347 # pylint: disable=protected-access
--> 348 fget = lambda s: s._get_dynamic_property(dynamic)
349 # pylint: enable=protected-access
350 setattr(self.class, dynamic.name, property(fget))

/opt/OpenvStorage/ovs/dal/dataobject.pyc in get_dynamic_property(self, dynamic)
415 """
416 data_loader = getattr(self, '
{0}'.format(dynamic.name))
--> 417 return self._backend_property(data_loader, dynamic)
418
419 # Helper method supporting property setting

/opt/OpenvStorage/ovs/dal/dataobject.pyc in _backend_property(self, fct, dynamic)
1035 cached_data = {'data': dynamic_data}
1036 if dynamic.timeout > 0:
-> 1037 self._volatile.set(cache_key, cached_data, dynamic.timeout)
1038 return DalToolbox.convert_unicode_to_string(cached_data['data'])
1039 finally:

/usr/lib/python2.7/dist-packages/ovs_extensions/storage/volatile/memcachestore.pyc in new_function(self, *args, **kwargs)
42 if lock:
43 with self._lock:
---> 44 return f(self, *args, **kwargs)
45 else:
46 return f(self, *args, **kwargs)

/usr/lib/python2.7/dist-packages/ovs_extensions/storage/volatile/memcachestore.pyc in set(self, key, value, time)
121 Sets the value for a key to a given value (set)
122 """
--> 123 return self._set('set', key, value, time=time)
124
125 @locked()

/usr/lib/python2.7/dist-packages/ovs_extensions/storage/volatile/memcachestore.pyc in _set(self, action, key, value, time)
111 else:
112 data = value
--> 113 data = ujson.dumps(data)
114 if action == 'set':
115 return self._client.set(key, data, time, min_compress_len=MemcacheStore.COMPRESSION_THRESHOLD)

OverflowError: Invalid Inf value when encoding double

Testing on 2.9 series:

Request payload in the UI
{name: "8e500000000", consistent: false, sticky: false}
consistent: false
name: "8e500000000"
sticky: false

Upon entry within our api view:

Apr 29 10:49:51 DEV-3N-199-181 gunicorn[24744]: 2019-04-29 10:49:51 71100 +0200 - DEV-3N-199-181 - 24770/139931746848272 - api/vdisks - 11 - INFO - Types: name <type 'float'>

Edit: the params supplied into the viewset are coming from our @load decorator which json loads every value.
So if the string represents something number like, it'll return the number

In [2]: x = "8e5000000"

In [3]: json.loads(x)
Out[3]: inf

Fixed by #2294