How to Add Disk Space to an OpenStack Instance Using a flavor Volume

 

While installing Openshift on Openstack I was quickly informed that my masters needed at least 40 GB of Disk Volume, while my Openstack Flavor had only 10.

If your Openstack Instance is using an attached volume, it is pretty straightforward to expand the volume with:

openstack volume set VOLUME-ID --size 10

This only works with a number larger than the present size.

However, when your volume is the root volume from a flavor you can’t do that. You need to change the instances flavor to a flavor with a larger volume. When changing instance flavors you can downgrade to a smaller flavor, but not if the volume is smaller.

I needed to first add a new flavor that has a larger volume then change the flavor. To create the new flavor I use a hot stack containing the following:

heat_template_version: 2016-04-08

description: >
HOT template to create FLAVORS

parameters:

resources:
m5_large_50_gb_vol:
type: OS::Nova::Flavor
properties:
name: M5 Large 50gb Volume
disk: 50
ram: 32768
vcpus: 8

Save that Hot code as a yaml template

then from with your cli, logged in to the correct project

run

 openstack stack create  --template   NAME-OF-YOUR-TEMPLATE  STACK-NAME

To resize your instance run the following command:

 openstack server resize --flavor UID-or-NAME-OF_YOUR_NEWFLAVOR  INSTANCE-NAME-OR-ID