lxd/storage_lvm_utils.go
func (s *storageLvm) copyVolume(sourcePool string, source string) error {
	targetMntPoint := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)

	err := os.MkdirAll(targetMntPoint, 0711)
	if err != nil {
		return err
	}

	if s.useThinpool && sourcePool == s.pool.Name {
		err = s.copyVolumeThinpool(source, s.volume.Name, false)
	} else {
		err = s.copyVolumeLv(sourcePool, source, s.volume.Name, false)
	}
	if err != nil {
		return err
	}

	return nil
}
func (s *storageLvm) copyVolume(sourcePool string, source string) error {
	targetMntPoint := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)

	err := os.MkdirAll(targetMntPoint, 0711)
	if err != nil {
		return err
	}

	if s.useThinpool && sourcePool == s.pool.Name {
		err = s.copyVolumeThinpool(source, s.volume.Name, false)
	} else {
		err = s.copyVolumeLv(sourcePool, source, s.volume.Name, false)
	}
	if err != nil {
		return err
	}

	return nil
}
// Copy an LVM custom volume.