فهرست منبع

Merge pull request #263 from Dany9966/http-transfer-fixes

HTTPS backup writer transfer fixes
Daniel Vincze 2 سال پیش
والد
کامیت
b8aadc51a8
2فایلهای تغییر یافته به همراه19 افزوده شده و 4 حذف شده
  1. 8 3
      coriolis/providers/backup_writers.py
  2. 11 1
      coriolis/utils.py

+ 8 - 3
coriolis/providers/backup_writers.py

@@ -19,11 +19,13 @@ from oslo_log import log as logging
 import paramiko
 import paramiko
 import requests
 import requests
 from six import with_metaclass
 from six import with_metaclass
+
 from coriolis import constants
 from coriolis import constants
 from coriolis import data_transfer
 from coriolis import data_transfer
 from coriolis import exception
 from coriolis import exception
 from coriolis import utils
 from coriolis import utils
 
 
+
 CONF = cfg.CONF
 CONF = cfg.CONF
 opts = [
 opts = [
     cfg.BoolOpt('compress_transfers',
     cfg.BoolOpt('compress_transfers',
@@ -99,9 +101,12 @@ def _disable_lvm_metad_udev_rule(ssh):
     migrations with multiple replications, these services need to be disabled,
     migrations with multiple replications, these services need to be disabled,
     therefore we make it impossible for the minion OS to create them.
     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):
 def _check_deserialize_key(key):

+ 11 - 1
coriolis/utils.py

@@ -25,7 +25,6 @@ import OpenSSL
 from oslo_config import cfg
 from oslo_config import cfg
 from oslo_log import log as logging
 from oslo_log import log as logging
 from oslo_serialization import jsonutils
 from oslo_serialization import jsonutils
-
 import netifaces
 import netifaces
 import paramiko
 import paramiko
 # NOTE(gsamfira): I am aware that this is not ideal, but pip
 # NOTE(gsamfira): I am aware that this is not ideal, but pip
@@ -41,6 +40,7 @@ from coriolis import constants
 from coriolis import exception
 from coriolis import exception
 from coriolis import secrets
 from coriolis import secrets
 
 
+
 opts = [
 opts = [
     cfg.StrOpt('qemu_img_path',
     cfg.StrOpt('qemu_img_path',
                default='qemu-img',
                default='qemu-img',
@@ -709,6 +709,15 @@ def _write_systemd(ssh, cmdline, svcname, run_as=None, start=True):
                 ssh, "sudo systemctl start %s" % svcname,
                 ssh, "sudo systemctl start %s" % svcname,
                 get_pty=True)
                 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 = {
     systemd_args = {
         "cmdline": cmdline,
         "cmdline": cmdline,
         "username": "root",
         "username": "root",
@@ -726,6 +735,7 @@ def _write_systemd(ssh, cmdline, svcname, run_as=None, start=True):
         ssh,
         ssh,
         "sudo mv /tmp/%s.service %s" % (name, serviceFilePath),
         "sudo mv /tmp/%s.service %s" % (name, serviceFilePath),
         get_pty=True)
         get_pty=True)
+    _correct_selinux_label()
     _reload_and_start(start=start)
     _reload_and_start(start=start)