20 Commits

Author SHA1 Message Date
72f1617fac Bump Go module to v5
Moving from Go module v4 to v5 prepares us for public releases.

Move done using gomove [1] as with the v3 and v4 moves.

[1] https://github.com/KSubedi/gomove

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-08 09:35:39 -05:00
2a2d0b0e18 chore: delete obsolete // +build lines
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-04 11:53:38 +02:00
bad25da92e libpod: add !remote tag
This should never be pulled into the remote client.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-10-24 12:11:34 +02:00
b6ec2127b8 libpod: set cid network alias in setupContainer()
Since we have sqlite there is no point in duplicating this acroos two db
backends. Just set earlier when we validate the networks anyway.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-11 15:16:11 +02:00
bbe9d61c49 sqlite: move first read into a transaction
According to an old upstream issue [1]: "If the first statement after
BEGIN DEFERRED is a SELECT, then a read transaction is started.
Subsequent write statements will upgrade the transaction to a write
transaction if possible, or return SQLITE_BUSY."

So let's move the first SELECT under the same transaction as the table
initialization.

[NO NEW TESTS NEEDED] as it's a hard to cause race.

[1] https://github.com/mattn/go-sqlite3/issues/274#issuecomment-1429054597

Fixes: #17859
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-04-25 16:01:49 +02:00
94f905a503 Fix SQLite DB schema migration code
It now can safely run on bare databases, before any tables are
created.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2023-03-17 13:24:53 -04:00
2ec11b16ab Fix various integration test issues with SQLite state
Two main changes:
- The transient state tests relied on BoltDB paths, change to
  make them agnostic
- The volume code in SQLite wasn't retrieving and setting the
  volume plugin for volumes that used one.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-03-15 14:45:18 -04:00
6e0f11da5d Improve handling of existing container names in SQLite
Return more sensible errors than SQLite's embedded constraint
failure ones. Should fix a number of integration tests.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-03-15 14:44:47 -04:00
2c67ff5d40 sqlite: add container short ID to network aliases
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-03-01 16:09:51 +01:00
2342d1a314 sqlite: addContainer: add named volume only once
There's a unique constraint in the table, so we shouldn't add the same
volume more than once to the same container.

[NO NEW TESTS NEEDED] as it fixes an existing one.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-03-01 16:09:51 +01:00
69ff04f736 sqlite: fix type rewriting container config
It's `UPDATE $NAME` not `UPDATE TABLE $NAME`.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-03-01 16:09:51 +01:00
7c11f7e174 sqlite: exit code: allow -1
The value of -1 is used when we do not _yet_ know the exit code of the
container.  Otherwise, the DB checks would error.  There's probably a
smarter than allowing -1 but for now, that will do the trick and let the
tests progress.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-23 10:35:48 +01:00
eeabe975ea sqlite: implement pod methods
[NO NEW TESTS NEEDED] - the sqlite backend is still in development and
is not enabled by default.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-23 10:35:41 +01:00
59a54f32dc Add support for volume operations to SQLite state
Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00
c0b92bdbc7 Implement exec session handling in SQL database
Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00
627a5b73bf Various fixes from code review
Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00
97499a70aa Implement network disconnect for SQLite state
Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00
8ab18d8482 Fix various lint issues
Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00
b4c4f9c93d Some further work on SQLite state
- Added a mechanism to check schema version and migrate
  (no migrations yet since schema hasn't changed yet).
- Added pod support to AddContainer, and unified AddContainer and
  RemoveContainer between containers and pods.
- Fixed newly-added GetPodName and GetCtrName in BoltDB so they
  only return pod/container names.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00
1b968c6074 Add initial SQLite-backed state implementation
This contains the implementation of (most) container functions,
with stubs for all pod and volume functions. Presently accessed
via environment variable only for testing purposes.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-02-22 11:00:50 -05:00