foreman_ovirt 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -17
  3. data/app/assets/javascripts/foreman_ovirt/ovirt.js +37 -8
  4. data/app/controllers/concerns/foreman_ovirt/api_compute_resources_controller_extension.rb +42 -0
  5. data/app/controllers/concerns/foreman_ovirt/compute_resources_vms_controller.rb +3 -1
  6. data/app/controllers/concerns/foreman_ovirt/parameters_extension.rb +5 -5
  7. data/app/controllers/foreman_ovirt/concerns/compute_resources_controller_extensions.rb +12 -3
  8. data/app/helpers/ovirt_compute_resource_helper.rb +18 -4
  9. data/app/models/concerns/fog_extensions/ovirt/server.rb +13 -4
  10. data/app/models/concerns/fog_extensions/ovirt/template.rb +3 -1
  11. data/app/models/concerns/fog_extensions/ovirt/volume.rb +3 -1
  12. data/app/models/foreman_ovirt/ovirt.rb +167 -142
  13. data/app/views/api/v2/compute_resources/ovirt.json.rabl +2 -0
  14. data/config/routes.rb +8 -5
  15. data/db/migrate/20250810212811_update_legacy_ovirt_compute_resource_type.rb +5 -3
  16. data/lib/foreman_ovirt/engine.rb +8 -5
  17. data/lib/foreman_ovirt/version.rb +3 -1
  18. data/lib/foreman_ovirt.rb +2 -0
  19. data/lib/tasks/foreman_ovirt_tasks.rake +37 -22
  20. data/locale/gemspec.rb +3 -1
  21. data/package.json +1 -0
  22. data/test/controllers/api/v2/compute_resources_controller_test.rb +186 -0
  23. data/test/controllers/hosts_controller_test.rb +46 -0
  24. data/test/factories/foreman_ovirt_factories.rb +27 -2
  25. data/test/fixtures/ovirt_operating_systems.xml +243 -0
  26. data/test/graphql/types/provider_enum_test.rb +12 -0
  27. data/test/integration/compute_profile_js_test.rb +49 -0
  28. data/test/models/compute_resources/compute_resource_test_helpers.rb +143 -0
  29. data/test/models/compute_resources/ovirt_test.rb +687 -0
  30. data/test/models/ovirt_volume_test.rb +104 -0
  31. data/test/test_plugin_helper.rb +2 -0
  32. data/test/unit/compute_resource_host_importer_test.rb +48 -0
  33. data/test/unit/ovirt_connection_test.rb +123 -0
  34. data/webpack/components/__tests__/ovirt.test.js +17 -0
  35. data/webpack/components/extensions/HostDetails/DetailsTabCards/OvirtCard.js +40 -38
  36. data/webpack/global_index.js +0 -2
  37. data/webpack/global_test_setup.js +3 -3
  38. data/webpack/index.js +0 -1
  39. metadata +26 -8
  40. data/test/unit/foreman_ovirt_test.rb +0 -11
