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

fabiand at redhat.com fabiand at redhat.com
Thu Nov 13 21:19:23 UTC 2014


Fabian Deutsch has posted comments on this change.

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


Patch Set 9:

(5 comments)

http://gerrit.ovirt.org/#/c/33439/9/src/ovirt/node/config/defaults.py
File src/ovirt/node/config/defaults.py:

Line 1125:             title = "Mounting NFS volume for kdump configuration"
Line 1126: 
Line 1127:             def commit(self):
Line 1128:                 try:
Line 1129:                     if not os.path.isdir("/var/run/kdump-nfs"):
Please still use a variable for the path to be used :) To prevent copy-n-paste errors or typos
Line 1130:                         os.makedirs("/var/run/kdump-nfs")
Line 1131:                     utils.process.check_call(["mount", "-t", "nfs", nfs,
Line 1132:                                               "/var/run/kdump-nfs"])
Line 1133: 


Line 1127:             def commit(self):
Line 1128:                 try:
Line 1129:                     if not os.path.isdir("/var/run/kdump-nfs"):
Line 1130:                         os.makedirs("/var/run/kdump-nfs")
Line 1131:                     utils.process.check_call(["mount", "-t", "nfs", nfs,
We can also use the mount class here.
Line 1132:                                               "/var/run/kdump-nfs"])
Line 1133: 
Line 1134:                     File("/etc/fstab").write(
Line 1135:                         "%s\t/var/run/kdump-nfs\tnfs\tdefaults\t0 0" % nfs,


Line 1131:                     utils.process.check_call(["mount", "-t", "nfs", nfs,
Line 1132:                                               "/var/run/kdump-nfs"])
Line 1133: 
Line 1134:                     File("/etc/fstab").write(
Line 1135:                         "%s\t/var/run/kdump-nfs\tnfs\tdefaults\t0 0" % nfs,
To prevent problems if the last line does not end with \n, we should append "\n…"
Line 1136:                         "a")
Line 1137:                 except utils.process.CalledProcessError:
Line 1138:                     self.logger.warning("Failed to mount %s at " +
Line 1139:                                         "/var/run/kdump-nfs" %


Line 1143:             title = "Umounting Kdump NFS volume"
Line 1144: 
Line 1145:             def commit(self):
Line 1146:                 try:
Line 1147:                     utils.process.check_call(["umount", nfs])
And here the mount class as well
Line 1148:                     File("/etc/fstab").sed("/.*\/var\/run\/kdump-nfs/d")
Line 1149:                 except utils.process.CalledProcessError:
Line 1150:                     self.logger.warning("Failed to umount %s" % nfs,
Line 1151:                                         exc_info=True)


Line 1285:             tx.append(LocalKdumpConfig())
Line 1286:         else:
Line 1287:             final_txe = RemoveKdumpConfig(backup_txe.backups)
Line 1288: 
Line 1289:         if not nfs and "/var/run/kdump-nfs" in File("/proc/mounts").read():
Use the variable introduced above
Line 1290:             tx[:0] = [UmountNFS()]
Line 1291: 
Line 1292:         tx.append(final_txe)
Line 1293: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7b64094fe1c42638eac00ad81c79c043b884a528
Gerrit-PatchSet: 9
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Ryan Barry <rbarry at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes



More information about the node-patches mailing list