svengali 0.2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/LICENSE +20 -0
  2. data/README +0 -0
  3. data/README.rdoc +17 -0
  4. data/Rakefile +47 -0
  5. data/VERSION +1 -0
  6. data/api_document020_en.pdf +0 -0
  7. data/api_document020_ja.pdf +0 -0
  8. data/api_document_en.pptx +0 -0
  9. data/api_document_ja.pptx +0 -0
  10. data/lib/svengali.rb +2 -0
  11. data/lib/svengali/config.rb +78 -0
  12. data/lib/svengali/ext_string.rb +55 -0
  13. data/lib/svengali/ext_string/command.yml +6 -0
  14. data/lib/svengali/ext_string/path.yml +6 -0
  15. data/lib/svengali/file_io.rb +106 -0
  16. data/lib/svengali/machine.rb +123 -0
  17. data/lib/svengali/platforms/debian.rb +5 -0
  18. data/lib/svengali/platforms/default.rb +4 -0
  19. data/lib/svengali/plugins/eucalyptus.rb +339 -0
  20. data/lib/svengali/plugins/machine_config.rb +126 -0
  21. data/lib/svengali/plugins/package.rb +7 -0
  22. data/lib/svengali/ssh.rb +106 -0
  23. data/lib/svengali/svengali.rb +19 -0
  24. data/lib/svengali/util.rb +117 -0
  25. data/rdoc/classes/CLibIPAddr.html +230 -0
  26. data/rdoc/classes/Cloud.html +506 -0
  27. data/rdoc/classes/Config.html +151 -0
  28. data/rdoc/classes/Config/ConfigFile.html +319 -0
  29. data/rdoc/classes/ExtStr.html +209 -0
  30. data/rdoc/classes/ExtStrAccessor.html +183 -0
  31. data/rdoc/classes/FileIO.html +415 -0
  32. data/rdoc/classes/Machine.html +771 -0
  33. data/rdoc/classes/MachineMaster.html +117 -0
  34. data/rdoc/classes/Platform.html +121 -0
  35. data/rdoc/classes/SSH.html +315 -0
  36. data/rdoc/created.rid +1 -0
  37. data/rdoc/files/README.html +101 -0
  38. data/rdoc/files/README_rdoc.html +133 -0
  39. data/rdoc/files/lib/svengali/config_rb.html +114 -0
  40. data/rdoc/files/lib/svengali/ext_string_rb.html +108 -0
  41. data/rdoc/files/lib/svengali/file_io_rb.html +115 -0
  42. data/rdoc/files/lib/svengali/machine_rb.html +108 -0
  43. data/rdoc/files/lib/svengali/platforms/debian_rb.html +107 -0
  44. data/rdoc/files/lib/svengali/platforms/default_rb.html +107 -0
  45. data/rdoc/files/lib/svengali/plugins/eucalyptus_rb.html +389 -0
  46. data/rdoc/files/lib/svengali/plugins/machine_config_rb.html +101 -0
  47. data/rdoc/files/lib/svengali/plugins/package_rb.html +101 -0
  48. data/rdoc/files/lib/svengali/ssh_rb.html +110 -0
  49. data/rdoc/files/lib/svengali/svengali_rb.html +125 -0
  50. data/rdoc/files/lib/svengali/util_rb.html +439 -0
  51. data/rdoc/files/lib/svengali_rb.html +108 -0
  52. data/rdoc/fr_class_index.html +37 -0
  53. data/rdoc/fr_file_index.html +41 -0
  54. data/rdoc/fr_method_index.html +100 -0
  55. data/rdoc/index.html +26 -0
  56. data/rdoc/rdoc-style.css +208 -0
  57. data/spec/spec.opts +1 -0
  58. data/spec/spec_helper.rb +9 -0
  59. data/spec/svengali_spec.rb +7 -0
  60. data/svengali.gemspec +113 -0
  61. data/svengali_sample.rb +43 -0
  62. data/test/scenario.sh +3 -0
  63. metadata +179 -0
