Atom feed of this document
 

 Creating instances

 Create Your Server with the nova Client

 

Procedure 8.1. To create and boot your server with the nova client:

  1. Issue the following command. In the command, specify the server name, flavor ID, and image ID:

    $ nova boot myUbuntuServer --image "3afe97b2-26dc-49c5-a2cc-a2fc8d80c001" --flavor 6

    The command returns a list of server properties. The status field indicates whether the server is being built or is active. A status of BUILD indicates that your server is being built.

    +-------------------------+--------------------------------------+
    | Property                | Value                                |
    +-------------------------+--------------------------------------+
    | OS-DCF:diskConfig       | AUTO                                 |
    | accessIPv4              |                                      |
    | accessIPv6              |                                      |
    | adminPass               | ZbaYPZf6r2an                         |
    | config_drive            |                                      |
    | created                 | 2012-07-27T19:59:31Z                 |
    | flavor                  | 8GB Standard Instance                |
    | hostId                  |                                      |
    | id                      | d8093de0-850f-4513-b202-7979de6c0d55 |
    | image                   | Ubuntu 12.04                         |
    | metadata                | {}                                   |
    | name                    | myUbuntuServer                       |
    | progress                | 0                                    |
    | status                  | BUILD                                |
    | tenant_id               | 345789                               |
    | updated                 | 2012-07-27T19:59:31Z                 |
    | user_id                 | 170454                               |
    +-------------------------+--------------------------------------+
  2. Copy the server ID value from the id field in the output. You use this ID to get details for your server to determine if it built successfully.

    Copy the administrative password value from the adminPass field. You use this value to log into your server.

 Launch from a Volume

The Compute service has support for booting an instance from a volume.

 Manually Creating a Bootable Volume

To manually create a bootable volume, mount the volume to an existing instance, and then build a volume-backed image. Here is an example based on exercises/boot_from_volume.sh. This example assumes that you have a running instance with a 1GB volume mounted at /dev/vdc. These commands will make the mounted volume bootable using a CirrOS image. As root:

# mkfs.ext3 -b 1024 /dev/vdc 1048576
# mkdir /tmp/stage
# mount /dev/vdc /tmp/stage

# cd /tmp
# wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz
# gunzip cirros-0.3.0-x86_64-rootfs.img.gz
# mkdir /tmp/cirros
# mount /tmp/cirros-0.3.0-x86_64-rootfs.img /tmp/cirros

# cp -pr /tmp/cirros/* /tmp/stage
# umount /tmp/cirros
# sync
# umount /tmp/stage

Detach the volume once you are done.

 Creating a Bootable Volume from an Image

Cinder has the ability to create a bootable volume from an image stored in Glance.

# cinder create --image-id <image_id> --display-name my-bootable-vol <size>  
      

This feature is also mirrored in Nova:

# nova volume-create --image-id <image_id> --display-name my-bootable-vol <size>
      

[Note]Note

As of Grizzly, the following block storage drivers are compatible: iSCSI-based, LVM, and Ceph.

Make sure you configure Cinder with the relevant Glance options:

Table 8.1. List of configuration flags for NFS
Flag Name Type Default Description

glance_host

Optional

$my_ip

(StrOpt) default glance hostname or ip

glance_port

Optional

9292

(IntOpt) default glance port

glance_api_servers

Optional

$glance_host:$glance_port

(ListOpt) A list of the glance api servers available to cinder: ([hostname|ip]:port) (list value)

glance_api_version

Optional

1

(IntOpt) default version of the glance api to use

glance_num_retries

Optional

0

(IntOpt) Number retries when downloading an image from glance

glance_api_insecure

Optional

false

(BoolOpt) Allow to perform insecure SSL (https) requests to glance

 Booting an instance from the volume

To boot a new instance from the volume, use the nova boot command with the --block_device_mapping flag. The output for nova help boot shows the following documentation about this flag:

 --block_device_mapping <dev_name=mapping>
                        Block device mapping in the format <dev_name>=<id>:<type>:<size(GB)>:<delete_on_terminate>.
 

The command arguments are:

dev_name

A device name where the volume will be attached in the system at /dev/dev_name. This value is typically vda.

id

The ID of the volume to boot from, as shown in the output of nova volume-list.

type

This is either snap, which means that the volume was created from a snapshot, or anything other than snap (a blank string is valid). In the example above, the volume was not created from a snapshot, so we will leave this field blank in our example below.

size (GB)

The size of the volume, in GB. It is safe to leave this blank and have the Compute service infer the size.

delete_on_terminate

A boolean to indicate whether the volume should be deleted when the instance is terminated. True can be specified as True or 1. False can be specified as False or 0.

[Note]Note

Because of bug #1163566, you must specify an image when booting from a volume in Horizon, even though this image will not be used.

The following example will attempt boot from volume on the command line with ID=13, it will not delete on terminate. Replace the --key_name with a valid keypair name:

$ nova boot --flavor 2 --key_name mykey --block_device_mapping vda=13:::0 boot-from-vol-test
Log a bug against this page


loading table of contents...