Glance task creates failed when setting work_dir local and qemu-img version is 1.5.3

Bug #1591971 reported by Yafei Yu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Invalid
Medium
Yafei Yu

Bug Description

The openstack version is mitaka.

# rpm -qa |grep qemu-img
qemu-img-1.5.3-105.el7_2.4.x86_64

The glance-api.conf setting is:
[task]
work_dir = /home/work/
[taskflow_executor]
conversion_format = raw

Then run the cli:
glance task-create --type import --input '{"import_from":"http://10.43.177.17/cirros-0.3.2-x86_64-disk.img","import_from_format": "","image_properties":{"disk_format":"qcow2","container_format":"bare","name":"test1"}}'

The log is :
2016-06-14 04:08:29.032 DEBUG oslo_concurrency.processutils [-] CMD "qemu-img info --output=json file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d" returned: 1 in 0.025s from (pid=5460) execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:374
2016-06-14 04:08:29.033 DEBUG oslo_concurrency.processutils [-] None
command: u'qemu-img info --output=json file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d'
exit code: 1
stdout: u''
stderr: u"qemu-img: Could not open 'file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d': Could not open 'file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d': No such file or directory\n" from (pid=5460) execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:413
2016-06-14 04:08:29.034 DEBUG oslo_concurrency.processutils [-] u'qemu-img info --output=json file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d' failed. Not Retrying. from (pid=5460) execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:422
Command: qemu-img info --output=json file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d
Exit code: 1
Stdout: u''
Stderr: u"qemu-img: Could not open 'file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d': Could not open 'file:///home/work/90ff2129-0079-487e-a7ec-79ef23bd1c0d': No such file or directory\n"
2016-06-14 04:08:29.072 WARNING glance.async.taskflow_executor [-] Task 'import-ImportToFS-42684807-86db-4ff5-a4a9-abf3b1998b63' (5ff9cf63-f257-48d2-9cc9-cfeffd905854) transitioned into state 'FAILURE' from state 'RUNNING'
4 predecessors (most recent first):
  Flow 'import'
  |__Atom 'import-CreateImage-42684807-86db-4ff5-a4a9-abf3b1998b63' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': '90ff2129-0079-487e-a7ec-79ef23bd1c0d'}
     |__Atom 'import_retry' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': [(None, {})]}
        |__Flow 'import'
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor Traceback (most recent call last):
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 82, in _execute_task
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor result = task.execute(**arguments)
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor File "/opt/stack/glance/glance/async/flows/base_import.py", line 175, in execute
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor metadata = json.loads(stdout)
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor return _default_decoder.decode(s)
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor raise ValueError("No JSON object could be decoded")
2016-06-14 04:08:29.072 TRACE glance.async.taskflow_executor ValueError: No JSON object could be decoded

Yafei Yu (yu-yafei)
Changed in glance:
assignee: nobody → yuyafei (yu-yafei)
Yafei Yu (yu-yafei)
summary: - Glance task creates failed when setting word_dir local
+ Glance task creates failed when setting work_dir local
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/329394

Changed in glance:
status: New → In Progress
Yafei Yu (yu-yafei)
description: updated
description: updated
Yafei Yu (yu-yafei)
summary: - Glance task creates failed when setting work_dir local
+ Glance task creates failed when setting work_dir local and qemu-img
+ version is 1.5.3
Changed in glance:
importance: Undecided → Medium
Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

I think the bug seems to be in oslo_concurrency.processutils because glance is merely using:

---

glance/async/flows/base_import.py: stdout, stderr = putils.trycmd('qemu-img', 'info',
glance/async/flows/convert.py: # format already. Probably using `qemu-img` just like the
glance/async/flows/convert.py: stdout, stderr = putils.trycmd('qemu-img', 'convert', '-O',
glance/async/flows/introspect.py: stdout, stderr = putils.trycmd('qemu-img', 'info',

---

So, the file:/ should not appear in the task command because glance does not set those. Can you reconfirm?

Revision history for this message
Yafei Yu (yu-yafei) wrote :

Thank you, Nikhil.
I make a test in two host, and the result looks because different versions of qemu-img.
if path is "file:///work_dir", qemu-img command failed, but if "/work_dir" qemu-img works well when qemu-img-1.5.3-105.el7_2.4.x86_64.
So I make a change in glance:"file:///work_dir"--->"/work_dir"

[root@stack ~]# rpm -qa |grep release
isorelax-0-0.15.release20050331.el7.noarch
centos-release-7-0.1406.el7.centos.2.3.x86_64
rdo-release-mitaka-2.noarch
epel-release-7-6.noarch
[root@stack ~]# rpm -qa |grep qemu-img
qemu-img-1.5.3-105.el7_2.4.x86_64
[root@stack ~]# qemu-img info --output=json file:///home/cirros-0.3.1-x86_64-disk.img
qemu-img: Could not open 'file:///home/cirros-0.3.1-x86_64-disk.img': Could not open 'file:///home/cirros-0.3.1-x86_64-disk.img': No such file or directory
[root@stack ~]# qemu-img info --output=json /home/cirros-0.3.1-x86_64-disk.img
{
    "virtual-size": 41126400,
    "filename": "/home/cirros-0.3.1-x86_64-disk.img",
    "cluster-size": 65536,
    "format": "qcow2",
    "actual-size": 13148160,
    "format-specific": {
        "type": "qcow2",
        "data": {
            "compat": "0.10"
        }
    },
    "dirty-flag": false
}

[root@2C5_10_DELL05 ~]# rpm -qa |grep release
centos-release-7-0.1406.el7.centos.2.4.x86_64
tfg-release-1.0-472.6.1.15.noarch
[root@2C5_10_DELL05 ~]# rpm -qa |grep qemu-img
qemu-img-2.5.0-5.6.1.1.el7.centos.x86_64
[root@2C5_10_DELL05 ~]# qemu-img info --output=json file:///home/cirros-0.3.1-x86_64-disk.img
{
    "virtual-size": 41126400,
    "filename": "///home/cirros-0.3.1-x86_64-disk.img",
    "cluster-size": 65536,
    "format": "qcow2",
    "actual-size": 13148160,
    "format-specific": {
        "type": "qcow2",
        "data": {
            "compat": "0.10",
            "refcount-bits": 16
        }
    },
    "dirty-flag": false
}
[root@2C5_10_DELL05 ~]# qemu-img info --output=json /home/cirros-0.3.1-x86_64-disk.img
{
    "virtual-size": 41126400,
    "filename": "/home/cirros-0.3.1-x86_64-disk.img",
    "cluster-size": 65536,
    "format": "qcow2",
    "actual-size": 13148160,
    "format-specific": {
        "type": "qcow2",
        "data": {
            "compat": "0.10",
            "refcount-bits": 16
        }
    },
    "dirty-flag": false
}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by yuyafei (<email address hidden>) on branch: master
Review: https://review.openstack.org/329394

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Looks like this was fixed by configuration, closing.

Changed in glance:
status: In Progress → Invalid
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.