Skip to content

Commit 2780b22

Browse files
author
Ken Evensen
committed
Initial Commit
1 parent 1eb1cf7 commit 2780b22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1810
-0
lines changed

.DS_Store

6 KB
Binary file not shown.
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
object_type: class
3+
version: 1.0
4+
object:
5+
attributes:
6+
description:
7+
display_name:
8+
name: Export
9+
type:
10+
inherits:
11+
visibility:
12+
owner:
13+
schema:
14+
- field:
15+
aetype: attribute
16+
name: export_domain
17+
display_name:
18+
datatype: string
19+
priority: 1
20+
owner:
21+
default_value:
22+
substitute: true
23+
message: create
24+
visibility:
25+
collect:
26+
scope:
27+
description:
28+
condition:
29+
on_entry:
30+
on_exit:
31+
on_error:
32+
max_retries:
33+
max_time:
34+
- field:
35+
aetype: state
36+
name: PreFlight
37+
display_name:
38+
datatype: string
39+
priority: 2
40+
owner:
41+
default_value: /POC/Infrastructure/VM/Export/Methods/pre_flight
42+
substitute: true
43+
message: create
44+
visibility:
45+
collect:
46+
scope:
47+
description:
48+
condition:
49+
on_entry: tag_status(status => 'beginning_preflight')
50+
on_exit: tag_status(status => 'passed_preflight')
51+
on_error: tag_status(status => 'failed_preflight')
52+
max_retries:
53+
max_time:
54+
- field:
55+
aetype: state
56+
name: Export
57+
display_name:
58+
datatype: string
59+
priority: 3
60+
owner:
61+
default_value: /POC/Infrastructure/VM/Export/Methods/export
62+
substitute: true
63+
message: create
64+
visibility:
65+
collect:
66+
scope:
67+
description:
68+
condition:
69+
on_entry: tag_status(status => 'beginning_export')
70+
on_exit: tag_status(status => 'completed_export')
71+
on_error: tag_status(status => 'failed_export')
72+
max_retries:
73+
max_time:
74+
- field:
75+
aetype: state
76+
name: TagJobID
77+
display_name:
78+
datatype: string
79+
priority: 4
80+
owner:
81+
default_value: /POC/Infrastructure/VM/Export/Methods/tag_with_job
82+
substitute: true
83+
message: create
84+
visibility:
85+
collect: ''
86+
scope:
87+
description:
88+
condition:
89+
on_entry: tag_status(status => 'tagging_with_job')
90+
on_exit: tag_status(status => 'tagged_with_job')
91+
on_error:
92+
max_retries: ''
93+
max_time:
94+
- field:
95+
aetype: state
96+
name: CheckStatus
97+
display_name:
98+
datatype: string
99+
priority: 5
100+
owner:
101+
default_value: /POC/Infrastructure/VM/Export/Methods/export_status
102+
substitute: true
103+
message: create
104+
visibility:
105+
collect:
106+
scope:
107+
description:
108+
condition:
109+
on_entry: tag_status(status => 'checking_export')
110+
on_exit: tag_status(status => 'still_exporting')
111+
on_error:
112+
max_retries: '30'
113+
max_time:
114+
- field:
115+
aetype: state
116+
name: ClearJobID
117+
display_name:
118+
datatype: string
119+
priority: 6
120+
owner:
121+
default_value: /POC/Infrastructure/VM/Export/Methods/clear_job_tags
122+
substitute: true
123+
message: create
124+
visibility:
125+
collect:
126+
scope:
127+
description:
128+
condition:
129+
on_entry: tag_status(status => 'clearing_job_tags')
130+
on_exit: tag_status(status => 'cleared_job_tags')
131+
on_error:
132+
max_retries:
133+
max_time:
134+
- field:
135+
aetype: state
136+
name: MountExports
137+
display_name:
138+
datatype: string
139+
priority: 7
140+
owner:
141+
default_value: /POC/Infrastructure/VM/Export/Methods/mount_exports
142+
substitute: true
143+
message: create
144+
visibility:
145+
collect:
146+
scope:
147+
description:
148+
condition:
149+
on_entry: tag_status(status => 'mounting_export_dir')
150+
on_exit: tag_status(status => 'mounted_export_dir')
151+
on_error:
152+
max_retries:
153+
max_time:
154+
- field:
155+
aetype: state
156+
name: CreateUserDirectory
157+
display_name:
158+
datatype: string
159+
priority: 8
160+
owner:
161+
default_value: /POC/Infrastructure/VM/Export/Methods/mkdir_exports_user
162+
substitute: true
163+
message: create
164+
visibility:
165+
collect:
166+
scope:
167+
description:
168+
condition:
169+
on_entry: tag_status(status => 'creating_user_exports_dir')
170+
on_exit: tag_status(status => 'created_user_exports_dir')
171+
on_error:
172+
max_retries:
173+
max_time:
174+
- field:
175+
aetype: state
176+
name: Convert
177+
display_name:
178+
datatype: string
179+
priority: 9
180+
owner:
181+
default_value: /POC/Infrastructure/VM/Export/Methods/create_ova
182+
substitute: true
183+
message: create
184+
visibility:
185+
collect:
186+
scope:
187+
description:
188+
condition:
189+
on_entry: tag_status(status => 'creating_ova_file')
190+
on_exit: tag_status(status => 'created_ova_file')
191+
on_error:
192+
max_retries:
193+
max_time:
194+
- field:
195+
aetype: state
196+
name: DeleteExportedVM
197+
display_name:
198+
datatype: string
199+
priority: 10
200+
owner:
201+
default_value: /POC/Infrastructure/VM/Export/Methods/delete_vm
202+
substitute: true
203+
message: create
204+
visibility:
205+
collect:
206+
scope:
207+
description:
208+
condition:
209+
on_entry: tag_status(status => 'deleteing_vm_from_ex_domain')
210+
on_exit: tag_status(status => 'export_complete')
211+
on_error:
212+
max_retries:
213+
max_time:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Description: <Method description here>
3+
#
4+
5+
status = $evm.inputs['status']
6+
vm = $evm.root['vm']
7+
8+
description = status.gsub("_"," ")
9+
10+
description = description.gsub(/\w+/) { $&.capitalize }
11+
12+
#If the category doesn't exist, create it
13+
if $evm.execute('category_exists?', "export_status")
14+
$evm.log("info", "Category export_status exists")
15+
else
16+
$evm.log("info", "Category export_status doesn't exist, creating category")
17+
$evm.execute('category_create', :name => "export_status", :single_value => true, :description => "Export Status")
18+
end
19+
20+
#If the particular status doesn't exist, create it
21+
if $evm.execute('tag_exists?', "export_status",status)
22+
$evm.log("info","Tag #{status} exists for category export_status")
23+
else
24+
$evm.log("info", "Adding new tag in export_status Category")
25+
$evm.execute("tag_create", "export_status", :name => status, :description => description)
26+
end
27+
28+
#Unassign any existing tags in the export_status category.
29+
vm.tags("export_status").each do |tag|
30+
vm.tag_unassign(tag)
31+
end
32+
33+
#Assign this particular status tag
34+
vm.tag_assign("export_status/#{status}")
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
object_type: method
3+
version: 1.0
4+
object:
5+
attributes:
6+
name: tag_status
7+
display_name:
8+
description:
9+
scope: instance
10+
language: ruby
11+
location: inline
12+
inputs:
13+
- field:
14+
aetype:
15+
name: status
16+
display_name:
17+
datatype:
18+
priority: 1
19+
owner:
20+
default_value:
21+
substitute: true
22+
message: create
23+
visibility:
24+
collect:
25+
scope:
26+
description:
27+
condition:
28+
on_entry:
29+
on_exit:
30+
on_error:
31+
max_retries:
32+
max_time:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
object_type: instance
3+
version: 1.0
4+
object:
5+
attributes:
6+
display_name:
7+
name: default
8+
inherits:
9+
description:
10+
fields:
11+
- export_domain:
12+
value: exports
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
object_type: instance
3+
version: 1.0
4+
object:
5+
attributes:
6+
display_name:
7+
name: rhev_to_qcow2
8+
inherits:
9+
description:
10+
fields:
11+
- Convert:
12+
value: /POC/Infrastructure/VM/Export/Methods/create_qcow2
13+
on_entry: tag_status(status => 'creating_qcow2_file')
14+
on_exit: tag_status(status => 'done_creating_qcow2_file')
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
object_type: instance
3+
version: 1.0
4+
object:
5+
attributes:
6+
display_name:
7+
name: rhev_to_vmdk
8+
inherits:
9+
description:
10+
fields:
11+
- Convert:
12+
value: /POC/Infrastructure/VM/Export/Methods/create_vmdk
13+
on_entry: tag_status(status => 'creating_vmdk_file')
14+
on_exit: tag_status(status => 'done_creating_vmdk_file')
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
object_type: class
3+
version: 1.0
4+
object:
5+
attributes:
6+
description:
7+
display_name:
8+
name: Methods
9+
type:
10+
inherits:
11+
visibility:
12+
owner:
13+
schema:
14+
- field:
15+
aetype: attribute
16+
name: export_domain
17+
display_name:
18+
datatype: string
19+
priority: 1
20+
owner:
21+
default_value: exports
22+
substitute: true
23+
message: create
24+
visibility:
25+
collect:
26+
scope:
27+
description:
28+
condition:
29+
on_entry:
30+
on_exit:
31+
on_error:
32+
max_retries:
33+
max_time:
34+
- field:
35+
aetype: method
36+
name: meth1
37+
display_name:
38+
datatype: string
39+
priority: 2
40+
owner:
41+
default_value:
42+
substitute: true
43+
message: create
44+
visibility:
45+
collect:
46+
scope:
47+
description:
48+
condition:
49+
on_entry:
50+
on_exit:
51+
on_error:
52+
max_retries:
53+
max_time:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Description: This method will remove any job tags.
3+
# Author: Kenneth D. Evensen <[email protected]>
4+
5+
@method = 'clear_job_tags'
6+
$evm.log("info", "----Entering method #{@method}----")
7+
8+
vm = $evm.root['vm']
9+
10+
for count in 0..4
11+
#Unassign any existing tags in the job_id_# category.
12+
$evm.log("info","Attempting to remove tags in category job_id_#{count}")
13+
vm.tags("job_id_#{count}").each do |tag|
14+
$evm.log("info","Attempting to remove tag job_id_#{count}/#{tag}")
15+
vm.tag_unassign("job_id_#{count}/#{tag}")
16+
end
17+
end
18+
19+
$evm.log("info", "----Exiting method #{@method}----")
20+

0 commit comments

Comments
 (0)