IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Bläddra i källkod

Added focker volume create.

tags/0.92
förälder
incheckning
5b34b99c9e
4 ändrade filer med 20 tillägg och 5 borttagningar
  1. +2
    -2
      focker.py
  2. +2
    -2
      image.py
  3. +4
    -0
      misc.py
  4. +12
    -1
      volume.py

+ 2
- 2
focker.py Visa fil

@@ -27,7 +27,7 @@ def create_parser():
parser = subparsers.add_parser('build')
parser.set_defaults(func=command_image_build)
parser.add_argument('focker_dir', type=str)
parser.add_argument('--tag', '-t', type=str, nargs='+', default=[])
parser.add_argument('--tags', '-t', type=str, nargs='+', default=[])
parser = subparsers.add_parser('tag')
parser.set_defaults(func=command_image_tag)
@@ -62,7 +62,7 @@ def create_parser():
subparsers = subparsers_top.add_parser('volume').add_subparsers()
parser = subparsers.add_parser('create')
parser.set_defaults(func=command_volume_create)
parser.add_argument('--tag', '-t', type=str, nargs='+', default=[])
parser.add_argument('--tags', '-t', type=str, nargs='+', default=[])
parser = subparsers.add_parser('prune')
parser.set_defaults(func=command_volume_prune)


+ 2
- 2
image.py Visa fil

@@ -74,8 +74,8 @@ def command_image_build(args):
spec = yaml.safe_load(f)
print('spec:', spec)
image, image_sha256 = build(spec, args)
zfs_untag(args.tag)
zfs_tag(image.split('@')[0], args.tag)
zfs_untag(args.tags)
zfs_tag(image.split('@')[0], args.tags)
def command_image_tag(args):


+ 4
- 0
misc.py Visa fil

@@ -0,0 +1,4 @@
import random
def random_sha256_hexdigest():
return bytes([ random.randint(0, 255) for _ in range(32) ]).hex()

+ 12
- 1
volume.py Visa fil

@@ -1,5 +1,16 @@
from .misc import random_sha256_hexdigest
from .zfs import *
def command_volume_create(args):
raise NotImplementedError
sha256 = random_sha256_hexdigest()
poolname = zfs_poolname()
for pre in range(7, 64):
name = poolname + '/focker/volumes/' + sha256[:pre]
if not zfs_exists(name):
break
zfs_run(['zfs', 'create', '-o', 'focker:sha256=' + sha256, name])
zfs_tag(name, args.tags)
def command_volume_prune(args):


Laddar…
Avbryt
Spara