ensure packages before xfs migration
This commit is contained in:
parent
5050648451
commit
4bba417801
20
lib/xfs.py
20
lib/xfs.py
|
@ -1,8 +1,10 @@
|
|||
# Library to setup XFS partition for docker
|
||||
from lib import ensure_packages_installed
|
||||
from lib import logging as logging_lib
|
||||
from lib import docker_interface
|
||||
from lib import utils
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
|
||||
|
@ -16,6 +18,15 @@ MIN_XFS_PARTITION_SIZE = 1024*24 # 24 GB
|
|||
|
||||
XFS_STATE_FILE = "/opt/clore-hosting/xfs_state"
|
||||
|
||||
MANDATORY_PACKAGES = [
|
||||
"xfsprogs",
|
||||
"dmidecode",
|
||||
"openvpn",
|
||||
"iproute2",
|
||||
"iputils-ping",
|
||||
"util-linux"
|
||||
]
|
||||
|
||||
# This code is runned on start of clore hosting to migrate docker to XFS partition system
|
||||
|
||||
# sudo fallocate -l 300G /docker-storage.img
|
||||
|
@ -30,6 +41,13 @@ def migrate():
|
|||
elif docker_xfs_state == "valid":
|
||||
return 'success'
|
||||
|
||||
packages_available = asyncio.run(ensure_packages_installed.ensure_packages_installed(
|
||||
MANDATORY_PACKAGES
|
||||
))
|
||||
|
||||
if not packages_available:
|
||||
return 'packages-missing'
|
||||
|
||||
log.info("Starting migration to xfs")
|
||||
docker_interface.stop_all_containers()
|
||||
|
||||
|
@ -80,7 +98,7 @@ def migrate():
|
|||
def validate_docker_xfs():
|
||||
code_root, stdout_root, stderr_root = utils.run_command("df -T /")
|
||||
code, stdout, stderr = utils.run_command(f"df -T {DOCKER_ROOT}")
|
||||
print([code, stderr, stdout])
|
||||
#print([code, stderr, stdout])
|
||||
if code_root == 0 and stderr_root == '' and ((code == 0 and stderr == '') or (code == 1 and f" {DOCKER_ROOT}: " in stderr and stdout == '')):
|
||||
root_blocks = None
|
||||
docker_root_blocks = None
|
||||
|
|
Loading…
Reference in New Issue