code: func ConfigMapDataToVolumeConfig(data map[string]string, provisionerConfig *ProvisionerConfiguration) error {
  	rawYaml := ""
  	for key, val := range data {
  		rawYaml += key
  		rawYaml += ": \n"
  		rawYaml += insertSpaces(string(val))
  	}
  
  	if err := yaml.Unmarshal([]byte(rawYaml), provisionerConfig); err != nil {
  		return fmt.Errorf("fail to Unmarshal yaml due to: %#v", err)
  	}
  	for class, config := range provisionerConfig.StorageClassConfig {
  		if config.BlockCleanerCommand == nil {
  			// Supply a default block cleaner command.
  			config.BlockCleanerCommand = []string{DefaultBlockCleanerCommand}
  		} else {
  			// Validate that array is non empty.
  			if len(config.BlockCleanerCommand) < 1 {
  				return fmt.Errorf("Invalid empty block cleaner command for class %v", class)
  			}
  		}
  		if config.MountDir == "" || config.HostDir == "" {
  			return fmt.Errorf("Storage Class %v is misconfigured, missing HostDir or MountDir parameter", class)
  		}
  
  		if config.VolumeMode == "" {
  			config.VolumeMode = DefaultVolumeMode
  		}
  		volumeMode := v1.PersistentVolumeMode(config.VolumeMode)
  		if volumeMode != v1.PersistentVolumeBlock && volumeMode != v1.PersistentVolumeFilesystem {
  			return fmt.Errorf("unsupported volume mode %s", config.VolumeMode)
  		}
  
  		provisionerConfig.StorageClassConfig[class] = config
  		glog.Infof("StorageClass %q configured with MountDir %q, HostDir %q, VolumeMode %q, FsType %q, BlockCleanerCommand %q",
  			class,
  			config.MountDir,
  			config.HostDir,
  			config.VolumeMode,
  			config.FsType,
  			config.BlockCleanerCommand)
  	}
  	return nil
  }
docs: // ConfigMapDataToVolumeConfig converts configmap data to volume config.