@@ -0,0 +1,243 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <operating_systems>
3
+ <operating_system href="/api/operatingsystems/0" id="0">
4
+ <name>other</name>
5
+ <description>Other OS</description>
6
+ <large_icon href="/api/icons/ae11230a-3831-4281-86f3-ce095f795f12" id="ae11230a-3831-4281-86f3-ce095f795f12"/>
7
+ <small_icon href="/api/icons/f559f0f3-3539-4955-89b9-f431e9a61fce" id="f559f0f3-3539-4955-89b9-f431e9a61fce"/>
8
+ </operating_system>
9
+ <operating_system href="/api/operatingsystems/1" id="1">
10
+ <name>windows_xp</name>
11
+ <description>Windows XP</description>
12
+ <large_icon href="/api/icons/fb3fe792-3b5d-4024-9365-33926f23c387" id="fb3fe792-3b5d-4024-9365-33926f23c387"/>
13
+ <small_icon href="/api/icons/3c8eb95c-f18f-4139-9c24-0940c4415821" id="3c8eb95c-f18f-4139-9c24-0940c4415821"/>
14
+ </operating_system>
15
+ <operating_system href="/api/operatingsystems/3" id="3">
16
+ <name>windows_2003</name>
17
+ <description>Windows 2003</description>
18
+ <large_icon href="/api/icons/1d7cf62a-49c8-49e1-962a-9ca437ea04f3" id="1d7cf62a-49c8-49e1-962a-9ca437ea04f3"/>
19
+ <small_icon href="/api/icons/b42b805c-9439-45c4-b6db-43edb4d4abc9" id="b42b805c-9439-45c4-b6db-43edb4d4abc9"/>
20
+ </operating_system>
21
+ <operating_system href="/api/operatingsystems/4" id="4">
22
+ <name>windows_2008</name>
23
+ <description>Windows 2008</description>
24
+ <large_icon href="/api/icons/c2e76670-3273-48ad-b139-7fffb1a6c9f1" id="c2e76670-3273-48ad-b139-7fffb1a6c9f1"/>
25
+ <small_icon href="/api/icons/b42b805c-9439-45c4-b6db-43edb4d4abc9" id="b42b805c-9439-45c4-b6db-43edb4d4abc9"/>
26
+ </operating_system>
27
+ <operating_system href="/api/operatingsystems/5" id="5">
28
+ <name>other_linux</name>
29
+ <description>Linux</description>
30
+ <large_icon href="/api/icons/6ae13be7-5004-4475-8044-2a355deb74af" id="6ae13be7-5004-4475-8044-2a355deb74af"/>
31
+ <small_icon href="/api/icons/62945139-38d6-4278-859d-903c36bf6f2b" id="62945139-38d6-4278-859d-903c36bf6f2b"/>
32
+ </operating_system>
33
+ <operating_system href="/api/operatingsystems/7" id="7">
34
+ <name>rhel_5</name>
35
+ <description>Red Hat Enterprise Linux 5.x</description>
36
+ <large_icon href="/api/icons/5971ff19-016b-4447-b5d2-c76f291dfdf3" id="5971ff19-016b-4447-b5d2-c76f291dfdf3"/>
37
+ <small_icon href="/api/icons/559a7e75-8da8-43a5-bf14-246fcf8cb538" id="559a7e75-8da8-43a5-bf14-246fcf8cb538"/>
38
+ </operating_system>
39
+ <operating_system href="/api/operatingsystems/8" id="8">
40
+ <name>rhel_4</name>
41
+ <description>Red Hat Enterprise Linux 4.x</description>
42
+ <large_icon href="/api/icons/821274b8-0a09-4cf5-b616-3cb4b266197c" id="821274b8-0a09-4cf5-b616-3cb4b266197c"/>
43
+ <small_icon href="/api/icons/1aabcf64-e5b1-4191-aaec-2be8d5607dd9" id="1aabcf64-e5b1-4191-aaec-2be8d5607dd9"/>
44
+ </operating_system>
45
+ <operating_system href="/api/operatingsystems/9" id="9">
46
+ <name>rhel_3</name>
47
+ <description>Red Hat Enterprise Linux 3.x</description>
48
+ <large_icon href="/api/icons/2ce0e5c9-301f-4275-b511-9745ad563685" id="2ce0e5c9-301f-4275-b511-9745ad563685"/>
49
+ <small_icon href="/api/icons/22d34678-29c5-42fe-90a8-875a8235ab34" id="22d34678-29c5-42fe-90a8-875a8235ab34"/>
50
+ </operating_system>
51
+ <operating_system href="/api/operatingsystems/10" id="10">
52
+ <name>windows_2003x64</name>
53
+ <description>Windows 2003 x64</description>
54
+ <large_icon href="/api/icons/069a7d65-e8e2-41e5-8c9c-7a7c68ffd6c9" id="069a7d65-e8e2-41e5-8c9c-7a7c68ffd6c9"/>
55
+ <small_icon href="/api/icons/b42b805c-9439-45c4-b6db-43edb4d4abc9" id="b42b805c-9439-45c4-b6db-43edb4d4abc9"/>
56
+ </operating_system>
57
+ <operating_system href="/api/operatingsystems/1500" id="1500">
58
+ <name>freebsd</name>
59
+ <description>FreeBSD 9.2</description>
60
+ <large_icon href="/api/icons/7a977302-c141-4603-9b6f-4bd172294236" id="7a977302-c141-4603-9b6f-4bd172294236"/>
61
+ <small_icon href="/api/icons/24630eb6-ba6c-4b7e-a9d7-651233a8920c" id="24630eb6-ba6c-4b7e-a9d7-651233a8920c"/>
62
+ </operating_system>
63
+ <operating_system href="/api/operatingsystems/11" id="11">
64
+ <name>windows_7</name>
65
+ <description>Windows 7</description>
66
+ <large_icon href="/api/icons/7d8af0a5-3378-41f5-b9f0-3beb76ce4e94" id="7d8af0a5-3378-41f5-b9f0-3beb76ce4e94"/>
67
+ <small_icon href="/api/icons/88e63e32-d407-4333-9a7d-9ef799b702cc" id="88e63e32-d407-4333-9a7d-9ef799b702cc"/>
68
+ </operating_system>
69
+ <operating_system href="/api/operatingsystems/1501" id="1501">
70
+ <name>freebsdx64</name>
71
+ <description>FreeBSD 9.2 x64</description>
72
+ <large_icon href="/api/icons/a9202c2f-8298-461b-9f59-4da9fadf5ff0" id="a9202c2f-8298-461b-9f59-4da9fadf5ff0"/>
73
+ <small_icon href="/api/icons/13d6c8f6-7aff-461e-880f-74be0c5b9ca1" id="13d6c8f6-7aff-461e-880f-74be0c5b9ca1"/>
74
+ </operating_system>
75
+ <operating_system href="/api/operatingsystems/12" id="12">
76
+ <name>windows_7x64</name>
77
+ <description>Windows 7 x64</description>
78
+ <large_icon href="/api/icons/1bd004a0-2f43-4c7e-9c11-97767c1ba978" id="1bd004a0-2f43-4c7e-9c11-97767c1ba978"/>
79
+ <small_icon href="/api/icons/88e63e32-d407-4333-9a7d-9ef799b702cc" id="88e63e32-d407-4333-9a7d-9ef799b702cc"/>
80
+ </operating_system>
81
+ <operating_system href="/api/operatingsystems/13" id="13">
82
+ <name>rhel_5x64</name>
83
+ <description>Red Hat Enterprise Linux 5.x x64</description>
84
+ <large_icon href="/api/icons/ba1c5a85-5cd8-4ae5-9375-944c09bdbedf" id="ba1c5a85-5cd8-4ae5-9375-944c09bdbedf"/>
85
+ <small_icon href="/api/icons/559a7e75-8da8-43a5-bf14-246fcf8cb538" id="559a7e75-8da8-43a5-bf14-246fcf8cb538"/>
86
+ </operating_system>
87
+ <operating_system href="/api/operatingsystems/14" id="14">
88
+ <name>rhel_4x64</name>
89
+ <description>Red Hat Enterprise Linux 4.x x64</description>
90
+ <large_icon href="/api/icons/cc385716-b98e-49be-91af-70bb2c0564b4" id="cc385716-b98e-49be-91af-70bb2c0564b4"/>
91
+ <small_icon href="/api/icons/1aabcf64-e5b1-4191-aaec-2be8d5607dd9" id="1aabcf64-e5b1-4191-aaec-2be8d5607dd9"/>
92
+ </operating_system>
93
+ <operating_system href="/api/operatingsystems/15" id="15">
94
+ <name>rhel_3x64</name>
95
+ <description>Red Hat Enterprise Linux 3.x x64</description>
96
+ <large_icon href="/api/icons/9aeb785e-8202-4b2a-922b-bb2a14c958f2" id="9aeb785e-8202-4b2a-922b-bb2a14c958f2"/>
97
+ <small_icon href="/api/icons/22d34678-29c5-42fe-90a8-875a8235ab34" id="22d34678-29c5-42fe-90a8-875a8235ab34"/>
98
+ </operating_system>
99
+ <operating_system href="/api/operatingsystems/1300" id="1300">
100
+ <name>debian_7</name>
101
+ <description>Debian 7</description>
102
+ <large_icon href="/api/icons/187e6ea6-1dfb-4ba3-b9b3-889d113c5d02" id="187e6ea6-1dfb-4ba3-b9b3-889d113c5d02"/>
103
+ <small_icon href="/api/icons/2fb99200-62ef-46cc-90d9-8a1cb46f546a" id="2fb99200-62ef-46cc-90d9-8a1cb46f546a"/>
104
+ </operating_system>
105
+ <operating_system href="/api/operatingsystems/17" id="17">
106
+ <name>windows_2008R2x64</name>
107
+ <description>Windows 2008 R2 x64</description>
108
+ <large_icon href="/api/icons/5ce1d3ab-0686-4483-9789-9ad04e2aca88" id="5ce1d3ab-0686-4483-9789-9ad04e2aca88"/>
109
+ <small_icon href="/api/icons/b42b805c-9439-45c4-b6db-43edb4d4abc9" id="b42b805c-9439-45c4-b6db-43edb4d4abc9"/>
110
+ </operating_system>
111
+ <operating_system href="/api/operatingsystems/1001" id="1001">
112
+ <name>other_ppc64</name>
113
+ <description>Other OS</description>
114
+ <large_icon href="/api/icons/e0f2d023-636b-4139-9205-e57b56e93975" id="e0f2d023-636b-4139-9205-e57b56e93975"/>
115
+ <small_icon href="/api/icons/f559f0f3-3539-4955-89b9-f431e9a61fce" id="f559f0f3-3539-4955-89b9-f431e9a61fce"/>
116
+ </operating_system>
117
+ <operating_system href="/api/operatingsystems/16" id="16">
118
+ <name>windows_2008x64</name>
119
+ <description>Windows 2008 x64</description>
120
+ <large_icon href="/api/icons/fda64af2-25a8-4881-b8e6-aae475ec1211" id="fda64af2-25a8-4881-b8e6-aae475ec1211"/>
121
+ <small_icon href="/api/icons/b42b805c-9439-45c4-b6db-43edb4d4abc9" id="b42b805c-9439-45c4-b6db-43edb4d4abc9"/>
122
+ </operating_system>
123
+ <operating_system href="/api/operatingsystems/19" id="19">
124
+ <name>rhel_6x64</name>
125
+ <description>Red Hat Enterprise Linux 6.x x64</description>
126
+ <large_icon href="/api/icons/fc6f23e8-34a9-4a27-abb1-a82995fa976e" id="fc6f23e8-34a9-4a27-abb1-a82995fa976e"/>
127
+ <small_icon href="/api/icons/470c6313-247b-47fd-bda5-8688566792d1" id="470c6313-247b-47fd-bda5-8688566792d1"/>
128
+ </operating_system>
129
+ <operating_system href="/api/operatingsystems/1003" id="1003">
130
+ <name>rhel_6_ppc64</name>
131
+ <description>Red Hat Enterprise Linux 6.x</description>
132
+ <large_icon href="/api/icons/661ae396-a4db-471e-a381-774ecd010c4f" id="661ae396-a4db-471e-a381-774ecd010c4f"/>
133
+ <small_icon href="/api/icons/470c6313-247b-47fd-bda5-8688566792d1" id="470c6313-247b-47fd-bda5-8688566792d1"/>
134
+ </operating_system>
135
+ <operating_system href="/api/operatingsystems/18" id="18">
136
+ <name>rhel_6</name>
137
+ <description>Red Hat Enterprise Linux 6.x</description>
138
+ <large_icon href="/api/icons/b39dd98b-9a6e-44a0-afa4-641267da0db3" id="b39dd98b-9a6e-44a0-afa4-641267da0db3"/>
139
+ <small_icon href="/api/icons/470c6313-247b-47fd-bda5-8688566792d1" id="470c6313-247b-47fd-bda5-8688566792d1"/>
140
+ </operating_system>
141
+ <operating_system href="/api/operatingsystems/1002" id="1002">
142
+ <name>other_linux_ppc64</name>
143
+ <description>Linux</description>
144
+ <large_icon href="/api/icons/61daf86e-a6bb-4497-aedf-d64f185cd35b" id="61daf86e-a6bb-4497-aedf-d64f185cd35b"/>
145
+ <small_icon href="/api/icons/62945139-38d6-4278-859d-903c36bf6f2b" id="62945139-38d6-4278-859d-903c36bf6f2b"/>
146
+ </operating_system>
147
+ <operating_system href="/api/operatingsystems/21" id="21">
148
+ <name>windows_8x64</name>
149
+ <description>Windows 8 x64</description>
150
+ <large_icon href="/api/icons/f5c7045b-196d-4ab3-bb01-f3c2fe7b0a99" id="f5c7045b-196d-4ab3-bb01-f3c2fe7b0a99"/>
151
+ <small_icon href="/api/icons/9ac39e4d-d801-4627-b272-ff2b351adda7" id="9ac39e4d-d801-4627-b272-ff2b351adda7"/>
152
+ </operating_system>
153
+ <operating_system href="/api/operatingsystems/1005" id="1005">
154
+ <name>ubuntu_14_04_ppc64</name>
155
+ <description>Ubuntu Trusty Tahr LTS</description>
156
+ <large_icon href="/api/icons/658238e9-9c49-4c69-ade9-79c9660eedb7" id="658238e9-9c49-4c69-ade9-79c9660eedb7"/>
157
+ <small_icon href="/api/icons/39216915-ed55-430f-a494-2c456c428aac" id="39216915-ed55-430f-a494-2c456c428aac"/>
158
+ </operating_system>
159
+ <operating_system href="/api/operatingsystems/20" id="20">
160
+ <name>windows_8</name>
161
+ <description>Windows 8</description>
162
+ <large_icon href="/api/icons/4790fb01-d3e7-4d97-baf9-9c6119f1ffed" id="4790fb01-d3e7-4d97-baf9-9c6119f1ffed"/>
163
+ <small_icon href="/api/icons/9ac39e4d-d801-4627-b272-ff2b351adda7" id="9ac39e4d-d801-4627-b272-ff2b351adda7"/>
164
+ </operating_system>
165
+ <operating_system href="/api/operatingsystems/1004" id="1004">
166
+ <name>sles_11_ppc64</name>
167
+ <description>SUSE Linux Enterprise Server 11</description>
168
+ <large_icon href="/api/icons/4ed962ed-bc3b-4d54-9d7e-11d62ba4dd68" id="4ed962ed-bc3b-4d54-9d7e-11d62ba4dd68"/>
169
+ <small_icon href="/api/icons/ef709529-51e6-440e-95bf-9465a74112b8" id="ef709529-51e6-440e-95bf-9465a74112b8"/>
170
+ </operating_system>
171
+ <operating_system href="/api/operatingsystems/23" id="23">
172
+ <name>windows_2012x64</name>
173
+ <description>Windows 2012 x64</description>
174
+ <large_icon href="/api/icons/6542d2c0-12e1-4207-9e91-bac0f1ec9269" id="6542d2c0-12e1-4207-9e91-bac0f1ec9269"/>
175
+ <small_icon href="/api/icons/0a193c31-438b-4793-873f-b5b025ee27e1" id="0a193c31-438b-4793-873f-b5b025ee27e1"/>
176
+ </operating_system>
177
+ <operating_system href="/api/operatingsystems/1006" id="1006">
178
+ <name>rhel_7_ppc64</name>
179
+ <description>Red Hat Enterprise Linux 7.x</description>
180
+ <large_icon href="/api/icons/a9cf9feb-77fb-40d8-8dad-22cd60fce493" id="a9cf9feb-77fb-40d8-8dad-22cd60fce493"/>
181
+ <small_icon href="/api/icons/673d6c7d-a593-4e8c-b67d-c443844b3c4b" id="673d6c7d-a593-4e8c-b67d-c443844b3c4b"/>
182
+ </operating_system>
183
+ <operating_system href="/api/operatingsystems/25" id="25">
184
+ <name>windows_2012R2x64</name>
185
+ <description>Windows 2012R2 x64</description>
186
+ <large_icon href="/api/icons/058dd930-2f39-4130-9efe-5015594f14a2" id="058dd930-2f39-4130-9efe-5015594f14a2"/>
187
+ <small_icon href="/api/icons/0a193c31-438b-4793-873f-b5b025ee27e1" id="0a193c31-438b-4793-873f-b5b025ee27e1"/>
188
+ </operating_system>
189
+ <operating_system href="/api/operatingsystems/24" id="24">
190
+ <name>rhel_7x64</name>
191
+ <description>Red Hat Enterprise Linux 7.x x64</description>
192
+ <large_icon href="/api/icons/b4c5e01a-b61e-4dfc-b5d4-bed305aa6802" id="b4c5e01a-b61e-4dfc-b5d4-bed305aa6802"/>
193
+ <small_icon href="/api/icons/673d6c7d-a593-4e8c-b67d-c443844b3c4b" id="673d6c7d-a593-4e8c-b67d-c443844b3c4b"/>
194
+ </operating_system>
195
+ <operating_system href="/api/operatingsystems/27" id="27">
196
+ <name>windows_10x64</name>
197
+ <description>Windows 10 x64</description>
198
+ <large_icon href="/api/icons/210eccd0-e40a-488c-b0e7-975129bcd268" id="210eccd0-e40a-488c-b0e7-975129bcd268"/>
199
+ <small_icon href="/api/icons/dc93fda8-c6ed-4bd7-8e6e-d9423952f3b5" id="dc93fda8-c6ed-4bd7-8e6e-d9423952f3b5"/>
200
+ </operating_system>
201
+ <operating_system href="/api/operatingsystems/26" id="26">
202
+ <name>windows_10</name>
203
+ <description>Windows 10</description>
204
+ <large_icon href="/api/icons/148d175f-bc51-4136-a85b-b6d5df975b12" id="148d175f-bc51-4136-a85b-b6d5df975b12"/>
205
+ <small_icon href="/api/icons/5f8bceee-71ce-4665-8104-bc868d92480c" id="5f8bceee-71ce-4665-8104-bc868d92480c"/>
206
+ </operating_system>
207
+ <operating_system href="/api/operatingsystems/1255" id="1255">
208
+ <name>ubuntu_13_10</name>
209
+ <description>Ubuntu Saucy Salamander</description>
210
+ <large_icon href="/api/icons/b415d06d-9ebd-4db1-91a8-0be4b91ebe7d" id="b415d06d-9ebd-4db1-91a8-0be4b91ebe7d"/>
211
+ <small_icon href="/api/icons/08e0268d-1d29-4609-87d7-2101e39dcbb5" id="08e0268d-1d29-4609-87d7-2101e39dcbb5"/>
212
+ </operating_system>
213
+ <operating_system href="/api/operatingsystems/1254" id="1254">
214
+ <name>ubuntu_13_04</name>
215
+ <description>Ubuntu Raring Ringtails</description>
216
+ <large_icon href="/api/icons/5cf3e2cf-1f60-43cf-ab0c-e20c5b9140f3" id="5cf3e2cf-1f60-43cf-ab0c-e20c5b9140f3"/>
217
+ <small_icon href="/api/icons/295ce8a2-3f75-4ab8-911f-ef6f89f3234d" id="295ce8a2-3f75-4ab8-911f-ef6f89f3234d"/>
218
+ </operating_system>
219
+ <operating_system href="/api/operatingsystems/1253" id="1253">
220
+ <name>ubuntu_12_10</name>
221
+ <description>Ubuntu Quantal Quetzal</description>
222
+ <large_icon href="/api/icons/fa867707-0914-4405-a87a-d3549c2329ed" id="fa867707-0914-4405-a87a-d3549c2329ed"/>
223
+ <small_icon href="/api/icons/3a8eaa56-2a80-4053-b736-cd247131a23b" id="3a8eaa56-2a80-4053-b736-cd247131a23b"/>
224
+ </operating_system>
225
+ <operating_system href="/api/operatingsystems/1252" id="1252">
226
+ <name>ubuntu_12_04</name>
227
+ <description>Ubuntu Precise Pangolin LTS</description>
228
+ <large_icon href="/api/icons/30db59e4-62cc-4142-857d-7a0bc92d68d3" id="30db59e4-62cc-4142-857d-7a0bc92d68d3"/>
229
+ <small_icon href="/api/icons/7bf1c98a-e2e4-4290-a3b5-8ac1a2e8bd64" id="7bf1c98a-e2e4-4290-a3b5-8ac1a2e8bd64"/>
230
+ </operating_system>
231
+ <operating_system href="/api/operatingsystems/1193" id="1193">
232
+ <name>sles_11</name>
233
+ <description>SUSE Linux Enterprise Server 11</description>
234
+ <large_icon href="/api/icons/56ecd832-7a11-4bf0-9afb-7a3a2b54efb3" id="56ecd832-7a11-4bf0-9afb-7a3a2b54efb3"/>
235
+ <small_icon href="/api/icons/ef709529-51e6-440e-95bf-9465a74112b8" id="ef709529-51e6-440e-95bf-9465a74112b8"/>
236
+ </operating_system>
237
+ <operating_system href="/api/operatingsystems/1256" id="1256">
238
+ <name>ubuntu_14_04</name>
239
+ <description>Ubuntu Trusty Tahr LTS</description>
240
+ <large_icon href="/api/icons/387aa324-ba3a-40b6-bd99-653bfb3e9e43" id="387aa324-ba3a-40b6-bd99-653bfb3e9e43"/>
241
+ <small_icon href="/api/icons/39216915-ed55-430f-a494-2c456c428aac" id="39216915-ed55-430f-a494-2c456c428aac"/>
242
+ </operating_system>
243
+ </operating_systems>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_plugin_helper'
4
+
5
+ module ForemanOvirt
6
+ class ProviderEnumTest < ActiveSupport::TestCase
7
+ test 'Ovirt provider is registered in ProviderEnum when plugin is loaded' do
8
+ assert_includes ::Types::ProviderEnum.values.keys, 'Ovirt',
9
+ 'Ovirt provider should be registered in ProviderEnum by the foreman_ovirt plugin'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_plugin_helper'
4
+ require 'integration_test_helper'
5
+
6
+ module ForemanOvirt
7
+ class ComputeProfileJSTest < IntegrationTestWithJavascript
8
+ setup do
9
+ Fog.mock!
10
+ @ovirt_cr = FactoryBot.create(:ovirt_cr)
11
+ end
12
+
13
+ teardown do
14
+ Fog.unmock!
15
+ end
16
+
17
+ test 'create compute profile' do
18
+ visit compute_profiles_path
19
+ click_on('Create Compute Profile')
20
+ fill_in('compute_profile_name', with: 'test')
21
+ click_on('Submit')
22
+
23
+ click_link(@ovirt_cr.to_s)
24
+ assert page.has_select?('compute_attribute[vm_attrs][vm_template]')
25
+
26
+ # Selecting a template triggers a POST to template_selected. The JS handler
27
+ # in ovirt.js receives the response and populates memory and cores via
28
+ # setMemoryInputProps and updateCoresAndSockets.
29
+ # Fog.mock! intercepts the client calls so no real oVirt connection is made.
30
+ select('hwp_small (base version)', from: 'compute_attribute[vm_attrs][vm_template]')
31
+ wait_for_ajax
32
+
33
+ click_button('Submit')
34
+
35
+ created_profile = ComputeProfile.find_by!(name: 'test')
36
+ assert_current_path compute_profile_path(created_profile)
37
+
38
+ # Reload the form and verify the template values were saved and are
39
+ # rendered back correctly by the server.
40
+ # hwp_small has memory: 536870912 bytes (512 MB) and cores: 1 per Fog mock data.
41
+ visit compute_profiles_path
42
+ click_link('test')
43
+ click_link(@ovirt_cr.to_s)
44
+
45
+ assert_equal '512 MB', find_field('compute_attribute_vm_attrs_memory').value
46
+ assert_equal '1', find_field('compute_attribute_vm_attrs_cores').value
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Metrics/ModuleLength
4
+ module ComputeResourceTestHelpers
5
+ def empty_servers
6
+ servers = mock
7
+ servers.stubs(:get).returns(nil)
8
+ servers
9
+ end
10
+
11
+ def servers_raising_exception(exception)
12
+ servers = mock
13
+ servers.stubs(:get).raises(exception)
14
+ servers
15
+ end
16
+
17
+ def mock_cr_servers(compute_resource, servers)
18
+ client = mock
19
+ client.stubs(:servers).returns(servers)
20
+
21
+ compute_resource.stubs(:client).returns(client)
22
+ compute_resource
23
+ end
24
+
25
+ def mock_cr(compute_resource, attributes)
26
+ attributes.each do |attr, stubbed_value|
27
+ compute_resource.stubs(attr).returns(stubbed_value)
28
+ end
29
+ compute_resource
30
+ end
31
+
32
+ def assert_find_by_uuid_raises(ex_class, compute_resource)
33
+ assert_raises(ex_class) do
34
+ compute_resource.find_vm_by_uuid('abc')
35
+ end
36
+ end
37
+
38
+ def assert_blank_attr_nilified(compute_resource, attr_name)
39
+ vm_attrs = {
40
+ attr_name => '',
41
+ }
42
+ normalized = compute_resource.normalize_vm_attrs(vm_attrs)
43
+
44
+ assert(normalized.key?(attr_name))
45
+ assert_nil(normalized[attr_name])
46
+ end
47
+
48
+ def assert_attrs_mapped(compute_resource, attr_before, attr_after)
49
+ vm_attrs = {
50
+ attr_before => 'ATTR_VALUE',
51
+ }
52
+ normalized = compute_resource.normalize_vm_attrs(vm_attrs)
53
+
54
+ assert_not(normalized.key?(attr_before))
55
+ assert_equal(
56
+ 'ATTR_VALUE', normalized[attr_after]
57
+ )
58
+ end
59
+
60
+ def assert_blank_mapped_attr_nilified(compute_resource, attr_before, attr_after)
61
+ vm_attrs = {
62
+ attr_before => '',
63
+ }
64
+ normalized = compute_resource.normalize_vm_attrs(vm_attrs)
65
+
66
+ assert_not(normalized.key?(attr_before))
67
+ assert(normalized.key?(attr_after))
68
+ assert_nil(normalized[attr_after])
69
+ end
70
+
71
+ # rubocop:disable Metrics/MethodLength
72
+ #
73
+ def allowed_vm_attr_names
74
+ @allowed_vm_attr_names ||= %w[
75
+ add_cdrom
76
+ annotation
77
+ availability_zone
78
+ boot_from_volume
79
+ boot_volume_size
80
+ cluster_id
81
+ cluster_name
82
+ cores
83
+ cores_per_socket
84
+ cpu_hot_add_enabled
85
+ cpus
86
+ associate_external_ip
87
+ firmware
88
+ flavor_id
89
+ flavor_name
90
+ floating_ip_network
91
+ folder_name
92
+ folder_path
93
+ guest_id
94
+ guest_name
95
+ hardware_version_id
96
+ hardware_version_name
97
+ image_id
98
+ image_name
99
+ interfaces_attributes
100
+ keys
101
+ machine_type
102
+ managed_ip
103
+ memory
104
+ memory_hot_add_enabled
105
+ network
106
+ resource_pool_id
107
+ resource_pool_name
108
+ scheduler_hint_filter
109
+ scsi_controllers
110
+ nvme_controllers
111
+ security_groups
112
+ security_group_id
113
+ security_group_name
114
+ subnet_id
115
+ subnet_name
116
+ template_id
117
+ template_name
118
+ tenant_id
119
+ tenant_name
120
+ volumes_attributes
121
+ ]
122
+ end
123
+
124
+ # rubocop:enable Metrics/MethodLength
125
+
126
+ def check_vm_attribute_names(compute_resource)
127
+ normalized_keys = compute_resource.normalize_vm_attrs({}).keys
128
+
129
+ normalized_keys.each do |name|
130
+ assert_equal(name, name.to_s.underscore,
131
+ "Attribute '#{name}' breaks naming conventions. All attributes should be in snake_case.")
132
+ end
133
+
134
+ unexpected_names = normalized_keys - (normalized_keys & allowed_vm_attr_names)
135
+ msg = "Some unexpected attributes detected: #{unexpected_names.join(', ')}."
136
+ msg += "\nMake user you can't use one of names that already exist.
137
+ If not, please extend ComputeResourceTestHelpers.allowed_vm_attr_names."
138
+ assert_empty(
139
+ unexpected_names, msg
140
+ )
141
+ end
142
+ end
143
+ # rubocop:enable Metrics/ModuleLength