vcenter_storage_policy¶
Client for vCenter Storage Policy-Based Management.
Note: the vSphere REST SPBM API (/api/vcenter/storage/policies) is
read-only and has no per-policy GET path. Policies are a synthesized view of
profiles from multiple underlying sources (built-in VMC profiles, vSAN,
vVol, user-authored) and are exposed only as an enumerable, filterable list.
get() is implemented in terms of the filter query parameter
(?policies=<id>) which returns a single-element list when the id
matches.
Authoring (create/update/delete) a tag/capability-based policy has never
been exposed over REST — that’s only reachable through the PBM SOAP service
(saltext.vcf.utils.pbm), the same one PowerCLI’s
New-/Set-/Remove-SpbmStoragePolicy wrap.
- saltext.vcf.clients.vcenter_storage_policy.get(opts, policy, profile=None)[source]¶
Return the single policy with id policy.
Implemented via the filter query parameter since the SPBM REST API has no per-id GET path. Raises
requests.HTTPError404 when the policy is unknown.
- saltext.vcf.clients.vcenter_storage_policy.get_by_name(opts, name, profile=None)[source]¶
Return
{"id", "name", "description", "constraints"}for the user-authored policy name, via PBM (so constraints are readable), orNoneif it doesn’t exist.
- saltext.vcf.clients.vcenter_storage_policy.create(opts, name, constraints, description=None, profile=None)[source]¶
Create a tag/capability-based storage policy and return its id.
constraints is a list of rulesets, each an optional
{"capabilities": {...}, "tags": {...}}dict. Rulesets are OR-ed by the server when evaluating the policy; capabilities/tags within one ruleset are AND-ed. See_to_subprofiles().
- saltext.vcf.clients.vcenter_storage_policy.update(opts, name, constraints=None, description=None, profile=None)[source]¶
Update an existing policy’s description and/or constraints.
Fields left as
Noneare unchanged.
- saltext.vcf.clients.vcenter_storage_policy.delete(opts, name, profile=None)[source]¶
Delete the user-authored policy name.