On 08/28/2012 11:11 AM, Wayne Sun wrote:
create_netfs_pool:
In rhel7 the source nfs mount dir shows in /proc/mounts will end with a
'/' which in rhel6 and rhel5 didn't. So the check with exact match will
fail on rhel7. Change with '/*' will accept with both '/' exist or not.
create_logical_volume:
When grep lvcreate command in /etc/lvm/backup/logical_pool for create
logical volume, rhel6 and rhel7 command is slightly differnet with
rhel5, so make the change to fit for all version.
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
repos/storage/create_logical_volume.py | 6 +++---
repos/storage/create_netfs_pool.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/repos/storage/create_logical_volume.py
b/repos/storage/create_logical_volume.py
index 098c148..9fd1305 100644
--- a/repos/storage/create_logical_volume.py
+++ b/repos/storage/create_logical_volume.py
@@ -54,9 +54,9 @@ def check_volume_create(poolobj, poolname, volname, size):
logger.debug("%s file path: %s" % (poolname, path))
if os.access(path, os.R_OK):
logger.debug("execute grep lvcreate %s command" % path)
- stat, ret = commands.getstatusoutput("grep \
-'lvcreate --name %s -L %sK /dev/%s' %s"\
- % (volname, size, poolname, path))
+ stat, ret = commands.getstatusoutput(
+ "grep 'lvcreate --name %s -L %sK .*%s' %s"
+ % (volname, size, poolname, path))
if stat == 0 and volname in poolobj.listVolumes():
logger.debug(ret)
return True
diff --git a/repos/storage/create_netfs_pool.py b/repos/storage/create_netfs_pool.py
index 9fb7b69..4603788 100644
--- a/repos/storage/create_netfs_pool.py
+++ b/repos/storage/create_netfs_pool.py
@@ -44,7 +44,7 @@ def check_pool_create_OS(conn, poolname, logger):
(src_host, src_path, dest_path) )
fd = open("/proc/mounts","r")
mount = src_host + ":" + src_path
- pat = mount + "\s+" + dest_path
+ pat = mount + "/*\s+" + dest_path
found = 0
for line in fd:
if re.match(pat, line):
ACK, thank for this patch.
pushed
Guannan