'size': volume.get('size'),
'availability_zone': volume.get('availability_zone'),
'created_at': volume.get('created_at'),
+ 'updated_at': volume.get('updated_at'),
'attachments': self._get_attachments(volume),
'name': volume.get('display_name'),
'description': volume.get('display_description'),
'server_id': attachment.get('instance_uuid'),
'host_name': attachment.get('attached_host'),
'device': attachment.get('mountpoint'),
+ 'attached_at': attachment.get('attach_time'),
}
attachments.append(a)
'availability_zone': backup.get('availability_zone'),
'container': backup.get('container'),
'created_at': backup.get('created_at'),
+ 'updated_at': backup.get('updated_at'),
'name': backup.get('display_name'),
'description': backup.get('display_description'),
'fail_reason': backup.get('fail_reason'),
'snapshot': {
'id': snapshot.id,
'created_at': snapshot.created_at,
+ 'updated_at': snapshot.updated_at,
'name': snapshot.display_name,
'description': snapshot.display_description,
'volume_id': snapshot.volume_id,
self.assertEqual(volume_id, res_dict['backup']['volume_id'])
self.assertFalse(res_dict['backup']['is_incremental'])
self.assertFalse(res_dict['backup']['has_dependent_backups'])
+ self.assertIn('updated_at', res_dict['backup'])
db.backup_destroy(context.get_admin_context(), backup_id)
db.volume_destroy(context.get_admin_context(), volume_id)
res_dict = json.loads(res.body)
self.assertEqual(200, res.status_int)
- self.assertEqual(14, len(res_dict['backups'][0]))
+ self.assertEqual(15, len(res_dict['backups'][0]))
self.assertEqual('az1', res_dict['backups'][0]['availability_zone'])
self.assertEqual('volumebackups',
res_dict['backups'][0]['container'])
self.assertEqual(0, res_dict['backups'][0]['size'])
self.assertEqual('creating', res_dict['backups'][0]['status'])
self.assertEqual('1', res_dict['backups'][0]['volume_id'])
+ self.assertIn('updated_at', res_dict['backups'][0])
- self.assertEqual(14, len(res_dict['backups'][1]))
+ self.assertEqual(15, len(res_dict['backups'][1]))
self.assertEqual('az1', res_dict['backups'][1]['availability_zone'])
self.assertEqual('volumebackups',
res_dict['backups'][1]['container'])
self.assertEqual(0, res_dict['backups'][1]['size'])
self.assertEqual('creating', res_dict['backups'][1]['status'])
self.assertEqual('1', res_dict['backups'][1]['volume_id'])
+ self.assertIn('updated_at', res_dict['backups'][1])
- self.assertEqual(14, len(res_dict['backups'][2]))
+ self.assertEqual(15, len(res_dict['backups'][2]))
self.assertEqual('az1', res_dict['backups'][2]['availability_zone'])
self.assertEqual('volumebackups', res_dict['backups'][2]['container'])
self.assertEqual('this is a test backup',
self.assertEqual(0, res_dict['backups'][2]['size'])
self.assertEqual('creating', res_dict['backups'][2]['status'])
self.assertEqual('1', res_dict['backups'][2]['volume_id'])
+ self.assertIn('updated_at', res_dict['backups'][2])
db.backup_destroy(context.get_admin_context(), backup_id3)
db.backup_destroy(context.get_admin_context(), backup_id2)
self.assertEqual(200, res.status_int)
self.assertEqual(2, len(res_dict['backups']))
- self.assertEqual(14, len(res_dict['backups'][0]))
+ self.assertEqual(15, len(res_dict['backups'][0]))
self.assertEqual(backup_id3, res_dict['backups'][0]['id'])
- self.assertEqual(14, len(res_dict['backups'][1]))
+ self.assertEqual(15, len(res_dict['backups'][1]))
self.assertEqual(backup_id2, res_dict['backups'][1]['id'])
db.backup_destroy(context.get_admin_context(), backup_id3)
self.assertEqual(200, res.status_int)
self.assertEqual(2, len(res_dict['backups']))
- self.assertEqual(14, len(res_dict['backups'][0]))
+ self.assertEqual(15, len(res_dict['backups'][0]))
self.assertEqual(backup_id2, res_dict['backups'][0]['id'])
- self.assertEqual(14, len(res_dict['backups'][1]))
+ self.assertEqual(15, len(res_dict['backups'][1]))
self.assertEqual(backup_id1, res_dict['backups'][1]['id'])
db.backup_destroy(context.get_admin_context(), backup_id3)
self.assertEqual(200, res.status_int)
self.assertEqual(1, len(res_dict['backups']))
- self.assertEqual(14, len(res_dict['backups'][0]))
+ self.assertEqual(15, len(res_dict['backups'][0]))
self.assertEqual(backup_id2, res_dict['backups'][0]['id'])
db.backup_destroy(context.get_admin_context(), backup_id3)
'status': 'available',
'volume_size': 100,
'created_at': None,
+ 'updated_at': None,
'user_id': 'bcb7746c7a41472d88a1ffac89ba6a9b',
'project_id': '7ffe17a15c724e2aa79fc839540aec15',
'display_name': 'Default name',
self.assertEqual(snapshot_description,
resp_dict['snapshot']['description'])
self.assertTrue(mock_validate.called)
+ self.assertIn('updated_at', resp_dict['snapshot'])
db.volume_destroy(self.ctx, volume.id)
def test_snapshot_create_force(self):
resp_dict['snapshot']['name'])
self.assertEqual(snapshot_description,
resp_dict['snapshot']['description'])
+ self.assertIn('updated_at', resp_dict['snapshot'])
snapshot = {
"volume_id": volume.id,
'status': u'available',
'size': 100,
'created_at': None,
+ 'updated_at': None,
'name': u'Updated Test Name',
'description': u'Default description',
'metadata': {},
self.assertIn('snapshot', resp_dict)
self.assertEqual(UUID, resp_dict['snapshot']['id'])
+ self.assertIn('updated_at', resp_dict['snapshot'])
def test_snapshot_show_invalid_id(self):
snapshot_id = INVALID_UUID
self.assertIn('snapshots', resp_dict)
resp_snapshots = resp_dict['snapshots']
self.assertEqual(1, len(resp_snapshots))
+ self.assertIn('updated_at', resp_snapshots[0])
resp_snapshot = resp_snapshots.pop()
self.assertEqual(UUID, resp_snapshot['id'])
self.assertIn('snapshots', res)
self.assertEqual(1, len(res['snapshots']))
self.assertEqual(snaps[1].id, res['snapshots'][0]['id'])
+ self.assertIn('updated_at', res['snapshots'][0])
# Test that we get an empty list with an offset greater than the
# number of items
'bootable': 'false',
'consistencygroup_id': consistencygroup_id,
'created_at': datetime.datetime(1900, 1, 1, 1, 1, 1),
+ 'updated_at': datetime.datetime(1900, 1, 1, 1, 1, 1),
'description': description,
'id': stubs.DEFAULT_VOL_ID,
'links':
attachment = db.volume_attach(context.get_admin_context(), values)
db.volume_attached(context.get_admin_context(),
attachment['id'], stubs.FAKE_UUID, None, '/')
-
+ attach_tmp = db.volume_attachment_get(context.get_admin_context(),
+ attachment['id'])
+ volume_tmp = db.volume_get(context.get_admin_context(), '1')
updates = {
"name": "Updated Test Name",
}
expected = self._expected_vol_from_controller(
availability_zone=stubs.DEFAULT_AZ, volume_type=None,
status='in-use', name='Updated Test Name',
- attachments=[{
- 'id': '1',
- 'attachment_id': attachment['id'],
- 'volume_id': stubs.DEFAULT_VOL_ID,
- 'server_id': stubs.FAKE_UUID,
- 'host_name': None,
- 'device': '/',
- }],
+ attachments=[{'id': '1',
+ 'attachment_id': attachment['id'],
+ 'volume_id': stubs.DEFAULT_VOL_ID,
+ 'server_id': stubs.FAKE_UUID,
+ 'host_name': None,
+ 'device': '/',
+ 'attached_at': attach_tmp['attach_time'],
+ }],
metadata={'key': 'value', 'readonly': 'True'},
with_migration_status=True)
+ expected['volume']['updated_at'] = volume_tmp['updated_at']
self.assertEqual(expected, res_dict)
self.assertEqual(2, len(self.notifier.notifications))
self.assertTrue(mock_validate.called)
attachment = db.volume_attach(context.get_admin_context(), values)
db.volume_attached(context.get_admin_context(),
attachment['id'], stubs.FAKE_UUID, None, '/')
+ attach_tmp = db.volume_attachment_get(context.get_admin_context(),
+ attachment['id'])
+ volume_tmp = db.volume_get(context.get_admin_context(), '1')
req = fakes.HTTPRequest.blank('/v2/volumes/detail')
admin_ctx = context.RequestContext('admin', 'fakeproject', True)
'server_id': stubs.FAKE_UUID,
'host_name': None,
'id': '1',
- 'volume_id': stubs.DEFAULT_VOL_ID}],
+ 'volume_id': stubs.DEFAULT_VOL_ID,
+ 'attached_at': attach_tmp['attach_time'],
+ }],
metadata={'key': 'value', 'readonly': 'True'},
with_migration_status=True)
+ exp_vol['volume']['updated_at'] = volume_tmp['updated_at']
expected = {'volumes': [exp_vol['volume']]}
self.assertEqual(expected, res_dict)
attachment = db.volume_attach(context.get_admin_context(), values)
db.volume_attached(context.get_admin_context(),
attachment['id'], stubs.FAKE_UUID, None, '/')
-
+ attach_tmp = db.volume_attachment_get(context.get_admin_context(),
+ attachment['id'])
+ volume_tmp = db.volume_get(context.get_admin_context(), '1')
req = fakes.HTTPRequest.blank('/v2/volumes/1')
admin_ctx = context.RequestContext('admin', 'fakeproject', True)
req.environ['cinder.context'] = admin_ctx
expected = self._expected_vol_from_controller(
availability_zone=stubs.DEFAULT_AZ,
volume_type=None, status='in-use',
- attachments=[{
- 'id': '1',
- 'attachment_id': attachment['id'],
- 'volume_id': stubs.DEFAULT_VOL_ID,
- 'server_id': stubs.FAKE_UUID,
- 'host_name': None,
- 'device': '/'}],
+ attachments=[{'id': '1',
+ 'attachment_id': attachment['id'],
+ 'volume_id': stubs.DEFAULT_VOL_ID,
+ 'server_id': stubs.FAKE_UUID,
+ 'host_name': None,
+ 'device': '/',
+ 'attached_at': attach_tmp['attach_time'],
+ }],
metadata={'key': 'value', 'readonly': 'True'},
with_migration_status=True)
+ expected['volume']['updated_at'] = volume_tmp['updated_at']
self.assertEqual(expected, res_dict)
def test_volume_show_with_encrypted_volume(self):