LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-23-2014, 04:45 AM   #1
mlpa
Member
 
Registered: May 2008
Location: Aveiro
Distribution: Slackware
Posts: 542

Rep: Reputation: 50
SlackwareCloud - How to build OpenStack Slackaware image


Someone asked me to write a small tutorial about building a OpenStack Slackware image. Since I have to write the tutorial I may as well share it on LinuxQuestions.

Building a Slackware image for OpenStack is not different from building any other custom Linux image. A custom image must fulfill a set of requirements:
  1. The image must support KVM disk paravirtualization ( disks will be named /dev/vdX instead of /dev/sdX)
  2. After launching the image it is necessary to expand the filesystem in order to match the virtual disk.
  3. The boot log should be redirect to ttyS0 (serial port), that way is possible to analyze the boot log at runtime.
  4. The image must be able to retrieve metadata from OpenStack (ssh keys).

To build the custom image you need a machine virtualizer. I use QEMU to build my custom images (it is available in slackbuilds.org). In the rest of the tutorial the specifics will be explained with QEMU.

After installing QEMU the fist thing you need to do is build a new virtual disk:
Code:
qemu-img create -f qcow2  slackCloud.qcow 10G
This command creates a qcow2 disk named "slackCloud.qcow" with 10 gigabytes.
QCOW2 is native format of QEMU and it is supported by OpenStack.

To begin the installation type:
Code:
qemu-system-x86 -m 1024 -cdrom image.iso -drive file=slackCloud.qcow,if=virtio,index=0 -boot d -net nic -net user
The command starts a virtual machine with 1 gigabyte of memory (-m 1024), 1 CPU (default option) and user mode networking (-net nic -net user).
The Virtual Machine (VM) disk is paravirtualization through virtio.
To use virtio paravirtualization with qemu just type "-drive file=slackCloud.qcow,if=virtio,index=0", where slackCloud.qcow is the name of the disk.
Finally the system needs to boot from the installation media, in our example a ISO image.
The option "-cdrom image.iso" adds a cdrom drive, and the option "-boot d" makes qemu boot from the cdrom drive.

Do a normal installation, just remember the disk are named /dev/vdX instead of /dev/sdX.

After installing the system you reach the boot loader step. It is not possible to install LILO with the default configuration. You can just skip this step.
Before rebooting the VM it is necessary to tweak the system a little bit.

We are going to 'chroot' into our fresh installation:
Code:
chroot /mnt
Edit the "/etc/lilo.conf" file (or create a fresh one) and the following lines:
Code:
#Boot from virtio devices(/dev/vdX)
boot=/dev/vda
disk=/dev/vda bios=0x80 max-partitions=7
#Redirect boot log to ttyS0
serial=0,115200n8
append="console=tty0 console=ttyS0,115200n8"
To use a generic kernel it is necessary to generate a initrd (more information in here).
Slackware ships a useful tool that outputs a the command to generate a initrd:
Code:
/usr/share/mkinitrd/mkinitrd_command_generator.sh
Copy the generated command, run it and add the initrd to the lilo configuration file.
After switching to the generic kernel, run "lilo" to install the boot loader.

OpenStack has a special metadata service that enables virtual machines to retrieve specific metadata.
VM access the metadata service through http://169.254.169.254.

The VMs imports several configurations through metadata, the most important being SSH keys.
CloudInit is the Ubuntu package that handles early initialization of a VM.
I made a smaller script that fetches the root ssh key (rc.cloud).
Copy the script into the VM and add the following lines to rc.local
Code:
if [ -x /etc/rc.d/rc.cloud ]; then
    /etc/rc.d/rc.cloud start
fi
So now you have a shiny custom image ready for OpenStack.
You can compress the image with the following command:
Code:
qemu-img convert -p -c -O qcow2 disk.qcow new_disk.qcow
 
Old 03-23-2014, 06:15 AM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Well done. Thank you. Have you considered adding it to the Slackware Documentation Project? See the link in my signature.
 
  


Reply

Tags
openstack, qcow2, qemu, slackware, virtio



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Short Stack: OpenStack jobs on rise, OpenStack Cinder and considering multi-cloud strategies LXer Syndicated Linux News 0 03-20-2014 08:21 AM
LXer: Short Stack: How OpenStack should engage AWS, OpenStack grows up LXer Syndicated Linux News 0 02-13-2014 10:42 PM
Need to build out private network for openstack Thaidog Linux - Virtualization and Cloud 1 09-27-2013 09:39 AM
LXer: IT Consultants Build OpenStack Cloud Business Practices LXer Syndicated Linux News 0 04-13-2012 08:30 PM
Dependencies, gnome, slackaware, how? rosariowong Slackware 3 08-07-2004 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration