示例#1
0
 def get_service_config(self):
     fstab = Fstab()
     fstab.read(self.__FSTAB)
     configurations = []
     for l in fstab.get_rozofs_lines():
         o = l.get_rozofs_options()
         configurations.append(RozofsMountConfig(o["host"], o["path"], o["instance"]))
     return configurations
示例#2
0
 def _remove_mountpoint(self, export_host, export_path):
     fstab = Fstab()
     fstab.read(self.__FSTAB)
     mount_path = self._mount_path(export_host, export_path)
     if os.path.exists(mount_path):
         os.rmdir(mount_path)
     # remove the line from fstab
     newlines = [l for l in fstab.lines if l.directory != mount_path]
     fstab.lines = newlines
     fstab.write(self.__FSTAB)
示例#3
0
 def _add_mountpoint(self, export_host, export_path, instance):
     fstab = Fstab()
     fstab.read(self.__FSTAB)
     mount_path = self._mount_path(export_host, export_path)
     if not os.path.exists(mount_path):
         os.makedirs(mount_path)
     # add a line to fstab
     fstab.lines.append(
         Line(self.__FSTAB_LINE %
              (mount_path, export_host, export_path, instance)))
     fstab.write(self.__FSTAB)
示例#4
0
 def _add_mountpoint(self, export_host, export_path, instance, options):
     fstab = Fstab()
     fstab.read(self.__FSTAB)
     mount_path = self._mount_path(export_host, export_path)
     if not os.path.exists(mount_path):
         os.makedirs(mount_path)
     # add a line to fstab
     if not options:
         stroptions=""
     else:
         stroptions = ',' + ','.join(options)
     
     fstab.lines.append(Line(self.__FSTAB_LINE % (mount_path, export_host, export_path, instance, stroptions)))
     fstab.write(self.__FSTAB)
示例#5
0
 def _list_mountpoint(self):
     fstab = Fstab()
     fstab.read(self.__FSTAB)
     return [l.directory for l in fstab.get_rozofs_lines()]