Version 3 (modified by pruth, 7 years ago)

--

Virtual Machine Images

Known ORCA images can be found here: images

ImageProxy: Using ImageProxy with ORCA

ImageProxy

Virtual Machine images can be made available to ORCA by placing them (and their metadata) at well known URLs. An ORCA service called ImageProxy will manage staging and caching all images at the appropriate cloud site(s). ImageProxy identifies each image by its URL and the SHA-1 hash of the image and requires an xml metadata file with the identifying information.

Sample metadata file. Node element names and keywords representing image type are case sensitive:

<images>
	<image>
		<type>FILESYSTEM</type>
		<signature>FS_IMAGE_HASH</signature>
		<url>http://url_filesystem_image</url>
	</image>
	<image>
		<type>KERNEL</type>
		<signature>KERNEL_IMAGE_HASH</signature>
		<url>http://url_kernel_image</url>
	</image>
	<image>
		<type>RAMDISK</type>
		<signature>RAMDISK_IMAGE_HASH</signature>
		<url>http://url_ramdisk_image</url>
	</image>
</images>

The metadata file itself also needs to be hosted. Provided with the URL for the metadata file and its signature (SHA1 hash), ImageProxy associated with a cloud site can download and install the required images and provide ORCA with site-specific image ids (AMI/EMI, AKI/EKI, ARI/ERI) that can be used to create guest VMs on that site.

The documentation for the latest metafile format is maintained on the ImageProxy wiki.

Compressed Images

The image provider can reduce the amount of data transfered across the network by compressing the virtual machine images and modifying the metadata file to indicate that the image is compressed. The file system type should be set to "ZFILESYSTEM".

<images>
	<image>
		<type>ZFILESYSTEM</type>
		<signature>FS_IMAGE_HASH</signature>
		<url>http://url_to_compressed_filesystem_image</url>
	</image>
	<image>
		<type>KERNEL</type>
		<signature>KERNEL_IMAGE_HASH</signature>
		<url>http://url_kernel_image</url>
	</image>
	<image>
		<type>RAMDISK</type>
		<signature>RAMDISK_IMAGE_HASH</signature>
		<url>http://url_ramdisk_image</url>
	</image>
</images>

Currently, ZFILESYSTEM can handle .gz, .bz2, and .xz. images compressed with these tools can have any name.

In addition, ZFILESYSTEM can handle images that are tarred before they are compressed with the tools above extending the allowed formats to include .tgz, .tbz2, and .txz. However, images that are tarred and gzipped must conform to the expected naming convention by naming the image file "filesystem". The tarball can have any name.

Sparse Images

The astute reader might point out that tarring an individual file is unnecessary and an odd format for ORCA to accept. However, when used appropriately, this functionality can reduce the time and space necessary to stage and boot a virtual machine to a small fraction of the original. The key is to store images as sparse files. Sparse files take up less space when uncompressed and can be take less time to be uncompressed.

It is not too difficult to create sparse files but it can be tricky to keep the files sparse while handling them. Many common tool cannot process a sparse file without eliminating the sparse property (i.e. gzip, bzip2). Other tools can maintain sparsity but do not by default (i.e. cp, tar). Further, some operating systems and file systems cannot handle sparse files (i.e. nfs).

Create a Sparse Image

This section assumes that you have a working non-sparse image and want to convert it to a sparse image.

Create an appropriately sized sparse file (make sure your operating system and file system support sparse files... don't use nfs):

$ dd if=/dev/zero of=my_sparse_image.img bs=1 count=1 seek=2G

Mount both your sparse image and non-sparse image:

$ mkdir mnt-src
$ mount -o loop my_image.img mnt-src
$ mkdir mnt-dst
$ mount -o loop my_sparse_image.img mnt-dst

Copy all the files from the non-sparse image to the sparse image (use 'cp -a' to preserve permissions and ownership):

$ cp -a mnt-src/* mnt-dst/.

Unmount both images:

$ umount mnt-src
$ umount mnt-dst

You now have a sparse image called my_sparse_image.img. Don't mess it up by using any tools that remove the sparsity.

Tar the file with -S to preserve sparsity:

$ tar -S -zcvf  my_sparse_image.img.tgz my_sparse_image.img

Note: to use the image with ORCA, must rename the image "filesystem" before tarring:

$ mv my_sparse_image.img filesystem
$ tar -S -zcvf  my_sparse_image.img.tgz filesystem

Attachments