On Mon, Jul 29, 2013 at 8:34 PM, Michele Tartara <[email protected]> wrote: > On Mon, Jul 29, 2013 at 1:24 PM, harryxiyou <[email protected]> wrote: >> >> On Mon, Jul 29, 2013 at 7:04 PM, Michele Tartara <[email protected]> >> wrote: >> > 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. >> > >> >> ACK. >> >> Should I update it as follows? >> >> if not os.path.ismount(gluster_storage_dir): >> do_mount_operations >> else: >> etc_mtab = rpc_get_etc_mtab_file_contents() >> gluster_storage_dir_line = get_line(etc_mtab) >> hostname = get_hostname(gluster_storage_dir_line) >> volname = get_volname(gluster_storage_dir_line) >> gluster_dir = get_gluster_dir(gluster_storage_dir_line) >> mount_type = get_mount_type(gluster_storage_dir_line) >> >> if hostname != gluster_hostname or >> volname != gluster_volname or >> gluster_dir != gluster_storage_dir or >> mount_type != "fuse.glusterfs" >> report_errors() >> >> >> >> Are above Okay? Any comments? > > > Yes, this is ok. Just be careful to get the right line from the file (take > it using the mount point as the reference). >
Okay, thanks very much ;-) -- Thanks Weiwei Jia (Harry Wei)
