← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1643684] [NEW] _check_requested_image uses incorrect bdm info to validate target volume when booting from boot from volume instance snapshot image

 

Public bug reported:

This is a complicated one.

Start with a boot from volume instance. Instance uses a 1G volume, and a
tiny image. Make a snapshot of this, which results in a volume snapshot
plus a image in glance. Image details:

# openstack image show a9a2a4af-0383-47a0-85e6-c3211f11459e
+------------------+-----------------------------------------------------------+
| Field            | Value                                                     |
+------------------+-----------------------------------------------------------+
| checksum         | d41d8cd98f00b204e9800998ecf8427e                          |
| container_format | bare                                                      |
| created_at       | 2016-11-21T18:13:23Z                                      |
| disk_format      | qcow2                                                     |
| file             | /v2/images/a9a2a4af-0383-47a0-85e6-c3211f11459e/file      |
| id               | a9a2a4af-0383-47a0-85e6-c3211f11459e                      |
| min_disk         | 10                                                        |
| min_ram          | 0                                                         |
| name             | testsnap                                                  |
| owner            | 6fe9193745c64a44ab30d6bd1c5cb8bb                          |
| properties       | base_image_ref='', bdm_v2='True',                         |
|                  | block_device_mapping='[{"guest_format": null,             |
|                  | "boot_index": 0, "delete_on_termination": false,          |
|                  | "no_device": null, "snapshot_id": "5186f403-bf91-49d4     |
|                  | -b3db-c273e087fcfa", "device_name": "/dev/vda",           |
|                  | "disk_bus": "virtio", "image_id": null, "source_type":    |
|                  | "snapshot", "tag": null, "device_type": "disk",           |
|                  | "volume_id": null, "destination_type": "volume",          |
|                  | "volume_size": 1}]', owner_specified.shade.md5='133eae9fb |
|                  | 1c98f45894a4e60d8736619',                                 |
|                  | owner_specified.shade.object='images/cirros', owner_speci |
|                  | fied.shade.sha256='f11286e2bd317ee1a1d0469a6b182b33bda4af |
|                  | 6f35ba224ca49d75752c81e20a', root_device_name='/dev/vda'  |
| protected        | False                                                     |
| schema           | /v2/schemas/image                                         |
| size             | 0                                                         |
| status           | active                                                    |
| tags             |                                                           |
| updated_at       | 2016-11-21T18:13:24Z                                      |
| virtual_size     | None                                                      |
| visibility       | private                                                   |
+------------------+-----------------------------------------------------------+

First, try booting just using the image:

# openstack server create --image a9a2a4af-0383-47a0-85e6-c3211f11459e --flavor 2 --nic net-id=832c3099-a589-4f05-8f70-c5af5b2f852b lolwhut
Volume is smaller than the minimum size specified in image metadata. Volume size is 1073741824 bytes, minimum size is 10737418240 bytes. (HTTP 400) (Request-ID: req-97cc0a55-7d5b-4e14-8f4b-e8a501f96f11)

Nova is saying that the minimum size is 10G, but the requested bdm size
is 1. I'm assuming that's coming from the instance data's
block_device_mapping key, which has volume_size of 1.

Now, try doing this where you're also requesting to boot from volume, of
size 15 (this was done via horizon):

