Difference between revisions of "stoney backup: prov-backup-rsnapshot"

From stoney cloud
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Test the daemon)
(Testing)
Line 91: Line 91:
 
...
 
...
 
</source>
 
</source>
 +
 +
= Source Code =
 +
 +
== Exit Codes ==
 +
The following list defines the return codes and their meaning for the ...:
 +
use constant UNDEFINED_ERROR                            => 1;
  
 
= Testing =
 
= Testing =

Revision as of 13:15, 13 August 2013

Overview

This pages contains all necessary information one needs to know about the prov-backup-rsnapshot daemon.

Communication with LDAP

The daemon "communicates" with the LDAP to let other processes know its current state. The important attributes therefore are sstProvisioningMode and sstProvisioningState in the given Backup-Account entry. The sequence is defined for adding, modifying or deleting an entry. The preconditions for all three modi are:

  • sstProvisioningMode is set to add, modify or delete
  • sstProvisioningState is set to 0
  • sstProvisioningDate is set to 0 or the current date (format: YYYYMMDD)

Add

Precondition

...
sstProvisioningMode: add
sstProvisioningState: 0
sstProvisioningDate: 0
...

Step 1

...
sstProvisioningMode: adding
sstProvisioningState: 0
sstProvisioningDate: 0
...

Now the prov-backup-rsnapshot daemon works on the given entry.

Step 2

As soon as the prov-backup-rsnapshot daemon finished working on the given entry:

...
sstProvisioningMode: added
sstProvisioningState: YYYYMMDDThhmmssZ
sstProvisioningDate: 0
...

Modify

Precondition

...
sstProvisioningMode: modify
sstProvisioningState: 0
sstProvisioningDate: 0
...

Step 1

...
sstProvisioningMode: modifying
sstProvisioningState: 0
sstProvisioningDate: 0
...

Now the prov-backup-rsnapshot daemon works on the given entry.

Step 2

As soon as the prov-backup-rsnapshot daemon has finished working on the given entry:

...
sstProvisioningMode: modified
sstProvisioningState: YYYYMMDDThhmmssZ
sstProvisioningDate: 0
...

Delete

Precondition

...
sstProvisioningMode: delete
sstProvisioningState: 0
sstProvisioningDate: 0
...

Step 1

...
sstProvisioningMode: deleting
sstProvisioningState: 0
sstProvisioningDate: 0
...

Now the prov-backup-rsnapshot daemon works on the given entry.

Step 2

As soon as the prov-backup-rsnapshot daemon finished working on the given entry:

...
sstProvisioningMode: deleted
sstProvisioningState: YYYYMMDDThhmmssZ
sstProvisioningDate: 0
...

Source Code

Exit Codes

The following list defines the return codes and their meaning for the ...:

use constant UNDEFINED_ERROR                             => 1;

Testing

Requirements

  • A sandbox of the prov-backup-rsnapshot deamon:
cd /var/work
git clone --recursive https://github.com/stepping-stone/prov-backup-rsnapshot.git
cd /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/
ln -s ../../../etc/Provisioning/Backup/ Backup
cd /var/work/prov-backup-rsnapshot/Provisioning/lib/Provisioning/
ln -s ../../../lib/Provisioning/Backup/ Backup
  • A test configuration
cd /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Backup/
cp -p Rsnapshot.conf.template Rsnapshot_test.conf
vi Rsnapshot_test.conf

Update the Database section accordingly

Test the daemon

  • Open a terminal and login to the server
    • Start the prov-backup-rsnapshot daemon in debug mode by typing:
    • /var/work/prov-backup-rsnapshot/Provisioning/bin/provisioning.pl -c /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Backup/Rsnapshot_test.conf -g /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Global.conf -d 
    • (You can stop the deamon by sending SIGTERM (press Ctrl + C) )
  • Open a second terminal and login to the server
    • Make sure the directory /root/data exists, if not create it
    • Create an online backup account by executing the test script:
    • /var/work/prov-backup-rsnapshot/bin/createBackupAccountLDIF.pl --uid 3724300
    • The test script currently supports the following options:
      • --uid <UID>: Mandatory option, the backup accounts uid
      • --reseller <UID>: Optional, sets sstBelongsToResellerUID (default 4000000)
      • --customer <UID>: Optional, sets sstBelongsToCustomerUID (default 4000001)
      • --people <UID>: Optional, sets sstBelongsToPersonUID (default 4000002)
      • --givenname <Name>: Optional, sets the givenname attribute (default "Givenname")
      • --surname <Name>: Optional, sets the sn attribute (defualt "Surname")
    • Load the generated LDIF (you find them under /root/data) step by step into the LDAP and observe what the deamon is doing in the first terminal:
      • /root/loadOpenLDAPsingleLDIF.sh /root/data/01_add_3724300.ldif
      • /root/loadOpenLDAPsingleLDIF.sh /root/data/02_modify_3724300.ldif
      • /root/loadOpenLDAPsingleLDIF.sh /root/data/03_delete_3724300.ldif
      • /root/loadOpenLDAPsingleLDIF.sh /root/data/04_remove_3724300.ldif