venerdì 23 marzo 2012

xenbackup-ng, for backing up your xenserver VMs with quiescent snapshot

Starting from Filippo Zanardo's Xenbackup, I wrote a modified version of his scripts, now tested and running on Citrix Xenserver 5.6 fp1 and Citrix Xenserver 6.0.2.

The script has the purpose to backup a Citrix Xenserver Guests Virtual Machines and it can be configured for doing it in different ways. 

Besides the Filippo's original version, I included some features:
  • Split configuration files: one for strings, one for operational parameters.
  • Added the Job feature: it is possible to create a job file in the job dir where general options can be overridden.
  • Selective VM backup: it is possible to declare a list of VMs that will be backed up.
  • Quiesce Snapshot on Windows VM: only with Xen VSS Provider installed on guest.
  • Preserve VM power state: in case of normal backup (Shutdown->Backup->Start) the original vm state will be preserved. So, if a VM is initially powered off it will not powered on after backup.
  • Improved email notifications: now is possible to receive a mail with a summary of operations executed or a verbose log of backup process. 

You can download the script direct from here or from my GitHub.

Dont't forget to change the mail address where you receive notification!

10 commenti:

  1. Thanks for your script, but i've got this error. What does it mean ?

    [root@Cluster-Node1 backup]# perl xenbackup.pl m3
    Missing right curly or square bracket at xenbackup.pl line 605, at end of line
    syntax error at xenbackup.pl line 605, at EOF
    Execution of xenbackup.pl aborted due to compilation errors.

    RispondiElimina
  2. Sorry I linked the version in development.
    I've updated the link, you can re-download the script, wich is the stable one!

    RispondiElimina
  3. Looks interesting, any plans for Hyper-V support?

    I am currently using SCST as an iSCSI Target for 3 Hyper-V servers, using HDD Images created via dd and exported via fileio device, so I imagine it would not be an issue right??

    Project looks promising, keep it up!!

    RispondiElimina
    Risposte
    1. Are you talkin' about my storage distro or xenserver backup script? :P

      Elimina
    2. Talking about the Storage Distro.

      Elimina
    3. Sorry - Seems I posted it on the wrong Post :p

      Elimina
  4. No problem :)
    Anyway...
    ... you can test with hyper-v and tell me if it works. In a few days I will release the "next step" version, which includes data deduplication. You can create a cluster resource that is a tie of drbd device, dedup file system and an iSCSI LUN pointing on a file seating on the dedup fs.

    RispondiElimina
  5. Hello, Does anybody used this script on citrix xenserver 6?

    RispondiElimina
  6. Hello, I'm using it in a production environment runnig Xenserver 6.0.2.

    RispondiElimina
  7. Hello Riccardo,

    i'm using your script and its working wonderful except one thing: sending the mail after backup does not work at all.
    In /var/log/maillog there are always the same entries saying:
    ...
    Aug 1 12:46:05 xen-1 sSMTP[20593]: 501 Syntax error, parameters in command "MAIL FROM:" unrecognized or missing
    ...

    I have edited /etc/ssmtp/ssmtp.conf, its now:

    root=postmaster
    mailhub=mailserver.mydomain.com:25
    rewriteDomain=
    hostname=_HOSTNAME_
    FromLineOverride=YES

    if i run the ssmtp manually using -v switch it says:

    [root@xen-1 ~]# ssmtp info@mydomain.com "
    [->] HELO _HOSTNAME_
    [<-] 250 Hello _HOSTNAME_ ([192.168.2.9]), pleased to meet you
    >->] MAIL FROM:" unrecognized or missing

    if i do a "telnet mailserver.mydomain.com 25" it is working fine:

    [root@xen-1 ~]# telnet mailserver.mydomain.com 25
    Trying 192.168.2.11...
    Connected to mailserver.mydomain.com.
    Escape character is '^]'.
    220 "Welcome to ..."
    EHLO _HOSTNAME_
    250-mailserver.mydomain.com Hello _HOSTNAME_ ([192.168.2.9]), pleased to meet you
    250-HELP
    250-AUTH LOGIN
    250-SIZE
    250 PIPELINING
    mail from:info@xen-1.mydomain.com
    250 info@xen-1.mydomain.com... Sender OK
    rcpt to:info@somewhereelse.com
    250 info@somewhereelse.com... Recipient OK
    data
    354 Enter message, end with "." on a line by itself
    Subject: testmail
    Blabla
    .
    250 Message accepted for delivery


    What can i do for successfully sending the logs to my mailbox?

    Thanks in advance,

    Peter

    RispondiElimina