Projet

Général

Profil

Tâche #31661

Scénario #31591: Sauvegarde/restauration des Images et VM Hapy 2.8.0+

Créer le script de sauvegarde

Ajouté par Philippe Caseiro il y a environ 3 ans. Mis à jour il y a presque 3 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Début:
01/02/2021
Echéance:
% réalisé:

0%

Restant à faire (heures):
0.0

Description

Ajouter un outil pour réaliser les sauvegardes

Révisions associées

Révision de75d567 (diff)
Ajouté par Philippe Caseiro il y a environ 3 ans

Adding backup script and dico updates

ref #31661
ref #31660

How it works :

Update the backup configuration in gen_config
set the backup directory (to host the backups)
set if you only want to backup tagged VMS
set if you want to backup unused images to
reconfigure your hapy server

run the backup script with no options

First the script will backup the unused images (if neede) and the non persistent
images to BACKUP_DIR/one/datastores/<STORAGE_DS>/<REAL_IMAGE_FILE_NAME>.

Then script will perform a "disk-saveas" on each disk of each Virtual
Machine.

Then it will backup the new image files under the original name, in the
write place. If your disk is non persistent it will backup it into
BACKUP_DIR/one/datastores/<SYSTEM_DS>/<VMID>/disk.<DISK_ID>.

If it's persistent it will save the symlink into
BACKUP_DIR/one/datastores/<SYSTEM_DS>/<VMID>/disk.<DISK_ID> keeping the original
link, then it will follow the link to backup the real disk file into
BACKUP_DIR/one/datastores/<STORAGE_DS>/<LINKED_FILE_NAME>.

The script will save the deployment files also.

At the end the BACKUP_DIR will look like this :
/mnt/sauvegardes/
└── one
└── datastores
├── 100
│   ├── 21
│   │   ├── deployment.0
│   │   ├── disk.0
│   │   └── disk.1
│   ├── 29
│   │   ├── deployment.0
│   │   ├── disk.0 -> /var/lib/one/datastores/101/df10525da0493c30ca40c08251db0f2f
│   │   ├── disk.1
│   │   └── disk.2
│   └── 30
│   ├── deployment.0
│   ├── disk.0 -> /var/lib/one/datastores/101/43518126a512251a3779f6bca536f451
│   ├── disk.1 -> /var/lib/one/datastores/101/45c8c138535cc9f3478bdf5fce200045
│   └── disk.2
└── 101
├── 22dd469f98f6201b7924922e04ec55ff
├── 43518126a512251a3779f6bca536f451
├── 45c8c138535cc9f3478bdf5fce200045
├── 56eb26b37173238e3c763d571b9fba02
├── 93c849afd23e8be14f90bda68b313491
├── d6c590ad07d4ee5740d63713a4bc3da6
└── df10525da0493c30ca40c08251db0f2f

Historique

#1 Mis à jour par Philippe Caseiro il y a environ 3 ans

  • Statut changé de Nouveau à En cours

#2 Mis à jour par Philippe Caseiro il y a environ 3 ans

  • Statut changé de En cours à Résolu

#3 Mis à jour par Daniel Dehennin il y a environ 3 ans

  • Statut changé de Résolu à En cours

Cela va plus loin avec le dernier paquet 2.8.1 mais plante avec le message suivant :

root@grichka:~# onebck 
/mnt/sauvegardes
Saving unused (if needed) and non persistent images
undefined method `[]' for nil:NilClass
/usr/lib/ruby/vendor_ruby/one/backup/vm.rb:14:in `initialize'
/usr/bin/onebck:213:in `new'
/usr/bin/onebck:213:in `block in <main>'
/usr/lib/one/ruby/opennebula/xml_pool.rb:35:in `block in each_element'
/usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:238:in `block in each'
/usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:237:in `upto'
/usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:237:in `each'
/usr/lib/one/ruby/opennebula/xml_pool.rb:34:in `each_element'
/usr/lib/one/ruby/opennebula/pool.rb:159:in `each'
/usr/bin/onebck:211:in `<main>'

Pour info :

root@grichka:~# tree /var/lib/one/datastores/
/var/lib/one/datastores/
├── 0
├── 1
├── 100
│   ├── 4
│   │   ├── deployment.0
│   │   └── disk.0 -> /var/lib/one/datastores/101/ce93f817cbbacfb33901156a39ea2fbd
│   └── 7
│       ├── deployment.0
│       ├── disk.0 -> /var/lib/one/datastores/101/79d42822d54e341ecd542f60e511f8e9
│       └── disk.1 -> /var/lib/one/datastores/101/0d8067e2788695d02d139670cf03f8b0
├── 101
│   ├── 0d8067e2788695d02d139670cf03f8b0
│   ├── 1cc415bbd8d5faa18fec1aebd76e1ace
│   ├── 79d42822d54e341ecd542f60e511f8e9
│   ├── 9aaae78209c0ada7d1226e04603c2484
│   └── ce93f817cbbacfb33901156a39ea2fbd
├── 102
│   ├── 4701303683d94e4f7abaafd05de3e814
│   └── 850babac1e90781d39003b6d19ba5e7f
└── 2

8 directories, 12 files
root@grichka:~# tree /mnt/sauvegardes/one/
/mnt/sauvegardes/one/
└── datastores
    ├── 101
    │   ├── 1cc415bbd8d5faa18fec1aebd76e1ace
    │   └── 9aaae78209c0ada7d1226e04603c2484
    └── 102
        ├── 4701303683d94e4f7abaafd05de3e814
        └── 850babac1e90781d39003b6d19ba5e7f

3 directories, 4 files

#4 Mis à jour par Philippe Caseiro il y a presque 3 ans

  • Statut changé de En cours à Résolu

#5 Mis à jour par Gilles Grandgérard il y a presque 3 ans

  • Statut changé de Résolu à Fermé
  • Restant à faire (heures) mis à 0.0

Formats disponibles : Atom PDF