No edit summary |
(Update to grizzly functionality) |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
We assume that an instance has already been booted in the previous test case, and we use this as a builder to facilitate the creation of a bootable volume. | We assume that an instance has already been booted in the previous test case, and we use this as a builder to facilitate the creation of a bootable volume. | ||
We also need a | We also need a bootable image, which may be download from: | ||
$> wget | $> wget https://launchpadlibrarian.net/83305348/cirros-0.3.0-x86_64-disk.img | ||
Finally, we assume that the nova-volume service or cinder is enabled and running. | Finally, we assume that the nova-volume service or cinder is enabled and running. | ||
|actions= | |actions= | ||
Upload the image to glance: | |||
$> glance add name=cirros_boot is_public=true disk_format=qcow2 container_format=bare < ./cirros-0.3.0-x86_64-disk.img | |||
$> <nowiki>IMAGE_ID=$(glance image-list | awk '/cirros-boot/ {print $2}')</nowiki> | |||
Create a 1Gb volume, which we will make bootable: | Create a 1Gb volume, which we will make bootable: | ||
$> cinder create --display_name= | $> cinder create --image-id $IMAGE_ID --display_name=bootable_cirros 1 | ||
$> <nowiki>VOLUME_ID=$( | $> <nowiki>VOLUME_ID=$(cinder list | awk '/bootable_cirros/ {print $2}')</nowiki> | ||
and wait for the volume to become available: | and wait for the volume to become available: | ||
$> <nowiki>watch " | $> <nowiki>watch "cinder show bootable_cirros | grep status"</nowiki> | ||
Now snapshot the bootable volume we just created: | Now snapshot the bootable volume we just created: | ||
$> | $> cinder snapshot-create --display_name bootable_snapshot $VOLUME_ID | ||
and wait for the snapshot to become available: | and wait for the snapshot to become available: | ||
$> | $> watch "cinder snapshot-show bootable_snapshot" | ||
$> <nowiki>SNAPSHOT_ID=$( | $> <nowiki>SNAPSHOT_ID=$(cinder snapshot-list | awk '/bootable_snapshot/ {print $2}')</nowiki> | ||
Now we can boot from the bootable volume. We use the same image as the builder instance, but that is only in order to retrieve the image properties. | Now we can boot from the bootable volume. We use the same image as the builder instance, but that is only in order to retrieve the image properties. | ||
$> nova boot --flavor 1 --block_device_mapping vda=${SNAPSHOT_ID}:snap::0 --key_name nova_key volume_backed | |||
$> nova boot --flavor 1 | |||
|results= | |results= | ||
Line 90: | Line 46: | ||
You should be able able to ssh into the volume-backed instance. | You should be able able to ssh into the volume-backed instance. | ||
Also note that for the volume-backed instance you've fired up, there is a volume cloned from the corresponding snapshot: | |||
Also note the volume-backed instance you've fired up, there is a volume cloned from the corresponding snapshot: | |||
$> | $> cinder list | ||
}} | }} |
Latest revision as of 16:26, 2 April 2013
Description
Nova instances can be booted from volume, analogous to EBS-backed volumes in EC2.
We construct a bootable volume, then fire up an instance backed by this volume.
Setup
We assume that an instance has already been booted in the previous test case, and we use this as a builder to facilitate the creation of a bootable volume.
We also need a bootable image, which may be download from:
$> wget https://launchpadlibrarian.net/83305348/cirros-0.3.0-x86_64-disk.img
Finally, we assume that the nova-volume service or cinder is enabled and running.
How to test
Upload the image to glance:
$> glance add name=cirros_boot is_public=true disk_format=qcow2 container_format=bare < ./cirros-0.3.0-x86_64-disk.img $> IMAGE_ID=$(glance image-list | awk '/cirros-boot/ {print $2}')
Create a 1Gb volume, which we will make bootable:
$> cinder create --image-id $IMAGE_ID --display_name=bootable_cirros 1 $> VOLUME_ID=$(cinder list | awk '/bootable_cirros/ {print $2}')
and wait for the volume to become available:
$> watch "cinder show bootable_cirros | grep status"
Now snapshot the bootable volume we just created:
$> cinder snapshot-create --display_name bootable_snapshot $VOLUME_ID
and wait for the snapshot to become available:
$> watch "cinder snapshot-show bootable_snapshot" $> SNAPSHOT_ID=$(cinder snapshot-list | awk '/bootable_snapshot/ {print $2}')
Now we can boot from the bootable volume. We use the same image as the builder instance, but that is only in order to retrieve the image properties.
$> nova boot --flavor 1 --block_device_mapping vda=${SNAPSHOT_ID}:snap::0 --key_name nova_key volume_backed
Expected Results
You should be able able to ssh into the volume-backed instance.
Also note that for the volume-backed instance you've fired up, there is a volume cloned from the corresponding snapshot:
$> cinder list