[node-patches] Change in ovirt-node[master]: Mount kdump nfs targets before trying to use them

rbarry at redhat.com rbarry at redhat.com
Sun Sep 28 17:21:12 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Mount kdump nfs targets before trying to use them
......................................................................

Mount kdump nfs targets before trying to use them

Kdump over NFS won't even try anymore if it's not mounted. See
the discussion in rhbz#808298

Mount it before we try to set it as a target so kdump can deal
with it, then ummount it when we're done

Change-Id: I7b64094fe1c42638eac00ad81c79c043b884a528
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1095140
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/config/defaults.py
1 file changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/39/33439/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 64d7e6b..8491637 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -28,6 +28,7 @@
 from ovirt.node.utils.system import Bootloader
 import glob
 import os
+import tempfile
 
 """
 Classes and functions related to model of the configuration of oVirt Node.
@@ -1121,6 +1122,28 @@
 
                 _set_values(vals)
 
+        class MountNFS(utils.Transaction.Element):
+            title = "Mounting NFS volume for kdump configuration"
+
+            def commit(self):
+                try:
+                    import tempfile
+                    tmpdir = tempfile.mkdtemp()
+                    utils.process.check_call(["mount", "-t", "nfs", nfs,
+                                              tmpdir])
+                except utils.process.CalledProcessError as e:
+                    self.logger.warning("Failed to mount %s at %s" % (nfs,
+                                                                      tmpdir))
+
+        class UmountNFS(utils.Transaction.Element):
+            title = "Umounting NFS volume"
+
+            def commit(self):
+                try:
+                    utils.process.check_call(["umount", nfs])
+                except utils.process.CalledProcessError as e:
+                    self.logger.warning("Failed to umount %s" % nfs)
+
         class CreateNfsKdumpConfig(utils.Transaction.Element):
             title = "Creating kdump NFS config"
 
@@ -1245,6 +1268,8 @@
 
         final_txe = RestartKdumpService(backup_txe.backups)
         if nfs:
+            if not system.is_max_el(6):
+                tx.append(MountNFS())
             tx.append(CreateNfsKdumpConfig())
         elif ssh:
             if ssh_key:
@@ -1257,6 +1282,8 @@
 
         tx.append(final_txe)
 
+        if not system.is_max_el(6) and nfs:
+            tx.append(UmountNFS())
         return tx
 
 


-- 
To view, visit http://gerrit.ovirt.org/33439
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b64094fe1c42638eac00ad81c79c043b884a528
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list