]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Fix response when querying host detail by host name
authorwanghao <wanghao749@huawei.com>
Mon, 9 Mar 2015 10:49:31 +0000 (18:49 +0800)
committerwanghao <wanghao749@huawei.com>
Wed, 27 May 2015 02:06:47 +0000 (10:06 +0800)
commitaf853d479b70c22d60ae09e798ef4c3b62632fb2
tree523da9553e2a7063be05a83ed0afaca5060f26aa
parentc2db466995d5e534b6cc87fae917d7ec9109a18c
Fix response when querying host detail by host name

When querying host detail by host name like
'wanghao-devstack-snapshot@lvmdriver-1'
returned by host list command, cinder returns
incorrect result in 'total' block.
"resource": {
        "volume_count": "0",
        "total_volume_gb": "0",
        "total_snapshot_gb": "0",
        "project": "(total)",
        "host": "wanghao-devstack-snapshot@lvmdriver-1",
        "snapshot_count": "0"
        }
This issue is caused by 'volume_data_get_for_host'
in sqlalchemy. This has nothing to do with multibackend,
this is due to the introduction of pool support for single
backend.
Fix this by querying volume filter by host or host name
like 'host#%' in volume_data_get_for_host.

Change-Id: I751a474677d50e552d87fe06fadfed45e3c1ddab
Closes-Bug: #1429787
cinder/db/sqlalchemy/api.py
cinder/tests/unit/test_db_api.py