func parseClone(clone string) (string, string, string, error) {
	idx := strings.Index(clone, "/")
	if idx == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}
	slider := clone[(idx + 1):]
	poolName := clone[:idx]

	volumeType := slider
	idx = strings.Index(slider, "zombie_")
	if idx == 0 {
		idx += len("zombie_")
		volumeType = slider
		slider = slider[idx:]
	}

	idxType := strings.Index(slider, "_")
	if idxType == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}

	if idx == len("zombie_") {
		idxType += idx
	}
	volumeType = volumeType[:idxType]

	idx = strings.Index(slider, "_")
	if idx == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}

	volumeName := slider
	idx = strings.Index(volumeName, "_")
	if idx == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}
	volumeName = volumeName[(idx + 1):]

	return poolName, volumeType, volumeName, nil
}
func parseClone(clone string) (string, string, string, error) {
	idx := strings.Index(clone, "/")
	if idx == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}
	slider := clone[(idx + 1):]
	poolName := clone[:idx]

	volumeType := slider
	idx = strings.Index(slider, "zombie_")
	if idx == 0 {
		idx += len("zombie_")
		volumeType = slider
		slider = slider[idx:]
	}

	idxType := strings.Index(slider, "_")
	if idxType == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}

	if idx == len("zombie_") {
		idxType += idx
	}
	volumeType = volumeType[:idxType]

	idx = strings.Index(slider, "_")
	if idx == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}

	volumeName := slider
	idx = strings.Index(volumeName, "_")
	if idx == -1 {
		return "", "", "", fmt.Errorf("Unexpected parsing error")
	}
	volumeName = volumeName[(idx + 1):]

	return poolName, volumeType, volumeName, nil
}
func parseClone ( clone string ) ( string , string , string , error ) { idx := strings . Index ( clone , " " ) if idx == - 1 { return " " , " " , " " , fmt . Errorf ( " " ) } slider := clone [ ( idx + 1 ) : ] poolName := clone [ : idx ] volumeType := slider idx = strings . Index ( slider , " " ) if idx == 0 { idx += len ( " " ) volumeType = slider slider = slider [ idx : ] } idxType := strings . Index ( slider , " " ) if idxType == - 1 { return " " , " " , " " , fmt . Errorf ( " " ) } if idx == len ( " " ) { idxType += idx } volumeType = volumeType [ : idxType ] idx = strings . Index ( slider , " " ) if idx == - 1 { return " " , " " , " " , fmt . Errorf ( " " ) } volumeName := slider idx = strings . Index ( volumeName , " " ) if idx == - 1 { return " " , " " , " " , fmt . Errorf ( " " ) } volumeName = volumeName [ ( idx + 1 ) : ] return poolName , volumeType , volumeName , nil }
// parseClone splits a strings describing an RBD storage volume
// For example a string like
// <osd-pool-name>/<lxd-specific-prefix>_<rbd-storage-volume>
// will be split into
// <osd-pool-name>, <lxd-specific-prefix>, <rbd-storage-volume>
parseClone splits a strings describing an RBD storage volume For example a string like <osd - pool - name > / <lxd - specific - prefix > _<rbd - storage - volume > will be split into <osd - pool - name > <lxd - specific - prefix > <rbd - storage - volume >