vol_glance_metadata = models.VolumeGlanceMetadata()
vol_glance_metadata.volume_id = volume_id
vol_glance_metadata.key = key
- vol_glance_metadata.value = value
+ vol_glance_metadata.value = str(value)
vol_glance_metadata.save(session=session)
vol_metadata = db.volume_glance_metadata_create(ctxt, 2,
'key2',
'value2')
+ vol_metadata = db.volume_glance_metadata_create(ctxt, 2,
+ 'key3',
+ 123)
expected_metadata_1 = {'volume_id': '1',
'key': 'key1',
'value': 'value1'},
{'volume_id': '2',
'key': 'key2',
- 'value': 'value2'})
+ 'value': 'value2'},
+ {'volume_id': '2',
+ 'key': 'key3',
+ 'value': '123'})
metadata = db.volume_glance_metadata_get(ctxt, 2)
- self.assertEqual(len(metadata), 2)
+ self.assertEqual(len(metadata), 3)
for expected, meta in zip(expected_metadata_2, metadata):
for key, value in expected.iteritems():
self.assertEqual(meta[key], value)