Skip to content

Commit

Permalink
Add built in policy to prevent transformed VM from starting.
Browse files Browse the repository at this point in the history
  • Loading branch information
lfu committed Jun 6, 2018
1 parent 75b03cb commit 4e3336b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/service_template_transformation_plan_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def task_finished
vm_resource.update_attributes(:status => status == 'Ok' ? ServiceResource::STATUS_COMPLETED : ServiceResource::STATUS_FAILED)
end

def mark_vm_migrated
source.tag_with("migrated", :ns => "/managed", :cat => "transformation_status")
end

def task_active
vm_resource.update_attributes(:status => ServiceResource::STATUS_ACTIVE)
end
Expand Down
13 changes: 13 additions & 0 deletions product/policy/built_in_policies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
:modifier: deny
:mode: control
:action: vm_suspend
- :name: Prevent Transformed VM from Starting
:description: Prevent Transformed VM from starting
:towhat: Vm
:event: request_vm_start
:applies_to?: true
:active: true
:condition:
"CONTAINS":
tag: Vm.managed-transformation_status
value: migrated
:modifier: deny
:mode: control
:action: prevent
- :name: Stop Retired VM
:description: Stop Retired VM
:towhat: Vm
Expand Down

0 comments on commit 4e3336b

Please sign in to comment.