'Verifies the unique \'no_migration_targets\'=True filter.
This filter returns volumes with either a NULL \'migration_status\'
or a non-NULL value that does not start with \'target:\'.'

def test_volume_get_no_migration_targets(self):

    vol1 = db.volume_create(self.ctxt, {'display_name': 'test1'})
    vol2 = db.volume_create(self.ctxt, {'display_name': 'test2', 'migration_status': 'bogus'})
    vol3 = db.volume_create(self.ctxt, {'display_name': 'test3', 'migration_status': 'btarget:'})
    vol4 = db.volume_create(self.ctxt, {'display_name': 'test4', 'migration_status': 'target:'})
    self._assertEqualsVolumeOrderResult([vol4, vol3, vol2, vol1])
    filters = {'no_migration_targets': True}
    self._assertEqualsVolumeOrderResult([vol3, vol2, vol1], filters=filters)
    self._assertEqualsVolumeOrderResult([vol3, vol2], limit=2, filters=filters)
    filters = {'no_migration_targets': True, 'display_name': 'test4'}
    self._assertEqualsVolumeOrderResult([], filters=filters)
