/[smeserver]/cdrom.image/sme9/updates/storage/partspec.py
ViewVC logotype

Annotation of /cdrom.image/sme9/updates/storage/partspec.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download) (as text)
Tue Jul 30 21:01:52 2013 UTC (11 years, 3 months ago) by charliebrady
Branch: MAIN
Content type: text/x-python
Add storage module from anaconda to updates directory, so that parts of it can be modified.

1 charliebrady 1.1 # partspec.py
2     #
3     # Copyright (C) 2009 Red Hat, Inc.
4     #
5     # This copyrighted material is made available to anyone wishing to use,
6     # modify, copy, or redistribute it subject to the terms and conditions of
7     # the GNU General Public License v.2, or (at your option) any later version.
8     # This program is distributed in the hope that it will be useful, but WITHOUT
9     # ANY WARRANTY expressed or implied, including the implied warranties of
10     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11     # Public License for more details. You should have received a copy of the
12     # GNU General Public License along with this program; if not, write to the
13     # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
14     # 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
15     # source code or documentation are not subject to the GNU General Public
16     # License and may only be used or replicated with the express permission of
17     # Red Hat, Inc.
18     #
19     # Red Hat Author(s): Chris Lumens <clumens@redhat.com>
20     #
21    
22     class PartSpec(object):
23     def __init__(self, mountpoint=None, fstype=None, size=None, maxSize=None,
24     grow=False, asVol=False, singlePV=False, weight=0,
25     requiredSpace=0):
26     """ Create a new storage specification. These are used to specify
27     the default partitioning layout as an object before we have the
28     storage system up and running. The attributes are obvious
29     except for the following:
30    
31     asVol -- Should this be allocated as a logical volume? If not,
32     it will be allocated as a partition.
33     singlePV -- Should this logical volume map to a single physical
34     volume in the volume group? Implies asVol=True
35     weight -- An integer that modifies the sort algorithm for partition
36     requests. A larger value means the partition will end up
37     closer to the front of the disk. This is mainly used to
38     make sure /boot ends up in front, and any special (PReP,
39     appleboot, etc.) partitions end up in front of /boot.
40     This value means nothing if asVol=False.
41     requiredSpace -- This value is only taken into account if
42     asVol=True, and specifies the size in MB that the
43     containing VG must be for this PartSpec to even
44     get used. The VG's size is calculated before any
45     other LVs are created inside it. If not enough
46     space exists, this PartSpec will never get turned
47     into an LV.
48     """
49    
50     self.mountpoint = mountpoint
51     self.fstype = fstype
52     self.size = size
53     self.maxSize = maxSize
54     self.grow = grow
55     self.asVol = asVol
56     self.singlePV = singlePV
57     self.weight = weight
58     self.requiredSpace = requiredSpace
59    
60     if self.singlePV and not self.asVol:
61     self.asVol = True
62    
63     def __str__(self):
64     s = ("%(type)s instance (%(id)s) -- \n"
65     " mountpoint = %(mountpoint)s asVol = %(asVol)s singlePV = %(singlePV)s\n"
66     " weight = %(weight)s fstype = %(fstype)s\n"
67     " size = %(size)s maxSize = %(maxSize)s grow = %(grow)s\n" %
68     {"type": self.__class__.__name__, "id": "%#x" % id(self),
69     "mountpoint": self.mountpoint, "asVol": self.asVol,
70     "singlePV": self.singlePV, "weight": self.weight,
71     "fstype": self.fstype, "size": self.size,
72     "maxSize": self.maxSize, "grow": self.grow})
73    
74     return s

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed