Use this procedure to create a volume from an image, and use it to boot an instance.
You can create a volume from an existing image, volume, or snapshot.
List available images:
$ nova image-list +--------------------------------------+---------------------------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------------------------------+--------+--------+ | e0b7734d-2331-42a3-b19e-067adc0da17d | cirros-0.3.2-x86_64-uec | ACTIVE | | | 75bf193b-237b-435e-8712-896c51484de9 | cirros-0.3.2-x86_64-uec-kernel | ACTIVE | | | 19eee81c-f972-44e1-a952-1dceee148c47 | cirros-0.3.2-x86_64-uec-ramdisk | ACTIVE | | +--------------------------------------+---------------------------------+--------+--------+
To create a bootable volume from an image and launch an instance from this volume, use the
--block-device
parameter.For example:
$ nova boot --flavor
FLAVOR
--block-device source=SOURCE
,id=ID
,dest=DEST
,size=SIZE
,shutdown=PRESERVE
,bootindex=INDEX
NAME
The parameters are:
Parameter Description --flavor
FLAVOR
The flavor ID or name.
--block-device
source=SOURCE
,id=ID
,dest=DEST
,size=SIZE
,shutdown=PRESERVE
,bootindex=INDEX
SOURCE
: The type of object used to create the block device. Valid values arevolume
,snapshot
,image
andblank
.ID
: The ID of the source object.DEST
: The type of the target virtual device. Valid values arevolume
andlocal
.SIZE
: The size of the volume that will be created.PRESERVE
: What to do with the volume when the instance is terminated.preserve
will not delete the volume,remove
will.INDEX
: Used to order the boot disks. Use0
to boot from this volume.
NAME
The name for the server.
-
Create a bootable volume from an image, before the instance boots. The volume is not deleted when the instance is terminated:
$ nova boot --flavor 2 \ --block-device source=image,id=e0b7734d-2331-42a3-b19e-067adc0da17d,dest=volume,size=10,shutdown=preserve,bootindex=0 \ myInstanceFromVolume +--------------------------------------+-------------------------------------------------+ | Property | Value | +--------------------------------------+-------------------------------------------------+ | OS-EXT-STS:task_state | scheduling | | image | Attempt to boot from volume - no image supplied | | OS-EXT-STS:vm_state | building | | OS-EXT-SRV-ATTR:instance_name | instance-00000003 | | OS-SRV-USG:launched_at | None | | flavor | m1.small | | id | 2e65c854-dba9-4f68-8f08-fe332e546ecc | | security_groups | [{u'name': u'default'}] | | user_id | 352b37f5c89144d4ad0534139266d51f | | OS-DCF:diskConfig | MANUAL | | accessIPv4 | | | accessIPv6 | | | progress | 0 | | OS-EXT-STS:power_state | 0 | | OS-EXT-AZ:availability_zone | nova | | config_drive | | | status | BUILD | | updated | 2014-02-02T13:29:54Z | | hostId | | | OS-EXT-SRV-ATTR:host | None | | OS-SRV-USG:terminated_at | None | | key_name | None | | OS-EXT-SRV-ATTR:hypervisor_hostname | None | | name | myInstanceFromVolume | | adminPass | TzjqyGsRcJo9 | | tenant_id | f7ac731cc11f40efbc03a9f9e1d1d21f | | created | 2014-02-02T13:29:53Z | | os-extended-volumes:volumes_attached | [] | | metadata | {} | +--------------------------------------+-------------------------------------------------+
List volumes to see the bootable volume and its attached
myInstanceFromVolume
instance:$ cinder list +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+ | 2fff50ab-1a9c-4d45-ae60-1d054d6bc868 | in-use | | 10 | None | true | 2e65c854-dba9-4f68-8f08-fe332e546ecc | +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+