2016-11-21 19:50:28.398 12516 DEBUG nova.api.openstack.wsgi [req-
4481446f-e026-4e83-b07a-1acdfa08194f 4921001dd4944f1396f7e6d64717f044
6fe9193745c64a44ab30d6bd1c5cb8bb - default default] Action: 'create',
calling method: <bound method ServersController.create of
<nova.api.openstack.compute.servers.ServersController object at
0x7fed5204cd50>>, body: {"server": {"name": "jlkwhat", "imageRef": "",
"availability_zone": "ci", "key_name": "turtle-key", "flavorRef": "2",
"OS-DCF:diskConfig": "AUTO", "max_count": 1, "block_device_mapping_v2":
[{"boot_index": "0", "uuid": "a9a2a4af-0383-47a0-85e6-c3211f11459e",
"volume_size": 15, "device_name": "vda", "source_type": "image",
"destination_type": "volume", "delete_on_termination": false}],
"min_count": 1, "networks": [{"uuid":
"832c3099-a589-4f05-8f70-c5af5b2f852b"}], "security_groups": [{"name":
"f8cb8d50-698a-48b0-9a83-1201e89834e0"}]}} _process_stack
/opt/bbc/openstack-2016.2-newton/nova/local/lib/python2.7/site-
packages/nova/api/openstack/wsgi.py:633


See that it has a source_type of image, and a destination_type of volume, and block_device_mapping_v2 shows volume_size of 15 (but references that image UUID from above).

Nova STILL spits out the same warning:

2016-11-21 19:50:29.004 12516 DEBUG nova.api.openstack.wsgi [req-
4481446f-e026-4e83-b07a-1acdfa08194f 4921001dd4944f1396f7e6d64717f044
6fe9193745c64a44ab30d6bd1c5cb8bb - default default] Returning 400 to
user: Volume is smaller than the minimum size specified in image
metadata. Volume size is 1073741824 bytes, minimum size is 10737418240
bytes. __call__
/opt/bbc/openstack-2016.2-newton/nova/local/lib/python2.7/site-
packages/nova/api/openstack/wsgi.py:1044

It would appear that even though I'm asking nova to create and boot from
a 15 gig volume, the internal check for validity of the target is using
the info it gleans from the image's own block_device_mapping, not the
boot request's block_device_mapping(_v2).

This is all done on a stable/newton install, from commit
867661d51bdb0cf2a6f326cb18f26bbc1f04eb15

** Affects: nova
     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/1643684

Title:
  _check_requested_image uses incorrect bdm info to validate target
  volume when booting from boot from volume instance snapshot image

Status in OpenStack Compute (nova):
  New

