Parcourir la source

Disable lvm-metad udev rules when setting up backup writer

Some newer OS releases have udev rules that create lvm2-pvscan services for
each disk with detected lvm partitions (usually after a replication transfer is
complete), making normal migrations using multiple replications impossible to
complete, as it interferes with the second replication process by not having
the disk file available. This patch deletes the udev rules upon backup writer
setup.
Daniel Vincze il y a 3 ans
Parent
commit
1453f9bded
1 fichiers modifiés avec 14 ajouts et 0 suppressions
  1. 14 0
      coriolis/providers/backup_writers.py

+ 14 - 0
coriolis/providers/backup_writers.py

@@ -94,6 +94,18 @@ def _disable_lvm2_lvmetad(ssh):
             ssh, "sudo vgchange -an", get_pty=True)
 
 
+def _disable_lvm_metad_udev_rule(ssh):
+    """
+    Removes lvm-metad rule which creates lvm2-pvscan services for each disk
+    detected with lvm partitions (after a transfer is complete). During normal
+    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)
+
+
 def _check_deserialize_key(key):
     res = None
     if isinstance(key, paramiko.RSAKey):
@@ -459,6 +471,7 @@ class SSHBackupWriter(BaseBackupWriter):
 
     def _get_impl(self, path, disk_id):
         ssh = self._connect_ssh()
+        _disable_lvm_metad_udev_rule(ssh)
         _disable_lvm2_lvmetad(ssh)
 
         matching_devs = [
@@ -884,6 +897,7 @@ class HTTPBackupWriterBootstrapper(object):
         self._inject_iptables_allow(ssh)
 
     def setup_writer(self):
+        _disable_lvm_metad_udev_rule(self._ssh)
         _disable_lvm2_lvmetad(self._ssh)
         self._copy_writer(self._ssh)
         paths = utils.retry_on_error()(