VEXXHOSTDocumentation
Guides

Change a budget

Change a Budgets budget's amount, filter or thresholds, pause it, or delete it, without overwriting someone else's change.

This guide raises a budget's amount, pauses it, and deletes it. It also explains what happens when two people change the same budget at once.

Before you begin

You need a budget to change. See Create a budget. For the Python examples, create the Python client.

1. Change the amount or thresholds

The CLI changes only the options you give it and keeps the rest:

openstack budget set compute-monthly --amount 1500

--threshold replaces all of the budget's thresholds, so repeat every threshold you want to keep. --no-service, --no-region and --no-usage-type clear a filter.

The API and Python client replace the whole budget, and the request carries the revision you read. Read the budget, change it, and write it back:

from budgetclient.v1.budgets import to_update_spec

current = budgets.budgets.find("compute-monthly")
spec = to_update_spec(current)
spec["amount"] = "1500"
budgets.budgets.update(current["id"], **spec)

If someone changed the budget after you read it, the API refuses the update with 409 Conflict instead of overwriting their change. Read the budget again and reapply yours. The CLI reads the budget for you, so this only happens when two changes land within moments of each other.

2. Pause or resume it

A budget that is turned off is not checked and sends no alerts, but keeps its settings and history:

openstack budget set compute-monthly --disable
openstack budget set compute-monthly --enable

Turning a budget off and on again in the same window does not repeat an alert it already sent.

3. Delete it

Deleting a budget also deletes its window and alert history:

openstack budget delete compute-monthly

Verify

openstack budget show compute-monthly -c amount -c enabled -c revision
+----------+-------+
| Field    | Value |
+----------+-------+
| amount   | 1500  |
| enabled  | True  |
| revision | 2     |
+----------+-------+

Each change increases revision by one.

Next steps

  • Review what a budget has sent with openstack budget notification list compute-monthly.
  • See every option of budget set in the CLI reference.

On this page