← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1369854] [NEW] min_disk and size information wrong when creating an instance image

 

Public bug reported:

If I launch an instance from an image that has min_disk set to 2GB, then
create an image from the instance, the min_disk attribute is not set
correctly on the image (it's set to 0). Instead of being set as an
attribute, it exists as a property instead. This can cause issues when
other services rely on min_disk to make decisions about size (e.g. bug
1368600 for Horizon, not sure if Cinder is affected too).

This doesn't seem to happen when creating a basic instance from an
instance, only when there is also a volume involved.

I'm not sure if this is a nova or glance issue so I'm opening a task on
both for now.

Steps to reproduce
------------------------
(done on a recent devstack)

1. Create a new image with e.g. min_disk 2GB
$ glance image-create --name mindisk2gb --disk-format qcow2 --container-format bare --location https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-i386-disk.img --min-disk 2
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | None                                 |
| container_format | bare                                 |
| created_at       | 2014-09-16T12:35:33                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 9bbed3a5-00bf-4901-855e-556ca02e7fb7 |
| is_public        | False                                |
| min_disk         | 2                                    |      <-- min_disk set as expected
| min_ram          | 0                                    |
| name             | mindisk2gb                           |
| owner            | eb6acc49df4b4390a99c722ded526284     |
| protected        | False                                |
| size             | 9159168                              |      <-- size looks ok
| status           | active                               |
| updated_at       | 2014-09-16T12:35:37                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

2. Boot an instance from this image, backed by a volume (I believe this matches what happens when launching with "Image (creates a new volume)" in Horizon)
$ nova boot --flavor 4115a835-04f0-4457-b93c-1817bc44812c --block-device device='/dev/vda',source='image',dest='volume',id='9bbed3a5-00bf-4901-855e-556ca02e7fb7',size=2,bootindex=0 my_instance 
+--------------------------------------+--------------------------------------------------+
| Property                             | Value                                            |
+--------------------------------------+--------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                           |
| OS-EXT-AZ:availability_zone          | nova                                             |
| OS-EXT-STS:power_state               | 0                                                |
| OS-EXT-STS:task_state                | -                                                |
| OS-EXT-STS:vm_state                  | building                                         |
| OS-SRV-USG:launched_at               | -                                                |
| OS-SRV-USG:terminated_at             | -                                                |
| accessIPv4                           |                                                  |
| accessIPv6                           |                                                  |
| adminPass                            | Uo2DL64GaY74                                     |
| config_drive                         |                                                  |
| created                              | 2014-09-16T12:55:30Z                             |
| flavor                               | m1.lowmem (4115a835-04f0-4457-b93c-1817bc44812c) |
| hostId                               |                                                  |
| id                                   | 3e70fd2e-1dc6-4001-941e-9496a9514882             |
| image                                | Attempt to boot from volume - no image supplied  |
| key_name                             | -                                                |
| metadata                             | {}                                               |
| name                                 | my_instance                                      |
| os-extended-volumes:volumes_attached | []                                               |
| progress                             | 0                                                |
| security_groups                      | default                                          |
| status                               | BUILD                                            |
| tenant_id                            | eb6acc49df4b4390a99c722ded526284                 |
| updated                              | 2014-09-16T12:55:31Z                             |
| user_id                              | 437279436240498faca4f7bfd0fdc78a                 |
+--------------------------------------+--------------------------------------------------+

3. Create a snapshot 
$ nova image-create 3e70fd2e-1dc6-4001-941e-9496a9514882 my_instance_snap

4. Find the snapshot in glance image-list and look at the details:
$ glance image-show d44f7368-5b91-4291-b1f4-e9386fbbbe93
+---------------------------------+----------------------------------------------------------------------------------+
| Property                        | Value                                                                            |
+---------------------------------+----------------------------------------------------------------------------------+
| Property 'bdm_v2'               | True                                                                             |
| Property 'block_device_mapping' | [{"guest_format": null, "boot_index": 0, "no_device": null, "snapshot_id":       |
|                                 | "bce8f300-e21f-47c9-a015-3dfee2f35745", "delete_on_termination": null,           |
|                                 | "disk_bus": "virtio", "image_id": null, "source_type": "snapshot",               |
|                                 | "device_type": "disk", "volume_id": null, "destination_type": "volume",          |
|                                 | "volume_size": null}]                                                            |
| Property 'container_format'     | bare                                                                             |
| Property 'disk_format'          | qcow2                                                                            |
| Property 'image_id'             | 9bbed3a5-00bf-4901-855e-556ca02e7fb7                                             |
| Property 'image_name'           | mindisk2gb                                                                       |
| Property 'min_disk'             | 2                                                                                |      <-- min_disk is set as a property
| Property 'min_ram'              | 0                                                                                |
| Property 'root_device_name'     | /dev/vda                                                                         |
| Property 'size'                 | 9159168                                                                          |      <-- the size appears correct in the properties
| created_at                      | 2014-09-16T12:57:25                                                              |
| deleted                         | False                                                                            |
| id                              | d44f7368-5b91-4291-b1f4-e9386fbbbe93                                             |
| is_public                       | False                                                                            |
| min_disk                        | 0                                                                                |       <-- min_disk is 0
| min_ram                         | 0                                                                                |
| name                            | my_instance_snap                                                                 |
| owner                           | eb6acc49df4b4390a99c722ded526284                                                 |
| protected                       | False                                                                            |
| size                            | 0                                                                                |      <-- size is set to 0 too
| status                          | active                                                                           |
| updated_at                      | 2014-09-16T12:57:25                                                              |
+---------------------------------+----------------------------------------------------------------------------------+

Chatting with someone on the Glance team this doesn't seem to be the
expected behaviour? I would expect the size and min_disk attribute to be
correct and similar to the properties, in this case.

** Affects: glance
     Importance: Undecided
         Status: New

** Affects: nova
     Importance: Undecided
         Status: New

** Also affects: glance
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1369854

Title:
  min_disk and size information wrong when creating an instance image

Status in OpenStack Image Registry and Delivery Service (Glance):
  New
Status in OpenStack Compute (Nova):
  New

Bug description:
  If I launch an instance from an image that has min_disk set to 2GB,
  then create an image from the instance, the min_disk attribute is not
  set correctly on the image (it's set to 0). Instead of being set as an
  attribute, it exists as a property instead. This can cause issues when
  other services rely on min_disk to make decisions about size (e.g. bug
  1368600 for Horizon, not sure if Cinder is affected too).

  This doesn't seem to happen when creating a basic instance from an
  instance, only when there is also a volume involved.

  I'm not sure if this is a nova or glance issue so I'm opening a task
  on both for now.

  Steps to reproduce
  ------------------------
  (done on a recent devstack)

  1. Create a new image with e.g. min_disk 2GB
  $ glance image-create --name mindisk2gb --disk-format qcow2 --container-format bare --location https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-i386-disk.img --min-disk 2
  +------------------+--------------------------------------+
  | Property         | Value                                |
  +------------------+--------------------------------------+
  | checksum         | None                                 |
  | container_format | bare                                 |
  | created_at       | 2014-09-16T12:35:33                  |
  | deleted          | False                                |
  | deleted_at       | None                                 |
  | disk_format      | qcow2                                |
  | id               | 9bbed3a5-00bf-4901-855e-556ca02e7fb7 |
  | is_public        | False                                |
  | min_disk         | 2                                    |      <-- min_disk set as expected
  | min_ram          | 0                                    |
  | name             | mindisk2gb                           |
  | owner            | eb6acc49df4b4390a99c722ded526284     |
  | protected        | False                                |
  | size             | 9159168                              |      <-- size looks ok
  | status           | active                               |
  | updated_at       | 2014-09-16T12:35:37                  |
  | virtual_size     | None                                 |
  +------------------+--------------------------------------+

  2. Boot an instance from this image, backed by a volume (I believe this matches what happens when launching with "Image (creates a new volume)" in Horizon)
  $ nova boot --flavor 4115a835-04f0-4457-b93c-1817bc44812c --block-device device='/dev/vda',source='image',dest='volume',id='9bbed3a5-00bf-4901-855e-556ca02e7fb7',size=2,bootindex=0 my_instance 
  +--------------------------------------+--------------------------------------------------+
  | Property                             | Value                                            |
  +--------------------------------------+--------------------------------------------------+
  | OS-DCF:diskConfig                    | MANUAL                                           |
  | OS-EXT-AZ:availability_zone          | nova                                             |
  | OS-EXT-STS:power_state               | 0                                                |
  | OS-EXT-STS:task_state                | -                                                |
  | OS-EXT-STS:vm_state                  | building                                         |
  | OS-SRV-USG:launched_at               | -                                                |
  | OS-SRV-USG:terminated_at             | -                                                |
  | accessIPv4                           |                                                  |
  | accessIPv6                           |                                                  |
  | adminPass                            | Uo2DL64GaY74                                     |
  | config_drive                         |                                                  |
  | created                              | 2014-09-16T12:55:30Z                             |
  | flavor                               | m1.lowmem (4115a835-04f0-4457-b93c-1817bc44812c) |
  | hostId                               |                                                  |
  | id                                   | 3e70fd2e-1dc6-4001-941e-9496a9514882             |
  | image                                | Attempt to boot from volume - no image supplied  |
  | key_name                             | -                                                |
  | metadata                             | {}                                               |
  | name                                 | my_instance                                      |
  | os-extended-volumes:volumes_attached | []                                               |
  | progress                             | 0                                                |
  | security_groups                      | default                                          |
  | status                               | BUILD                                            |
  | tenant_id                            | eb6acc49df4b4390a99c722ded526284                 |
  | updated                              | 2014-09-16T12:55:31Z                             |
  | user_id                              | 437279436240498faca4f7bfd0fdc78a                 |
  +--------------------------------------+--------------------------------------------------+

  3. Create a snapshot 
  $ nova image-create 3e70fd2e-1dc6-4001-941e-9496a9514882 my_instance_snap

  4. Find the snapshot in glance image-list and look at the details:
  $ glance image-show d44f7368-5b91-4291-b1f4-e9386fbbbe93
  +---------------------------------+----------------------------------------------------------------------------------+
  | Property                        | Value                                                                            |
  +---------------------------------+----------------------------------------------------------------------------------+
  | Property 'bdm_v2'               | True                                                                             |
  | Property 'block_device_mapping' | [{"guest_format": null, "boot_index": 0, "no_device": null, "snapshot_id":       |
  |                                 | "bce8f300-e21f-47c9-a015-3dfee2f35745", "delete_on_termination": null,           |
  |                                 | "disk_bus": "virtio", "image_id": null, "source_type": "snapshot",               |
  |                                 | "device_type": "disk", "volume_id": null, "destination_type": "volume",          |
  |                                 | "volume_size": null}]                                                            |
  | Property 'container_format'     | bare                                                                             |
  | Property 'disk_format'          | qcow2                                                                            |
  | Property 'image_id'             | 9bbed3a5-00bf-4901-855e-556ca02e7fb7                                             |
  | Property 'image_name'           | mindisk2gb                                                                       |
  | Property 'min_disk'             | 2                                                                                |      <-- min_disk is set as a property
  | Property 'min_ram'              | 0                                                                                |
  | Property 'root_device_name'     | /dev/vda                                                                         |
  | Property 'size'                 | 9159168                                                                          |      <-- the size appears correct in the properties
  | created_at                      | 2014-09-16T12:57:25                                                              |
  | deleted                         | False                                                                            |
  | id                              | d44f7368-5b91-4291-b1f4-e9386fbbbe93                                             |
  | is_public                       | False                                                                            |
  | min_disk                        | 0                                                                                |       <-- min_disk is 0
  | min_ram                         | 0                                                                                |
  | name                            | my_instance_snap                                                                 |
  | owner                           | eb6acc49df4b4390a99c722ded526284                                                 |
  | protected                       | False                                                                            |
  | size                            | 0                                                                                |      <-- size is set to 0 too
  | status                          | active                                                                           |
  | updated_at                      | 2014-09-16T12:57:25                                                              |
  +---------------------------------+----------------------------------------------------------------------------------+

  Chatting with someone on the Glance team this doesn't seem to be the
  expected behaviour? I would expect the size and min_disk attribute to
  be correct and similar to the properties, in this case.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1369854/+subscriptions


Follow ups

References