On Sun, Jul 28, 2013 at 11:27 AM, Weiwei Jia <[email protected]> wrote: > This patch is based "Add gluster disk template" patch set. It would > umount gluster storage dir when the cluster is destroied. > > Signed-off-by: Weiwei Jia <[email protected]> > --- > lib/backend.py | 27 +++++++++++++++++++++++++++ > lib/bootstrap.py | 10 ++++++++++ > lib/rpc_defs.py | 3 +++ > lib/server/noded.py | 8 ++++++++ > 4 files changed, 48 insertions(+) > > diff --git a/lib/backend.py b/lib/backend.py > index c61a1e8..f58fa31 100644 > --- a/lib/backend.py > +++ b/lib/backend.py > @@ -3286,6 +3286,33 @@ def RemoveFileStorageDir(file_storage_dir): > file_storage_dir, err) > > > +def UmountGlusterStorageDir(gluster_storage_dir): > + """Umount gluster storage directory. > + > + Umount it only if it's mounted. If not log an error and return. > + > + @type gluster_storage_dir: string > + @param gluster_storage_dir: the directory we should umount > + @rtype: tuple (success,) > + @return: tuple of one element, C{success}, denoting > + whether the operation was successful > + > + """ > + gluster_storage_dir = _TransformFileStorageDir(gluster_storage_dir) > + if os.path.exists(gluster_storage_dir): > + if not os.path.isdir(gluster_storage_dir): > + _Fail("Specified Storage directory '%s' is not a directory", > + gluster_storage_dir) > + # umount dir only if it's mounted, otherwise we want to fail the rpc call > + result = utils.RunCmd(["umount", gluster_storage_dir]) > + > + if result.failed: > + raise errors.OpPrereqError("Could not umount %s, error %s" % > + (gluster_storage_dir, result.output)) > + else: > + _Fail("Gluster storage dir %s does not exist", gluster_storage_dir) > + > + > def RenameFileStorageDir(old_file_storage_dir, new_file_storage_dir): > """Rename the file storage directory. > > diff --git a/lib/bootstrap.py b/lib/bootstrap.py > index 54bd38a..cd8543b 100644 > --- a/lib/bootstrap.py > +++ b/lib/bootstrap.py > @@ -773,6 +773,16 @@ def FinalizeClusterDestroy(master_uuid): > if msg: > logging.warning("Could not disable the master IP: %s", msg) > > + gluster_storage_dir = cfg.GetClusterInfo().gluster_file_storage_dir > + if os.path.ismount(gluster_storage_dir): > + result = runner.call_gluster_storage_dir_umount(master_name, > + gluster_storage_dir) > + > + msg = result.fail_msg > + if msg: > + logging.warning("Could not umount gluster storage dir %s: %s" % > + (gluster_storage_dir, msg)) > +
This should be umounted at node remove time. I would send a new patch. Thanks. -- Thanks Weiwei Jia (Harry Wei)
