DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Revolutionize JSON Parsing in Java With Manifold
  • How Agile Works at Tesla [Video]
  • How to Use an Anti-Corruption Layer Pattern for Improved Microservices Communication
  • AI and Cybersecurity Protecting Against Emerging Threats

Trending

  • Revolutionize JSON Parsing in Java With Manifold
  • How Agile Works at Tesla [Video]
  • How to Use an Anti-Corruption Layer Pattern for Improved Microservices Communication
  • AI and Cybersecurity Protecting Against Emerging Threats
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Deploying and Redeploying OpenStack on a Physical Server

Deploying and Redeploying OpenStack on a Physical Server

OpenStack deploys can be time-consuming, especially if you need to restore your server to an old state. Fortunately, with Snapper, you can make frequent deploys easier.

Rathinasabapathy Arumugam user avatar by
Rathinasabapathy Arumugam
·
Mar. 21, 17 · Tutorial
Like (3)
Save
Tweet
Share
4.07K Views

Join the DZone community and get the full member experience.

Join For Free

OpenStack can be deployed for multiple purposes, such as learning, training, exploring certain features, developing or enhancing projects, integrating it with other systems, running Test or Production workloads, etc.

We often need to deploy and redeploy OpenStack on the same physical server for:

  1. Upgrades

  2. Problems in deployment

  3. Perfecting configurations

  4. Change in hypervisor

  5. Tuning

  6. OpenStack deployment training

The challenge with redeployment is that we need to trace back all the packages installed as part of OpenStack and uninstall all of them. It is a tedious and cumbersome process. The other option is to reinstall the OS, but that is a time-consuming effort. An optimal way to do that activity over and over again is to restore the physical server to the old state using Snapper. This blog outlines the procedure for installing Snapper, creating a Snapshot of your physical server — similar to a virtual image — deploying OpenStack, and restoring the physical server to the old state for redeployment.

OpenStack

OpenStack is a leading open-source software platform for cloud computing, mostly deployed as an infrastructure-as-a-service (IaaS). The software platform consists of interrelated components that control diverse, multi-vendor hardware pools of processing, storage, and networking resources throughout a Data Center

Snapper

Snapper is a Linux command ­line tool to create and manage snapshots of your filesystems. It allows you to create read­-only snapshots of physical machines that can be used to restore the state of the server during a disaster situation.

Steps for Deploying OpenStack With Snapper and Restoring to the Original State

The block diagram below outlines the various layers involved in the setup:

Image title

Prerequisites

  • A BTRFS file system.
  • OS: Ubuntu14.04,16.04
  • Snapper Version 0.1.8
  • Resource requirement: 4GB RAM, 20GB HDD

Note: Snapper has full support in the Open SUSE platform

Step1: Installing Snapper

Install Snapper using the command:

apt-get install snapper -y

Step 2: Prepare Your Script for Creating Config and Mount Point

Create the script below with the name snapperconfigandmountpoint.sh.

#Snapper with btrfs filesystem in ubuntu 14.04

ARGS=$(getopt -o a:b -l "configname:,mountpoint:" -- "$@");
eval set -- "$ARGS";
while true; do
case "$1" in
-a|--configname)
shift;
if [ -n "$1" ]; then
configname=$1;
shift;
fi
;;
-b|--mountpoint)
shift;
if [ -n "$1" ]; then
mountpoint=$1;
shift;
fi
;;
--)
shift;
break;
;;
esac
done

#creating a config file 
echo $configname
echo $mountpoint
snapper -c $configname create-config $mountpoint
snapper list-configs


Step 3: Run the Script

Run the script using the command below. Use the same configname and mount point until the end.

bash snapperconfigandmountpoint.sh –configname –mountpoint

Step 4: Prepare the Snapshot Script

Create the script below with the name Snapshotcreation.sh.

ARGS=$(getopt -o a:b -l "configname:,snapshotname:" -- "$@");
eval set -- "$ARGS";
while true; do
case "$1" in
-a|--configname)
shift;

if [ -n "$1" ]; then
configname=$1;
shift;
fi
;;
-b|--snapshotname)
shift;
if [ -n "$1" ]; then
snapshotname=$1;
shift;
fi
;;
--)
shift;
break;
;;
esac
done


echo $configname
echo $snapshotname

snapper --config $configname create --description "$snapshotname "
snapper --config $configname  list


Step 5: Run the Script to Create a Snapshot Using Snapper

Run the script using the command:

bash snapshotcreation.sh –configname –snapshotname

The execution will create a snapshot and list the created snapshots. Create a snapshot name of your choice, but ensure that you use the same config name used earlier.

Step 6: Deploy OpenStack

Deploy OpenStack Mitaka by following the instructions available here.

Step 7: Prepare a Script to Restore Your Snapshot

Create the following script with the name Restore.sh to restore the physical server to an older state:

ARGS=$(getopt -o a:b:c -l "configname:,state_to_revert:,state_to_modify:," -- "$@");
eval set -- "$ARGS";
while true; do
case "$1" in
-a|--configname)
shift;
if [ -n "$1" ]; then
configname=$1;
shift;
fi
;;
-b|--state_to_revert)
shift;
if [ -n "$1" ]; then
state_to_revert=$1;
shift;
fi
;;
-c|--state_to_modify)
shift;
if [ -n "$1" ]; then
state_to_modify=$1;
shift;
fi
;;
--)
shift;
break;
;;
esac
done

echo $configname
echo $state_to_revert
echo $state_to_modify

snapper -c $configname -v undochange $state_to_revert..$state_to_modify


Step 8: Run script to restore older snapshot using Snapper

Run the script using the command below, specifying the config name and Snapshot number to which we need to restore.

bash restore.sh –configname –state_to_revert –state_to_modify

Example:

bash restoretest.sh –configname snapconfig –state_to_revert 1 –state_to_modify 2

Congratulate Yourself!

If everything works correctly, you will able to deploy OpenStack, restore your server to its original state, and redeploy again and again.

OpenStack

Published at DZone with permission of Rathinasabapathy Arumugam, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Revolutionize JSON Parsing in Java With Manifold
  • How Agile Works at Tesla [Video]
  • How to Use an Anti-Corruption Layer Pattern for Improved Microservices Communication
  • AI and Cybersecurity Protecting Against Emerging Threats

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: