Exemplo n.º 1
0
func execSubvolumeSnapshot(src string, dest string, readOnly bool) (retErr error) {
	defer func() {
		protolog.Info(&SubvolumeSnapshot{src, dest, readOnly, errorToString(retErr)})
	}()
	if readOnly {
		return executil.Run("btrfs", "subvolume", "snapshot", "-r", src, dest)
	}
	return executil.Run("btrfs", "subvolume", "snapshot", src, dest)
}
Exemplo n.º 2
0
func execPropertySetReadonly(path string, readonly bool) error {
	readonlyString := "false"
	if readonly {
		readonlyString = "true"
	}
	return executil.Run("btrfs", "property", "set", path, "ro", readonlyString)
}
Exemplo n.º 3
0
func execSubvolumeExists(path string) (result bool) {
	defer func() {
		protolog.Info(&SubvolumeExists{path, result})
	}()
	if err := executil.Run("btrfs", "subvolume", "show", path); err != nil {
		return false
	}
	return true
}
Exemplo n.º 4
0
func execSubvolumeSnapshot(src string, dest string, readonly bool) error {
	if readonly {
		return executil.Run("btrfs", "subvolume", "snapshot", "-r", src, dest)
	}
	return executil.Run("btrfs", "subvolume", "snapshot", src, dest)
}
Exemplo n.º 5
0
func execSubvolumeCreate(path string) error {
	return executil.Run("btrfs", "subvolume", "create", path)
}
Exemplo n.º 6
0
func snapshot(volume string, dest string, readonly bool) error {
	if readonly {
		return executil.Run("btrfs", "subvolume", "snapshot", "-r", FilePath(volume), FilePath(dest))
	}
	return executil.Run("btrfs", "subvolume", "snapshot", FilePath(volume), FilePath(dest))
}
Exemplo n.º 7
0
func subvolumeDelete(name string) error {
	return executil.Run("btrfs", "subvolume", "delete", FilePath(name))
}
Exemplo n.º 8
0
func execSubvolumeExists(path string) bool {
	if err := executil.Run("btrfs", "subvolume", "show", path); err != nil {
		return false
	}
	return true
}
Exemplo n.º 9
0
func execSubvolumeDelete(path string) error {
	return executil.Run("btrfs", "subvolume", "delete", path)
}
Exemplo n.º 10
0
func execSubvolumeDelete(path string) (retErr error) {
	defer func() {
		protolog.Info(&SubvolumeDelete{path, errorToString(retErr)})
	}()
	return executil.Run("btrfs", "subvolume", "delete", path)
}