Example #1
0
 def show_pool_type_help(self, pool_type):
     """ Show pool type help to the user """
     msg = ""
     if pool_type == "None":
         msg = _("'None' pool will use ZFS on a single selected disk.")
     elif pool_type == "Stripe":
         msg = _("When created together, with equal capacity, ZFS "
                 "space-balancing makes a span act like a RAID0 stripe. "
                 "The space is added together. Provided all the devices "
                 "are of the same size, the stripe behavior will "
                 "continue regardless of fullness level. If "
                 "devices/vdevs are not equally sized, then they will "
                 "fill mostly equally until one device/vdev is full.")
     elif pool_type == "Mirror":
         msg = _("A mirror consists of two or more devices, all data "
                 "will be written to all member devices. Cnchi will "
                 "try to group devices in groups of two.")
     elif pool_type.startswith("RAID-Z"):
         msg = _("ZFS implements RAID-Z, a variation on standard "
                 "RAID-5. ZFS supports three levels of RAID-Z which "
                 "provide varying levels of redundancy in exchange for "
                 "decreasing levels of usable storage. The types are "
                 "named RAID-Z1 through RAID-Z3 based on the number of "
                 "parity devices in the array and the number of disks "
                 "which can fail while the pool remains operational.")
     if msg:
         show.message(self.get_main_window(), msg)
Example #2
0
    def show_pool_type_help(self, pool_type):
        """ Show pool type help to the user """
        ptype = pool_type if 'RAID-Z' not in pool_type else 'RAID-Z'
        help_text = {
            "None":
            _("'None' pool will use ZFS on a single selected disk."),
            "Stripe":
            _("When created together, with equal capacity, ZFS "
              "space-balancing makes a span act like a RAID0 stripe. "
              "The space is added together. Provided all the devices "
              "are of the same size, the stripe behavior will "
              "continue regardless of fullness level. If "
              "devices/vdevs are not equally sized, then they will "
              "fill mostly equally until one device/vdev is full."),
            "Mirror":
            _("A mirror consists of two or more devices, all data "
              "will be written to all member devices. Cnchi will "
              "try to group devices in groups of two."),
            "RAID-Z":
            _("ZFS implements RAID-Z, a variation on standard "
              "RAID-5. ZFS supports three levels of RAID-Z which "
              "provide varying levels of redundancy in exchange for "
              "decreasing levels of usable storage. The types are "
              "named RAID-Z1 through RAID-Z3 based on the number of "
              "parity devices in the array and the number of disks "
              "which can fail while the pool remains operational.")
        }

        if ptype in help_text:
            show.message(self.get_main_window(), help_text[ptype])
Example #3
0
    def check_pool_type(self, show_warning=False):
        """ Check that the user has selected the right number
        of devices for the selected pool type """

        num_drives = 0
        msg = ""
        pool_type = self.zfs_options["pool_type"]

        for row in self.device_list_store:
            if row[COL_USE_ACTIVE]:
                num_drives += 1

        if pool_type == "None":
            is_ok = num_drives == 1
            if not is_ok:
                msg = _("You must select one drive")

        elif pool_type in ["Stripe", "Mirror"]:
            is_ok = num_drives > 1
            if not is_ok:
                msg = _("For the {0} pool_type, you must select at least two "
                        "drives").format(pool_type)

        elif "RAID" in pool_type:
            pool_types = {
                'RAID-Z': {'min_drives': 3, 'min_parity_drives': 1},
                'RAID-Z2': {'min_drives': 4, 'min_parity_drives': 2},
                'RAID-Z3': {'min_drives': 5, 'min_parity_drives': 3}
            }

            min_drives = pool_types[pool_type]['min_drives']
            min_parity_drives = pool_types[pool_type]['min_parity_drives']

            if num_drives < min_drives:
                is_ok = False
                msg = _("You must select at least {0} drives")
                msg = msg.format(min_drives)
            else:
                num = math.log2(num_drives - min_parity_drives)
                if not is_int(num):
                    msg = _("For the {0} pool type, you must use a 'power of "
                            "two' (2,4,8,...) plus the appropriate number of "
                            "drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
                            "= 2 disks, and so on.")
                    msg = msg.format(pool_type, min_parity_drives)
                    is_ok = False
                else:
                    is_ok = True
        else:
            # If we get here, something is wrong.
            msg = _('An unknown error occurred while processing chosen ZFS options.')
            is_ok = False

        if not is_ok and show_warning:
            show.message(self.get_main_window(), msg)

        return is_ok
Example #4
0
    def check_pool_type(self, show_warning=False):
        """ Check that the user has selected the right number
        of devices for the selected pool type """

        num_drives = 0
        msg = ""
        pool_type = self.zfs_options["pool_type"]

        for row in self.device_list_store:
            if row[COL_USE_ACTIVE]:
                num_drives += 1

        if pool_type == "None":
            if num_drives == 1:
                is_ok = True
            else:
                is_ok = False
                msg = _("You must select one drive")
        elif pool_type in ["Stripe", "Mirror"]:
            if num_drives > 1:
                is_ok = True
            else:
                is_ok = False
                msg = _("For the {0} pool_type, you must select at least two " "drives").format(pool_type)
        elif "RAID" in pool_type:
            min_drives = 3
            min_parity_drives = 1

            if pool_type == "RAID-Z2":
                min_drives = 4
                min_parity_drives = 2
            elif pool_type == "RAID-Z3":
                min_drives = 5
                min_parity_drives = 3

            if num_drives < min_drives:
                is_ok = False
                msg = _("You must select at least {0} drives")
                msg = msg.format(min_drives)
            else:
                num = math.log2(num_drives - min_parity_drives)
                if not is_int(num):
                    msg = _(
                        "For the {0} pool type, you must use a 'power of "
                        "two' (2,4,8,...) plus the appropriate number of "
                        "drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
                        "= 2 disks, and so on."
                    )
                    msg = msg.format(pool_type, min_parity_drives)
                else:
                    is_ok = True

        if not is_ok and show_warning:
            show.message(self.get_main_window(), msg)

        return is_ok
