On Mon, Jul 29, 2013 at 1:01 PM, harryxiyou <[email protected]> wrote:
> On Mon, Jul 29, 2013 at 6:29 PM, Michele Tartara <[email protected]> > wrote: > [...] > > 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). > > > > ACK. > > > 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). > > > > Should I do it as follows? > > if not os.path.ismount(gluster_storage_dir): > do_mount_operations. > else: > etc_mtab = get_etc_mtab_contents() > if fuse.glusterfs not in etc_mat: > report_errors() > More or less. But the check should be more precise. You should check whether you can find in there one line that shows that in the directory you are looking for there is something mounted, and if that something is a gluster FS, and whether it corresponds to the one you actually wanted to mount there. 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
