mirror of
https://github.com/containers/podman.git
synced 2025-07-18 10:08:07 +08:00
Merge pull request #16648 from ashley-cui/machos
Introduce podman machine os commands
This commit is contained in:
9
Makefile
9
Makefile
@ -395,6 +395,15 @@ bin/rootlessport: $(SOURCES) go.mod go.sum
|
|||||||
.PHONY: rootlessport
|
.PHONY: rootlessport
|
||||||
rootlessport: bin/rootlessport
|
rootlessport: bin/rootlessport
|
||||||
|
|
||||||
|
.PHONY: podman-remote-experimental
|
||||||
|
podman-remote-experimental: $(SRCBINDIR)/experimental/podman$(BINSFX)
|
||||||
|
$(SRCBINDIR)/experimental/podman$(BINSFX): $(SOURCES) go.mod go.sum | $(SRCBINDIR)
|
||||||
|
$(GOCMD) build \
|
||||||
|
$(BUILDFLAGS) \
|
||||||
|
$(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
|
||||||
|
-tags "${REMOTETAGS} experimental" \
|
||||||
|
-o $@ ./cmd/podman
|
||||||
|
|
||||||
###
|
###
|
||||||
### Secondary binary-build targets
|
### Secondary binary-build targets
|
||||||
###
|
###
|
||||||
|
28
cmd/podman/machine/os.go
Normal file
28
cmd/podman/machine/os.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//go:build (amd64 || arm64) && experimental
|
||||||
|
// +build amd64 arm64
|
||||||
|
// +build experimental
|
||||||
|
|
||||||
|
package machine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/registry"
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/validate"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
OSCmd = &cobra.Command{
|
||||||
|
Use: "os",
|
||||||
|
Short: "Manage a virtual machine's os",
|
||||||
|
Long: "Manage a virtual machine's operating system",
|
||||||
|
PersistentPreRunE: validate.NoOp,
|
||||||
|
RunE: validate.SubCommandExists,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
|
Command: OSCmd,
|
||||||
|
Parent: machineCmd,
|
||||||
|
})
|
||||||
|
}
|
38
cmd/podman/machine/os/apply.go
Normal file
38
cmd/podman/machine/os/apply.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//go:build (amd64 || arm64) && experimental
|
||||||
|
// +build amd64 arm64
|
||||||
|
// +build experimental
|
||||||
|
|
||||||
|
package machineos
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/machine"
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/registry"
|
||||||
|
"github.com/containers/podman/v4/cmd/podman/validate"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
applyCmd = &cobra.Command{
|
||||||
|
Use: "apply",
|
||||||
|
Short: "Apply OCI image to existing VM",
|
||||||
|
Long: "Apply custom layers from a containerized Fedora CoreOS image on top of an existing VM",
|
||||||
|
PersistentPreRunE: validate.NoOp,
|
||||||
|
RunE: apply,
|
||||||
|
Example: `podman machine os apply myimage`,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
|
Command: applyCmd,
|
||||||
|
Parent: machine.OSCmd,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func apply(cmd *cobra.Command, args []string) error {
|
||||||
|
fmt.Println("Applying..")
|
||||||
|
return nil
|
||||||
|
}
|
8
cmd/podman/main_experimental.go
Normal file
8
cmd/podman/main_experimental.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//go:build experimental
|
||||||
|
// +build experimental
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "github.com/containers/podman/v4/cmd/podman/machine/os"
|
||||||
|
)
|
Reference in New Issue
Block a user