From 30fa5b494415c05d135f7b18e6eb44a48dbe2feb Mon Sep 17 00:00:00 2001 From: Juan Manuel Bardallo Date: Tue, 26 Mar 2019 12:04:01 +0100 Subject: #906 Operations with partitions and images support NVMe --- client/engine/Disk.lib | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'client/engine/Disk.lib') diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib index ac7aab5f..3ea01bbd 100755 --- a/client/engine/Disk.lib +++ b/client/engine/Disk.lib @@ -94,12 +94,18 @@ trap "rm -f $tmpsfdisk" 1 2 3 9 15 echo "unit: sectors" >$tmpsfdisk echo >>$tmpsfdisk +NVME_PREFIX="" +if [[ $DISK == *"nvme"* ]]; then + NVME_PREFIX="p" +fi + + # Generar fichero de entrada para "sfdisk" con las particiones. shift while [ $# -gt 0 ]; do # Conservar los datos de la partición de caché. if [ "$ND $PART" == "$CACHEPART" -a -n "$CACHESIZE" ]; then - echo "$DISK$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk + echo "$DISK$NVME_PREFIX$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk PART=$[PART+1] fi # Leer formato de cada parámetro - Tipo:Tamaño @@ -125,7 +131,7 @@ while [ $# -gt 0 ]; do SECTORS=$[EXTSTART+EXTSIZE] fi # Generar datos para la partición. - echo "$DISK$PART : start=$START, size=$SIZE, Id=$ID" >>$tmpsfdisk + echo "$DISK$NVME_PREFIX$PART : start=$START, size=$SIZE, Id=$ID" >>$tmpsfdisk # Error si se supera el nº total de sectores. START=$[START+SIZE] if [ "$IOSIZE" == "4096" -a $PART -gt 4 ]; then @@ -138,9 +144,9 @@ done # Si no se indican las 4 particiones primarias, definirlas como vacías, conservando la partición de caché. while [ $PART -le 4 ]; do if [ "$ND $PART" == "$CACHEPART" -a -n "$CACHESIZE" ]; then - echo "$DISK$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk + echo "$DISK$NVME_PREFIX$PART : start=$[SECTORS+1], size=$CACHESIZE, Id=ca" >>$tmpsfdisk else - echo "$DISK$PART : start=0, size=0, Id=0" >>$tmpsfdisk + echo "$DISK$NVME_PREFIX$PART : start=0, size=0, Id=0" >>$tmpsfdisk fi PART=$[PART+1] done @@ -431,7 +437,13 @@ fi # Si no se encuentra, procesa todos los discos para devolver su nº de orden y de partición. n=1 for d in $(ogDiskToDev); do - [ -n "$(echo $DEV | grep $d)" ] && echo "$n ${DEV#$d}" && return +NVME_PREFIX="" +if [[ $d == *"nvme"* ]]; then + NVME_PREFIX="p" +fi + + + [ -n "$(echo $DEV | grep $d)" ] && echo "$n ${DEV#$d$NVME_PREFIX}" && return n=$[n+1] done ogRaiseError $OG_ERR_NOTFOUND "$1" -- cgit v1.2.3-18-g5258