Skip to content

Commit 9ec6afe

Browse files
committed
Enable unified limits in the nova-next job
This configures the nova-next job to enable the new experimental unified limits functionality. This also adds basic testing for nova "global" limits in keystone in the post-test-hook for the nova-next job. These can't be tested in tempest because they involve modifying global quota limits that would affect any other server tests running in parallel. Related to blueprint unified-limits-nova Depends-On: https://review.opendev.org/c/openstack/devstack/+/789962 Depends-On: https://review.opendev.org/c/openstack/tempest/+/790186 Depends-On: https://review.opendev.org/c/openstack/tempest/+/804311 Change-Id: I624b2684867305a9095e8964ead786c7b0c28242
1 parent 2197290 commit 9ec6afe

File tree

2 files changed

+67
-3
lines changed

2 files changed

+67
-3
lines changed

.zuul.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@
339339
compute-feature-enabled:
340340
# The q35 machine type doesn't support an IDE bus
341341
ide_bus: False
342+
# Added in Yoga.
343+
unified_limits: True
342344
neutron_plugin_options:
343345
available_type_drivers: flat,geneve,vlan,gre,local,vxlan
344346
devstack_localrc:
@@ -355,6 +357,7 @@
355357
FORCE_CONFIG_DRIVE: True
356358
# Added in Yoga.
357359
NOVNC_FROM_PACKAGE: False
360+
NOVA_USE_UNIFIED_LIMITS: True
358361
devstack_services:
359362
# Disable OVN services
360363
br-ex-tcpdump: false

gate/post_test_hook.sh

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ set -e
5959
purge_db
6060

6161
# We need to get the admin credentials to run the OSC CLIs for Placement.
62-
set +x
63-
source $BASE/devstack/openrc admin
64-
set -x
62+
export OS_CLOUD=devstack-admin
6563

6664
# Verify whether instances were archived from all cells. Admin credentials are
6765
# needed to list deleted instances across all projects.
@@ -271,3 +269,66 @@ set -e
271269
# Verify whether online data migrations run after archiving will succeed.
272270
# See for more details: https://bugs.launchpad.net/nova/+bug/1824435
273271
$MANAGE db online_data_migrations
272+
273+
274+
# Test global registered unified limits by updating registered limits and
275+
# attempting to create resources. Because these quota limits are global, we
276+
# can't test them in tempest because modifying global limits can cause other
277+
# tests running in parallel to fail.
278+
echo "Testing unified limits registered limits"
279+
280+
# Get the registered limits IDs.
281+
reglimit_ids_names=$(openstack registered limit list -f value -c "ID" -c "Resource Name")
282+
283+
# Put them in a map to lookup ID from name for subsequent limit set commands.
284+
# Requires Bash 4.
285+
declare -A id_name_map
286+
while read id name
287+
do id_name_map["$name"]="$id"
288+
done <<< "$reglimit_ids_names"
289+
290+
# Server metadata items
291+
#
292+
# Set the quota to 1.
293+
metadata_items_id="${id_name_map["server_metadata_items"]}"
294+
295+
bash -c "unset OS_USERNAME OS_TENANT_NAME OS_PROJECT_NAME;
296+
openstack --os-cloud devstack-system-admin registered limit set \
297+
--default-limit 1 $metadata_items_id"
298+
299+
# Create a server. Should succeed with one metadata item.
300+
openstack --os-compute-api-version 2.37 \
301+
server create --image ${image_id} --flavor ${flavor_id} --nic none \
302+
--property cool=true --wait metadata-items-test1
303+
304+
# Try to create another server with two metadata items. This should fail.
305+
set +e
306+
output=$(openstack --os-compute-api-version 2.37 \
307+
server create --image ${image_id} --flavor ${flavor_id} --nic none \
308+
--property cool=true --property location=fridge \
309+
--wait metadata-items-test2)
310+
rc=$?
311+
set -e
312+
# Return code should be 1 if server create failed.
313+
if [[ ${rc} -ne 1 ]]; then
314+
echo "Expected return code 1 from server create with two metadata items"
315+
exit 2
316+
fi
317+
# Verify it's a quota error.
318+
if [[ ! "HTTP 403" =~ "$output" ]]; then
319+
echo "Expected HTTP 403 from server create with two metadata items"
320+
exit 2
321+
fi
322+
323+
# Increase the quota limit to two.
324+
bash -c "unset OS_USERNAME OS_TENANT_NAME OS_PROJECT_NAME;
325+
openstack --os-cloud devstack-system-admin registered limit set \
326+
--default-limit 2 $metadata_items_id"
327+
328+
# Second server create should succeed now.
329+
openstack --os-compute-api-version 2.37 \
330+
server create --image ${image_id} --flavor ${flavor_id} --nic none \
331+
--property cool=true --property location=fridge --wait metadata-items-test2
332+
333+
# Delete the servers.
334+
openstack server delete metadata-items-test1 metadata-items-test2

0 commit comments

Comments
 (0)