def extend_online(self, dev_path):
     cmd = '/usr/sbin/xfs_growfs'
     args = [cmd, dev_path]
     cmdstr = ' '.join(args)
     msg = RESIZING_FS % (self.name)
     o, e, s = execWithCaptureErrorStatusProgress(cmd, args, msg)
     if s != 0:
         raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr, e))
    def create(self, path):
        if not self.creatable:
            raise "not creatable"

        try:
            valid = False
            while not valid:
                rc = self.dlg.run()
                if rc == gtk.RESPONSE_OK:
                    valid = True
                    msg = ''
                    illegal_chars = ';:\'"/?.>,<]}[{ =+)(*&^%$#@!`~'
                    c_name = self.clustername_entry.get_text().strip()
                    g_name = self.gfsname_entry.get_text().strip()
                    for c in illegal_chars:
                        if c in c_name:
                            msg = _(
                                "Cluster name contains illegal character " + c)
                            valid = False
                        if c in g_name:
                            msg = _("GFS name contains illegal character " + c)
                            valid = False
                    if len(c_name) == 0:
                        msg = _("Missing Cluster Name")
                        valid = False
                    elif len(g_name) == 0:
                        msg = _("Missing GFS Name")
                        valid = False
                    if not valid:
                        self.__errorMessage(msg)
                    else:
                        j_num = self.journals_spin.get_value_as_int()
                        table = c_name + ':' + g_name
                        locking_type = 'lock_'
                        if self.lock_dlm_butt.get_active():
                            locking_type += 'dlm'
                        elif self.lock_gulm_butt.get_active():
                            locking_type += 'gulm'
        except:
            self.dlg.hide()
            raise
        self.dlg.hide()

        MKFS_GFS_BIN = '/sbin/gfs_mkfs'
        args = [MKFS_GFS_BIN]
        args.append('-j')
        args.append(str(j_num))
        args.append('-p')
        args.append(locking_type)
        args.append('-t')
        args.append(table)
        args.append('-O')
        args.append(path)
        cmdstr = ' '.join(args)
        msg = CREATING_FS % (self.name)
        o, e, r = execWithCaptureErrorStatusProgress(MKFS_GFS_BIN, args, msg)
        if r != 0:
            raise CommandError('FATAL', FSCREATE_FAILURE % (cmdstr, e))
 def extend_online(self, dev_path):
     args = ['/sbin/gfs2_grow']
     args.append(dev_path)
     cmdstr = ' '.join(args)
     msg = RESIZING_FS % (self.name)
     o, e, r = execWithCaptureErrorStatusProgress('/sbin/gfs2_grow', args,
                                                  msg)
     if r != 0:
         raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr, e))
 def upgrade(self, dev_path):
     args = ['/sbin/tune2fs']
     args.append('-j')
     args.append(dev_path)
     cmdstr = ' '.join(args)
     msg = UPGRADING_FS % (self.name, ext3().name)
     o, e, r = execWithCaptureErrorStatusProgress('/sbin/tune2fs', args,
                                                  msg)
     if r != 0:
         raise CommandError('FATAL', FSUPGRADE_FAILURE % (cmdstr, e))
 def create(self, path):
     args = list()
     args.append("/sbin/mkfs")
     args.append("-t")
     args.append('xfs')
     args.append(path)
     cmdstr = ' '.join(args)
     msg = CREATING_FS % (self.name)
     o, e, r = execWithCaptureErrorStatusProgress("/sbin/mkfs", args, msg)
     if r != 0:
         raise CommandError('FATAL', FSCREATE_FAILURE % (cmdstr, e))
    def extend_offline(self, dev_path):
        # first check fs (resize2fs requirement)
        args = list()
        args.append('/sbin/e2fsck')
        args.append('-f')
        args.append('-p')  # repair fs
        args.append(dev_path)
        cmdstr = ' '.join(args)
        msg = CHECKING_FS % self.name
        o, e, r = execWithCaptureErrorStatusProgress('/sbin/e2fsck', args, msg)
        if not (r == 0 or r == 1):
            raise CommandError('FATAL', FSCHECK_FAILURE % (cmdstr, e))

        args = list()
        args.append('/sbin/resize2fs')
        args.append(dev_path)
        cmdstr = ' '.join(args)
        msg = RESIZING_FS % (self.name)
        o, e, r = execWithCaptureErrorStatusProgress('/sbin/resize2fs', args,
                                                     msg)
        if r != 0:
            raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr, e))
 def create(self, path):
     MKFS_GFS_BIN = '/sbin/gfs2_mkfs'
     args = [MKFS_GFS_BIN]
     args.append('-j')
     args.append('1')
     args.append('-p')
     args.append('lock_nolock')
     args.append('-O')
     args.append(path)
     cmdstr = ' '.join(args)
     msg = CREATING_FS % (self.name)
     o, e, r = execWithCaptureErrorStatusProgress(MKFS_GFS_BIN, args, msg)
     if r != 0:
         raise CommandError('FATAL', FSCREATE_FAILURE % (cmdstr, e))