Glance creates image with zero size if location is wrong

Bug #1482709 reported by Kyrylo Romanenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Fix Released
Medium
Kairat Kushaev
7.0.x
Won't Fix
Medium
Kairat Kushaev
8.0.x
Fix Released
Medium
Kairat Kushaev

Bug Description

I tried to upload images from location by way like using SCP:

# glance image-create --name LINUX-64 --is-public True --disk-format iso --container-format bare --progress --location http://<fuel_ip>:~/ubuntu-14.04.2-server-amd64.iso

Glance client accepted wrong location and as result i got images in Glance with Active status and 0 size.
Same behavior noticed with aki and ari images.

Expected that Glance client will prevent creation of image from malformed source.

Environment:
VERSION:
  feature_groups:
    - mirantis
  production: "docker"
  release: "7.0"
  openstack_version: "2015.1.0-7.0"
  api: "1.0"
  build_number: "139"
  build_id: "2015-08-05_21-24-26"
  nailgun_sha: "c842770d56680d0e0cdf3573d329ce36d4fb2c64"
  python-fuelclient_sha: "28ddd022fd230fde0e88f2f3e4a6a6dddcb58abe"
  fuel-agent_sha: "1fe47720ba554818a0be707f2e16281791492d50"
  fuel-nailgun-agent_sha: "1512b9af6b41cc95c4d891c593aeebe0faca5a63"
  astute_sha: "e1d3a435e5df5b40cbfb1a3acf80b4176d15a2dc"
  fuel-library_sha: "347d51f391a6f2c621006c00e3416718140889ac"
  fuel-ostf_sha: "5cb828f6200e5ae0da63dd39d11fbf910237db95"
  fuelmain_sha: "858a4ee8336789c10c5c2189c3718f9a605d0eeb"

Ubuntu, Neutron VLAN, Cinder LVM
1 Controller + Ironic
1 Cinder
1 Compute

Tags: glance
Changed in mos:
importance: Undecided → Medium
Changed in mos:
status: New → Confirmed
Changed in mos:
assignee: MOS Glance (mos-glance) → Kairat Kushaev (kkushaev)
Revision history for this message
Kairat Kushaev (kkushaev) wrote :

So the case in the issue is divided into 2 parts:
1) When we uploaded an image from location the image created successfully (although it is not in real life)
2) When we uploaded an image with copy-from the image was not uploaded successfully and was not created. Because of glance implementation we didn't show an error here to user.
I am proceeding analysis of this bug and will get back with more detailed results.

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Ok, i could not reproduce the step where we created the image with:
glance image-create --name LINUX-64-2 --is-public True --disk-format iso --container-format bare --progress --copy-from http://<fuel_ip>:~/ubuntu-14.04.2-server-amd64.iso
The glance is responding with image status=queued and kills the image after that(because it can't request an image from url).
The glance logs shows the reason why the image killed:
2015-08-17 13:19:04.548 8969 ERROR glance.api.v1.images [req-c5ed90a5-c4c1-48e8-b4b2-8e21fc5ea9f0 85429ef7376840ceb4edfcafee859ed2 2fffbc217d5444c2aa9a89bc0749854c - - -] Copy from external source 'swift' failed for image: e42b73c1-3bce-44e1-baaa-c98c668f8c74
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images Traceback (most recent call last):
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 617, in _upload
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images dest=store)
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 469, in _get_from_store
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images image_data, image_size = src_store.get(loc, context=context)
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/dist-packages/glance_store/capabilities.py", line 226, in op_checker
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images return store_op_fun(store, *args, **kwargs)
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/dist-packages/glance_store/_drivers/http.py", line 129, in get
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images conn, resp, content_length = self._query(location, 'GET')
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/dist-packages/glance_store/_drivers/http.py", line 180, in _query
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images conn = conn_class(loc.netloc)
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/httplib.py", line 710, in __init__
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images self._set_hostport(host, port)
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images File "/usr/lib/python2.7/httplib.py", line 738, in _set_hostport
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images InvalidURL: nonnumeric port: '~'
2015-08-17 13:19:04.548 8969 TRACE glance.api.v1.images
Kyrylo, could you please provide more details about this case?

I am proceeding with analysis of the following:
glance image-create --name LINUX-64 --is-public True --disk-format iso --container-format bare --progress --location http://<fuel_ip>:~/ubuntu-14.04.2-server-amd64.iso

Revision history for this message
ruhe (ruhe) wrote :

Following comments from Kairat I'm re-assigning this ticket to Kirill and moving it to Incomplete.

Changed in mos:
assignee: Kairat Kushaev (kkushaev) → nobody
assignee: nobody → Kyrylo Romanenko (kromanenko)
status: Confirmed → Incomplete
Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Ruslan, here are 2 cases that Kyrylo wrote, the following case cause an issue in glance:
glance image-create --name LINUX-64 --is-public True --disk-format iso --container-format bare --progress --location http://<fuel_ip>:~/ubuntu-14.04.2-server-amd64.iso
So I will update the issue description to contain only one case.
Kyrylo, if you will manage to reproduce the case where the following image
glance image-create --name LINUX-64 --is-public True --disk-format iso --container-format bare --progress --location http://<fuel_ip>:~/ubuntu-14.04.2-server-amd64.iso
leads to active image then please create a separate issue for it.

description: updated
Changed in mos:
status: Incomplete → In Progress
assignee: Kyrylo Romanenko (kromanenko) → Kairat Kushaev (kkushaev)
Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Here is the fix for upstream: https://review.openstack.org/#/c/213925/.
Hope we will merge it soon.

Mike Fedosin (mfedosin)
Changed in mos:
milestone: 7.0 → 7.0-updates
Revision history for this message
Vitaly Sedelnik (vsedelnik) wrote :

Nominated for 8.0 and Won't Fix for 7.0-updates because of Medium importance

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Just FYI. The fix has been merged recently and proposed to stable/liberty
https://review.openstack.org/#/c/229321/.

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

It was merged in latest liberty upstream sync.

Revision history for this message
Alexey Galkin (agalkin) wrote :

verified on:

    VERSION:
      api: '1.0'
      astute_sha: 959b06c5ef8143125efd1727d350c050a922eb12
      build_id: '168'
      build_number: '168'
      feature_groups:
      - mirantis
      fuel-agent_sha: 2750600e946e96701099dfef5a7d69017f2e9956
      fuel-createmirror_sha: e34a0dd080fe6c133bcc75a00c31b27934ba51bc
      fuel-library_sha: 0d210dc3851ac6c74b3914ef4df0139defc8d117
      fuel-nailgun-agent_sha: 3e9d17211d65c80bf97c8d83979979f6c7feb687
      fuel-nailgun_sha: a5f4c44d08715f3be6b200a69032b30d347ac911
      fuel-ostf_sha: 9690a2de829d3b063ed1e64b0b10dde39f711dc0
      fuel-upgrade_sha: 1e894e26d4e1423a9b0d66abd6a79505f4175ff6
      fuelmain_sha: 266f9b374934c64629a84b5146632cc0de70ac91
      fuelmenu_sha: 06bbcebed6c8d0b0f9279e2997d2f958c800e98c
      network-checker_sha: a57e1d69acb5e765eb22cab0251c589cd76f51da
      openstack_version: 2015.1.0-8.0
      production: docker
      python-fuelclient_sha: e685d68c1c0d0fa0491a250f07d9c3a8d0f9608c
      release: '8.0'
      shotgun_sha: 25dd78a3118267e3616df0727ce746e7dead2d67

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.