Example #5
0
 def on_force_4k_help_btn_clicked(self, widget):
     """ Show 4k help to the user """
     msg = _("Advanced Format (AF) is a new disk format which natively "
             "uses a 4,096 byte instead of 512 byte sector size. To "
             "maintain compatibility with legacy systems AF disks emulate "
             "a sector size of 512 bytes. By default, ZFS will "
             "automatically detect the sector size of the drive. This "
             "combination will result in poorly aligned disk access which "
             "will greatly degrade the pool performance. If that might be "
             "your case, you can force ZFS to use a sector size of 4,096 "
             "bytes by selecting this option.")
     show.message(self.get_main_window(), msg)
Example #6
0
 def on_force_4k_help_btn_clicked(self, widget):
     """ Show 4k help to the user """
     msg = _("Advanced Format (AF) is a new disk format which natively "
             "uses a 4,096 byte instead of 512 byte sector size. To "
             "maintain compatibility with legacy systems AF disks emulate "
             "a sector size of 512 bytes. By default, ZFS will "
             "automatically detect the sector size of the drive. This "
             "combination will result in poorly aligned disk access which "
             "will greatly degrade the pool performance. If that might be "
             "your case, you can force ZFS to use a sector size of 4,096 "
             "bytes by selecting this option.")
     show.message(self.get_main_window(), msg)
Example #7
0
    def manage_events_from_cb_queue(self):
        try:
            event = self.callback_queue.get_nowait()
        except queue.Empty:
            event = ()

        if len(event) > 0:
            if event[0] == "percent":
                self.progress_bar.set_fraction(event[1])
            elif event[0] == "finished":
                log.debug(event[1])
                self.set_message(self.install_ok)
                response = show.message(self.install_ok)
                if response == Gtk.ResponseType.YES:
                    # TODO: This needs testing
                    #subp = subprocess.Popen(['reboot'], stdout=subprocess.PIPE)
                    with misc.raised_privileges():
                        subp = subprocess.Popen(['shutdown', '-r', 'now'])
                else:
                    tmp_files = [".setup-running", ".km-running", "setup-pacman-running", "setup-mkinitcpio-running", ".tz-running", ".setup" ]
                    for t in tmp_files:
                        p = os.path.join("/tmp", t)
                        if os.path.exists(p):
                            os.remove(p)
                    Gtk.main_quit()
                        
                self.exit_button.show()
                return False
            elif event[0] == "error":
                show.fatal_error(event[1])
            else:
                log.debug(event[1])
                self.set_message(event[1])
                # remove old messages from the event queue 
                with self.callback_queue.mutex:
                    self.callback_queue.queue.clear()

        return True
Example #8
0
    def check_pool_type(self, show_warning=False):
        """ Check that the user has selected the right number
        of devices for the selected pool type """

        num_drives = 0
        msg = ""
        pool_type = self.zfs_options["pool_type"]

        for row in self.device_list_store:
            if row[COL_USE_ACTIVE]:
                num_drives += 1

        if pool_type == "None":
            is_ok = num_drives == 1
            if not is_ok:
                msg = _("You must select one drive")

        elif pool_type in ["Stripe", "Mirror"]:
            is_ok = num_drives > 1
            if not is_ok:
                msg = _("For the {0} pool_type, you must select at least two "
                        "drives").format(pool_type)

        elif "RAID" in pool_type:
            pool_types = {
                'RAID-Z': {
                    'min_drives': 3,
                    'min_parity_drives': 1
                },
                'RAID-Z2': {
                    'min_drives': 4,
                    'min_parity_drives': 2
                },
                'RAID-Z3': {
                    'min_drives': 5,
                    'min_parity_drives': 3
                }
            }

            min_drives = pool_types[pool_type]['min_drives']
            min_parity_drives = pool_types[pool_type]['min_parity_drives']

            if num_drives < min_drives:
                is_ok = False
                msg = _("You must select at least {0} drives")
                msg = msg.format(min_drives)
            else:
                num = math.log2(num_drives - min_parity_drives)
                if not is_int(num):
                    msg = _("For the {0} pool type, you must use a 'power of "
                            "two' (2,4,8,...) plus the appropriate number of "
                            "drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
                            "= 2 disks, and so on.")
                    msg = msg.format(pool_type, min_parity_drives)
                    is_ok = False
                else:
                    is_ok = True
        else:
            # If we get here, something is wrong.
            msg = _(
                'An unknown error occurred while processing chosen ZFS options.'
            )
            is_ok = False

        if not is_ok and show_warning:
            show.message(self.get_main_window(), msg)

        return is_ok