Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate - Retirement - Remove miq_provision and/or tag code #6290

Merged
merged 1 commit into from
Jan 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Get vm from root object
vm = $evm.root['vm']
category = "lifecycle"
tag = "retire_full"

removal_type = $evm.inputs['removal_type'].downcase
$evm.set_state_var('vm_removed_from_provider', false)
Expand All @@ -14,11 +12,9 @@
ems = vm.ext_management_system
case removal_type
when "remove_from_disk"
if vm.miq_provision || vm.tagged_with?(category, tag)
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
end
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
when "unregister"
$evm.log('info', "Unregistering VM:<#{vm.name}> from provider:<#{ems.try(:name)}")
vm.unregister
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Get vm from root object
vm = $evm.root['vm']
category = "lifecycle"
tag = "retire_full"

removal_type = $evm.inputs['removal_type'].downcase
$evm.set_state_var('vm_removed_from_provider', false)
Expand All @@ -14,11 +12,9 @@
ems = vm.ext_management_system
case removal_type
when "remove_from_disk"
if vm.miq_provision || vm.tagged_with?(category, tag)
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
end
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
when "unregister"
$evm.log('info', "Unregistering VM:<#{vm.name}> from provider:<#{ems.try(:name)}")
vm.unregister
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@vm = FactoryGirl.create(:vm_vmware, :host => @host,
:ems_id => @ems.id, :name => "testVM", :raw_power_state => "poweredOn",
:registered => true)
@vm.tag_with("retire_full", :ns => "/managed", :cat => "lifecycle")
@ins = "/Infrastructure/VM/Retirement/StateMachines/Methods/RemoveFromProvider"
end

Expand Down