1
0
Fork 0

refs #1594 indent some comments

code-review
Natalia Serrano 2025-02-20 13:57:57 +01:00
parent c1dc47f160
commit acf2c1dc49
1 changed files with 20 additions and 20 deletions

View File

@ -70,7 +70,7 @@ def ogCreatePartitions (disk, parts):
SECTORS = ogGetLastSector (disk)
# Se recalcula el nº de sectores del disco 1, si existe partición de caché.
# Se recalcula el nº de sectores del disco si existe partición de caché.
CACHESIZE = 0
CACHEPART = CacheLib.ogFindCache()
if CACHEPART:
@ -148,6 +148,8 @@ def ogCreatePartitions (disk, parts):
sfdisk_input += f'{DISK}{NVME_PREFIX}{PART} : start={START}, size={SIZE}, Id={ID}\n'
# Error si se supera el nº total de sectores.
START += SIZE
# Error si se supera el nº total de sectores.
if '4096' == IOSIZE and PART > 4:
START += 2048
if START > SECTORS:
@ -172,6 +174,7 @@ def ogCreatePartitions (disk, parts):
# Si la tabla de particiones no es valida, volver a generarla.
ogCreatePartitionTable (ND)
# Definir particiones y notificar al kernel.
print (f'about to run sfdisk: ({sfdisk_input})')
p = subprocess.run (['sfdisk', DISK], input=sfdisk_input, capture_output=True, text=True)
@ -198,7 +201,6 @@ def ogCreatePartitions (disk, parts):
#@todo Definir atributos (arranque, oculta) y tamaños en MB, GB, etc.
#*/ ##
def ogCreateGptPartitions (disk, parts):
# Nº total de sectores, para evitar desbordamiento (evitar redondeo).
ND = disk
DISK = ogDiskToDev (ND)
if not DISK: return None
@ -225,7 +227,7 @@ def ogCreateGptPartitions (disk, parts):
DELOPTIONS = []
OPTIONS = []
for p in parts:
# Si PART es la cache, nos la saltamos y seguimos con el siguiente numero para conservar los datos de la partición de caché.
# Conservar los datos de la partición de caché.
if f'{ND} {PART}' == CACHEPART and CACHESIZE:
PART += 1
@ -284,9 +286,7 @@ def ogCreateGptPartitions (disk, parts):
# Borramos primero las particiones y luego creamos las nuevas
subprocess.run (['sgdisk'] + DELOPTIONS + OPTIONS + [DISK])
subprocess.run (['partprobe', DISK])
if CACHESIZE: CacheLib.ogMountCache()
return True