Exemplo n.º 1
0
    def sanityCheckRaid(self, partitions):
        if not self.raidmembers or not self.raidlevel:
            return _("No members in RAID request, or not RAID "
                     "level specified.")
        # XXX fix this code to look to see if there is a bootable partition
        bootreq = partitions.getBootableRequest()
        if not bootreq and self.mountpoint:
            # XXX 390 can't have boot on raid
            if (self.mountpoint in partitions.getBootableMountpoints()
                    and not raid.isRaid1(self.raidlevel)):
                return _("Bootable partitions can only be on RAID1 devices.")

        minmembers = raid.get_raid_min_members(self.raidlevel)
        if len(self.raidmembers) < minmembers:
            return _(
                "A RAID device of type %s "
                "requires at least %s members.") % (self.raidlevel, minmembers)

        if len(self.raidmembers) > 27:
            return "RAID devices are limited to 27 members."

        if self.raidspares:
            if (len(self.raidmembers) - self.raidspares) < minmembers:
                return _(
                    "This RAID device can have a maximum of %s spares. "
                    "To have more spares you will need to add members to "
                    "the RAID device.") % (len(self.raidmembers) - minmembers)
        return None
Exemplo n.º 2
0
    def sanityCheckRaid(self, partitions):
        if not self.raidmembers or not self.raidlevel:
            return _("No members in RAID request, or not RAID "
                     "level specified.")
        # XXX fix this code to look to see if there is a bootable partition
        bootreq = partitions.getBootableRequest()
        if not bootreq and self.mountpoint:
            # XXX 390 can't have boot on raid
            if (self.mountpoint in partitions.getBootableMountpoints()
                 and not raid.isRaid1(self.raidlevel)):
                return _("Bootable partitions can only be on RAID1 devices.")

        minmembers = raid.get_raid_min_members(self.raidlevel)
        if len(self.raidmembers) < minmembers:
            return _("A RAID device of type %s "
                     "requires at least %s members.") % (self.raidlevel,
                                                         minmembers)

        if len(self.raidmembers) > 27:
            return "RAID devices are limited to 27 members."

        if self.raidspares:
            if (len(self.raidmembers) - self.raidspares) < minmembers:
                return _("This RAID device can have a maximum of %s spares. "
                         "To have more spares you will need to add members to "
                         "the RAID device.") % (len(self.raidmembers)
                                                - minmembers )
        return None
Exemplo n.º 3
0
def get_raid_min_members(raidlevel):
    """Return the minimum number of raid members required for raid level"""
    return raid.get_raid_min_members(raidlevel)