forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request containers#2350 from mheon/lock_renumber
Add lock renumbering
- Loading branch information
Showing
26 changed files
with
569 additions
and
70 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -548,3 +548,7 @@ type SystemPruneValues struct { | |
Force bool | ||
Volume bool | ||
} | ||
|
||
type SystemRenumberValues struct { | ||
PodmanCommand | ||
} |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/containers/libpod/cmd/podman/cliconfig" | ||
"github.com/containers/libpod/cmd/podman/libpodruntime" | ||
"github.com/pkg/errors" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
renumberCommand cliconfig.SystemRenumberValues | ||
renumberDescription = ` | ||
podman system renumber | ||
Migrate lock numbers to handle a change in maximum number of locks. | ||
Mandatory after the number of locks in libpod.conf is changed. | ||
` | ||
|
||
_renumberCommand = &cobra.Command{ | ||
Use: "renumber", | ||
Short: "Migrate lock numbers", | ||
Long: renumberDescription, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
renumberCommand.InputArgs = args | ||
renumberCommand.GlobalFlags = MainGlobalOpts | ||
return renumberCmd(&renumberCommand) | ||
}, | ||
} | ||
) | ||
|
||
func init() { | ||
renumberCommand.Command = _renumberCommand | ||
renumberCommand.SetUsageTemplate(UsageTemplate()) | ||
} | ||
|
||
func renumberCmd(c *cliconfig.SystemRenumberValues) error { | ||
// We need to pass one extra option to NewRuntime. | ||
// This will inform the OCI runtime to start a renumber. | ||
// That's controlled by the last argument to GetRuntime. | ||
r, err := libpodruntime.GetRuntimeRenumber(&c.PodmanCommand) | ||
if err != nil { | ||
return errors.Wrapf(err, "error renumbering locks") | ||
} | ||
if err := r.Shutdown(false); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
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,29 @@ | ||
% podman-system-renumber(1) podman | ||
|
||
## NAME | ||
podman\-system\-renumber - Renumber container locks | ||
|
||
## SYNOPSIS | ||
** podman system renumber** | ||
|
||
## DESCRIPTION | ||
** podman system renumber** renumbers locks used by containers and pods. | ||
|
||
Each Podman container and pod is allocated a lock at creation time, up to a maximum number controlled by the **num_locks** parameter in **libpod.conf**. | ||
|
||
When all available locks are exhausted, no further containers and pods can be created until some existing containers and pods are removed. This can be avoided by increasing the number of locks available via modifying **libpod.conf** and subsequently running **podman system renumber** to prepare the new locks (and reallocate lock numbers to fit the new struct). | ||
|
||
**podman system renumber** must be called after any changes to **num_locks** - failure to do so will result in errors starting Podman as the number of locks available conflicts with the configured number of locks. | ||
|
||
**podman system renumber** can also be used to migrate 1.0 and earlier versions of Podman, which used a different locking scheme, to the new locking model. It is not strictly required to do this, but it is highly recommended to do so as deadlocks can occur otherwise. | ||
|
||
If possible, avoid calling **podman system renumber** while there are other Podman processes running. | ||
|
||
## SYNOPSIS | ||
**podman system renumber** | ||
|
||
## SEE ALSO | ||
`podman(1)`, `libpod.conf(5)` | ||
|
||
# HISTORY | ||
February 2019, Originally compiled by Matt Heon (mheon at redhat dot com) |
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
Oops, something went wrong.