
While we should not start using this for cloning things in the gate yet, the opendev.org links provide for a nicer browsing experience already even though the service is in beta. Go ahead and swap our browsing links. While in there, remove some masakari references to github links to the source code. Masakari now publishes api docs to developer.openstack.org so there is no need to point people to source code for api docs. Change-Id: I14afa3476f9832ef433ec744e888348fc9a359e3
2.7 KiB
Managing Policies
A policy type can be treated as the meta-type of a Policy object. A registry of policy types is built when the Cluster service starts. When creating a Policy object, you will indicate the policy type used in its spec property.
List Policies
To examine the list of policies:
../../examples/clustering/policy.py
When listing policies, you can specify the sorting option using the
sort
parameter and you can do pagination using the
limit
and marker
parameters.
Full example: manage policy
Create Policy
When creating a policy, you will provide a dictionary with keys and values according to the policy type referenced.
../../examples/clustering/policy.py
Optionally, you can specify a metadata
keyword argument
that contains some key-value pairs to be associated with the policy.
Full example: manage policy
Find Policy
To find a policy based on its name or ID:
../../examples/clustering/policy.py
Full example: manage policy
Get Policy
To get a policy based on its name or ID:
../../examples/clustering/policy.py
Full example: manage policy
Update Policy
After a policy is created, most of its properties are immutable.
Still, you can update a policy's name
and/or
metadata
.
../../examples/clustering/policy.py
The Cluster service doesn't allow updating the spec
of a
policy. The only way to achieve that is to create a new policy.
Full example: manage policy
Delete Policy
A policy can be deleted after creation, provided that it is not referenced by any active clusters or nodes. If you attempt to delete a policy that is still in use, you will get an error message.
../../examples/clustering/policy.py