Linux Image Preparation for OpenStack

This describes how to prepare a Linux guest VM for SCM. CentOS is used in the examples, but any version of Linux can be used as a guest VM.

Install CentOS manually


Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file. Remove:

  • UUIDs
  • MAC addresses (asasigned by OpenStack)




# yum remove NetworkManager


Replace UUIDs in /etc/fstab with device names like /dev/vda for the /boot partition, so the system will boot when replicated to a new boot volume.

nVidia GPU steps

If you are using an nVidia GPU:

# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf

Add these lines to /etc/grub.conf:

serial --unit=0 --speed=115200
terminal --timeout=10 console serial

Change each kernel line by replacing rhgb quiet at the end of each line with:

rdblacklist=nouveau console=tty0 console=ttyS0,115200n8

Install driver prerequisites:

# yum install dkms
# yum groupinstall "Development Tools"

Download the nVidia drivers:

# wget

Drop back to runlevel 3:

# telinit 3

Install the nVidia drivers:

# chmod +x
# ./ --silent --dkms

Edit /etc/inittab and change the default runlevel from 5 to 3.

Install cloud-init

Install the prerequisites for cloud-init:

# yum install \
     acpid cloud-init cloud-utils cloud-utils-growpart \
     dracut-kernel dracut dracut-modules-growroot

Edit /etc/cloud/cloud.cfg and change the values at the top of the file to these:

disable_root: 0
ssh_pwauth:   1
ssh_deletekeys:   0

Empty the /var/lib/cloud directory for the full cloud-init run on first boot:

# rm -rf /var/lib/cloud/*

Shutdown the VM

# shutdown -h now

Create a CentOS VM

With virt-manager, create a CentOS VM, using a qcow2 file for the boot disk. Details are available here.

Prep the image for reuse

Get the name of the new VM:

# virsh list --all

Prep the image:

# virt-sysprep -d centos-6.7

Install libguestfs

# yum install libguestfs-tools

Compress the image to upload

# qemu-img convert -c \
    -f qcow2 \
    -O qcow2  \
    /var/lib/libvirt/images/centos-6.7-scw.qcow2 \

Convert qcow2 to a sparse raw file for Glance

# qemu-img convert \
    -f qcow2 \
     -O raw \
     /tmp/centos-6.7-scw.qcow2 \

Load the raw file into Glance

# glance image-create \
    --name centos_image  \
    --is-public true \
    --file /tmp/centos6.7-working.raw  \
    --disk-format raw \
    --container-format bare \
    --min-disk 15 \
    --min-ram 512 \
    --progress \
    --property image_type=loginnode \
    --property service_type=loginNode \
    --property hw_video_model=qxl \
    --property service_url='https://{}/' \
    --property hw_video_ram=8

(Optional) set the is-linux property

The image is-linux property defaults to True, so you don’t really need to set it for Linux images. If True, SCM assumes that the VM supports ssh and that the ssh server starts at boot time. If the Cloud Controller setting (in the cloudcontroller.ini file) for userauth.manage_sshd_acls is also True (its default value), then the Controller writes AllowUsers lines (one per user account with access to this VM instance) to the VM’s /etc/ssh/sshd_config file after the VM starts. Then the ssh server on the VM is restarted. The effect is to allow password logins for those accounts, while still allowing key-based access for others.

To disable password access to the VM, set either the image property is-linux or Cloud Controller setting userauth.manage_sshd_acls to False.