forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: containers#12768 Signed-off-by: Daniel J Walsh <[email protected]>
- Loading branch information
Showing
13 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package volumes | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/containers/podman/v4/cmd/podman/common" | ||
"github.com/containers/podman/v4/cmd/podman/registry" | ||
"github.com/containers/podman/v4/cmd/podman/utils" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
volumeMountDescription = `Mount a volume and return the mountpoint` | ||
volumeMountCommand = &cobra.Command{ | ||
Annotations: map[string]string{ | ||
registry.UnshareNSRequired: "", | ||
registry.ParentNSRequired: "", | ||
registry.EngineMode: registry.ABIMode, | ||
}, | ||
Use: "mount NAME", | ||
Short: "Mount volume", | ||
Long: volumeMountDescription, | ||
RunE: volumeMount, | ||
Example: `podman volume mount myvol`, | ||
Args: cobra.ExactArgs(1), | ||
ValidArgsFunction: common.AutocompleteVolumes, | ||
} | ||
) | ||
|
||
func init() { | ||
registry.Commands = append(registry.Commands, registry.CliCommand{ | ||
Command: volumeMountCommand, | ||
Parent: volumeCmd, | ||
}) | ||
} | ||
|
||
func volumeMount(cmd *cobra.Command, args []string) error { | ||
var errs utils.OutputErrors | ||
reports, err := registry.ContainerEngine().VolumeMount(registry.GetContext(), args) | ||
if err != nil { | ||
return err | ||
} | ||
for _, r := range reports { | ||
if r.Err == nil { | ||
fmt.Println(r.Path) | ||
continue | ||
} | ||
errs = append(errs, r.Err) | ||
} | ||
return errs.PrintErrors() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package volumes | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/containers/podman/v4/cmd/podman/common" | ||
"github.com/containers/podman/v4/cmd/podman/registry" | ||
"github.com/containers/podman/v4/cmd/podman/utils" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
volumeUnmountDescription = `Unmount a volume` | ||
volumeUnmountCommand = &cobra.Command{ | ||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode}, | ||
Use: "unmount NAME", | ||
Short: "Unmount volume", | ||
Long: volumeUnmountDescription, | ||
RunE: volumeUnmount, | ||
Example: `podman volume unmount myvol`, | ||
Args: cobra.ExactArgs(1), | ||
ValidArgsFunction: common.AutocompleteVolumes, | ||
} | ||
) | ||
|
||
func init() { | ||
registry.Commands = append(registry.Commands, registry.CliCommand{ | ||
Command: volumeUnmountCommand, | ||
Parent: volumeCmd, | ||
}) | ||
} | ||
|
||
func volumeUnmount(cmd *cobra.Command, args []string) error { | ||
var errs utils.OutputErrors | ||
reports, err := registry.ContainerEngine().VolumeUnmount(registry.GetContext(), args) | ||
if err != nil { | ||
return err | ||
} | ||
for _, r := range reports { | ||
var errs utils.OutputErrors | ||
if r.Err == nil { | ||
fmt.Println(r.Id) | ||
} else { | ||
errs = append(errs, r.Err) | ||
} | ||
} | ||
return errs.PrintErrors() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
% podman-volume-mount(1) | ||
|
||
## NAME | ||
podman\-volume\-mount - Mount a volume filesystem | ||
|
||
## SYNOPSIS | ||
**podman volume mount** [*volume* ...] | ||
|
||
## DESCRIPTION | ||
Mounts the specified volumes' file system in a location which can be | ||
accessed from the host, and returns its location. | ||
|
||
Rootless mode only supports mounting file volumes, unless you enter the user namespace | ||
via the `podman unshare` command. All other volume types will fail to mount. | ||
|
||
## RETURN VALUE | ||
The location of the mounted file system. On error an empty string and errno is | ||
returned. | ||
|
||
## EXAMPLE | ||
|
||
``` | ||
podman volume mount foo | ||
/home/dwalsh/.local/share/containers/storage/volumes/foo/_data | ||
``` | ||
|
||
## SEE ALSO | ||
**[podman(1)](podman.1.md)**, **[podman-volume(1)](podman-volume.1.md)**, **[podman-volume-unmount(1)](podman-volume-unmount.1.md)**, **[podman-unshare(1)](podman-unshare.1.md)**, **mount(8)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
% podman-volume-unmount(1) | ||
|
||
## NAME | ||
podman\-volume\-unmount - Unmount a volume | ||
|
||
## SYNOPSIS | ||
**podman volume unmount** *volume* [...] | ||
|
||
**podman volume umount** *volume* [...] | ||
|
||
## DESCRIPTION | ||
Unmounts the specified volume, if there are no other containers | ||
using it. | ||
|
||
Volume storage increments a mount counter each time a volume is mounted. | ||
When a volume is unmounted, the mount counter is decremented, and the | ||
volume's filesystem is physically unmounted only when the mount | ||
counter reaches zero indicating no other processes are using the mount. | ||
|
||
## EXAMPLE | ||
|
||
podman volume unmount volumeID | ||
|
||
podman volume unmount volumeID1 volumeID2 volumeID3 | ||
|
||
## SEE ALSO | ||
**[podman(1)](podman.1.md)**, **[podman-volume(1)](podman-volume.1.md)**, **[podman-volume-mount(1)](podman-volume-mount.1.md)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build linux | ||
// +build linux | ||
|
||
package libpod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters