Commit graph

31 commits

Author SHA1 Message Date
Matthew Heon a3dbb7a837 Add ability to rewrite pod configs in the database
Necessary for rewriting lock IDs as part of renumber.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-21 10:51:42 -05:00
Matthew Heon 84feff2e06 Add a function for overwriting container config
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-21 10:51:42 -05:00
Matthew Heon 5ed23327a9 Rename libpod.Config back to ContainerConfig
During an earlier bugfix, we swapped all instances of
ContainerConfig to Config, which was meant to fix some data we
were returning from Inspect. This unfortunately also renamed a
libpod internal struct for container configs. Undo the rename
here.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-01-07 14:37:51 -05:00
Matthew Heon 625c7e18ef Update unit tests to use in-memory lock manager
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2019-01-04 09:51:09 -05:00
Daniel J Walsh c657dc4fdb
Switch all referencs to image.ContainerConfig to image.Config
This will more closely match what Docker is doing.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-21 15:59:34 -05:00
Matthew Heon e3882cfa2d Use runtime lockDir in BoltDB state
Instead of storing the runtime's file lock dir in the BoltDB
state, refer to the runtime inside the Bolt state instead, and
use the path stored in the runtime.

This is necessary since we moved DB initialization very far up in
runtime init, before the locks dir is properly initialized (and
it must happen before the locks dir can be created, as we use the
DB to retrieve the proper path for the locks dir now).

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-04 13:58:51 -05:00
Matthew Heon 69ed2ccc54 Make locks dir in unit tests
Ensure we don't break the unit tests by creating a locks
directory (which, prior to the last commit, would be created by
BoltDB state init).

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-12-02 16:53:15 -05:00
Matthew Heon c7c56d800c Rework state testing to allow State structs to be empty
Pod and container State structs are now allowed to be empty on
first being retrieved from the database. Rework pod and container
equality functions used in testing to account for this change.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1186
Approved by: rhatdan
2018-07-31 14:19:50 +00:00
Miloslav Trmač 24fe6e950c Use testify/require in a few places to avoid panics in tests
Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1115
Approved by: rhatdan
2018-07-26 20:47:31 +00:00
Matthew Heon 84afa32493 Ensure pods are part of the set namespace when added
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Matthew Heon 7b30659629 Enforce namespace checks on container add
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Matthew Heon 572fd75d22 Add tests for state namespacing
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Matthew Heon 92e6bd01a8 Add namespaces to in memory state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Matthew Heon e838dcb4bf Add constraint that dependencies must be in the same ns
Dependency containers must be in the same namespace, to ensure
there are never problems resolving a dependency.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Matthew Heon ab9bc21877 Add namespaces and initial constraints to database
Add basic awareness of namespaces to the database. As part of
this, add constraints so containers can only be added to pods in
the same namespace.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Matthew Heon 018d2c6b1d Add pod state
Add a mutable state to pods, and database backend sutable for
modifying and updating said state.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #784
Approved by: rhatdan
2018-05-17 23:10:12 +00:00
Matthew Heon a1c0f18bca Add backend code for generic dependencies
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #577
Approved by: rhatdan
2018-04-03 14:57:16 +00:00
Matthew Heon b1dfee50e8 Add tests for container graphs
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #557
Approved by: rhatdan
2018-03-29 02:18:45 +00:00
Matthew Heon 5b6f59e36c Prevent ctrs not in pods from depending on pod ctrs
Containers in pods cannot depend on containers outside of the
same pod. Make the reverse true as well - containers not in pods
cannot depend on containers in pods. This greatly simplifies our
dependency handling, as we can guarantee that removing a pod will
not encounter dependency issues.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #558
Approved by: rhatdan
2018-03-29 01:27:40 +00:00
Matthew Heon b18f089545 Remove current SQLite DB driver
The SQLite DB backend has become an unmanageable nightmare. I
like having the option for DB work, but it's become an active
hindrance to further development, and it's definitely not in any
shape to be actively used.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #548
Approved by: baude
2018-03-26 20:18:24 +00:00
Matthew Heon f2041b51f3 Add FFJSON encoding/decoding for our container structs
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #323
Approved by: mheon
2018-02-16 16:46:09 +00:00
Matthew Heon dc6a99df4c Containers in a pod can only join namespaces in that pod
This solves some dependency problems in the state, and makes
sense from a design standpoint.

Containers not in a pod can still depend on the namespaces of
containers joined to a pod, which we might also want to change in
the future.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon 3962d10bd4 Fix gofmt and lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon 4f225b47c9 Refactor Pod to use a Config struct
This allows us to JSON it and stuff it in the DB - previously,
all pod fields were private, so JSON couldn't encode them. This
allows us to keep all pod fields private by having a substruct
with public fields.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon b4cdc27b31 Add implementation for BoltDB-backed state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon 86d549f2cd Fix gofmt and lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 19840e0b3d Finish unit tests for pods
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 4ecebf20b4 Rework state tests to avoid boilerplate. Begin adding pod tests.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 54e258bfde Convert remaining state tests to new style
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 0ae9097b32 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 67b6c132d8 Modify unit tests for state to run on all state implementations
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Renamed from libpod/sql_state_test.go (Browse further)