Bug description:
  This is a complicated one.

  Start with a boot from volume instance. Instance uses a 1G volume, and
  a tiny image. Make a snapshot of this, which results in a volume
  snapshot plus a image in glance. Image details:

  # openstack image show a9a2a4af-0383-47a0-85e6-c3211f11459e
  +------------------+-----------------------------------------------------------+
  | Field            | Value                                                     |
  +------------------+-----------------------------------------------------------+
  | checksum         | d41d8cd98f00b204e9800998ecf8427e                          |
  | container_format | bare                                                      |
  | created_at       | 2016-11-21T18:13:23Z                                      |
  | disk_format      | qcow2                                                     |
  | file             | /v2/images/a9a2a4af-0383-47a0-85e6-c3211f11459e/file      |
  | id               | a9a2a4af-0383-47a0-85e6-c3211f11459e                      |
  | min_disk         | 10                                                        |
  | min_ram          | 0                                                         |
  | name             | testsnap                                                  |
  | owner            | 6fe9193745c64a44ab30d6bd1c5cb8bb                          |
  | properties       | base_image_ref='', bdm_v2='True',                         |
  |                  | block_device_mapping='[{"guest_format": null,             |
  |                  | "boot_index": 0, "delete_on_termination": false,          |
  |                  | "no_device": null, "snapshot_id": "5186f403-bf91-49d4     |
  |                  | -b3db-c273e087fcfa", "device_name": "/dev/vda",           |
  |                  | "disk_bus": "virtio", "image_id": null, "source_type":    |
  |                  | "snapshot", "tag": null, "device_type": "disk",           |
  |                  | "volume_id": null, "destination_type": "volume",          |
  |                  | "volume_size": 1}]', owner_specified.shade.md5='133eae9fb |
  |                  | 1c98f45894a4e60d8736619',                                 |
  |                  | owner_specified.shade.object='images/cirros', owner_speci |
  |                  | fied.shade.sha256='f11286e2bd317ee1a1d0469a6b182b33bda4af |
  |                  | 6f35ba224ca49d75752c81e20a', root_device_name='/dev/vda'  |
  | protected        | False                                                     |
  | schema           | /v2/schemas/image                                         |
  | size             | 0                                                         |
  | status           | active                                                    |
  | tags             |                                                           |
  | updated_at       | 2016-11-21T18:13:24Z                                      |
  | virtual_size     | None                                                      |
  | visibility       | private                                                   |
  +------------------+-----------------------------------------------------------+

  First, try booting just using the image:

  # openstack server create --image a9a2a4af-0383-47a0-85e6-c3211f11459e --flavor 2 --nic net-id=832c3099-a589-4f05-8f70-c5af5b2f852b lolwhut
  Volume is smaller than the minimum size specified in image metadata. Volume size is 1073741824 bytes, minimum size is 10737418240 bytes. (HTTP 400) (Request-ID: req-97cc0a55-7d5b-4e14-8f4b-e8a501f96f11)

  Nova is saying that the minimum size is 10G, but the requested bdm
  size is 1. I'm assuming that's coming from the instance data's
  block_device_mapping key, which has volume_size of 1.

  Now, try doing this where you're also requesting to boot from volume,
  of size 15 (this was done via horizon):

  2016-11-21 19:50:28.398 12516 DEBUG nova.api.openstack.wsgi [req-
  4481446f-e026-4e83-b07a-1acdfa08194f 4921001dd4944f1396f7e6d64717f044
  6fe9193745c64a44ab30d6bd1c5cb8bb - default default] Action: 'create',
  calling method: <bound method ServersController.create of
  <nova.api.openstack.compute.servers.ServersController object at
  0x7fed5204cd50>>, body: {"server": {"name": "jlkwhat", "imageRef": "",
  "availability_zone": "ci", "key_name": "turtle-key", "flavorRef": "2",
  "OS-DCF:diskConfig": "AUTO", "max_count": 1,
  "block_device_mapping_v2": [{"boot_index": "0", "uuid":
  "a9a2a4af-0383-47a0-85e6-c3211f11459e", "volume_size": 15,
  "device_name": "vda", "source_type": "image", "destination_type":
  "volume", "delete_on_termination": false}], "min_count": 1,
  "networks": [{"uuid": "832c3099-a589-4f05-8f70-c5af5b2f852b"}],
  "security_groups": [{"name": "f8cb8d50-698a-
  48b0-9a83-1201e89834e0"}]}} _process_stack
  /opt/bbc/openstack-2016.2-newton/nova/local/lib/python2.7/site-
  packages/nova/api/openstack/wsgi.py:633

  
  See that it has a source_type of image, and a destination_type of volume, and block_device_mapping_v2 shows volume_size of 15 (but references that image UUID from above).

  Nova STILL spits out the same warning:

  2016-11-21 19:50:29.004 12516 DEBUG nova.api.openstack.wsgi [req-
  4481446f-e026-4e83-b07a-1acdfa08194f 4921001dd4944f1396f7e6d64717f044
  6fe9193745c64a44ab30d6bd1c5cb8bb - default default] Returning 400 to
  user: Volume is smaller than the minimum size specified in image
  metadata. Volume size is 1073741824 bytes, minimum size is 10737418240
  bytes. __call__
  /opt/bbc/openstack-2016.2-newton/nova/local/lib/python2.7/site-
  packages/nova/api/openstack/wsgi.py:1044

  It would appear that even though I'm asking nova to create and boot
  from a 15 gig volume, the internal check for validity of the target is
  using the info it gleans from the image's own block_device_mapping,
  not the boot request's block_device_mapping(_v2).

  This is all done on a stable/newton install, from commit
  867661d51bdb0cf2a6f326cb18f26bbc1f04eb15

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


Follow ups