DZone
Cloud Zone
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
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Cloud Zone > 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 · Cloud Zone · Tutorial
Like (3)
Save
Tweet
3.89K 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.

Popular on DZone

  • Introduction to JWT (Also JWS, JWE, JWA, JWK)
  • Architecture as Code With C4 and Plantuml
  • Internal Developer Platform in Plain English
  • Data Statistics and Analysis With Java and Python

Comments

Cloud Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • 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
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo