def check(self,valuelist): if self.Get('cl_autopartition_set') == "on": if not valuelist: raise VariableError(_("For autopartition, please select the device")) useDisks = self.Select('os_disk_parent', where='os_disk_mount',ne='') for value in valuelist: if value in useDisks: raise VariableError( _("Device %s is already in use by the current " "system")%value) self.checkOnLvm(valuelist) self.checkOnRaid(valuelist) if len(valuelist) > 1 and \ self.Get('cl_autopartition_lvm_set') == 'off': raise VariableError( _("You should use LVM to install on more that one device")) freeSize = int(self.Get('cl_autopartition_free_size')) if freeSize < 0 and (abs(freeSize))/(Sizes.M*100) > 0: availSize = int(self.Get('cl_autopartition_device_size')) raise VariableError( _("There is not enough space on this device")+"\n"+ _("{avail} available, {need} needed").format( avail=humanreadableSize(availSize), need=humanreadableSize(availSize-freeSize)))
def humanReadable(self): return humanreadableSize(self.Get())