|
|
@ -144,20 +144,24 @@ class VariableClAutopartitionDeviceData(ReadonlyTableVariable):
|
|
|
|
'cl_autopartition_device_size',
|
|
|
|
'cl_autopartition_device_size',
|
|
|
|
'cl_autopartition_device_name']
|
|
|
|
'cl_autopartition_device_name']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
re_raid = re.compile("raid[1-9]")
|
|
|
|
|
|
|
|
|
|
|
|
def get(self, hr=HumanReadable.No):
|
|
|
|
def get(self, hr=HumanReadable.No):
|
|
|
|
def generator():
|
|
|
|
def generator():
|
|
|
|
for dev, _type, size, name in self.ZipVars(
|
|
|
|
for dev, _type, fulltype, size, name in self.ZipVars(
|
|
|
|
'os_device_dev', 'os_device_type',
|
|
|
|
'os_device_dev', 'os_device_type',
|
|
|
|
|
|
|
|
'os_device_fulltype',
|
|
|
|
'os_device_size', 'os_device_name'):
|
|
|
|
'os_device_size', 'os_device_name'):
|
|
|
|
hsize = humanreadableSize(size)
|
|
|
|
|
|
|
|
if not _type.startswith('raid'):
|
|
|
|
if not _type.startswith('raid'):
|
|
|
|
_type = "device"
|
|
|
|
_type = "device"
|
|
|
|
if not name:
|
|
|
|
if not name:
|
|
|
|
name = _("Unknown")
|
|
|
|
name = _("Unknown")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raidname = _type.upper()
|
|
|
|
name = _type.upper()
|
|
|
|
name = raidname
|
|
|
|
if self.re_raid.search(fulltype):
|
|
|
|
_type = "raid"
|
|
|
|
_type = "raid"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
_type = "raid0"
|
|
|
|
|
|
|
|
|
|
|
|
yield [dev, _type, size, name]
|
|
|
|
yield [dev, _type, size, name]
|
|
|
|
|
|
|
|
|
|
|
@ -353,15 +357,15 @@ class VariableClAutopartitionSchemeBuilder(ReadonlyVariable):
|
|
|
|
int(self.Get('cl_autopartition_calculate_size'))
|
|
|
|
int(self.Get('cl_autopartition_calculate_size'))
|
|
|
|
|
|
|
|
|
|
|
|
used_devices = self.Get('cl_autopartition_device')
|
|
|
|
used_devices = self.Get('cl_autopartition_device')
|
|
|
|
type_map = {
|
|
|
|
|
|
|
|
"raid": partition.VolumesBuilder.DeviceType.RAID,
|
|
|
|
|
|
|
|
"device": partition.VolumesBuilder.DeviceType.Device,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for dev, _type, size in self.ZipVars("cl_autopartition_device_dev",
|
|
|
|
for dev, _type, size in self.ZipVars("cl_autopartition_device_dev",
|
|
|
|
"cl_autopartition_device_type",
|
|
|
|
"cl_autopartition_device_type",
|
|
|
|
"cl_autopartition_device_size"):
|
|
|
|
"cl_autopartition_device_size"):
|
|
|
|
if dev in used_devices:
|
|
|
|
if dev in used_devices:
|
|
|
|
sb.add_device(dev, type_map.get(_type), int(size))
|
|
|
|
if _type.startswith("raid"):
|
|
|
|
|
|
|
|
device_type = partition.VolumesBuilder.DeviceType.RAID
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
device_type = partition.VolumesBuilder.DeviceType.Device
|
|
|
|
|
|
|
|
sb.add_device(dev, device_type, int(size))
|
|
|
|
|
|
|
|
|
|
|
|
sb.default_format = self.Get('cl_autopartition_default_format')
|
|
|
|
sb.default_format = self.Get('cl_autopartition_default_format')
|
|
|
|
|
|
|
|
|
|
|
@ -763,7 +767,7 @@ class VariableClAutopartitionRaid(ReadonlyVariable):
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
dev for dev, _type in self.ZipVars(
|
|
|
|
dev for dev, _type in self.ZipVars(
|
|
|
|
"cl_autopartition_device_dev", "cl_autopartition_device_type")
|
|
|
|
"cl_autopartition_device_dev", "cl_autopartition_device_type")
|
|
|
|
if dev in selected_dev and _type == "raid"]
|
|
|
|
if dev in selected_dev and _type.startswith("raid")]
|
|
|
|
|
|
|
|
|
|
|
|
class VariableClAutopartitionRaidParent(ReadonlyVariable):
|
|
|
|
class VariableClAutopartitionRaidParent(ReadonlyVariable):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -808,14 +812,31 @@ class VariableClAutopartitionEfi(ReadonlyVariable):
|
|
|
|
if not self.GetBool('cl_autopartition_uefi_set'):
|
|
|
|
if not self.GetBool('cl_autopartition_uefi_set'):
|
|
|
|
return []
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
|
|
selected_raid_devices = self.Get('cl_autopartition_raid_parent')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
efi = (efi for efi in self.select(
|
|
|
|
|
|
|
|
'os_device_efi', os_device_dev__in=selected_raid_devices)
|
|
|
|
|
|
|
|
if efi)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var_factory = self.Get('cl_autopartition_factory')
|
|
|
|
var_factory = self.Get('cl_autopartition_factory')
|
|
|
|
return sorted(set(efi) | set(var_factory.efi))
|
|
|
|
selected_dev = self.Get('cl_autopartition_device')
|
|
|
|
|
|
|
|
selected_data = ((dev, _type) for dev, _type in self.ZipVars(
|
|
|
|
|
|
|
|
"cl_autopartition_device_dev", "cl_autopartition_device_type")
|
|
|
|
|
|
|
|
if dev in selected_dev)
|
|
|
|
|
|
|
|
for dev, _type in selected_data:
|
|
|
|
|
|
|
|
if _type == "device":
|
|
|
|
|
|
|
|
if var_factory.efi:
|
|
|
|
|
|
|
|
return var_factory.efi[:1]
|
|
|
|
|
|
|
|
elif _type == "raid0":
|
|
|
|
|
|
|
|
parents = self.select('os_device_parent',
|
|
|
|
|
|
|
|
os_device_dev=dev, limit=1).split(',')
|
|
|
|
|
|
|
|
efidev = self.select('os_device_efi', os_device_dev__in=parents,
|
|
|
|
|
|
|
|
limit=1)
|
|
|
|
|
|
|
|
if efidev:
|
|
|
|
|
|
|
|
return [efidev]
|
|
|
|
|
|
|
|
# прочие raid
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
parents = self.select('os_device_parent',
|
|
|
|
|
|
|
|
os_device_dev=dev, limit=1).split(',')
|
|
|
|
|
|
|
|
efidevs = self.select('os_device_efi',
|
|
|
|
|
|
|
|
os_device_dev__in=parents)
|
|
|
|
|
|
|
|
if efidevs:
|
|
|
|
|
|
|
|
return sorted(set(filter(None, efidevs)))
|
|
|
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableClAutopartitionParent(ReadonlyVariable):
|
|
|
|
class VariableClAutopartitionParent(ReadonlyVariable):
|
|
|
@ -830,7 +851,7 @@ class VariableClAutopartitionParent(ReadonlyVariable):
|
|
|
|
for dev, _type in self.ZipVars(
|
|
|
|
for dev, _type in self.ZipVars(
|
|
|
|
"cl_autopartition_device_dev",
|
|
|
|
"cl_autopartition_device_dev",
|
|
|
|
"cl_autopartition_device_type"):
|
|
|
|
"cl_autopartition_device_type"):
|
|
|
|
if dev in selected_dev and _type != "raid":
|
|
|
|
if dev in selected_dev and not _type.startswith("raid"):
|
|
|
|
yield dev
|
|
|
|
yield dev
|
|
|
|
|
|
|
|
|
|
|
|
return ",".join(sorted(set(generate())))
|
|
|
|
return ",".join(sorted(set(generate())))
|
|
|
|