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

Network

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

  • UUIDs
  • MAC addresses (assigned by OpenStack)

Change:

NM_CONTROLLED="no"

Verify:

ONBOOT="yes"
BOOTPROTO
# yum remove NetworkManager

Finally, remove this file:

# rm /lib/udev/rules.d/75-persistent-net-generator.rules

This prevents the automatic creation of a /etc/udev/rules.d/70-persistent-net.rules file, which would rename network interfaces and interfere with the reuse of SCM images.

fstab

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 (optional)

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 http://us.download.nvidia.com/XFree86/Linux-x86_64/352.41/NVIDIA-Linux-x86_64-352.41.run

Drop back to runlevel 3:

# telinit 3

Install the nVidia drivers:

# chmod +x NVIDIA-Linux-x86_64-352.41.run
# ./NVIDIA-Linux-x86_64-352.41.run --silent --dkms

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

Install Scyld Cloud Workstation (optional)

Obtain the appropriate version of SCW from Penguin Computing as a RPM.

Install the RPM

yum localinstall scyld-cloud-workstation-$VERSION-rpm.

Configure SCW following the User Guide - http://www.penguincomputing.com/documentation/scyld-cloud-workstation/user-guide/

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 \
    /tmp/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 \
     /tmp/centos-6.7-working.raw

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 8 \
    --min-ram 512 \
    --progress \
    --property image_type=loginnode \
    --property hw_video_model=qxl \
    --property hw_video_ram=8

If the image will include Scyld Cloud Workstation, add –property service_url=’https://{}/’

Modifying image file properties

Once the image is uploaded, it can be updated through the Horizon dashboard, openstack image set <IMAGE_ID>, or glance image-update <IMAGE_ID>