stoney cloud: Resetting your Test-Environment
Contents
Overview
This page describes how to easily reset your stoney cloud Test-Environment.
Prerequisites
After you've installed and configured your stoney cloud Test-Environment, but before you've added any profiles, you need to make a complete Backup of your LDAP directory:
/usr/sbin/makeOpenLDAPmasterBackup.sh
The output will look something like:
Backup directory /var/backup/ldap/vm-test-01.int.stoney-cloud.org exists ################################################################################################### Removing backups older than 15 days ... ################################################################################################### find /var/backup/ldap/vm-test-01.int.stoney-cloud.org -type f -ctime +15 -exec rm {} \; >/dev/null Backup Started ################################################################################################### Executing touch /var/backup/ldap/vm-test-01.int.stoney-cloud.org/OpenLDAPmasterBackup.ldif.2015-02-12 ################################################################################################### Executing chmod 600 /var/backup/ldap/vm-test-01.int.stoney-cloud.org/OpenLDAPmasterBackup.ldif.2015-02-12 ################################################################################################### Executing /usr/sbin/slapcat -l /var/backup/ldap/vm-test-01.int.stoney-cloud.org/OpenLDAPmasterBackup.ldif.2015-02-12 ################################################################################################### Backup Finished ################################################################################################### You can look at the backup file with: vi /var/backup/ldap/vm-test-01.int.stoney-cloud.org/OpenLDAPmasterBackup.ldif.2015-02-12
Copy the newly created OpenLDAPmasterBackup.ldif.2015-02-12 to another location for later use:
mkdir -p /root/stoney-cloud-reset cp /var/backup/ldap/vm-test-01.int.stoney-cloud.org/OpenLDAPmasterBackup.ldif.2015-02-12 /root/stoney-cloud-reset/.
Resetting your Test-Environment
Stop the Web Server
Stop the Web server on both Master-Nodes:
/etc/init.d/apache2 stop
Stop the LDAP Server
Stop the LDAP server on both Master-Nodes:
/etc/init.d/slapd stop
Remove all unnecessary Files
Remove all the unnecessary files on the Primary-Master-Node:
rm /var/virtualization/iso-choosable/*.iso rm /var/virtualization/iso/*.iso rm /var/virtualization/vm-templates/*/*.qcow2 rm /var/virtualization/vm-dynamic/*/*.qcow2 rm /var/virtualization/vm-persistent/*/*.qcow2
Clean up the Firewall Rules
If you have configured the automatic firewall rules creation, you need to execute the following commands on the Primary-Master-Node:
svn up /usr/local/scripts/netfilter/local/chains/vms svn rm /usr/local/scripts/netfilter/local/chains/vms/* svn ci -m "Removed all test VM rules" /usr/local/scripts/netfilter/local/chains/vms/
On the Secondary-Master-Node and all other VM-Nodes, you'll need to execute:
svn up /usr/local/scripts/netfilter/local/chains/vms/
Reset the LDAP Server
Now you reset the LDAP server with the the previously created backup:
cp /root/stoney-cloud-reset/OpenLDAPmasterBackup.ldif.2015-02-12 /var/backup/ldap/vm-test-01.int.stoney-cloud.org/. /usr/sbin/restoreOpenLDAPmaster.sh
You'll be led through the restore process:
The following machines have an existing OpenLDAP backup: ################################################################################################### total 4 drwxr-sr-x 4 root vm-storage 74 25. Dez 2013 . drwx--S--- 5 root vm-storage 81 2. Apr 2014 .. drwxr-sr-x 2 root vm-storage 4096 12. Feb 03:00 vm-test-01.int.stoney-cloud.org drwxr-sr-x 2 root vm-storage 92 12. Feb 03:00 vm-test-02.int.stoney-cloud.org Please enter the machine from which you want to restore from: vm-test-01.int.stoney-cloud.org The following OpenLDAP backups exist: ################################################################################################### total 1100 drwxr-sr-x 2 root vm-storage 4096 12. Feb 03:00 . drwxr-sr-x 4 root vm-storage 74 25. Dez 2013 .. -rw------- 1 root vm-storage 735229 11. Feb 10:26 OpenLDAPmasterBackup.ldif.2015-02-10 -rw------- 1 root vm-storage 192334 11. Feb 13:36 OpenLDAPmasterBackup.ldif.2015-02-11 -rw------- 1 root vm-storage 193662 12. Feb 11:55 OpenLDAPmasterBackup.ldif.2015-02-12 Please enter the date of the backup to restore in the form of YYYY-DD-MM (for example: 2007-10-15): 2015-02-12
The LDAP server has now been restored to the state from 2015-02-12, the indices have been created and the LDAP server has been started.
Start the Web Server
Start the Web server on the Primary-Master-Nodes:
/etc/init.d/apache2 start