How to launch an instance from a DreamCompute volume

If you have multiple images or volumes with the same name, you will need to use IDs instead of names in the commands below.

Some of the examples below contain a back slash character at the end of each line. This back slash continues the command on the next line. If you like, you can remove this character and put the entire command on a single line.

You can boot instances from a volume instead of an image. There are several different configurations for working with instances and volumes, so please select the configuration you wish to use:

Boot instance from image and attach non-bootable volume

Create a non-bootable volume and attach that volume to an instance that you boot from an image.

To create a non-bootable volume, do not create it from an image. The volume must be entirely empty with no partition table and no file system.

  1. Create a non-bootable volume.
    [user@localhost]$ openstack volume create --size 8 my-volume
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | attachments         | []                                   |
    | availability_zone   | iad-2                                |
    | bootable            | false                                |
    | consistencygroup_id | None                                 |
    | created_at          | 2017-11-28T12:30:34.210721           |
    | description         | None                                 |
    | encrypted           | False                                |
    | id                  | d620d971-b160-4c4e-8652-2513d74e2080 |
    | multiattach         | False                                |
    | name                | my-volume                            |
    | properties          |                                      |
    | replication_status  | disabled                             |
    | size                | 8                                    |
    | snapshot_id         | None                                 |
    | source_volid        | None                                 |
    | status              | creating                             |
    | type                | None                                 |
    | updated_at          | None                                 |
    | user_id             | fef060ae7bfd4024b3edb97dff59017a     |
    +---------------------+--------------------------------------+
    
  2. Boot an instance from an image and attach the empty volume to that instance.
    [user@localhost]$ openstack server create --image Ubuntu-14.04 --flavor gp1.subsonic \
                      --key-name KEYNAME --nic net-id=e098d02f-bb35-4085-ae12-664aad3d9c52 \
                      --block-device-mapping vdb=d620d971-b160-4c4e-8652-2513d74e2080:false \
                      myInstanceWithVolume
    
    +--------------------------------------+-------------------------------------------+
    | Field                                | Value                                     |
    +--------------------------------------+-------------------------------------------+
    | OS-DCF:diskConfig                    | MANUAL                                    |
    | OS-EXT-AZ:availability_zone          | iad-2                                     |
    | OS-EXT-STS:power_state               | 0                                         |
    | OS-EXT-STS:task_state                | scheduling                                |
    | OS-EXT-STS:vm_state                  | building                                  |
    | OS-SRV-USG:launched_at               | None                                      |
    | OS-SRV-USG:terminated_at             | None                                      |
    | accessIPv4                           |                                           |
    | accessIPv6                           |                                           |
    | addresses                            |                                           |
    | adminPass                            | ZaiYeC8iucgU                              |
    | config_drive                         |                                           |
    | created                              | 2017-11-28T12:44:15Z                      |
    | flavor                               | gp1.subsonic (100)                        |
    | hostId                               |                                           |
    | id                                   | 1e1797f3-1662-49ff-ae8c-a77e82ee1571      |
    | image                                | Ubuntu-14.04 (c02561c3-7861-4cf3-95d4-... |
    | key_name                             | KEYNAME                                   |
    | name                                 | myInstanceWithVolume                      |
    | os-extended-volumes:volumes_attached | [{u'id': u'd620d971-b160-4c4e-8652-d7...  |
    | progress                             | 0                                         |
    | project_id                           | ccef9e62b1e645df98728fb2b3076f27          |
    | properties                           |                                           |
    | security_groups                      | [{u'name': u'default'}]                   |
    | status                               | BUILD                                     |
    | updated                              | 2017-11-28T12:44:15Z                      |
    | user_id                              | fef060ae7bfd4024b3edb97dff59017a          |
    +--------------------------------------+-------------------------------------------+
    

Create volume from image and boot instance

You can create a volume from an existing image, volume, or snapshot. This procedure shows you how to create a volume from an image, and use the volume to boot an instance.

  1. List the available images.
    [user@localhost]$ openstack image list
    +-----------------+---------------------------------+--------+
    | ID              | Name                            | Status |
    +-----------------+---------------------------------+--------+
    | 484e05af-a14... | Fedora-x86_64-20-20131211.1-sda | ACTIVE |
    | 98901246-af9... | cirros-0.3.1-x86_64-uec         | ACTIVE |
    | b6e95589-7eb... | cirros-0.3.1-x86_64-uec-kernel  | ACTIVE |
    | c90893ea-e73... | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE |
    +-----------------+---------------------------------+--------+
    
  2. Create a bootable volume from the image of your choice.
    [user@localhost]$ openstack volume create --image Ubuntu-14.04 \
                      --size 6 --bootable my-volume
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | attachments         | []                                   |
    | availability_zone   | iad-2                                |
    | bootable            | false                                |
    | consistencygroup_id | None                                 |
    | created_at          | 2017-11-29T08:51:57.849585           |
    | description         | None                                 |
    | encrypted           | False                                |
    | id                  | bf291606-b86e-48ac...                |
    | multiattach         | False                                |
    | name                | my-volume                            |
    | properties          |                                      |
    | replication_status  | disabled                             |
    | size                | 6                                    |
    | snapshot_id         | None                                 |
    | source_volid        | None                                 |
    | status              | creating                             |
    | type                | None                                 |
    | updated_at          | None                                 |
    | user_id             | fef060ae7bfd4024b3edb97dff59017a     |
    +---------------------+--------------------------------------+
    
  3. Now that you've created the volume, you can launch an instance with that volume as the boot source.

    [user@localhost]$ openstack server create myVolumeInstance \
                      --volume my-volume --flavor gp1.subsonic --key-name KEYNAME \
                      --nic net-id=e098d02f-bb35-4085-ae12-664aad3d9c52 
    +-----------------------------+-------------------------------------------+
    | Field                       | Value                                     |
    +-----------------------------+-------------------------------------------+
    | OS-DCF:diskConfig           | MANUAL                                    |
    | OS-EXT-AZ:availability_zone | iad-2                                     |
    | OS-EXT-STS:power_state      | NOSTATE                                   |
    | OS-EXT-STS:task_state       | scheduling                                |
    | OS-EXT-STS:vm_state         | building                                  |
    | OS-SRV-USG:launched_at      | None                                      |
    | OS-SRV-USG:terminated_at    | None                                      |
    | accessIPv4                  |                                           |
    | accessIPv6                  |                                           |
    | addresses                   |                                           |
    | adminPass                   | ZaiYeC8iucgU                              |
    | config_drive                |                                           |
    | created                     | 2017-11-29T08:58:22Z                      |
    | flavor                      | gp1.subsonic (100)                        |
    | hostId                      |                                           |
    | id                          | 3d495c5d-041d-43bc...                     |
    | image                       |                                           |
    | key_name                    | KEYNAME                                   |
    | name                        | myVolumeInstance                          |
    | progress                    | 0                                         |
    | project_id                  | ccef9e62b1e645df98728fb2b3076f27          |
    | properties                  |                                           |
    | security_groups             | name='default'                            |
    | status                      | BUILD                                     |
    | updated                     | 2017-11-29T08:58:23Z                      |
    | user_id                     | fef060ae7bfd4024b3edb97dff59017a          |
    | volumes_attached            | id='bf291606-b86e-48ac-8819-7e...'        |
    +-----------------------------+-------------------------------------------+
    

Boot instance from existing volume

If you have an existing volume that is bootable, you can use it as the boot source of a new instance.

  1. Use the following command to see the list of unattached volumes in your project.
    [user@localhost]$ openstack volume list --long --status available
    +-----------------------+--------------+-----------+------+------+----------+-------------+--------------------------------------+
    | ID                    | Display Name | Status    | Size | Type | Bootable | Attached to | Properties                           |
    +-----------------------+--------------+-----------+------+------+----------+-------------+--------------------------------------+
    | bf291606-b86e-48ac... | my-volume    | available |    8 | None | true     |             | readonly='False'                     |
    +-----------------------+--------------+-----------+------+------+----------+-------------+--------------------------------------+
    
  2. Create an instance using one of the unattached, bootable volumes from the list above as the boot source.
    [user@localhost]$ openstack server create myVolumeInstance \
                      --volume my-volume --flavor gp1.subsonic --key-name KEYNAME \
                      --nic net-id=e098d02f-bb35-4085-ae12-664aad3d9c52
    +-----------------------------+-------------------------------------------+
    | Field                       | Value                                     |
    +-----------------------------+-------------------------------------------+
    | OS-DCF:diskConfig           | MANUAL                                    |
    | OS-EXT-AZ:availability_zone | iad-2                                     |
    | OS-EXT-STS:power_state      | NOSTATE                                   |
    | OS-EXT-STS:task_state       | scheduling                                |
    | OS-EXT-STS:vm_state         | building                                  |
    | OS-SRV-USG:launched_at      | None                                      |
    | OS-SRV-USG:terminated_at    | None                                      |
    | accessIPv4                  |                                           |
    | accessIPv6                  |                                           |
    | addresses                   |                                           |
    | adminPass                   | ZaiYeC8iucgU                              |
    | config_drive                |                                           |
    | created                     | 2017-11-29T08:58:22Z                      |
    | flavor                      | gp1.subsonic (100)                        |
    | hostId                      |                                           |
    | id                          | 3d495c5d-041d-43bc...                     |
    | image                       |                                           |
    | key_name                    | KEYNAME                                   |
    | name                        | myVolumeInstance                          |
    | progress                    | 0                                         |
    | project_id                  | ccef9e62b1e645df98728fb2b3076f27          |
    | properties                  |                                           |
    | security_groups             | name='default'                            |
    | status                      | BUILD                                     |
    | updated                     | 2017-11-29T08:58:23Z                      |
    | user_id                     | fef060ae7bfd4024b3edb97dff59017a          |
    | volumes_attached            | id='bf291606-b86e-48ac-8819-7e...'        |
    +-----------------------------+-------------------------------------------+
    

Did this article answer your questions?

Article last updated .