-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathprovision_workflow.rb
70 lines (56 loc) · 1.57 KB
/
provision_workflow.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class ManageIQ::Providers::Kubevirt::InfraManager::ProvisionWorkflow < MiqProvisionInfraWorkflow
def self.default_dialog_file
'miq_provision_dialogs'
end
def self.provider_model
ManageIQ::Providers::Kubevirt::InfraManager
end
def supports_pxe?
get_value(@values[:provision_type]).to_s == 'pxe'
end
def supports_iso?
get_value(@values[:provision_type]).to_s == 'iso'
end
def supports_customization_template?
true
end
def supports_native_clone?
get_value(@values[:provision_type]).to_s == 'native_clone'
end
def allowed_provision_types(_options = {})
{
"native_clone" => "Native Clone"
}
end
def dialog_name_from_automate(message = 'get_dialog_name', extra_attrs = {'platform' => 'kubevirt'})
super(message, extra_attrs)
end
def update_field_visibility
super(:force_platform => 'linux')
end
def allowed_datacenters(_options = {})
super.slice(datacenter_by_vm.try(:id))
end
def datacenter_by_vm
@datacenter_by_vm ||= begin
vm = resources_for_ui[:vm]
VmOrTemplate.find(vm.id).parent_datacenter if vm
end
end
def set_on_vm_id_changed
@datacenter_by_vm = nil
super
end
def allowed_hosts_obj(_options = {})
super(:datacenter => datacenter_by_vm)
end
def allowed_storages(options = {})
return [] if resources_for_ui.blank?
result = super
result.select { |s| s.storage_domain_type == "data" }
end
def source_ems
src = get_source_and_targets
load_ar_obj(src[:ems])
end
end