purge bridge interfaces in migration to xfs
This commit is contained in:
parent
4bba417801
commit
081840e0e8
|
@ -6,6 +6,7 @@ import ipaddress
|
|||
import socket
|
||||
import psutil
|
||||
import sys
|
||||
import os
|
||||
|
||||
config = config_module.config
|
||||
log = logging_lib.log
|
||||
|
@ -96,3 +97,19 @@ def is_ip_in_network(ip: str, network: str) -> bool:
|
|||
# If there's an error with the input values, print the error and return False
|
||||
log.debug(f"NETWORKING | is_ip_in_network() | Error: {e}")
|
||||
return False
|
||||
|
||||
def purge_clore_interfaces():
|
||||
network_interfaces = get_network_interfaces_with_subnet()
|
||||
if type(network_interfaces) != dict:
|
||||
log.error("Failed to load network interfaces, restarting...")
|
||||
os._exit(1)
|
||||
|
||||
clore_subnets = [ "172.17.0.1/16" ] # I can include the docker default subnet here
|
||||
for clore_default_network in config.clore_default_networks:
|
||||
clore_subnets.append(clore_default_network["subnet"])
|
||||
|
||||
for network_interface in network_interfaces.keys():
|
||||
if network_interface == "docker0" or network_interface[:3] == "br-":
|
||||
subnet = network_interfaces[network_interface]
|
||||
if subnet in clore_subnets or network_interface == "docker0":
|
||||
utils.run_command(f"ip link delete {network_interface}")
|
|
@ -2,6 +2,7 @@
|
|||
from lib import ensure_packages_installed
|
||||
from lib import logging as logging_lib
|
||||
from lib import docker_interface
|
||||
from lib import networking
|
||||
from lib import utils
|
||||
|
||||
import asyncio
|
||||
|
@ -70,6 +71,9 @@ def migrate():
|
|||
code, stdout, stderr = utils.run_command(
|
||||
f"systemctl stop docker && rm -rf {DOCKER_ROOT} && fallocate -l {str(data_img_size)}M {DOCKER_DATA_IMG} && mkfs.xfs {DOCKER_DATA_IMG}"
|
||||
)
|
||||
|
||||
networking.purge_clore_interfaces()
|
||||
|
||||
if code == 0:
|
||||
docker_config_success = configure_docker_daemon()
|
||||
if code == 0 and docker_config_success:
|
||||
|
|
Loading…
Reference in New Issue