@@ -0,0 +1,506 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Cloud</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Cloud</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/svengali/plugins/eucalyptus_rb.html">
59
+ lib/svengali/plugins/eucalyptus.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000019">Cloud</a>&nbsp;&nbsp;
90
+ <a href="#M000026">dump_machine_cache_info</a>&nbsp;&nbsp;
91
+ <a href="#M000021">get_a_machine</a>&nbsp;&nbsp;
92
+ <a href="#M000020">get_a_machine_with_imageup</a>&nbsp;&nbsp;
93
+ <a href="#M000023">get_ipaddr_of_instance</a>&nbsp;&nbsp;
94
+ <a href="#M000024">get_ipaddr_of_instance_pre</a>&nbsp;&nbsp;
95
+ <a href="#M000022">is_exist_requested_machine</a>&nbsp;&nbsp;
96
+ <a href="#M000027">load_machine_cache_info</a>&nbsp;&nbsp;
97
+ <a href="#M000025">set_whether_do_cache</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+
103
+
104
+ <!-- if includes -->
105
+
106
+ <div id="section">
107
+
108
+
109
+ <div id="constants-list">
110
+ <h3 class="section-bar">Constants</h3>
111
+
112
+ <div class="name-list">
113
+ <table summary="Constants">
114
+ <tr class="top-aligned-row context-row">
115
+ <td class="context-item-name">DHCP_LEASE_RANGE</td>
116
+ <td>=</td>
117
+ <td class="context-item-value">&quot;xxx.xxx.xxx.xxx&quot;</td>
118
+ <td width="3em">&nbsp;</td>
119
+ <td class="context-item-desc">
120
+ TODO: enabling lib to find newly booted node without pinging
121
+
122
+ </td>
123
+ </tr>
124
+ <tr class="top-aligned-row context-row">
125
+ <td class="context-item-name">CACHE_FILE_NAME</td>
126
+ <td>=</td>
127
+ <td class="context-item-value">&quot;./machine_cache_hash.yml&quot;</td>
128
+ </tr>
129
+ </table>
130
+ </div>
131
+ </div>
132
+
133
+
134
+
135
+
136
+
137
+
138
+ <!-- if method_list -->
139
+ <div id="methods">
140
+ <h3 class="section-bar">Public Class methods</h3>
141
+
142
+ <div id="method-M000019" class="method-detail">
143
+ <a name="M000019"></a>
144
+
145
+ <div class="method-heading">
146
+ <a href="#M000019" class="method-signature">
147
+ <span class="method-name">Cloud</span><span class="method-args">(default_user,default_pass)</span>
148
+ </a>
149
+ </div>
150
+
151
+ <div class="method-description">
152
+ <p><a class="source-toggle" href="#"
153
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
154
+ <div class="method-source-code" id="M000019-source">
155
+ <pre>
156
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 176</span>
157
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">Cloud</span>(<span class="ruby-identifier">default_user</span>,<span class="ruby-identifier">default_pass</span>)
158
+ <span class="ruby-ivar">@@default_user</span> = <span class="ruby-identifier">default_user</span>
159
+ <span class="ruby-ivar">@@default_pass</span> = <span class="ruby-identifier">default_pass</span>
160
+ <span class="ruby-keyword kw">end</span>
161
+ </pre>
162
+ </div>
163
+ </div>
164
+ </div>
165
+
166
+ <div id="method-M000026" class="method-detail">
167
+ <a name="M000026"></a>
168
+
169
+ <div class="method-heading">
170
+ <a href="#M000026" class="method-signature">
171
+ <span class="method-name">dump_machine_cache_info</span><span class="method-args">(machine_cache_hash)</span>
172
+ </a>
173
+ </div>
174
+
175
+ <div class="method-description">
176
+ <p>
177
+ machine_cache_hash -&gt; hash : {&quot;xxx.xxx.xxx.xxx&quot; =&gt;
178
+ &quot;i-xxxxxxx&quot;, &#8230; }
179
+ </p>
180
+ <p><a class="source-toggle" href="#"
181
+ onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
182
+ <div class="method-source-code" id="M000026-source">
183
+ <pre>
184
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 310</span>
185
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dump_machine_cache_info</span>(<span class="ruby-identifier">machine_cache_hash</span>)
186
+ <span class="ruby-identifier">file</span> = <span class="ruby-identifier">open</span>(<span class="ruby-constant">CACHE_FILE_NAME</span>,<span class="ruby-value str">&quot;w&quot;</span>)
187
+ <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">machine_cache_hash</span>,<span class="ruby-identifier">file</span>)
188
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span>()
189
+ <span class="ruby-keyword kw">end</span>
190
+ </pre>
191
+ </div>
192
+ </div>
193
+ </div>
194
+
195
+ <div id="method-M000021" class="method-detail">
196
+ <a name="M000021"></a>
197
+
198
+ <div class="method-heading">
199
+ <a href="#M000021" class="method-signature">
200
+ <span class="method-name">get_a_machine</span><span class="method-args">(params_hash)</span>
201
+ </a>
202
+ </div>
203
+
204
+ <div class="method-description">
205
+ <p>
206
+ return -&gt; <a href="Machine.html">Machine</a> : <a
207
+ href="Machine.html">Machine</a> instance applied network configuration and
208
+ establised session
209
+ </p>
210
+ <p><a class="source-toggle" href="#"
211
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
212
+ <div class="method-source-code" id="M000021-source">
213
+ <pre>
214
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 196</span>
215
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_a_machine</span>(<span class="ruby-identifier">params_hash</span>)
216
+
217
+ <span class="ruby-comment cmt"># if @@do_cache true, Cloud class tries to reuse guest instance on Eucalyptus</span>
218
+ <span class="ruby-comment cmt"># whether exist appropriate instace is checked in terms of IP address</span>
219
+ <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">is_exist_requested_machine</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@@do_cache</span>
220
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;reused a guset instance which has address #{params_hash[:ipaddr]}&quot;</span>
221
+ <span class="ruby-comment cmt"># load instance ID corresponding to requested IP address from cache file</span>
222
+ <span class="ruby-identifier">machine_cache_hash</span> = <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">load_machine_cache_info</span>()
223
+ <span class="ruby-identifier">instance_id</span> = <span class="ruby-identifier">machine_cache_hash</span>[<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]]
224
+ <span class="ruby-keyword kw">else</span>
225
+ <span class="ruby-comment cmt"># calling of this method isn't needed under normal conditions</span>
226
+ <span class="ruby-identifier">get_ipaddr_of_instance_pre</span>()
227
+
228
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;executing euca-run-instance....&quot;</span>
229
+ <span class="ruby-comment cmt"># ** Attention ** below is draft code</span>
230
+ <span class="ruby-identifier">instance_id</span> = <span class="ruby-identifier">run_image</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:imageid</span>])
231
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;euca-run-instance finished.&quot;</span>
232
+
233
+ <span class="ruby-comment cmt">#get a CLibIPAddr insance</span>
234
+ <span class="ruby-identifier">ipaddr</span> = <span class="ruby-identifier">get_ipaddr_of_instance</span>(<span class="ruby-identifier">instance_id</span>)
235
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;IP address of the kicked instance: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ipaddr</span>.<span class="ruby-identifier">to_s</span>
236
+
237
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;configure network setting to the kicked instance.&quot;</span>
238
+ <span class="ruby-identifier">vanilla_machine</span> = <span class="ruby-constant">Machine</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ipaddr</span>)
239
+ <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">set_auth_info</span>(<span class="ruby-constant">DEFAULT_USER</span>,<span class="ruby-constant">DEFAULT_PASS</span>)
240
+ <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">establish_session</span>()
241
+
242
+ <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">config_nw_interface</span>(<span class="ruby-identifier">:ipaddr</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>], <span class="ruby-identifier">:interface</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:interface</span>], <span class="ruby-identifier">:netmask</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:netmask</span>], <span class="ruby-identifier">:gateway</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:gateway</span>], <span class="ruby-identifier">:onboot</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;yes&quot;</span>)
243
+ <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">set_resolver</span>(<span class="ruby-identifier">:primary_ip</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:dns</span>],<span class="ruby-identifier">:interface</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:interface</span>])
244
+
245
+ <span class="ruby-comment cmt">#reloads network configuration</span>
246
+ <span class="ruby-comment cmt">#10 seconds after, this will return with nil value</span>
247
+ <span class="ruby-comment cmt"># TODO: should eliminate assumption for platform</span>
248
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;reload network configuration....&quot;</span>
249
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">vanilla_machine</span>.<span class="ruby-identifier">exec!</span>(<span class="ruby-value str">&quot;/sbin/service network restart&quot;</span>, <span class="ruby-value">10</span>)
250
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;reloading of network configuration may have finished.&quot;</span>
251
+
252
+ <span class="ruby-comment cmt"># write machine info to cache file</span>
253
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@do_cache</span>
254
+ <span class="ruby-identifier">machine_cache_hash</span> = <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">load_machine_cache_info</span>()
255
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;----------------loaded_hash------------------&quot;</span>
256
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">machine_cache_hash</span>.<span class="ruby-identifier">inspect</span>()
257
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;class name of machine_cache_hash is #{machine_cache_hash.class}&quot;</span>
258
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-value str">&quot;---------------------------------------------&quot;</span>
259
+ <span class="ruby-identifier">machine_cache_hash</span>[<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>]] = <span class="ruby-identifier">instance_id</span>
260
+ <span class="ruby-constant">Cloud</span>.<span class="ruby-identifier">dump_machine_cache_info</span>(<span class="ruby-identifier">machine_cache_hash</span>)
261
+ <span class="ruby-keyword kw">end</span>
262
+
263
+ <span class="ruby-keyword kw">end</span>
264
+
265
+ <span class="ruby-identifier">configured_machine</span> = <span class="ruby-constant">Machine</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:ipaddr</span>])
266
+ <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">set_auth_info</span>(<span class="ruby-constant">DEFAULT_USER</span>,<span class="ruby-constant">DEFAULT_PASS</span>)
267
+ <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">establish_session</span>()
268
+ <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">set_instance_info</span>(<span class="ruby-identifier">instance_id</span>)
269
+
270
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@do_cache</span>
271
+ <span class="ruby-identifier">configured_machine</span>.<span class="ruby-identifier">set_whether_do_cache</span>(<span class="ruby-keyword kw">true</span>)
272
+ <span class="ruby-keyword kw">end</span>
273
+
274
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">configured_machine</span>
275
+ <span class="ruby-keyword kw">end</span>
276
+ </pre>
277
+ </div>
278
+ </div>
279
+ </div>
280
+
281
+ <div id="method-M000020" class="method-detail">
282
+ <a name="M000020"></a>
283
+
284
+ <div class="method-heading">
285
+ <a href="#M000020" class="method-signature">
286
+ <span class="method-name">get_a_machine_with_imageup</span><span class="method-args">(params_hash)</span>
287
+ </a>
288
+ </div>
289
+
290
+ <div class="method-description">
291
+ <p>
292
+ return -&gt; <a href="Machine.html">Machine</a> : <a
293
+ href="Machine.html">Machine</a> instance applied network configuration and
294
+ establised session
295
+ </p>
296
+ <p><a class="source-toggle" href="#"
297
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
298
+ <div class="method-source-code" id="M000020-source">
299
+ <pre>
300
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 182</span>
301
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_a_machine_with_imageup</span>(<span class="ruby-identifier">params_hash</span>)
302
+ <span class="ruby-identifier">check_has_keys</span>(<span class="ruby-identifier">params_hash</span>,[<span class="ruby-identifier">:imagepath</span>])
303
+
304
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">:imageid</span>] = <span class="ruby-identifier">upload_and_register_image</span>(<span class="ruby-identifier">params_hash</span>[<span class="ruby-identifier">image_path_str</span>],<span class="ruby-value">120</span>)
305
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;uploading and registration of image failed&quot;</span>
306
+ <span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">&quot;I wll exit&quot;</span>)
307
+ <span class="ruby-keyword kw">end</span>
308
+
309
+ <span class="ruby-identifier">not_tested</span>()
310
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_a_machine</span>(<span class="ruby-identifier">params_hash</span>)
311
+ <span class="ruby-keyword kw">end</span>
312
+ </pre>
313
+ </div>
314
+ </div>
315
+ </div>
316
+
317
+ <div id="method-M000023" class="method-detail">
318
+ <a name="M000023"></a>
319
+
320
+ <div class="method-heading">
321
+ <a href="#M000023" class="method-signature">
322
+ <span class="method-name">get_ipaddr_of_instance</span><span class="method-args">(instance_id)</span>
323
+ </a>
324
+ </div>
325
+
326
+ <div class="method-description">
327
+ <p>
328
+ ** Attention ** this is quick-fix implementation
329
+ </p>
330
+ <pre>
331
+ this method can't work on parallel kicking
332
+ </pre>
333
+ <p>
334
+ return -&gt; <a href="CLibIPAddr.html">CLibIPAddr</a> : xxx
335
+ </p>
336
+ <p><a class="source-toggle" href="#"
337
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
338
+ <div class="method-source-code" id="M000023-source">
339
+ <pre>
340
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 268</span>
341
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_ipaddr_of_instance</span>(<span class="ruby-identifier">instance_id</span>)
342
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@pre_alived_hash</span>
343
+ <span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">&quot;get_ipaddr_of_instance_pre() should be called on the eve of run_image(...)&quot;</span>)
344
+ <span class="ruby-keyword kw">end</span>
345
+
346
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-ivar">@@pre_alived_hash</span>.<span class="ruby-identifier">inspect</span>()
347
+
348
+ <span class="ruby-keyword kw">while</span>(<span class="ruby-keyword kw">true</span>)
349
+ <span class="ruby-identifier">alived_hash</span> = <span class="ruby-identifier">find_machines_on_range_by_ping</span>(<span class="ruby-constant">DHCP_LEASE_RANGE</span>)
350
+
351
+ <span class="ruby-comment cmt"># find difference</span>
352
+ <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@pre_alived_hash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>)}
353
+
354
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
355
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">inspect</span>()
356
+ <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">shift</span>()[<span class="ruby-value">0</span>]
357
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;found #{ret}&quot;</span>
358
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">CLibIPAddr</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ret</span>)
359
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">alived_hash</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
360
+ <span class="ruby-identifier">err_message_and_exit</span>(<span class="ruby-value str">&quot;There may be other booting machine!&quot;</span>)
361
+ <span class="ruby-keyword kw">end</span>
362
+ <span class="ruby-identifier">sleep</span> <span class="ruby-value">1</span> <span class="ruby-comment cmt">#leave a space</span>
363
+ <span class="ruby-keyword kw">end</span>
364
+
365
+ <span class="ruby-keyword kw">end</span>
366
+ </pre>
367
+ </div>
368
+ </div>
369
+ </div>
370
+
371
+ <div id="method-M000024" class="method-detail">
372
+ <a name="M000024"></a>
373
+
374
+ <div class="method-heading">
375
+ <a href="#M000024" class="method-signature">
376
+ <span class="method-name">get_ipaddr_of_instance_pre</span><span class="method-args">()</span>
377
+ </a>
378
+ </div>
379
+
380
+ <div class="method-description">
381
+ <p>
382
+ call of this method isn&#8216;t needed under normal conditions this method
383
+ should be called on the eve of run_image(&#8230;)
384
+ </p>
385
+ <p><a class="source-toggle" href="#"
386
+ onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
387
+ <div class="method-source-code" id="M000024-source">
388
+ <pre>
389
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 296</span>
390
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_ipaddr_of_instance_pre</span>()
391
+ <span class="ruby-ivar">@@pre_alived_hash</span> = <span class="ruby-identifier">find_machines_on_range_by_ping</span>(<span class="ruby-constant">DHCP_LEASE_RANGE</span>)
392
+ <span class="ruby-keyword kw">end</span>
393
+ </pre>
394
+ </div>
395
+ </div>
396
+ </div>
397
+
398
+ <div id="method-M000022" class="method-detail">
399
+ <a name="M000022"></a>
400
+
401
+ <div class="method-heading">
402
+ <a href="#M000022" class="method-signature">
403
+ <span class="method-name">is_exist_requested_machine</span><span class="method-args">(ipaddr)</span>
404
+ </a>
405
+ </div>
406
+
407
+ <div class="method-description">
408
+ <p>
409
+ ipaddr -&gt; <a href="CLibIPAddr.html">CLibIPAddr</a> whether exist
410
+ appropriate instace is checked in terms of IP address
411
+ </p>
412
+ <p><a class="source-toggle" href="#"
413
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
414
+ <div class="method-source-code" id="M000022-source">
415
+ <pre>
416
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 260</span>
417
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_exist_requested_machine</span>(<span class="ruby-identifier">ipaddr</span>)
418
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">is_exist_by_ping</span>(<span class="ruby-identifier">ipaddr</span>)
419
+ <span class="ruby-keyword kw">end</span>
420
+ </pre>
421
+ </div>
422
+ </div>
423
+ </div>
424
+
425
+ <div id="method-M000027" class="method-detail">
426
+ <a name="M000027"></a>
427
+
428
+ <div class="method-heading">
429
+ <a href="#M000027" class="method-signature">
430
+ <span class="method-name">load_machine_cache_info</span><span class="method-args">()</span>
431
+ </a>
432
+ </div>
433
+
434
+ <div class="method-description">
435
+ <p>
436
+ return -&gt; hash: {&quot;xxx.xxx.xxx.xxx&quot; =&gt;
437
+ &quot;i-xxxxxxx&quot;, &#8230; } if chache file doesn&#8216;t exist, return
438
+ a empty hash
439
+ </p>
440
+ <p><a class="source-toggle" href="#"
441
+ onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
442
+ <div class="method-source-code" id="M000027-source">
443
+ <pre>
444
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 318</span>
445
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_machine_cache_info</span>()
446
+ <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">CACHE_FILE_NAME</span>)
447
+ <span class="ruby-identifier">ret_hash</span> = <span class="ruby-keyword kw">nil</span>
448
+ <span class="ruby-identifier">open</span>(<span class="ruby-constant">CACHE_FILE_NAME</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
449
+ <span class="ruby-identifier">ret_hash</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
450
+ }
451
+
452
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret_hash</span>
453
+ <span class="ruby-keyword kw">else</span>
454
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>()
455
+ <span class="ruby-keyword kw">end</span>
456
+ <span class="ruby-keyword kw">end</span>
457
+ </pre>
458
+ </div>
459
+ </div>
460
+ </div>
461
+
462
+ <div id="method-M000025" class="method-detail">
463
+ <a name="M000025"></a>
464
+
465
+ <div class="method-heading">
466
+ <a href="#M000025" class="method-signature">
467
+ <span class="method-name">set_whether_do_cache</span><span class="method-args">(true_or_false)</span>
468
+ </a>
469
+ </div>
470
+
471
+ <div class="method-description">
472
+ <p>
473
+ set whether cache and reuse guest instance on Eucalyptus if true value is
474
+ set
475
+ </p>
476
+ <pre>
477
+ - get_a_machine(...) tries to reuse guest instance on Eucalyptus
478
+ - destroy_instance(...) of Machine class doesn't terminate instance
479
+ - write kicked machine info to cache file
480
+ </pre>
481
+ <p><a class="source-toggle" href="#"
482
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
483
+ <div class="method-source-code" id="M000025-source">
484
+ <pre>
485
+ <span class="ruby-comment cmt"># File lib/svengali/plugins/eucalyptus.rb, line 305</span>
486
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set_whether_do_cache</span>(<span class="ruby-identifier">true_or_false</span>)
487
+ <span class="ruby-ivar">@@do_cache</span> = <span class="ruby-identifier">true_or_false</span>
488
+ <span class="ruby-keyword kw">end</span>
489
+ </pre>
490
+ </div>
491
+ </div>
492
+ </div>
493
+
494
+
495
+ </div>
496
+
497
+
498
+ </div>
499
+
500
+
501
+ <div id="validator-badges">
502
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
503
+ </div>
504
+
505
+ </body>
506
+ </html>