Deploying an image on OpenStack that is bigger than the available flavors.

Today I tried to use our local OpenStack instance to deploy CloudForms Management Engine (CFME). Our OpenStack deployment has a set of flavors that all are defined with 20 GB Disks. The CFME image is larger than this, and will not deploy on the set of flavors. Here is how I worked around it.

The idea is that, instead of booting a server on Nova using an image and a flavor, first create a bootable volume, and use that to launch the virtual machine.

The command line way to create an 80 GB volume would be:

openstack volume create --image cfme-rhevm-5.9.0.15-1 --size 80 bootable_volume

But as you will see later, I used ansible to create it instead.

Uploading the image (downloaded from the redhat.com portal)

openstack image create --file ~/Downloads/cfme-rhevm-5.9.0.15-1.x86_64.qcow2 cfme-rhevm-5.9.0.15-1

Which takes a little while. Once it is done:

$ openstack image show cfme-rhevm-5.9.0.15-1
+------------------+---------------------------------------------------------------------------------+
| Field            | Value                                                                           |
+------------------+---------------------------------------------------------------------------------+
| checksum         | 52c57210cb8dd2df26ff5279a5b0be06                                                |
| container_format | bare                                                                            |
| created_at       | 2018-01-30T21:09:20Z                                                            |
| disk_format      | raw                                                                             |
| file             | /v2/images/cfcca613-40d9-44c8-b12f-e0ddc93ab914/file                            |
| id               | cfcca613-40d9-44c8-b12f-e0ddc93ab914                                            |
| min_disk         | 0                                                                               |
| min_ram          | 0                                                                               |
| name             | cfme-rhevm-5.9.0.15-1                                                           |
| owner            | fc56aad6163c44dc8beb0c287a975ca3                                                |
| properties       | direct_url='file:///var/lib/glance/images/cfcca613-40d9-44c8-b12f-e0ddc93ab914' |
| protected        | False                                                                           |
| schema           | /v2/schemas/image                                                               |
| size             | 1072365568                                                                      |
| status           | active                                                                          |
| tags             |                                                                                 |
| updated_at       | 2018-01-30T21:35:30Z                                                            |
| virtual_size     | None                                                                            |
| visibility       | private                                                                         |
+------------------+---------------------------------------------------------------------------------+

I used Ansible to create the volume and the server. This is the fragment from my task.yaml file.


- name: create CFME volume
  os_volume:
    cloud: "{{ cloudname }}"
    image: cfme-rhevm-5.9.0.15-1
    size: 80
    display_name: cfme_volume
  register: cfme_volume

- name: create CFME server
  os_server:
    cloud: "{{ cloudname }}"
    state: present
    name: "cfme.{{ clustername }}"
    key_name: ayoung-pubkey
    timeout: 200
    flavor: 2
    boot_volume: "{{ cfme_volume.volume.id }}"
    security_groups:
      - "{{ securitygroupname }}"
    nics:
      -  net-id:  "{{ osnetwork.network.id }}"
         net-name: "{{ netname }}_network"
    meta:
      hostname: "{{ netname }}"
  register: cfme_server

The interesting part is the boot_volume: “{{ cfme_volume.volume.id }} line, which uses the value registered in the volume create step to get the id of the new volume.

2 thoughts on “Deploying an image on OpenStack that is bigger than the available flavors.

  1. How about:

    – name: create CFME server
    os_server:
    cloud: “{{ cloudname }}”
    state: present
    name: “cfme.{{ clustername }}”
    key_name: ayoung-pubkey
    timeout: 200
    flavor: 2
    boot_from_volume: true
    volume_size: 80
    image: cfme-rhevm-5.9.0.15-1
    security_groups:
    – “{{ securitygroupname }}”
    nics:
    – net-id: “{{ osnetwork.network.id }}”
    net-name: “{{ netname }}_network”
    meta:
    hostname: “{{ netname }}”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.