15 Commits

Author SHA1 Message Date
Jonathan Boulle 4c64fa6e93 Merge pull request #861 from jonboulle/copyright
*: adjust copyright header + remove NOTICE
2015-05-07 14:38:45 -07:00
Jonathan Boulle 9685f37575 *: adjust copyright header
Inspired by a similar change in the Kubernetes project [1], this changes
the copyright header to the more generic "The rkt Authors" rather than
"CoreOS, Inc.", which is only sometimes correct.

https://github.com/GoogleCloudPlatform/kubernetes/commit/6b3a6e6b983f967c88d14d26542ec6e30c49ebd3
2015-05-03 14:29:15 -07:00
Brandon Philips 40ced98c32 version: bump to v0.5.5 2015-05-01 19:16:44 -04:00
Simone Gotti 7c69744267 rkt: add command to remove one or more images from the store.
This adds a new command `rkt rmimage` to remove one or more images from the
store providing a key uniquely resolvable.

The logic is to firstly remove transactional data (the rows in the aciinfo and
remote db tables for the given key) and then remove non transactional data (the
diskv blob and imageManifest stores).

The tree store is removed separately and only if an image hash related to the
tree store key isn't referenced by any preparing/prepared/running pod.
This means that an image can be removed (from the db and the blob/imageManifest
stores) but not from the treestore.

As removal of non transactional data can fail for multiple reasons some data
can remain stale, the same applies if the treestore can't be removed because
referenced by a pod.
A future patch will provide a cas gc to clean the stale files and unreferenced
treestores.

Example:

```
$ rkt rmimage sha512-aa244c542b1b631bbd616bc266909b sha512-aaa wronghash
rkt: successfully removed aci for key: "sha512-aa244c542b1b631bbd616bc266909b"
rkt: key "sha512-aaa" not valid: no keys found
rkt: wrong key "wronghash": badly formatted hash string
rkt: 1 image(s) successfully removed
rkt: 2 image(s) cannot be removed
```
2015-04-30 11:53:13 +02:00
Simone Gotti c1e9a85008 store: define specific error for key not found.
It's needed when you want to know if the key exists.
2015-04-30 11:53:13 +02:00
Simone Gotti 75bd537db2 rkt: add command to list images in the store.
This adds a new command "rkt images" to display the images in the store.

The -fields option let the user provide a comma separated list of fields to display. Accepted values: "key", "appname", "importtime", "latest".
The -sort option permits to sort the output according to the provided comma separated list of fields. Accepted values: "appname", "importtime".
The ordering is ascending by default but can be configured with the -order=[asc|desc] option.

By default all the available fields ("key", "appname", "importtime", "latest") are displayed sorted by ascending "importtime".

If the image has a version label its written in the app name (with the ":$version" format).

In future additional options can be provided:
* show all the labels
* define displayed time format (for example human format like "3 days ago").
* filter by field value.

Examples:

```
$ rkt images
KEY                                                                     APPNAME                                IMPORTTIME                              LATEST
sha512-fa1cb92dc276b0f9bedf87981e61ecde93cc16432d2441f23aa006a42bb873df coreos.com/etcd:v2.0.5                 2015-03-01 16:18:38.951 +0100 CET       false
sha512-683438b100a48aead6c37e4f581105713763bb41c3f995ad58a2cc49eb744d68 test                                   2015-03-01 16:53:47.45 +0100 CET        false
sha512-8cf2956f26035ac7d34b78722b8a738fae74acfe29b18db0a92ed44bbcfd2958 coreos.com/rocket/stage1:0.0.1         2015-03-01 17:02:34.636 +0100 CET       false
sha512-d6bb5eb2c30cd12d305192c395f783d7039136a7484f2e07761323a39a0915b6 coreos.com/rocket/stage1:0.0.1         2015-03-10 12:03:26.57 +0100 CET        false
```

```
$ rkt images -sort="appname,importtime" -order=desc -fields="importtime,appname,latest"
IMPORTTIME                              APPNAME                               LATEST
2015-03-01 16:53:47.45 +0100 CET        test                                  false
2015-03-10 12:03:26.57 +0100 CET        coreos.com/rocket/stage1:0.0.1        false
2015-03-01 17:02:34.636 +0100 CET       coreos.com/rocket/stage1:0.0.1        false
2015-03-01 16:18:38.951 +0100 CET       coreos.com/etcd:v2.0.5                false
```
2015-04-29 11:29:55 +02:00
Jonathan Boulle c8a7050a88 version: bump to v0.5.4 2015-04-23 10:39:30 -07:00
Jonathan Boulle fe9ca8ae89 store: fix final ds -> s 2015-04-21 01:59:17 -07:00
Jonathan Boulle e5eeaef5e3 store: rename ds -> s
ds was a legacy name reflecting the store was once DownloadStore
2015-04-20 16:47:44 -07:00
Jonathan Boulle b250e651be Merge pull request #762 from sgotti/rktsyncfs
rkt: sync prepared pod file contents on disk and use syncfs also in treestore
2015-04-17 12:14:50 -07:00
Iago López Galeiras dea7868cef install: fix rkt install again
Create all cas directories explicitly and create qldb files with the
right permissions.

If we don't create them and the first fetch is made by root, the
files/directories will be created with root permissions and following
fetches as a user belonging to the rkt group will fail.
2015-04-17 16:31:54 +02:00
Simone Gotti 324a38136a store: use syncfs instead of syncing every file on TreeStore.Write().
as suggested in #639 use syncfs syscall.
2015-04-15 10:57:36 +02:00
Simone Gotti 679b3bfe9c store: add migrate code and tests.
This patch adds migrate codes and tests. It simply updates the current db
version to 1 without changing the schema.

The migration needs an exclusive store lock to avoid concurrent old rkt versions
operating to an updated db and returning strange errors or giving bad behaviours.
As the store lock is removed when spawning the stage0, migration isn't blocked by
running containers but only by rkt processes doing store operations (like
downloading an image, rendering an aci etc...).

Now migration covers only db updates. If the migration needs to also operate on
the other "non transactional" store entities (like the diskv stores or the tree
store) this should be thoroughly reasoned, as a rollback in case of an error is
not an easy task.

Test are added to introduce the migration testing framework and be the base for
future migration tests.
2015-04-09 10:56:42 +02:00
Simone Gotti 140fcb3858 store: do not commit/rollback inside deferred function.
Actually if a panic in a called function happens, the deferred function will
call tx.Commit (as on panic err is nil), with the possibility to commit an
incomplete transaction, instead of rollbacking or returning an error (that will
rolback on the next db.Close).

One solution will be to recover the panic to avoid calling tx.Commit.

As the error path is only one, just call tx.Rollback/tx.Commit in the proper
places without using a deferred function.
2015-04-09 10:52:49 +02:00
Jesse Dubay 99218f8676 cas: rename to store
The cas package implements more than just a CAS, so this patch gives it
a suitably generic name.

Fixes #707
2015-04-07 18:05:03 -07:00