Public bug reported: I attempted to creat an instance using a boot-from-volume-like BDM but with `destination_type=local`, e.g.:
``` { "server": { "imageRef": "", "block_device_mapping_v2": [ { "uuid": "9acb21b3-0516-459a-9b0a-6357e66ff74a", "boot_index": 0, "source_type": "image", "destination_type": "local", "volume_size": 6 } ], // ... } } ``` (where '9acb21b3-0516-459a-9b0a-6357e66ff74a' is the UUID of an image in the deployment). This resulted in a successful response but the server later went into 'ERROR' state. This is because `imageRef` was unset, but that is the expected behaviour when using BFV. The following error can be seen. ``` Failed to build and run instance: nova.exception.ImageNotFound: Image could not be found. Traceback (most recent call last): File "/opt/stack/nova/nova/image/glance.py", line 391, in download image_chunks = self._client.call( File "/opt/stack/nova/nova/image/glance.py", line 191, in call result = getattr(controller, method)(*args, **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/utils.py", line 652, in inner return RequestIdProxy(wrapped(*args, **kwargs)) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/v2/images.py", line 249, in data resp, image_meta = self.http_client.get(url) File "/opt/stack/data/venv/lib/python3.10/site-packages/keystoneauth1/adapter.py", line 393, in get return self.request(url, 'GET', **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 376, in request return self._handle_response(resp) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 116, in _handle_response raise exc.from_response(resp, resp.content) glanceclient.exc.HTTPNotFound: HTTP 404 Not Found: The resource could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/stack/nova/nova/compute/manager.py", line 2641, in _build_and_run_instance self.driver.spawn(context, instance, image_meta, File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 4694, in spawn created_instance_dir, created_disks = self._create_image( File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5104, in _create_image created_disks = self._create_and_inject_local_root( File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5236, in _create_and_inject_local_root self._try_fetch_image_cache(backend, fetch_func, context, File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 11504, in _try_fetch_image_cache image.cache(fetch_func=fetch_func, File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 301, in cache self.create_image(fetch_func_sync, base, size, File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 676, in create_image prepare_template(target=base, *args, **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_concurrency/lockutils.py", line 412, in inner return f(*args, **kwargs) File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 298, in fetch_func_sync fetch_func(target=target, *args, **kwargs) File "/opt/stack/nova/nova/virt/libvirt/utils.py", line 487, in fetch_image images.fetch_to_raw(context, image_id, target, trusted_certs) File "/opt/stack/nova/nova/virt/images.py", line 187, in fetch_to_raw fetch(context, image_href, path_tmp, trusted_certs) File "/opt/stack/nova/nova/virt/images.py", line 109, in fetch IMAGE_API.download(context, image_href, dest_path=path, File "/opt/stack/nova/nova/image/glance.py", line 1304, in download return session.download(context, image_id, data=data, File "/opt/stack/nova/nova/image/glance.py", line 394, in download _reraise_translated_image_exception(image_id) File "/opt/stack/nova/nova/image/glance.py", line 1037, in _reraise_translated_image_exception raise new_exc.with_traceback(exc_trace) File "/opt/stack/nova/nova/image/glance.py", line 391, in download image_chunks = self._client.call( File "/opt/stack/nova/nova/image/glance.py", line 191, in call result = getattr(controller, method)(*args, **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/utils.py", line 652, in inner return RequestIdProxy(wrapped(*args, **kwargs)) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/v2/images.py", line 249, in data resp, image_meta = self.http_client.get(url) File "/opt/stack/data/venv/lib/python3.10/site-packages/keystoneauth1/adapter.py", line 393, in get return self.request(url, 'GET', **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 376, in request return self._handle_response(resp) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 116, in _handle_response raise exc.from_response(resp, resp.content) nova.exception.ImageNotFound: Image could not be found. ``` By comparison, if you attempt to create a BFV instance with `uuid` set to `''`, you get the following error: ``` openstack.exceptions.BadRequestException: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Invalid input for field/attribute uuid. Value: . '' is too short clean_up CreateServer: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Invalid input for field/attribute uuid. Value: . '' is too short ``` Likewise, if you attempt to create a "standard" instance from an image and omit the `imageRef` field, you get the following: ``` openstack.exceptions.BadRequestException: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Can not find requested image clean_up CreateServer: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Can not find requested image ``` Finally, if you attempt to create an instance using the "local" BFV and specify "imageRef", the BFV is ignored/overwritten. For example, given the following: ``` { "server": { "imageRef": "9acb21b3-0516-459a-9b0a-6357e66ff74a", "block_device_mapping_v2": [ { "uuid": "9acb21b3-0516-459a-9b0a-6357e66ff74a", "boot_index": 0, "source_type": "image", "destination_type": "local", "volume_size": 6 } ], "flavorRef": "1", // ... } } ``` where flavor "1" is the m1.tiny flavor, we end up with a 1GB disk in the flavor. This is probably expected, though arguably we should reject this in the future. ** Affects: nova Importance: Low Status: New ** Tags: api ** Changed in: nova Importance: Undecided => Low ** Tags added: api -- 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/2077980 Title: Creating a BFV instance with destination_type=local results in HTTP 500 Status in OpenStack Compute (nova): New Bug description: I attempted to creat an instance using a boot-from-volume-like BDM but with `destination_type=local`, e.g.: ``` { "server": { "imageRef": "", "block_device_mapping_v2": [ { "uuid": "9acb21b3-0516-459a-9b0a-6357e66ff74a", "boot_index": 0, "source_type": "image", "destination_type": "local", "volume_size": 6 } ], // ... } } ``` (where '9acb21b3-0516-459a-9b0a-6357e66ff74a' is the UUID of an image in the deployment). This resulted in a successful response but the server later went into 'ERROR' state. This is because `imageRef` was unset, but that is the expected behaviour when using BFV. The following error can be seen. ``` Failed to build and run instance: nova.exception.ImageNotFound: Image could not be found. Traceback (most recent call last): File "/opt/stack/nova/nova/image/glance.py", line 391, in download image_chunks = self._client.call( File "/opt/stack/nova/nova/image/glance.py", line 191, in call result = getattr(controller, method)(*args, **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/utils.py", line 652, in inner return RequestIdProxy(wrapped(*args, **kwargs)) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/v2/images.py", line 249, in data resp, image_meta = self.http_client.get(url) File "/opt/stack/data/venv/lib/python3.10/site-packages/keystoneauth1/adapter.py", line 393, in get return self.request(url, 'GET', **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 376, in request return self._handle_response(resp) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 116, in _handle_response raise exc.from_response(resp, resp.content) glanceclient.exc.HTTPNotFound: HTTP 404 Not Found: The resource could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/stack/nova/nova/compute/manager.py", line 2641, in _build_and_run_instance self.driver.spawn(context, instance, image_meta, File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 4694, in spawn created_instance_dir, created_disks = self._create_image( File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5104, in _create_image created_disks = self._create_and_inject_local_root( File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5236, in _create_and_inject_local_root self._try_fetch_image_cache(backend, fetch_func, context, File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 11504, in _try_fetch_image_cache image.cache(fetch_func=fetch_func, File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 301, in cache self.create_image(fetch_func_sync, base, size, File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 676, in create_image prepare_template(target=base, *args, **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_concurrency/lockutils.py", line 412, in inner return f(*args, **kwargs) File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 298, in fetch_func_sync fetch_func(target=target, *args, **kwargs) File "/opt/stack/nova/nova/virt/libvirt/utils.py", line 487, in fetch_image images.fetch_to_raw(context, image_id, target, trusted_certs) File "/opt/stack/nova/nova/virt/images.py", line 187, in fetch_to_raw fetch(context, image_href, path_tmp, trusted_certs) File "/opt/stack/nova/nova/virt/images.py", line 109, in fetch IMAGE_API.download(context, image_href, dest_path=path, File "/opt/stack/nova/nova/image/glance.py", line 1304, in download return session.download(context, image_id, data=data, File "/opt/stack/nova/nova/image/glance.py", line 394, in download _reraise_translated_image_exception(image_id) File "/opt/stack/nova/nova/image/glance.py", line 1037, in _reraise_translated_image_exception raise new_exc.with_traceback(exc_trace) File "/opt/stack/nova/nova/image/glance.py", line 391, in download image_chunks = self._client.call( File "/opt/stack/nova/nova/image/glance.py", line 191, in call result = getattr(controller, method)(*args, **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/utils.py", line 652, in inner return RequestIdProxy(wrapped(*args, **kwargs)) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/v2/images.py", line 249, in data resp, image_meta = self.http_client.get(url) File "/opt/stack/data/venv/lib/python3.10/site-packages/keystoneauth1/adapter.py", line 393, in get return self.request(url, 'GET', **kwargs) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 376, in request return self._handle_response(resp) File "/opt/stack/data/venv/lib/python3.10/site-packages/glanceclient/common/http.py", line 116, in _handle_response raise exc.from_response(resp, resp.content) nova.exception.ImageNotFound: Image could not be found. ``` By comparison, if you attempt to create a BFV instance with `uuid` set to `''`, you get the following error: ``` openstack.exceptions.BadRequestException: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Invalid input for field/attribute uuid. Value: . '' is too short clean_up CreateServer: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Invalid input for field/attribute uuid. Value: . '' is too short ``` Likewise, if you attempt to create a "standard" instance from an image and omit the `imageRef` field, you get the following: ``` openstack.exceptions.BadRequestException: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Can not find requested image clean_up CreateServer: BadRequestException: 400: Client Error for url: http://10.0.108.50/compute/v2.1/servers, Can not find requested image ``` Finally, if you attempt to create an instance using the "local" BFV and specify "imageRef", the BFV is ignored/overwritten. For example, given the following: ``` { "server": { "imageRef": "9acb21b3-0516-459a-9b0a-6357e66ff74a", "block_device_mapping_v2": [ { "uuid": "9acb21b3-0516-459a-9b0a-6357e66ff74a", "boot_index": 0, "source_type": "image", "destination_type": "local", "volume_size": 6 } ], "flavorRef": "1", // ... } } ``` where flavor "1" is the m1.tiny flavor, we end up with a 1GB disk in the flavor. This is probably expected, though arguably we should reject this in the future. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/2077980/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp