Skip to content

Commit

Permalink
Merge pull request #263 from Dany9966/http-transfer-fixes
Browse files Browse the repository at this point in the history
HTTPS backup writer transfer fixes
  • Loading branch information
Dany9966 authored Sep 5, 2023
2 parents c235cbb + a41af4a commit b8aadc5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 8 additions & 3 deletions coriolis/providers/backup_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import paramiko
import requests
from six import with_metaclass

from coriolis import constants
from coriolis import data_transfer
from coriolis import exception
from coriolis import utils


CONF = cfg.CONF
opts = [
cfg.BoolOpt('compress_transfers',
Expand Down Expand Up @@ -99,9 +101,12 @@ def _disable_lvm_metad_udev_rule(ssh):
migrations with multiple replications, these services need to be disabled,
therefore we make it impossible for the minion OS to create them.
"""
rule_path = "/lib/udev/rules.d/69-lvm-metad.rules"
if utils.test_ssh_path(ssh, rule_path):
utils.exec_ssh_cmd(ssh, "sudo rm %s" % rule_path, get_pty=True)
rule_paths = [
"/lib/udev/rules.d/69-lvm-metad.rules",
"/lib/udev/rules.d/69-dm-lvm.rules"]
for path in rule_paths:
if utils.test_ssh_path(ssh, path):
utils.exec_ssh_cmd(ssh, "sudo rm %s" % path, get_pty=True)


def _check_deserialize_key(key):
Expand Down
12 changes: 11 additions & 1 deletion coriolis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils

import netifaces
import paramiko
# NOTE(gsamfira): I am aware that this is not ideal, but pip
Expand All @@ -41,6 +40,7 @@
from coriolis import exception
from coriolis import secrets


opts = [
cfg.StrOpt('qemu_img_path',
default='qemu-img',
Expand Down Expand Up @@ -709,6 +709,15 @@ def _reload_and_start(start=True):
ssh, "sudo systemctl start %s" % svcname,
get_pty=True)

def _correct_selinux_label():
cmd = "sudo /sbin/restorecon -v %s" % serviceFilePath
try:
exec_ssh_cmd(ssh, cmd, get_pty=True)
except exception.CoriolisException:
LOG.warn(
"Could not relabel service '%s'. SELinux might not be "
"installed. Error was: %s", svcname, get_exception_details())

systemd_args = {
"cmdline": cmdline,
"username": "root",
Expand All @@ -726,6 +735,7 @@ def _reload_and_start(start=True):
ssh,
"sudo mv /tmp/%s.service %s" % (name, serviceFilePath),
get_pty=True)
_correct_selinux_label()
_reload_and_start(start=start)


Expand Down

0 comments on commit b8aadc5

Please sign in to comment.