Split disallowed flavor policy into monitor and remediation

Some users want the monitoring but not the remediation

Partially implements: blueprint policy-library
Partial-Bug: 1669948

Change-Id: Id14b2148f6ce41e9ffbd23d403fb4d5ebfb840da
This commit is contained in:
Eric Kao 2017-07-14 16:30:14 -07:00
parent aa1aad9bff
commit c7e13f4947
2 changed files with 16 additions and 4 deletions

View File

@ -1,6 +1,6 @@
---
name: PauseBadFlavors
description: "Pause any server using a flavor that is not permitted"
name: BadFlavors
description: "Error on any server using a flavor that is not permitted"
rules:
-
comment: "User should customize this. Permitted flavors."
@ -13,5 +13,5 @@ rules:
server_with_bad_flavor(id) :- nova:servers(id=id,flavor_id=flavor_id),
nova:flavors(id=flavor_id, name=flavor), not permitted_flavor(flavor)
-
comment: "Remediation: Pause any VM that shows up in the server_with_bad_flavor table"
rule: "execute[nova:servers.pause(id)] :- server_with_bad_flavor(id), nova:servers(id,status='ACTIVE')"
rule: >
error(id) :- server_with_bad_flavor(id)

View File

@ -0,0 +1,12 @@
---
name: PauseBadFlavors
description: "Pause any server using a flavor that is not permitted"
depends-on:
- BadFlavors
rules:
-
comment: "Remediation: Pause any VM that shows up in the server_with_bad_flavor table"
rule: >
execute[nova:servers.pause(id)] :-
BadFlavors:server_with_bad_flavor(id),
nova:servers(id,status='ACTIVE')