Ignition direct-lvm

329 views
Skip to first unread message

Douglas Davenport

unread,
Jan 22, 2017, 10:30:37 AM1/22/17
to CoreOS User
Can Ignition setup a second device to be used by the docker direct-lvm storage driver?

How should this be provisioned?

Douglas Davenport

unread,
Jan 23, 2017, 8:54:27 AM1/23/17
to CoreOS User


On Sunday, January 22, 2017 at 10:30:37 AM UTC-5, Douglas Davenport wrote:
Can Ignition setup a second device to be used by the docker direct-lvm storage driver?

How should this be provisioned?

I'm very new to Container Linux and Ignition. Can someone please review what I have so far. Is there a better more idiomatic way to use Ignition for this type of provisioning?


The following Ignition yaml seems to working:

storage:
  files:
    - path: /etc/lvm/profile/docker-thinpool.profile
      filesystem: root
      mode: 0644
      contents:
        inline: |
          activation {
              thin_pool_autoextend_threshold=80
              thin_pool_autoextend_percent=20
          }
    - path: /opt/init-direct-lvm
      filesystem: root
      mode: 0544
      contents:
        inline: |
          #!/bin/bash -ex
          /usr/sbin/wipefs -f /dev/sdb
          /usr/sbin/pvcreate -y /dev/sdb
          /usr/sbin/vgcreate -y docker /dev/sdb
          /usr/sbin/lvcreate --wipesignatures y -n thinpool docker -l 95%VG
          /usr/sbin/lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG
          /usr/sbin/lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta
          /usr/sbin/lvchange --metadataprofile docker-thinpool docker/thinpool
          /usr/sbin/lvs -o+seg_monitor
          /usr/bin/rm -rfv /var/lib/docker

systemd:
  units:
    - name: direct-lvm.service
      enable: true
      contents: |
        [Unit]
        Description=Configure device for docker direct-lvm storage driver
        ConditionFirstBoot=yes
        Before=docker.service
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=-+/opt/init-direct-lvm
        [Install]
        RequiredBy=docker.service

    - name: docker.service
      dropins:
        - name: 10-direct-lvm.conf
          contents: |
            [Service]
            Environment="DOCKER_OPTS=--storage-driver=devicemapper --storage-opt dm.fs=ext4 --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt=dm.use_deferred_removal=true --storage-opt=dm.use_deferred_deletion=true"


Alex Crawford

unread,
Jan 30, 2017, 10:35:04 PM1/30/17
to Douglas Davenport, CoreOS User
That seems reasonable. Just to be clear though, that config is a
Container Linux config which can be converted by the config-transpiler
(ct for short) [1] into an Ignition config.

-Alex

[1]: https://github.com/coreos/container-linux-config-transpiler
signature.asc
Reply all
Reply to author
Forward
0 new messages