735 |
|
|
736 |
def labelDevice(self, entry, chroot): |
def labelDevice(self, entry, chroot): |
737 |
file = entry.device.setupDevice(chroot) |
file = entry.device.setupDevice(chroot) |
738 |
label = labelFactory.createLabel("SWAP-%s" %entry.device.getDevice(), |
devName = entry.device.getDevice() |
739 |
self.maxLabelChars) |
# we'll keep the SWAP-* naming for all devs but Compaq SMART2 |
740 |
|
# nodes (#170500) |
741 |
|
if devName[0:6] == "cciss/": |
742 |
|
swapLabel = "SW-%s" % (devName) |
743 |
|
else: |
744 |
|
swapLabel = "SWAP-%s" % (devName) |
745 |
|
label = labelFactory.createLabel("%s" %swapLabel, self.maxLabelChars) |
746 |
rc = iutil.execWithRedirect ("/usr/sbin/mkswap", |
rc = iutil.execWithRedirect ("/usr/sbin/mkswap", |
747 |
[ "mkswap", '-v1', "-L", label, file ], |
[ "mkswap", '-v1', "-L", label, file ], |
748 |
stdout = "/dev/tty5", |
stdout = "/dev/tty5", |
831 |
def __init__(self): |
def __init__(self): |
832 |
FileSystemType.__init__(self) |
FileSystemType.__init__(self) |
833 |
self.partedFileSystemType = None |
self.partedFileSystemType = None |
834 |
|
self.partedPartitionFlags = [ parted.PARTITION_BOOT ] |
835 |
self.checked = 0 |
self.checked = 0 |
836 |
self.name = "PPC PReP Boot" |
self.name = "PPC PReP Boot" |
837 |
self.maxSizeMB = 10 |
self.maxSizeMB = 10 |
1187 |
|
|
1188 |
f.close() |
f.close() |
1189 |
|
|
1190 |
# return the "boot" devicce |
# return the "boot" device |
1191 |
def getBootDev(self): |
def getBootDev(self): |
1192 |
mntDict = {} |
mntDict = {} |
1193 |
bootDev = None |
bootDev = None |
1231 |
|
|
1232 |
if bootDev.getName() == "RAIDDevice": |
if bootDev.getName() == "RAIDDevice": |
1233 |
ret['boot'] = (bootDev.device, N_("RAID Device")) |
ret['boot'] = (bootDev.device, N_("RAID Device")) |
1234 |
|
ret['mbr'] = (bl.drivelist[0], N_("Master Boot Record (MBR)")) |
1235 |
return ret |
return ret |
1236 |
|
|
1237 |
if iutil.getPPCMacGen() == "NewWorld": |
if iutil.getPPCMacGen() == "NewWorld": |
1890 |
self.minor) |
self.minor) |
1891 |
|
|
1892 |
def raidTab (self, devPrefix='/dev'): |
def raidTab (self, devPrefix='/dev'): |
1893 |
d = self.numDisks |
if self.level == 1: |
1894 |
if d == 1: |
nDisks = max(2, self.numDisks) |
1895 |
d = 2 |
elif self.level == 5: |
1896 |
|
nDisks = max(3, self.numDisks) |
1897 |
|
elif self.level == 6: |
1898 |
|
nDisks = max(4, self.numDisks) |
1899 |
|
else: |
1900 |
|
nDisks = self.numDisks |
1901 |
|
|
1902 |
entry = "" |
entry = "" |
1903 |
entry = entry + "raiddev %s/%s\n" % (devPrefix, |
entry = entry + "raiddev %s/%s\n" % (devPrefix, |
1904 |
self.device,) |
self.device,) |
1905 |
entry = entry + "raid-level %d\n" % (self.level,) |
entry = entry + "raid-level %d\n" % (self.level,) |
1906 |
entry = entry + "nr-raid-disks %d\n" % (d) |
entry = entry + "nr-raid-disks %d\n" % (nDisks,) |
1907 |
entry = entry + "chunk-size %s\n" %(self.chunksize,) |
entry = entry + "chunk-size %s\n" %(self.chunksize,) |
1908 |
entry = entry + "persistent-superblock 1\n" |
entry = entry + "persistent-superblock 1\n" |
1909 |
entry = entry + "nr-spare-disks %d\n" % (self.spares,) |
entry = entry + "nr-spare-disks %d\n" % (self.spares,) |
1913 |
device) |
device) |
1914 |
entry = entry + " raid-disk %d\n" % (i,) |
entry = entry + " raid-disk %d\n" % (i,) |
1915 |
i = i + 1 |
i = i + 1 |
1916 |
|
while i < nDisks: |
1917 |
|
entry = entry + " device dev/null\n" |
1918 |
|
entry = entry + " failed-disk %d\n" % (i,) |
1919 |
|
i = i + 1 |
1920 |
i = 0 |
i = 0 |
1921 |
for device in self.members[self.numDisks:]: |
for device in self.members[self.numDisks:]: |
1922 |
entry = entry + " device %s/%s\n" % (devPrefix, |
entry = entry + " device %s/%s\n" % (devPrefix, |
1923 |
device) |
device) |
1924 |
entry = entry + " spare-disk %d\n" % (i,) |
entry = entry + " spare-disk %d\n" % (i,) |
1925 |
i = i + 1 |
i = i + 1 |
|
if self.numDisks == 1: |
|
|
entry = entry + " device dev/null\n" |
|
|
entry = entry + " failed-disk 1\n" |
|
1926 |
return entry |
return entry |
1927 |
|
|
1928 |
def setupDevice (self, chroot="/", devPrefix='/dev'): |
def setupDevice (self, chroot="/", devPrefix='/dev'): |
1929 |
def devify(x): |
def devify(x): |
1930 |
return "/dev/%s" %(x,) |
return "/dev/%s" %(x,) |
1931 |
|
|
1932 |
|
if self.level == 1: |
1933 |
|
nDisks = max(2, self.numDisks) |
1934 |
|
elif self.level == 5: |
1935 |
|
nDisks = max(3, self.numDisks) |
1936 |
|
elif self.level == 6: |
1937 |
|
nDisks = max(4, self.numDisks) |
1938 |
|
else: |
1939 |
|
nDisks = self.numDisks |
1940 |
|
|
1941 |
node = "%s/%s" % (devPrefix, self.device) |
node = "%s/%s" % (devPrefix, self.device) |
1942 |
isys.makeDevInode(self.device, node) |
isys.makeDevInode(self.device, node) |
1943 |
|
|
1946 |
PartitionDevice(device).setupDevice(chroot, |
PartitionDevice(device).setupDevice(chroot, |
1947 |
devPrefix=devPrefix) |
devPrefix=devPrefix) |
1948 |
|
|
1949 |
args = ["/usr/sbin/mdadm", "--create", "/dev/%s" %(self.device,), |
args = ["/usr/sbin/mdadm", "--create", "/dev/%s" %(self.device,), |
1950 |
"--run", "--chunk=%s" %(self.chunksize,), |
"--run", "--chunk=%s" %(self.chunksize,), |
1951 |
"--level=%s" %(self.level,), |
"--level=%s" %(self.level,), |
1952 |
] |
"--raid-devices=%s" %(nDisks,)] |
1953 |
|
|
1954 |
if self.spares > 0: |
if self.spares > 0: |
1955 |
args.append("--spare-devices=%s" %(self.spares,),) |
args.append("--spare-devices=%s" %(self.spares,),) |
1956 |
|
|
|
if self.numDisks == 1: |
|
|
args.append("--raid-devices=2") |
|
|
else: |
|
|
args.append("--raid-devices=%s" %(self.numDisks,),) |
|
|
|
|
1957 |
args.extend(map(devify, self.members)) |
args.extend(map(devify, self.members)) |
1958 |
|
|
1959 |
if self.numDisks == 1: |
i = 0 |
1960 |
|
while self.numDisks + i < nDisks: |
1961 |
args.append("missing") |
args.append("missing") |
1962 |
|
i = i + 1 |
1963 |
|
|
1964 |
log("going to run: %s" %(args,)) |
log("going to run: %s" %(args,)) |
1965 |
iutil.execWithRedirect (args[0], args, |
iutil.execWithRedirect (args[0], args, |