Use openstack resource provider inventory show to get inventory
Under python3, the output of the openstack resource provider inventory list command is random which breaks how the _get_inventory_value function is used to store and verify inventory before and after the upgrade. This change uses the "openstack resource provider inventory show" command to target the specific resource class and column value (total) so we don't have to worry about sort order. While in here, a comment is left about why we can't do the same for getting the resource class allocation value. Change-Id: I1e8dadae631bee87628c5b5390609deb8a1a71e5 Closes-Bug: #1803312
This commit is contained in:
parent
db3eef8db9
commit
8afd7beb07
|
@ -57,7 +57,7 @@ function _get_inventory_value() {
|
|||
provider=$(openstack resource provider list -f value | head -n1 | cut -d ' ' -f 1)
|
||||
|
||||
# Return the inventory total for $uuid and resource class $key
|
||||
openstack resource provider inventory list -f value $provider | grep "^$key" | cut -d ' ' -f 3
|
||||
openstack resource provider inventory show $provider $key -f value -c total
|
||||
}
|
||||
|
||||
function _get_allocation_value() {
|
||||
|
@ -67,7 +67,9 @@ function _get_allocation_value() {
|
|||
consumer="$1"
|
||||
key="$2"
|
||||
|
||||
# Return the allocated amount for $consumer and resource class $key
|
||||
# Return the allocated amount for $consumer and resource class $key;
|
||||
# we can't use -c $key here because the resource class amounts are
|
||||
# dumped in a json blob.
|
||||
openstack resource provider allocation show -f value $consumer | grep -o ".${key}.: [0-9]*" | cut -d ' ' -f 2
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue