Skip to content

Volume managment

Kamil Koczurek edited this page Sep 4, 2024 · 10 revisions

Introduction

This document describes the definition of volumes within the Deploy exe-script command.

Motivating example

Up until now, the root file system was built using overlay-fs with the lowerdir being the .gvmi image (or rather the squashfs image contained within) and the upperdir and workdir set to a 128MiB tmpfs.

Scope

By passing a volumes field within the deployment command, the following can be achieved:

  • Adding new volumes for transferring files between requestor and the VM (equivalent of VOLUME in Dockerfile).
  • Having upperdir and workdir of / in either a larger tmpfs or on disk-backed storage.
  • Mounting tmpfs or disk-backed storage at arbitrary paths.

Volumes

Two schemas are permitted. First, an explicit form mapping mount points (relative to root) to volume definitions (see below):

{ 
  deploy: {
    volumes: {
        "/golem/input": { host: {} }, 
        "/golem/output": { host: {} }
        "/": { ram: { size: "1g" }
    }
  }
}

As well as a simplified form if only { host: {} } volumes (equivalent to VOLUME in Dockerfile) are desired.

{ 
  deploy: {
    volumes: ["/golem/input", "/golem/output"]
  }
}

In this case, the equivalent long-form would be:

{ 
  deploy: {
    volumes: {
        "/golem/input": { host: {} }, 
        "/golem/output": { host: {} }
    }
  }
}

Variants:

host

This is used for creating a mount point for transfering files between requestor and provider. This variant is not permitted for the root directory.

ram

Name Type Description Notes
size String size formatting below [required]

storage

Name Type Description Notes
size String size formatting below [required]
preallocate String size formatting below [optional] [default to 0]
errors String possible values continue, remount-ro, panic [optional] [default to continue]

Size formatting

Size is formatted as a floating-point number suffixed by the unit, supporting both SI units (powers of 10) and binary units (powers of 2). The units are not case-sensitive and whitespace is permitted between the number and the unit.

Powers of 10

Long Short Value
b [n/a] 10^0 = 1
kb k 10^3 = 1000
mb m 10^6 = 1000^2
gb g 10^9 = 1000^3
tb t 10^12 = 1000^4
pb p 10^15 = 1000^5

Powers of 2

Long Short Value
b [n/a] 2^0 = 1
kib ki 2^10 = 1024
mib mi 2^20 = 1024^2
gib gi 2^30 = 1024^3
tib ti 2^40 = 1024^4
pib pi 2^50 = 1024^5

Examples

  1. Root file system that can grow upto 1 gigabyte. no preallocation. container will panic if error occurs.
{ 
  deploy: {
    volumes: {
        "/": { storage: { size: "1g",  errors: "panic" }
    }
  }
}
  1. Root fs, with prealoocated 10GB storage.
{ 
  deploy: {
    volumes: {
        "/": { storage: { size: "10g",  preallocate: "10g" }
    }
  }
}
  1. Root fs with in memory overflow size 1g
{ 
  deploy: {
    volumes: {
        "/": { tmpfs: { size: "1g" }
    }
  }
}
  1. Disable image volume definition for /golem/input
{ 
  deploy: {
    volumes: {
        "/golem/input": null
    }
  }
}
Clone this wiki locally