model_update = sfv.manage_existing(testvol, external_ref)
self.assertIsNotNone(model_update)
self.assertIsNone(model_update.get('provider_geometry', None))
+
+ def test_create_volume_for_migration(self):
+ def _fake_do_v_create(self, project_id, params):
+ return project_id, params
+
+ self.stubs.Set(SolidFireDriver, '_issue_api_request',
+ self.fake_issue_api_request)
+ self.stubs.Set(SolidFireDriver, '_do_volume_create', _fake_do_v_create)
+
+ testvol = {'project_id': 'testprjid',
+ 'name': 'testvol',
+ 'size': 1,
+ 'id': 'b830b3c0-d1f0-11e1-9b23-1900200c9a77',
+ 'volume_type_id': None,
+ 'created_at': timeutils.utcnow(),
+ 'migration_status': 'target:'
+ 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'}
+
+ sfv = SolidFireDriver(configuration=self.configuration)
+ proj_id, sf_vol_object = sfv.create_volume(testvol)
+ self.assertEqual('a720b3c0-d1f0-11e1-9b23-0800200c9a66',
+ sf_vol_object['attributes']['uuid'])
+ self.assertEqual('b830b3c0-d1f0-11e1-9b23-1900200c9a77',
+ sf_vol_object['attributes']['migration_uuid'])
+ self.assertEqual('UUID-a720b3c0-d1f0-11e1-9b23-0800200c9a66',
+ sf_vol_object['name'])
'attributes': attributes,
'qos': qos}
+ # NOTE(jdg): Check if we're a migration tgt, if so
+ # use the old volume-id here for the SF Name
+ migration_status = volume.get('migration_status', None)
+ if migration_status and 'target' in migration_status:
+ k, v = migration_status.split(':')
+ params['name'] = 'UUID-%s' % v
+ params['attributes']['migration_uuid'] = volume['id']
+ params['attributes']['uuid'] = v
+
return self._do_volume_create(volume['project_id'], params)
def create_cloned_volume(self, volume, src_vref):
new_vol_values['volume_type_id'] = new_type_id
new_vol_values['host'] = host['host']
new_vol_values['status'] = 'creating'
+
+ # FIXME(jdg): using a : delimeter is confusing to
+ # me below here. We're adding a string member to a dict
+ # using a :, which is kind of a poor choice in this case
+ # I think
new_vol_values['migration_status'] = 'target:%s' % volume['id']
new_vol_values['attach_status'] = 'detached'
new_volume = self.db.volume_create(ctxt, new_vol_values)