Ejemplo n.º 1
0
        def __init__(self, fstype, size = None, mountpoint = None,
                     preexist = 1, migrate = None, grow = 0, maxSizeMB = None,
                     start = None, end = None, drive = None, primary = None,
                     format = None, multidrive = None, bytesPerInode = 4096,
                     fslabel = None):
            """Create a new PartitionSpec object.

            fstype is the fsset filesystem type (should always be nfs).
            size is the requested size (in megabytes).
            mountpoint is the mountpoint.
            grow is whether or not the partition is growable (always 0).
            maxSizeMB is the maximum size of the partition in megabytes (always None).
            start is the starting cylinder/sector (new/preexist) (always None).
            end is the ending cylinder/sector (new/preexist) (always None).
            drive is the drive the partition goes on (default None should be a pseudo NFSDisk).
            primary is whether or not the partition should be forced as primary (always None).
            format is whether or not the partition should be formatted (always No).
            preexist is whether this partition is preexisting (always Yes).
            migrate is whether or not the partition should be migrated (always No).
            multidrive specifies if this is a request that should be replicated
            across _all_ of the drives in drive (always No)
            bytesPerInode is the size of the inodes on the filesystem (ignored).
            fslabel is the label to give to the filesystem (ignored).
            """

            # if it's preexisting, the original fstype should be set
            if preexist == 1:
                origfs = fstype
            else:
                origfs = None
            RequestSpec.__init__(self, fstype = fstype, size = size,
                                 mountpoint = mountpoint, format = None,
                                 preexist = 1, migrate = None,
                                 origfstype = origfs, bytesPerInode = bytesPerInode,
                                 fslabel = fslabel)
            self.type = REQUEST_PREEXIST

            self.grow = 0
            self.maxSizeMB = maxSizeMB
            self.requestSize = size
            self.start = start
            self.end = end

            self.drive = drive
            self.primary = None
            self.multidrive = None

            # should be able to map this from the device =\
            self.currentDrive = None
            """Drive that this request will currently end up on."""        
Ejemplo n.º 2
0
        def doSizeSanityCheck(self):
            """Sanity check that the size of the partition is sane."""
            if not self.fstype:
                return None
            if not self.format:
                return None
            ret = RequestSpec.doSizeSanityCheck(self)
            if ret is not None:
                return ret

            if (self.size and self.maxSizeMB
                and (self.size > self.maxSizeMB)):
                return (_("The size of the requested partition (size = %s MB) "
                          "exceeds the maximum size of %s MB.")
                        % (self.size, self.maxSizeMB))

            if self.size and self.size < 0:
                return _("The size of the requested partition is "
                         "negative! (size = %s MB)") % (self.size)
            return None