On Mon, Jul 29, 2013 at 11:14 AM, harryxiyou <[email protected]> wrote:
> On Mon, Jul 29, 2013 at 3:55 PM, Michele Tartara <[email protected]> > wrote: > > On Sat, Jul 27, 2013 at 7:28 PM, Weiwei Jia <[email protected]> > wrote: > >> > >> Signed-off-by: Weiwei Jia <[email protected]> > >> --- > >> lib/cmdlib/instance_storage.py | 16 ++++++++++++++++ > >> 1 file changed, 16 insertions(+) > >> > >> diff --git a/lib/cmdlib/instance_storage.py > >> b/lib/cmdlib/instance_storage.py > >> index 793cfa6..33b344d 100644 > >> --- a/lib/cmdlib/instance_storage.py > >> +++ b/lib/cmdlib/instance_storage.py > >> @@ -247,6 +247,22 @@ def CreateDisks(lu, instance, to_skip=None, > >> target_node_uuid=None, disks=None): > >> CheckDiskTemplateEnabled(lu.cfg.GetClusterInfo(), > >> instance.disk_template) > >> > >> if instance.disk_template in constants.DTS_FILEBASED: > >> + if instance.disk_template == constants.DT_GLUSTER_FILE: > >> + gluster_storage_dir = > >> lu.cfg.GetClusterInfo().gluster_file_storage_dir > >> + if not os.path.ismount(gluster_storage_dir): > > > > > > Actually, this isn't really going to work. > > > > This only checks that the directory is a mount point. But what you need > to > > know, is whether it is the mount point for the exact Gluster volume you > are > > interested into. > > So, while the check you used is required, it is not enough. > > After having some deep thoughts, I think it is *enough* for us to check. > Like the last email you reply to me, "mounting is safe, unmounting not > so much". We need NOT know whether it is the mount point for the exact > Gluster volume AND we just need to get the directory from the > gluster_storage_dir > at cluster initialization time and check whether it has been mounted. > If umounted, > just mount the gluster storage directory. > > Yes, mounting is safe as in "if nobody did it before and we do it, then we know we are not impacting anything else". But if something is already mounted, you need to check whether it's what you need or not. Otherwise you might end up writing files in the wrong place (for example, not in the actually shared file system). In order to check what is mounted there, you can have a look at the content of /etc/mtab (or at the output of "mount" executed with no parameters, which should be the same). Cheers, Michele -- Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
