'``/VolumeDriver.Mount`` sets the primary of the dataset with matching
name to the current node and then waits for the dataset to
actually arrive when used by the volumes that already exist and
don\'t have a special dataset ID.'

def test_mount_already_exists(self):

    name = u'myvol'
    mount_id = ''.join((random.choice('0123456789abcdef') for n in xrange(64)))
    d = self.flocker_client.create_dataset(self.NODE_A, int(DEFAULT_SIZE.to_Byte()), metadata={NAME_FIELD: name})
    def created(dataset):
        self.flocker_client.synchronize_state()
        result = self.assertResult('POST', '/VolumeDriver.Mount', {u'Name': name, u'ID': unicode(mount_id)}, OK, {u'Err': u'', u'Mountpoint': u'/flocker/{}'.format(dataset.dataset_id)})
        result.addCallback((lambda _: self.flocker_client.list_datasets_state()))
        result.addCallback((lambda ds: self.assertEqual([self.NODE_A], [d.primary for d in ds if (d.dataset_id == dataset.dataset_id)])))
        return result
    d.addCallback(created)
    return d
