summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-06-24 15:48:34 -0500
committerbaude <bbaude@redhat.com>2019-06-25 13:51:24 -0500
commitdd81a44ccfa34585ef62319835c8bb421db9e334 (patch)
tree7bab006a56d5823ccdf7b8cf6e59502ee954a979 /libpod/runtime.go
parenta1a4a75abee2c381483a218e1660621ee416ef7c (diff)
downloadpodman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.gz
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.bz2
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.zip
remove libpod from main
the compilation demands of having libpod in main is a burden for the remote client compilations. to combat this, we should move the use of libpod structs, vars, constants, and functions into the adapter code where it will only be compiled by the local client. this should result in cleaner code organization and smaller binaries. it should also help if we ever need to compile the remote client on non-Linux operating systems natively (not cross-compiled). Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go32
1 files changed, 15 insertions, 17 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 78fa22ec8..92a792e93 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -13,6 +13,7 @@ import (
"github.com/BurntSushi/toml"
is "github.com/containers/image/storage"
"github.com/containers/image/types"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/libpod/lock"
@@ -75,9 +76,6 @@ var (
// DefaultInfraCommand to be run in an infra container
DefaultInfraCommand = "/pause"
- // DefaultInitPath is the default path to the container-init binary
- DefaultInitPath = "/usr/libexec/podman/catatonit"
-
// DefaultSHMLockPath is the default path for SHM locks
DefaultSHMLockPath = "/libpod_lock"
// DefaultRootlessSHMLockPath is the default path for rootless SHM locks
@@ -298,7 +296,7 @@ func defaultRuntimeConfig() (RuntimeConfig, error) {
ConmonEnvVars: []string{
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
},
- InitPath: DefaultInitPath,
+ InitPath: define.DefaultInitPath,
CgroupManager: SystemdCgroupsManager,
StaticDir: filepath.Join(storeOpts.GraphRoot, "libpod"),
TmpDir: "",
@@ -598,7 +596,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
break
}
if !foundConmon {
- return errors.Wrapf(ErrInvalidArg,
+ return errors.Wrapf(define.ErrInvalidArg,
"could not find a working conmon binary (configured options: %v)",
runtime.config.ConmonPath)
}
@@ -621,7 +619,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
}
runtime.state = state
case SQLiteStateStore:
- return errors.Wrapf(ErrInvalidArg, "SQLite state is currently disabled")
+ return errors.Wrapf(define.ErrInvalidArg, "SQLite state is currently disabled")
case BoltDBStateStore:
dbPath := filepath.Join(runtime.config.StaticDir, "bolt_state.db")
@@ -631,7 +629,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
}
runtime.state = state
default:
- return errors.Wrapf(ErrInvalidArg, "unrecognized state type passed")
+ return errors.Wrapf(define.ErrInvalidArg, "unrecognized state type passed")
}
// Grab config from the database so we can reset some defaults
@@ -791,7 +789,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
}
if len(runtime.config.RuntimePath) == 0 {
- return errors.Wrapf(ErrInvalidArg, "empty runtime path array passed")
+ return errors.Wrapf(define.ErrInvalidArg, "empty runtime path array passed")
}
name := filepath.Base(runtime.config.RuntimePath[0])
@@ -816,7 +814,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
// Initialize remaining OCI runtimes
for name, paths := range runtime.config.OCIRuntimes {
if len(paths) == 0 {
- return errors.Wrapf(ErrInvalidArg, "must provide at least 1 path to OCI runtime %s", name)
+ return errors.Wrapf(define.ErrInvalidArg, "must provide at least 1 path to OCI runtime %s", name)
}
supportsJSON := false
@@ -865,7 +863,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
} else {
ociRuntime, ok := runtime.ociRuntimes[runtime.config.OCIRuntime]
if !ok {
- return errors.Wrapf(ErrInvalidArg, "default OCI runtime %q not found", runtime.config.OCIRuntime)
+ return errors.Wrapf(define.ErrInvalidArg, "default OCI runtime %q not found", runtime.config.OCIRuntime)
}
runtime.defaultOCIRuntime = ociRuntime
}
@@ -873,12 +871,12 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
// Do we have at least one valid OCI runtime?
if len(runtime.ociRuntimes) == 0 {
- return errors.Wrapf(ErrInvalidArg, "no OCI runtime has been configured")
+ return errors.Wrapf(define.ErrInvalidArg, "no OCI runtime has been configured")
}
// Do we have a default runtime?
if runtime.defaultOCIRuntime == nil {
- return errors.Wrapf(ErrInvalidArg, "no default OCI runtime was configured")
+ return errors.Wrapf(define.ErrInvalidArg, "no default OCI runtime was configured")
}
// Make the per-boot files directory if it does not exist
@@ -1030,7 +1028,7 @@ func (r *Runtime) GetConfig() (*RuntimeConfig, error) {
defer r.lock.RUnlock()
if !r.valid {
- return nil, ErrRuntimeStopped
+ return nil, define.ErrRuntimeStopped
}
config := new(RuntimeConfig)
@@ -1052,7 +1050,7 @@ func (r *Runtime) Shutdown(force bool) error {
defer r.lock.Unlock()
if !r.valid {
- return ErrRuntimeStopped
+ return define.ErrRuntimeStopped
}
r.valid = false
@@ -1064,7 +1062,7 @@ func (r *Runtime) Shutdown(force bool) error {
logrus.Errorf("Error retrieving containers from database: %v", err)
} else {
for _, ctr := range ctrs {
- if err := ctr.StopWithTimeout(CtrRemoveTimeout); err != nil {
+ if err := ctr.StopWithTimeout(define.CtrRemoveTimeout); err != nil {
logrus.Errorf("Error stopping container %s: %v", ctr.ID(), err)
}
}
@@ -1185,7 +1183,7 @@ func (r *Runtime) generateName() (string, error) {
if _, err := r.state.LookupContainer(name); err == nil {
continue
} else {
- if errors.Cause(err) != ErrNoSuchCtr {
+ if errors.Cause(err) != define.ErrNoSuchCtr {
return "", err
}
}
@@ -1193,7 +1191,7 @@ func (r *Runtime) generateName() (string, error) {
if _, err := r.state.LookupPod(name); err == nil {
continue
} else {
- if errors.Cause(err) != ErrNoSuchPod {
+ if errors.Cause(err) != define.ErrNoSuchPod {
return "", err
}
}