code: func (b *flockerVolumeMounter) updateDatasetPrimary(datasetUUID string, primaryUUID string) error {
  	// We need to update the primary and wait for it to be ready
  	_, err := b.flockerClient.UpdatePrimaryForDataset(primaryUUID, datasetUUID)
  	if err != nil {
  		return err
  	}
  
  	timeoutChan := time.NewTimer(timeoutWaitingForVolume)
  	defer timeoutChan.Stop()
  	tickChan := time.NewTicker(tickerWaitingForVolume)
  	defer tickChan.Stop()
  
  	for {
  		if s, err := b.flockerClient.GetDatasetState(datasetUUID); err == nil && s.Primary == primaryUUID {
  			return nil
  		}
  
  		select {
  		case <-timeoutChan.C:
  			return fmt.Errorf(
  				"Timed out waiting for the datasetUUID: '%s' to be moved to the primary: '%s'\n%v",
  				datasetUUID, primaryUUID, err,
  			)
  		case <-tickChan.C:
  			break
  		}
  	}
  
  }
docs: // updateDatasetPrimary will update the primary in Flocker and wait for it to
  // be ready. If it never gets to ready state it will timeout and error.