1448 |
formatted = [] |
formatted = [] |
1449 |
notformatted = [] |
notformatted = [] |
1450 |
for entry in self.entries: |
for entry in self.entries: |
|
if (entry.mountpoint != '/boot'): |
|
|
continue |
|
|
if (not entry.fsystem.isFormattable() or not entry.getFormat() |
|
|
or entry.isMounted()): |
|
|
notformatted.append(entry) |
|
|
continue |
|
|
try: |
|
|
self.formatEntry(entry, chroot) |
|
|
formatted.append(entry) |
|
|
except SystemError: |
|
|
if self.messageWindow: |
|
|
self.messageWindow(_("Error"), |
|
|
_("An error occurred trying to " |
|
|
"format %s. This problem is " |
|
|
"serious, and the install cannot " |
|
|
"continue.\n\n" |
|
|
"Press <Enter> to reboot your system.") |
|
|
% (entry.device.getDevice(),)) |
|
|
sys.exit(0) |
|
|
|
|
|
for entry in self.entries: |
|
|
if (entry.mountpoint == '/boot'): |
|
|
continue |
|
1451 |
if (not entry.fsystem.isFormattable() or not entry.getFormat() |
if (not entry.fsystem.isFormattable() or not entry.getFormat() |
1452 |
or entry.isMounted()): |
or entry.isMounted()): |
1453 |
notformatted.append(entry) |
notformatted.append(entry) |
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 |
|
|
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 and self.level == 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 and self.level == 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, |