Channels ▼
RSS

Project of the Month: OpenStack, A Universal Cloud Front End


Creating Custom Images for Bundling and Uploading to OpenStack

When you see the list of images available to you, you might want to add your own image that suits your needs. To create a custom image, start with an ISO file. You can download ISOs for CentOS, Debian, Fedora, or Ubuntu. Good starter images are available here . They are .tar.gz files that contain the VM image (*.img), a Xen compatible kernel/ramdisk pair (xen-kernel/vmlinuz* and xen-kernel/initrd*) and a KVM compatible kernel/ramdisk pair (kvm-kernel/vmlinuz* and kvm-kernel/initrd*). You can either customize the image from the command line or by using VirtualBox or other virtualization platform like kvm. You can make a .vdi image and convert it to raw using quemu-utils, which contains qemu-img.

You may want to increase the size of the image, add packages such as the Linux standard basics, and so on, to make it more practical for everyday use. Once you have made all your customizations in VirtualBox or any other platform, copy the file to a Linux machine with euca2ools installed. The next section describes how to add your custom image to your OpenStack cloud from the command line using euca- commands.

How To Add a New Image to OpenStack Image Service (Glance)

After you create a custom virtual machine image, you can store the disk image data in the Image Service and also store metadata about this image in the Image Service.

You can use the Eucalyptus tool set, which is an open source command-line client for clouds that are compatible with Amazon's EC2 API. Install the euca2ools command-line tools and ensure that your environment contains the credentials needed by Eucalyptus.

Upload the kernel and note the Amazon Kernel Image (AKI):

euca-bundle-image -i kvm-kernel/vmlinuz-2.6.28-11-generic --kernel true
euca-upload-bundle -b jbbucket -m /tmp/vmlinuz-2.6.28-11-generic.manifest.xml
euca-register jbbucket/vmlinuz-2.6.28-11-generic.manifest.xml

Upload the ramdisk and note the Amazon Ramdisk Image (ARI) so you can reference it when you bundle the image:

euca-bundle-image -i kvm-kernel/initrd.img-2.6.28-11-generic --ramdisk true
euca-upload-bundle -b jbbucket -m /tmp/initrd.img-2.6.28-11-generic.manifest.xml
euca-register jbbucket/initrd.img-2.6.28-11-generic.manifest.xml

Upload the custom machine image, specifying the values from the steps above to specify the kernel and ramdisk:

euca-bundle-image -i centos-5.5-x86_64.img --kernel aki-XXXXXXXX --ramdisk ari-XXXXXXXX
euca-upload-bundle -b jbbucket -m /tmp/centos-5.5-x86_64.img.manifest.xml
euca-register jbbucket/centos-5.5-x86_64.img.manifest.xml

You may have to wait a short while for it to upload to the image server — but then you should see your new AMI available as shown below when you use the Eucalyptus "describe images" command.

euca-describe-images
IMAGE    ami-reey5wk5    jbbucket/centos.5-5.x86-64.img.manifest.xml    myproject    available    private        x86_64    machine    ami-f4ks8moj    ami-jqxvgtmd

How to Work with Stored Objects Through a UI

You can use a REST API to access your stored objects in OpenStack, but you may just want a nice user interface to drag and drop files to store. Cyberduck, an open source client for both Mac OS X and Windows, provides a user interface for many different protocols from FTP to Object Storage. Since it's open source and cross platform, it is a good interface to an OpenStack Object Storage installation (such as Rackspace Cloud Files). You can download it from cyberduck.ch. In order to use it with an OpenStack installation, you need to change a hidden configuration option. You want to change the context of the URL from the default /v1.0 to /auth/v1.0 changing the values. To change the auth URL in Mac OSX, open a Terminal window and type:

Defaults defaults write ch.sudo.cyberduck cf.authentication.context /auth/v1.0

Cyberduck 3.8.1 includes a drop-down for selecting Swift (OpenStack Object Storage) when opening a connection. Launch Cyberduck, and then click the New Connection toolbar button or choose File > Open Connection.

Select Swift (OpenStack Object Storage) and enter the following values:

  • Server: Enter the URL of the installed Swift server.
  • Port: Enter 443 since users are connecting via https.
  • Username: Enter the account name followed by a colon and then the user name, for example test:tester.
  • Password: Enter the password for the account and user name entered above.

Figure 5 shows an example Cyberduck Swift Connection.


Figure 5.

Once you've created a container in your Object Storage system, you can use Cyberduck to copy files using drag-and-drop from your Desktop, see Figure 6.


Figure 6.

With this, you can back up all those photos and videos to a massively scalable storage system with redundancy built in.

Getting Help and Moving Forward

If you have questions during setup or testing, or just cannot get a feature to work correctly, the OpenStack community can help. One place to look for help is the "Answers" section on Launchpad.

The Launchpad answers sections are available here:

You can also ask questions on the OpenStack mailing list at https://launchpad.net/~openstack, leave a comment in the documentation , or talk with others on IRC in the #openstack channel.

Rackspace is now offering a series of lab-based OpenStack training classes for developers and systems administrators. Click here to learn more about the classes.

Now that you have the low down on OpenStack, here's to hoping you can stack some clouds up.


Anne Gentle is an OpenStack Content Stacker at Rackspace.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video