[51db584] | 1 | #!/bin/bash |
---|
| 2 | # Descripcion: Crea un test DESTRUCTIVO de los bloqueos de particiones y de imagenes |
---|
| 3 | # Se ejecuta en el servidor y el test creado se utiliza en el cliente |
---|
| 4 | # La imagen de prueba puede sufrir daños |
---|
| 5 | # Uso: creaTestLock2 NombreImagen |
---|
| 6 | |
---|
| 7 | # Variables. |
---|
| 8 | PROG=$(basename $0) |
---|
| 9 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} |
---|
| 10 | SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg |
---|
| 11 | TESTDIR="$OPENGNSYS/client/lib/engine/tests/Modify" |
---|
| 12 | TESTFILE="$TESTDIR/Lock2-img$1.shtest " |
---|
| 13 | # Control básico de errores. |
---|
| 14 | if [ $# -ne 1 ]; then |
---|
| 15 | echo "$PROG: Error de ejecución" |
---|
| 16 | echo "Formato: $PROG NOMBRE_IMAGEN" |
---|
| 17 | echo " La imagen de prueba puede sufrir daños" |
---|
| 18 | exit 1 |
---|
| 19 | fi |
---|
| 20 | |
---|
| 21 | IMG=$1 |
---|
| 22 | |
---|
| 23 | cat > $TESTFILE << EOF |
---|
| 24 | Test de bloqueos Destructivos |
---|
| 25 | ============================================================================= |
---|
| 26 | # Bloqueo de particiones |
---|
| 27 | $ ogUnmountAll 1 2>/dev/null |
---|
| 28 | |
---|
| 29 | $ ogLock 1 1 |
---|
| 30 | |
---|
| 31 | $ ogExtendFs 1 1 |
---|
[5bfead0] | 32 | OpenGnsys error: ogExtendFs: "1 1" |
---|
[51db584] | 33 | |
---|
| 34 | |
---|
| 35 | $ ogFormatFs 1 1 |
---|
[5bfead0] | 36 | OpenGnsys error: ogFormatFs: "1 1" |
---|
[51db584] | 37 | |
---|
| 38 | ############################################################################# |
---|
| 39 | # Los dos comandos siguientes dan error. Los comentamos por ahora |
---|
| 40 | ############################################################################# |
---|
| 41 | #$ ogMount 1 1 |
---|
| 42 | |
---|
| 43 | #$ ogUnmount 1 1; df|grep sda1 |
---|
| 44 | |
---|
| 45 | $ ogUnlock 1 1 |
---|
| 46 | |
---|
| 47 | $ ogExtendFs 1 1 >/dev/null 2>&1; echo $? |
---|
| 48 | 0 |
---|
| 49 | |
---|
| 50 | $ ogFormatFs 1 1 >/dev/null 2>&1; echo $? |
---|
| 51 | 0 |
---|
| 52 | |
---|
| 53 | $ ogMount 1 1 |
---|
| 54 | /mnt/sda1 |
---|
| 55 | |
---|
| 56 | $ ogUnmount 1 1; df|grep sda1 |
---|
| 57 | |
---|
| 58 | # Bloqueo de imagenes |
---|
| 59 | ############################################################################# |
---|
| 60 | # Los tres comandos siguientes dan error. Los comentamos por ahora |
---|
| 61 | ############################################################################# |
---|
| 62 | #$ ogLockImage REPO $IMG |
---|
| 63 | |
---|
| 64 | #$ ogRestoreImage REPO $IMG 1 1 >/dev/null 2>&1; echo $? |
---|
| 65 | |
---|
| 66 | #$ ogCreateImage 1 1 REPO $IMG >/dev/null 2>&1; echo $? |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | $ ogUnlockImage REPO $IMG |
---|
| 70 | |
---|
| 71 | # Lo mismo con la imagen desbloqueada. |
---|
| 72 | |
---|
| 73 | $ ogRestoreImage REPO $IMG 1 1 >/dev/null 2>&1; echo $? |
---|
| 74 | 0 |
---|
| 75 | |
---|
| 76 | $ ogCreateImage 1 1 REPO $IMG >/dev/null 2>&1; echo $? |
---|
| 77 | 0 |
---|
| 78 | EOF |
---|
| 79 | |
---|
| 80 | echo "Test creado en $TESTFILE" |
---|
| 81 | echo " La imagen de $IMG prueba puede quedar dañada despues de realizar el test" |
---|
| 82 | echo " Hay cinco comandos comentados porque por ahora dan error" |
---|