devmapper docs: small fixes
Signed-off-by: Gavin Inglis <giinglis@amazon.com>
This commit is contained in:
parent
459179360a
commit
c721c8e274
@ -8,7 +8,7 @@ in a devicemapper thin pool.
|
|||||||
To make it work you need to prepare `thin-pool` in advance and update containerd's configuration file.
|
To make it work you need to prepare `thin-pool` in advance and update containerd's configuration file.
|
||||||
This file is typically located at `/etc/containerd/config.toml`.
|
This file is typically located at `/etc/containerd/config.toml`.
|
||||||
|
|
||||||
Here's minimal sample entry that can be made in the configuration file:
|
Here's a minimal sample entry that can be made in the configuration file:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
version = 2
|
version = 2
|
||||||
@ -91,10 +91,10 @@ sudo dmsetup create "${POOL_NAME}" \
|
|||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
#
|
#
|
||||||
# Add this to your config.toml configuration file and restart containerd daemon
|
# Add this to your config.toml configuration file and restart the containerd daemon
|
||||||
#
|
#
|
||||||
[plugins]
|
[plugins]
|
||||||
[plugins.devmapper]
|
[plugins."io.containerd.snapshotter.v1.devmapper"]
|
||||||
pool_name = "${POOL_NAME}"
|
pool_name = "${POOL_NAME}"
|
||||||
root_path = "${DATA_DIR}"
|
root_path = "${DATA_DIR}"
|
||||||
base_image_size = "10GB"
|
base_image_size = "10GB"
|
||||||
@ -102,19 +102,19 @@ cat << EOF
|
|||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `dmsetup` to verify that the thin-pool created successfully:
|
Use `dmsetup` to verify that the thin-pool was created successfully:
|
||||||
```bash
|
```bash
|
||||||
sudo dmsetup ls
|
sudo dmsetup ls
|
||||||
devpool (253:0)
|
devpool (253:0)
|
||||||
```
|
```
|
||||||
|
|
||||||
Once configured and restarted `containerd`, you'll see the following output:
|
Once `containerd` is configured and restarted, you'll see the following output:
|
||||||
```
|
```
|
||||||
INFO[2020-03-17T20:24:45.532604888Z] loading plugin "io.containerd.snapshotter.v1.devmapper"... type=io.containerd.snapshotter.v1
|
INFO[2020-03-17T20:24:45.532604888Z] loading plugin "io.containerd.snapshotter.v1.devmapper"... type=io.containerd.snapshotter.v1
|
||||||
INFO[2020-03-17T20:24:45.532672738Z] initializing pool device "dev-pool"
|
INFO[2020-03-17T20:24:45.532672738Z] initializing pool device "dev-pool"
|
||||||
```
|
```
|
||||||
|
|
||||||
Another way to setup a thin-pool is via [container-storage-setup](https://github.com/projectatomic/container-storage-setup)
|
Another way to setup a thin-pool is via the [container-storage-setup](https://github.com/projectatomic/container-storage-setup)
|
||||||
tool (formerly known as `docker-storage-setup`). It is a script to configure CoW file systems like devicemapper:
|
tool (formerly known as `docker-storage-setup`). It is a script to configure CoW file systems like devicemapper:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -55,13 +55,13 @@ var (
|
|||||||
ErrAlreadyExists = errors.New("object already exists")
|
ErrAlreadyExists = errors.New("object already exists")
|
||||||
)
|
)
|
||||||
|
|
||||||
// PoolMetadata keeps device info for the given thin-pool device, it also responsible for
|
// PoolMetadata keeps device info for the given thin-pool device, generates next available device ids,
|
||||||
// generating next available device ids and tracking devmapper transaction numbers
|
// and tracks devmapper transaction numbers
|
||||||
type PoolMetadata struct {
|
type PoolMetadata struct {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPoolMetadata creates new or open existing pool metadata database
|
// NewPoolMetadata creates new or opens existing pool metadata database
|
||||||
func NewPoolMetadata(dbfile string) (*PoolMetadata, error) {
|
func NewPoolMetadata(dbfile string) (*PoolMetadata, error) {
|
||||||
db, err := bolt.Open(dbfile, 0600, nil)
|
db, err := bolt.Open(dbfile, 0600, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -133,7 +133,7 @@ func (m *PoolMetadata) ChangeDeviceState(ctx context.Context, name string, state
|
|||||||
|
|
||||||
// MarkFaulty marks the given device and corresponding devmapper device ID as faulty.
|
// MarkFaulty marks the given device and corresponding devmapper device ID as faulty.
|
||||||
// The snapshotter might attempt to recreate a device in 'Faulty' state with another devmapper ID in
|
// The snapshotter might attempt to recreate a device in 'Faulty' state with another devmapper ID in
|
||||||
// subsequent calls, and in case of success it's status will be changed to 'Created' or 'Activated'.
|
// subsequent calls, and in case of success its status will be changed to 'Created' or 'Activated'.
|
||||||
// The devmapper dev ID will remain in 'deviceFaulty' state until manually handled by a user.
|
// The devmapper dev ID will remain in 'deviceFaulty' state until manually handled by a user.
|
||||||
func (m *PoolMetadata) MarkFaulty(ctx context.Context, name string) error {
|
func (m *PoolMetadata) MarkFaulty(ctx context.Context, name string) error {
|
||||||
return m.db.Update(func(tx *bolt.Tx) error {
|
return m.db.Update(func(tx *bolt.Tx) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user