diff options
author | ramon <ramongomez@us.es> | 2017-04-25 16:13:46 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2017-04-25 16:13:46 +0000 |
commit | 31d44a4eda13233baa77a9cf2847983dbadd674f (patch) | |
tree | 75bae6738de10eb492b4ae07875a3d2941452eab /client/engine/Disk.lib | |
parent | e47e13175d9633674b31e91f6e4e3a311634cd3a (diff) |
#724: Función {{{ogGetPartitionSize}}} busca también tamaño de volumen lógico.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5278 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/engine/Disk.lib')
-rwxr-xr-x | client/engine/Disk.lib | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib index 5ca8c54b..45e5bedd 100755 --- a/client/engine/Disk.lib +++ b/client/engine/Disk.lib @@ -785,7 +785,7 @@ echo $ID function ogGetPartitionSize () { # Variables locales. -local PART +local PART SIZE # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then @@ -796,11 +796,12 @@ fi # Error si no se reciben 2 parámetros. [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? -# Devolver tamaño de partición o del sistema de archivos (para ZFS). +# Devolver tamaño de partición, del volumen lógico o del sistema de archivos (para ZFS). PART="$(ogDiskToDev $1 $2)" || return $? -partx -gbo SIZE $PART 2>/dev/null | awk '{print int($1/1024)}' -[ ${PIPESTATUS[0]} -ne 0 ] && ogGetFsSize $1 $2 -return 0 +SIZE=$(partx -gbo SIZE $PART 2>/dev/null | awk '{print int($1/1024)}') +[ -z "$SIZE" ] && SIZE=$(lvs --noheadings -o lv_size --units k $PART | awk '{printf "%d",$0}') +[ -z "$SIZE" ] && SIZE=$(ogGetFsSize $1 $2) +echo ${SIZE:-0} } |