wf_node_api 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +28 -0
  4. data/Gemfile.lock +66 -0
  5. data/LICENSE +340 -0
  6. data/Makefile +19 -0
  7. data/README.md +78 -0
  8. data/Rakefile +2 -0
  9. data/Vagrantfile +102 -0
  10. data/_docs/api/Api/NodeApi.html +123 -0
  11. data/_docs/api/Api.html +149 -0
  12. data/_docs/api/Config/Check.html +331 -0
  13. data/_docs/api/Config.html +115 -0
  14. data/_docs/api/ConfigCheck.html +365 -0
  15. data/_docs/api/ContainerManager.html +1632 -0
  16. data/_docs/api/ContainerManagerAdapter/Lxc.html +1352 -0
  17. data/_docs/api/ContainerManagerAdapter/Vserver.html +1358 -0
  18. data/_docs/api/ContainerManagerAdapter.html +151 -0
  19. data/_docs/api/Error/NotFound.html +134 -0
  20. data/_docs/api/Error.html +115 -0
  21. data/_docs/api/NotFoundError.html +157 -0
  22. data/_docs/api/OS.html +234 -0
  23. data/_docs/api/ResourceManager.html +322 -0
  24. data/_docs/api/ResourceManagerAdapter/Linux.html +326 -0
  25. data/_docs/api/ResourceManagerAdapter.html +149 -0
  26. data/_docs/api/WfNodeApi.html +163 -0
  27. data/_docs/api/_index.html +239 -0
  28. data/_docs/api/class_list.html +58 -0
  29. data/_docs/api/css/common.css +1 -0
  30. data/_docs/api/css/full_list.css +57 -0
  31. data/_docs/api/css/style.css +339 -0
  32. data/_docs/api/file.README.html +146 -0
  33. data/_docs/api/file_list.html +60 -0
  34. data/_docs/api/frames.html +26 -0
  35. data/_docs/api/index.html +146 -0
  36. data/_docs/api/js/app.js +219 -0
  37. data/_docs/api/js/full_list.js +181 -0
  38. data/_docs/api/js/jquery.js +4 -0
  39. data/_docs/api/method_list.html +273 -0
  40. data/_docs/api/top-level-namespace.html +244 -0
  41. data/_docs/rest/api_data.js +1 -0
  42. data/_docs/rest/api_data.json +1 -0
  43. data/_docs/rest/api_project.js +1 -0
  44. data/_docs/rest/api_project.json +1 -0
  45. data/_docs/rest/css/style.css +538 -0
  46. data/_docs/rest/header.md +3 -0
  47. data/_docs/rest/img/favicon.ico +0 -0
  48. data/_docs/rest/img/glyphicons-halflings-white.png +0 -0
  49. data/_docs/rest/img/glyphicons-halflings.png +0 -0
  50. data/_docs/rest/index.html +658 -0
  51. data/_docs/rest/locales/de.js +25 -0
  52. data/_docs/rest/locales/fr.js +25 -0
  53. data/_docs/rest/locales/locale.js +43 -0
  54. data/_docs/rest/locales/nl.js +25 -0
  55. data/_docs/rest/locales/pl.js +25 -0
  56. data/_docs/rest/locales/pt_br.js +25 -0
  57. data/_docs/rest/locales/ru.js +25 -0
  58. data/_docs/rest/locales/zh.js +25 -0
  59. data/_docs/rest/main.js +691 -0
  60. data/_docs/rest/utils/handlebars_helper.js +327 -0
  61. data/_docs/rest/utils/send_sample_request.js +158 -0
  62. data/_docs/rest/vendor/bootstrap-responsive.min.css +9 -0
  63. data/_docs/rest/vendor/bootstrap.min.css +9 -0
  64. data/_docs/rest/vendor/bootstrap.min.js +6 -0
  65. data/_docs/rest/vendor/diff_match_patch.min.js +49 -0
  66. data/_docs/rest/vendor/handlebars.min.js +28 -0
  67. data/_docs/rest/vendor/jquery.min.js +4 -0
  68. data/_docs/rest/vendor/lodash.min.js +61 -0
  69. data/_docs/rest/vendor/path-to-regexp/LICENSE +21 -0
  70. data/_docs/rest/vendor/path-to-regexp/index.js +205 -0
  71. data/_docs/rest/vendor/polyfill.js +100 -0
  72. data/_docs/rest/vendor/prettify/lang-apollo.js +2 -0
  73. data/_docs/rest/vendor/prettify/lang-basic.js +3 -0
  74. data/_docs/rest/vendor/prettify/lang-clj.js +18 -0
  75. data/_docs/rest/vendor/prettify/lang-css.js +2 -0
  76. data/_docs/rest/vendor/prettify/lang-dart.js +3 -0
  77. data/_docs/rest/vendor/prettify/lang-erlang.js +2 -0
  78. data/_docs/rest/vendor/prettify/lang-go.js +1 -0
  79. data/_docs/rest/vendor/prettify/lang-hs.js +2 -0
  80. data/_docs/rest/vendor/prettify/lang-lisp.js +3 -0
  81. data/_docs/rest/vendor/prettify/lang-llvm.js +1 -0
  82. data/_docs/rest/vendor/prettify/lang-lua.js +2 -0
  83. data/_docs/rest/vendor/prettify/lang-matlab.js +6 -0
  84. data/_docs/rest/vendor/prettify/lang-ml.js +2 -0
  85. data/_docs/rest/vendor/prettify/lang-mumps.js +2 -0
  86. data/_docs/rest/vendor/prettify/lang-n.js +4 -0
  87. data/_docs/rest/vendor/prettify/lang-pascal.js +3 -0
  88. data/_docs/rest/vendor/prettify/lang-proto.js +1 -0
  89. data/_docs/rest/vendor/prettify/lang-r.js +2 -0
  90. data/_docs/rest/vendor/prettify/lang-rd.js +1 -0
  91. data/_docs/rest/vendor/prettify/lang-scala.js +2 -0
  92. data/_docs/rest/vendor/prettify/lang-sql.js +2 -0
  93. data/_docs/rest/vendor/prettify/lang-tcl.js +3 -0
  94. data/_docs/rest/vendor/prettify/lang-tex.js +1 -0
  95. data/_docs/rest/vendor/prettify/lang-vb.js +2 -0
  96. data/_docs/rest/vendor/prettify/lang-vhdl.js +3 -0
  97. data/_docs/rest/vendor/prettify/lang-wiki.js +2 -0
  98. data/_docs/rest/vendor/prettify/lang-xq.js +3 -0
  99. data/_docs/rest/vendor/prettify/lang-yaml.js +2 -0
  100. data/_docs/rest/vendor/prettify/prettify.css +1 -0
  101. data/_docs/rest/vendor/prettify/prettify.js +30 -0
  102. data/_docs/rest/vendor/prettify/run_prettify.js +34 -0
  103. data/_docs/rest/vendor/prettify.css +101 -0
  104. data/_docs/rest/vendor/require.min.js +36 -0
  105. data/apidoc.json +23 -0
  106. data/bin/wf_node_api +80 -0
  107. data/lib/wf_node_api/api/node_api.rb +360 -0
  108. data/lib/wf_node_api/config/config_template.erb +50 -0
  109. data/lib/wf_node_api/config_check.rb +50 -0
  110. data/lib/wf_node_api/container_manager.rb +286 -0
  111. data/lib/wf_node_api/container_manager_adapter/lxc.rb +431 -0
  112. data/lib/wf_node_api/container_manager_adapter/vserver.rb +448 -0
  113. data/lib/wf_node_api/error/not_found.rb +27 -0
  114. data/lib/wf_node_api/os.rb +32 -0
  115. data/lib/wf_node_api/resource_manager.rb +49 -0
  116. data/lib/wf_node_api/resource_manager_adapter/linux.rb +53 -0
  117. data/lib/wf_node_api/translations.rb +38 -0
  118. data/lib/wf_node_api/version.rb +28 -0
  119. data/lib/wf_node_api.rb +57 -0
  120. data/manifests/files/dhozac-vserver.repo +4 -0
  121. data/wf-node-api.gemspec +53 -0
  122. metadata +221 -0
@@ -0,0 +1,1358 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: ContainerManagerAdapter::Vserver
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!ContainerManagerAdapter/Vserver.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (V)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../ContainerManagerAdapter.html" title="ContainerManagerAdapter (module)">ContainerManagerAdapter</a></span></span>
36
+ &raquo;
37
+ <span class="title">Vserver</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: ContainerManagerAdapter::Vserver
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ContainerManagerAdapter::Vserver</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/wf_node_api/container_manager_adapter/vserver.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Container adapter for linux-vserver. Encapsulates all vserver specific
106
+ command line wrapping</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ <h2>
123
+ Instance Method Summary
124
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
125
+ </h2>
126
+
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#container-instance_method" title="#container (instance method)">- (Hash) <strong>container</strong>(name) </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>Returns information for a single container.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#containers-instance_method" title="#containers (instance method)">- (Array) <strong>containers</strong> </a>
157
+
158
+
159
+
160
+ </span>
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"><div class='inline'>
171
+ <p>Lists all available containers.</p>
172
+ </div></span>
173
+
174
+ </li>
175
+
176
+
177
+ <li class="public ">
178
+ <span class="summary_signature">
179
+
180
+ <a href="#create_container-instance_method" title="#create_container (instance method)">- (String) <strong>create_container</strong>(name, ip_address, disk_size_gb, memory_limit_mb, cpu_core_count) </a>
181
+
182
+
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'>
195
+ <p>Creates a container with the given parameters.</p>
196
+ </div></span>
197
+
198
+ </li>
199
+
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#delete-instance_method" title="#delete (instance method)">- (String) <strong>delete</strong>(name) </a>
205
+
206
+
207
+
208
+ </span>
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ <span class="summary_desc"><div class='inline'>
219
+ <p>Deletes a container with the given name.</p>
220
+ </div></span>
221
+
222
+ </li>
223
+
224
+
225
+ <li class="public ">
226
+ <span class="summary_signature">
227
+
228
+ <a href="#exist%3F-instance_method" title="#exist? (instance method)">- (Boolean) <strong>exist?</strong>(name) </a>
229
+
230
+
231
+
232
+ </span>
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+ <span class="summary_desc"><div class='inline'>
243
+ <p>Checks if a container with the given name exists.</p>
244
+ </div></span>
245
+
246
+ </li>
247
+
248
+
249
+ <li class="public ">
250
+ <span class="summary_signature">
251
+
252
+ <a href="#free_cpu_core_count-instance_method" title="#free_cpu_core_count (instance method)">- (Integer) <strong>free_cpu_core_count</strong>(resman) </a>
253
+
254
+
255
+
256
+ </span>
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+ <span class="summary_desc"><div class='inline'>
267
+ <p>Returns the amount of free cpu cores.</p>
268
+ </div></span>
269
+
270
+ </li>
271
+
272
+
273
+ <li class="public ">
274
+ <span class="summary_signature">
275
+
276
+ <a href="#kill-instance_method" title="#kill (instance method)">- (String) <strong>kill</strong>(name) </a>
277
+
278
+
279
+
280
+ </span>
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+ <span class="summary_desc"><div class='inline'>
291
+ <p>Kills a container with the given name.</p>
292
+ </div></span>
293
+
294
+ </li>
295
+
296
+
297
+ <li class="public ">
298
+ <span class="summary_signature">
299
+
300
+ <a href="#start-instance_method" title="#start (instance method)">- (String) <strong>start</strong>(name) </a>
301
+
302
+
303
+
304
+ </span>
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <span class="summary_desc"><div class='inline'>
315
+ <p>Starts a container with the given name.</p>
316
+ </div></span>
317
+
318
+ </li>
319
+
320
+
321
+ <li class="public ">
322
+ <span class="summary_signature">
323
+
324
+ <a href="#stop-instance_method" title="#stop (instance method)">- (String) <strong>stop</strong>(name) </a>
325
+
326
+
327
+
328
+ </span>
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+ <span class="summary_desc"><div class='inline'>
339
+ <p>Stops a container with the given name.</p>
340
+ </div></span>
341
+
342
+ </li>
343
+
344
+
345
+ </ul>
346
+
347
+
348
+
349
+
350
+ <div id="instance_method_details" class="method_details_list">
351
+ <h2>Instance Method Details</h2>
352
+
353
+
354
+ <div class="method_details first">
355
+ <h3 class="signature first" id="container-instance_method">
356
+
357
+ - (<tt>Hash</tt>) <strong>container</strong>(name)
358
+
359
+
360
+
361
+
362
+
363
+ </h3><div class="docstring">
364
+ <div class="discussion">
365
+
366
+ <p>Returns information for a single container</p>
367
+
368
+
369
+ </div>
370
+ </div>
371
+ <div class="tags">
372
+ <p class="tag_title">Parameters:</p>
373
+ <ul class="param">
374
+
375
+ <li>
376
+
377
+ <span class='name'>name</span>
378
+
379
+
380
+ <span class='type'>(<tt>String</tt>)</span>
381
+
382
+
383
+
384
+ &mdash;
385
+ <div class='inline'>
386
+ <p>The container name</p>
387
+ </div>
388
+
389
+ </li>
390
+
391
+ </ul>
392
+
393
+ <p class="tag_title">Returns:</p>
394
+ <ul class="return">
395
+
396
+ <li>
397
+
398
+
399
+ <span class='type'>(<tt>Hash</tt>)</span>
400
+
401
+
402
+
403
+ &mdash;
404
+ <div class='inline'>
405
+ <p>Hash with information about the container</p>
406
+ </div>
407
+
408
+ </li>
409
+
410
+ </ul>
411
+
412
+ </div><table class="source_code">
413
+ <tr>
414
+ <td>
415
+ <pre class="lines">
416
+
417
+
418
+ 121
419
+ 122
420
+ 123
421
+ 124
422
+ 125
423
+ 126
424
+ 127
425
+ 128
426
+ 129
427
+ 130
428
+ 131
429
+ 132
430
+ 133
431
+ 134
432
+ 135
433
+ 136</pre>
434
+ </td>
435
+ <td>
436
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 121</span>
437
+
438
+ <span class='kw'>def</span> <span class='id identifier rubyid_container'>container</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
439
+ <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
440
+
441
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
442
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:state</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_translate_state'>translate_state</span><span class='lparen'>(</span><span class='id identifier rubyid_state'>state</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
443
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:ip_address</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_ip_addr'>ip_addr</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
444
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:cpu_usage</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
445
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:cpu_cores</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_assigned_cpu_cores'>assigned_cpu_cores</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
446
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:memory_limit_bytes</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_memory_limit'>memory_limit</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
447
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:memory_usage_bytes</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_memory_usage'>memory_usage</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
448
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:disk_space_gb</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
449
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:disk_usage_gb</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
450
+ <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='symbol'>:container_type</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>vserver</span><span class='tstring_end'>&#39;</span></span>
451
+
452
+ <span class='id identifier rubyid_data'>data</span>
453
+ <span class='kw'>end</span></pre>
454
+ </td>
455
+ </tr>
456
+ </table>
457
+ </div>
458
+
459
+ <div class="method_details ">
460
+ <h3 class="signature " id="containers-instance_method">
461
+
462
+ - (<tt>Array</tt>) <strong>containers</strong>
463
+
464
+
465
+
466
+
467
+
468
+ </h3><div class="docstring">
469
+ <div class="discussion">
470
+
471
+ <p>Lists all available containers</p>
472
+
473
+
474
+ </div>
475
+ </div>
476
+ <div class="tags">
477
+
478
+ <p class="tag_title">Returns:</p>
479
+ <ul class="return">
480
+
481
+ <li>
482
+
483
+
484
+ <span class='type'>(<tt>Array</tt>)</span>
485
+
486
+
487
+
488
+ </li>
489
+
490
+ </ul>
491
+
492
+ </div><table class="source_code">
493
+ <tr>
494
+ <td>
495
+ <pre class="lines">
496
+
497
+
498
+ 33
499
+ 34
500
+ 35
501
+ 36
502
+ 37
503
+ 38
504
+ 39
505
+ 40
506
+ 41</pre>
507
+ </td>
508
+ <td>
509
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 33</span>
510
+
511
+ <span class='kw'>def</span> <span class='id identifier rubyid_containers'>containers</span>
512
+ <span class='id identifier rubyid_container_list'>container_list</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
513
+
514
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_container_names'>container_names</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
515
+ <span class='id identifier rubyid_container_list'>container_list</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_container'>container</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
516
+ <span class='kw'>end</span>
517
+
518
+ <span class='id identifier rubyid_container_list'>container_list</span>
519
+ <span class='kw'>end</span></pre>
520
+ </td>
521
+ </tr>
522
+ </table>
523
+ </div>
524
+
525
+ <div class="method_details ">
526
+ <h3 class="signature " id="create_container-instance_method">
527
+
528
+ - (<tt>String</tt>) <strong>create_container</strong>(name, ip_address, disk_size_gb, memory_limit_mb, cpu_core_count)
529
+
530
+
531
+
532
+
533
+
534
+ </h3><div class="docstring">
535
+ <div class="discussion">
536
+
537
+ <p>Creates a container with the given parameters</p>
538
+
539
+
540
+ </div>
541
+ </div>
542
+ <div class="tags">
543
+ <p class="tag_title">Parameters:</p>
544
+ <ul class="param">
545
+
546
+ <li>
547
+
548
+ <span class='name'>name</span>
549
+
550
+
551
+ <span class='type'>(<tt>String</tt>)</span>
552
+
553
+
554
+
555
+ &mdash;
556
+ <div class='inline'>
557
+ <p>The container name</p>
558
+ </div>
559
+
560
+ </li>
561
+
562
+ <li>
563
+
564
+ <span class='name'>ip_address</span>
565
+
566
+
567
+ <span class='type'>(<tt>String</tt>)</span>
568
+
569
+
570
+
571
+ &mdash;
572
+ <div class='inline'>
573
+ <p>A valid IPv4 address</p>
574
+ </div>
575
+
576
+ </li>
577
+
578
+ <li>
579
+
580
+ <span class='name'>disk_size_gb</span>
581
+
582
+
583
+ <span class='type'>(<tt>Integer</tt>)</span>
584
+
585
+
586
+
587
+ &mdash;
588
+ <div class='inline'>
589
+ <p>The disk size in GB</p>
590
+ </div>
591
+
592
+ </li>
593
+
594
+ <li>
595
+
596
+ <span class='name'>memory_limit_mb</span>
597
+
598
+
599
+ <span class='type'>(<tt>Integer</tt>)</span>
600
+
601
+
602
+
603
+ &mdash;
604
+ <div class='inline'>
605
+ <p>The memory limit in MB</p>
606
+ </div>
607
+
608
+ </li>
609
+
610
+ <li>
611
+
612
+ <span class='name'>cpu_core_count</span>
613
+
614
+
615
+ <span class='type'>(<tt>Integer</tt>)</span>
616
+
617
+
618
+
619
+ &mdash;
620
+ <div class='inline'>
621
+ <p>Amount of Vcores to assign. 0 for no limit</p>
622
+ </div>
623
+
624
+ </li>
625
+
626
+ </ul>
627
+
628
+ <p class="tag_title">Returns:</p>
629
+ <ul class="return">
630
+
631
+ <li>
632
+
633
+
634
+ <span class='type'>(<tt>String</tt>)</span>
635
+
636
+
637
+
638
+ &mdash;
639
+ <div class='inline'>
640
+ <p>CLI output</p>
641
+ </div>
642
+
643
+ </li>
644
+
645
+ </ul>
646
+ <p class="tag_title">Raises:</p>
647
+ <ul class="raise">
648
+
649
+ <li>
650
+
651
+
652
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
653
+
654
+
655
+
656
+ </li>
657
+
658
+ </ul>
659
+
660
+ </div><table class="source_code">
661
+ <tr>
662
+ <td>
663
+ <pre class="lines">
664
+
665
+
666
+ 149
667
+ 150
668
+ 151
669
+ 152
670
+ 153
671
+ 154
672
+ 155
673
+ 156
674
+ 157
675
+ 158
676
+ 159
677
+ 160
678
+ 161
679
+ 162
680
+ 163
681
+ 164
682
+ 165
683
+ 166
684
+ 167
685
+ 168
686
+ 169
687
+ 170
688
+ 171
689
+ 172
690
+ 173
691
+ 174
692
+ 175
693
+ 176
694
+ 177
695
+ 178
696
+ 179
697
+ 180
698
+ 181
699
+ 182
700
+ 183
701
+ 184
702
+ 185
703
+ 186
704
+ 187
705
+ 188
706
+ 189
707
+ 190
708
+ 191
709
+ 192</pre>
710
+ </td>
711
+ <td>
712
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 149</span>
713
+
714
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_container'>create_container</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_ip_address'>ip_address</span><span class='comma'>,</span> <span class='id identifier rubyid_disk_size_gb'>disk_size_gb</span><span class='comma'>,</span> <span class='id identifier rubyid_memory_limit_mb'>memory_limit_mb</span><span class='comma'>,</span> <span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span><span class='rparen'>)</span>
715
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
716
+
717
+ <span class='kw'>begin</span>
718
+ <span class='kw'>if</span> <span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span> <span class='op'>!=</span> <span class='int'>0</span>
719
+ <span class='id identifier rubyid_cpuset'>cpuset</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_cpu_set'>generate_cpu_set</span><span class='lparen'>(</span><span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span><span class='comma'>,</span> <span class='const'>ResourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>linux</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
720
+ <span class='kw'>end</span>
721
+
722
+ <span class='id identifier rubyid_new_context'>new_context</span> <span class='op'>=</span> <span class='id identifier rubyid_highest_context'>highest_context</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span>
723
+ <span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='gvar'>$vserver_cmd_create</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[ip_address]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_ip_address'>ip_address</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[context]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_new_context'>new_context</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
724
+
725
+ <span class='id identifier rubyid_create_result'>create_result</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rparen'>)</span>
726
+
727
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>+=</span> <span class='id identifier rubyid_create_result'>create_result</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
728
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>+=</span> <span class='id identifier rubyid_create_result'>create_result</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
729
+
730
+ <span class='kw'>if</span> <span class='id identifier rubyid_create_result'>create_result</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span>
731
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>command did not exit with status 0</span><span class='tstring_end'>&#39;</span></span>
732
+ <span class='kw'>end</span>
733
+
734
+ <span class='comment'># memory limit
735
+ </span> <span class='id identifier rubyid_memory_limit_bytes'>memory_limit_bytes</span> <span class='op'>=</span> <span class='id identifier rubyid_memory_limit_mb'>memory_limit_mb</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>*</span> <span class='int'>1024</span> <span class='op'>*</span> <span class='int'>1024</span>
736
+ <span class='id identifier rubyid_page_size'>page_size</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='embexpr_beg'>#{</span><span class='gvar'>$page_size_cmd</span><span class='embexpr_end'>}</span><span class='tstring_end'>`</span></span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
737
+ <span class='id identifier rubyid_memory_limit_pages'>memory_limit_pages</span> <span class='op'>=</span> <span class='id identifier rubyid_memory_limit_bytes'>memory_limit_bytes</span> <span class='op'>/</span> <span class='id identifier rubyid_page_size'>page_size</span>
738
+
739
+ <span class='id identifier rubyid_write_config_file'>write_config_file</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/rlimits/rss.hard</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_memory_limit_pages'>memory_limit_pages</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
740
+
741
+ <span class='kw'>if</span> <span class='id identifier rubyid_cpu_core_count'>cpu_core_count</span> <span class='op'>!=</span> <span class='int'>0</span>
742
+ <span class='comment'># cpu core limit
743
+ </span> <span class='id identifier rubyid_write_config_file'>write_config_file</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/cgroup/cpuset.cpus</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_cpuset'>cpuset</span><span class='rparen'>)</span>
744
+ <span class='kw'>end</span>
745
+
746
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>creation of container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successful</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
747
+ <span class='kw'>return</span> <span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
748
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
749
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be created, rolling back...</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
750
+
751
+ <span class='comment'># rollback
752
+ </span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
753
+
754
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>+=</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
755
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
756
+ <span class='kw'>end</span>
757
+ <span class='kw'>end</span></pre>
758
+ </td>
759
+ </tr>
760
+ </table>
761
+ </div>
762
+
763
+ <div class="method_details ">
764
+ <h3 class="signature " id="delete-instance_method">
765
+
766
+ - (<tt>String</tt>) <strong>delete</strong>(name)
767
+
768
+
769
+
770
+
771
+
772
+ </h3><div class="docstring">
773
+ <div class="discussion">
774
+
775
+ <p>Deletes a container with the given name</p>
776
+
777
+
778
+ </div>
779
+ </div>
780
+ <div class="tags">
781
+ <p class="tag_title">Parameters:</p>
782
+ <ul class="param">
783
+
784
+ <li>
785
+
786
+ <span class='name'>name</span>
787
+
788
+
789
+ <span class='type'>(<tt>String</tt>)</span>
790
+
791
+
792
+
793
+ &mdash;
794
+ <div class='inline'>
795
+ <p>The container name</p>
796
+ </div>
797
+
798
+ </li>
799
+
800
+ </ul>
801
+
802
+ <p class="tag_title">Returns:</p>
803
+ <ul class="return">
804
+
805
+ <li>
806
+
807
+
808
+ <span class='type'>(<tt>String</tt>)</span>
809
+
810
+
811
+
812
+ &mdash;
813
+ <div class='inline'>
814
+ <p>CLI output</p>
815
+ </div>
816
+
817
+ </li>
818
+
819
+ </ul>
820
+ <p class="tag_title">Raises:</p>
821
+ <ul class="raise">
822
+
823
+ <li>
824
+
825
+
826
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
827
+
828
+
829
+
830
+ </li>
831
+
832
+ </ul>
833
+
834
+ </div><table class="source_code">
835
+ <tr>
836
+ <td>
837
+ <pre class="lines">
838
+
839
+
840
+ 104
841
+ 105
842
+ 106
843
+ 107
844
+ 108
845
+ 109
846
+ 110
847
+ 111
848
+ 112
849
+ 113
850
+ 114</pre>
851
+ </td>
852
+ <td>
853
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 104</span>
854
+
855
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
856
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$vserver_cmd_destroy</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
857
+
858
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span>
859
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully deleted</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
860
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
861
+ <span class='kw'>end</span>
862
+
863
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be deleted</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
864
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
865
+ <span class='kw'>end</span></pre>
866
+ </td>
867
+ </tr>
868
+ </table>
869
+ </div>
870
+
871
+ <div class="method_details ">
872
+ <h3 class="signature " id="exist?-instance_method">
873
+
874
+ - (<tt>Boolean</tt>) <strong>exist?</strong>(name)
875
+
876
+
877
+
878
+
879
+
880
+ </h3><div class="docstring">
881
+ <div class="discussion">
882
+
883
+ <p>Checks if a container with the given name exists</p>
884
+
885
+
886
+ </div>
887
+ </div>
888
+ <div class="tags">
889
+ <p class="tag_title">Parameters:</p>
890
+ <ul class="param">
891
+
892
+ <li>
893
+
894
+ <span class='name'>name</span>
895
+
896
+
897
+ <span class='type'>(<tt>String</tt>)</span>
898
+
899
+
900
+
901
+ &mdash;
902
+ <div class='inline'>
903
+ <p>The container name</p>
904
+ </div>
905
+
906
+ </li>
907
+
908
+ </ul>
909
+
910
+ <p class="tag_title">Returns:</p>
911
+ <ul class="return">
912
+
913
+ <li>
914
+
915
+
916
+ <span class='type'>(<tt>Boolean</tt>)</span>
917
+
918
+
919
+
920
+ &mdash;
921
+ <div class='inline'>
922
+ <p>Existing/not existing</p>
923
+ </div>
924
+
925
+ </li>
926
+
927
+ </ul>
928
+
929
+ </div><table class="source_code">
930
+ <tr>
931
+ <td>
932
+ <pre class="lines">
933
+
934
+
935
+ 199
936
+ 200
937
+ 201</pre>
938
+ </td>
939
+ <td>
940
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 199</span>
941
+
942
+ <span class='kw'>def</span> <span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
943
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_container_names'>container_names</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
944
+ <span class='kw'>end</span></pre>
945
+ </td>
946
+ </tr>
947
+ </table>
948
+ </div>
949
+
950
+ <div class="method_details ">
951
+ <h3 class="signature " id="free_cpu_core_count-instance_method">
952
+
953
+ - (<tt>Integer</tt>) <strong>free_cpu_core_count</strong>(resman)
954
+
955
+
956
+
957
+
958
+
959
+ </h3><div class="docstring">
960
+ <div class="discussion">
961
+
962
+ <p>Returns the amount of free cpu cores</p>
963
+
964
+
965
+ </div>
966
+ </div>
967
+ <div class="tags">
968
+ <p class="tag_title">Parameters:</p>
969
+ <ul class="param">
970
+
971
+ <li>
972
+
973
+ <span class='name'>resman</span>
974
+
975
+
976
+ <span class='type'>(<tt><span class='object_link'><a href="../ResourceManager.html" title="ResourceManager (class)">ResourceManager</a></span></tt>)</span>
977
+
978
+
979
+
980
+ &mdash;
981
+ <div class='inline'>
982
+ <p>A ResourceManager instance</p>
983
+ </div>
984
+
985
+ </li>
986
+
987
+ </ul>
988
+
989
+ <p class="tag_title">Returns:</p>
990
+ <ul class="return">
991
+
992
+ <li>
993
+
994
+
995
+ <span class='type'>(<tt>Integer</tt>)</span>
996
+
997
+
998
+
999
+ &mdash;
1000
+ <div class='inline'>
1001
+ <p>The amount of free cpu cores</p>
1002
+ </div>
1003
+
1004
+ </li>
1005
+
1006
+ </ul>
1007
+
1008
+ </div><table class="source_code">
1009
+ <tr>
1010
+ <td>
1011
+ <pre class="lines">
1012
+
1013
+
1014
+ 208
1015
+ 209
1016
+ 210</pre>
1017
+ </td>
1018
+ <td>
1019
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 208</span>
1020
+
1021
+ <span class='kw'>def</span> <span class='id identifier rubyid_free_cpu_core_count'>free_cpu_core_count</span><span class='lparen'>(</span><span class='id identifier rubyid_resman'>resman</span><span class='rparen'>)</span>
1022
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_free_cpu_cores'>free_cpu_cores</span><span class='lparen'>(</span><span class='id identifier rubyid_resman'>resman</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
1023
+ <span class='kw'>end</span></pre>
1024
+ </td>
1025
+ </tr>
1026
+ </table>
1027
+ </div>
1028
+
1029
+ <div class="method_details ">
1030
+ <h3 class="signature " id="kill-instance_method">
1031
+
1032
+ - (<tt>String</tt>) <strong>kill</strong>(name)
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+ </h3><div class="docstring">
1039
+ <div class="discussion">
1040
+
1041
+ <p>Kills a container with the given name</p>
1042
+
1043
+
1044
+ </div>
1045
+ </div>
1046
+ <div class="tags">
1047
+ <p class="tag_title">Parameters:</p>
1048
+ <ul class="param">
1049
+
1050
+ <li>
1051
+
1052
+ <span class='name'>name</span>
1053
+
1054
+
1055
+ <span class='type'>(<tt>String</tt>)</span>
1056
+
1057
+
1058
+
1059
+ &mdash;
1060
+ <div class='inline'>
1061
+ <p>The container name</p>
1062
+ </div>
1063
+
1064
+ </li>
1065
+
1066
+ </ul>
1067
+
1068
+ <p class="tag_title">Returns:</p>
1069
+ <ul class="return">
1070
+
1071
+ <li>
1072
+
1073
+
1074
+ <span class='type'>(<tt>String</tt>)</span>
1075
+
1076
+
1077
+
1078
+ &mdash;
1079
+ <div class='inline'>
1080
+ <p>CLI output</p>
1081
+ </div>
1082
+
1083
+ </li>
1084
+
1085
+ </ul>
1086
+ <p class="tag_title">Raises:</p>
1087
+ <ul class="raise">
1088
+
1089
+ <li>
1090
+
1091
+
1092
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1093
+
1094
+
1095
+
1096
+ </li>
1097
+
1098
+ </ul>
1099
+
1100
+ </div><table class="source_code">
1101
+ <tr>
1102
+ <td>
1103
+ <pre class="lines">
1104
+
1105
+
1106
+ 93
1107
+ 94
1108
+ 95</pre>
1109
+ </td>
1110
+ <td>
1111
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 93</span>
1112
+
1113
+ <span class='kw'>def</span> <span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1114
+ <span class='kw'>return</span> <span class='id identifier rubyid_stop'>stop</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1115
+ <span class='kw'>end</span></pre>
1116
+ </td>
1117
+ </tr>
1118
+ </table>
1119
+ </div>
1120
+
1121
+ <div class="method_details ">
1122
+ <h3 class="signature " id="start-instance_method">
1123
+
1124
+ - (<tt>String</tt>) <strong>start</strong>(name)
1125
+
1126
+
1127
+
1128
+
1129
+
1130
+ </h3><div class="docstring">
1131
+ <div class="discussion">
1132
+
1133
+ <p>Starts a container with the given name</p>
1134
+
1135
+
1136
+ </div>
1137
+ </div>
1138
+ <div class="tags">
1139
+ <p class="tag_title">Parameters:</p>
1140
+ <ul class="param">
1141
+
1142
+ <li>
1143
+
1144
+ <span class='name'>name</span>
1145
+
1146
+
1147
+ <span class='type'>(<tt>String</tt>)</span>
1148
+
1149
+
1150
+
1151
+ &mdash;
1152
+ <div class='inline'>
1153
+ <p>The container name</p>
1154
+ </div>
1155
+
1156
+ </li>
1157
+
1158
+ </ul>
1159
+
1160
+ <p class="tag_title">Returns:</p>
1161
+ <ul class="return">
1162
+
1163
+ <li>
1164
+
1165
+
1166
+ <span class='type'>(<tt>String</tt>)</span>
1167
+
1168
+
1169
+
1170
+ &mdash;
1171
+ <div class='inline'>
1172
+ <p>CLI output</p>
1173
+ </div>
1174
+
1175
+ </li>
1176
+
1177
+ </ul>
1178
+ <p class="tag_title">Raises:</p>
1179
+ <ul class="raise">
1180
+
1181
+ <li>
1182
+
1183
+
1184
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1185
+
1186
+
1187
+
1188
+ </li>
1189
+
1190
+ </ul>
1191
+
1192
+ </div><table class="source_code">
1193
+ <tr>
1194
+ <td>
1195
+ <pre class="lines">
1196
+
1197
+
1198
+ 50
1199
+ 51
1200
+ 52
1201
+ 53
1202
+ 54
1203
+ 55
1204
+ 56
1205
+ 57
1206
+ 58
1207
+ 59
1208
+ 60</pre>
1209
+ </td>
1210
+ <td>
1211
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 50</span>
1212
+
1213
+ <span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1214
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$vserver_cmd_start</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
1215
+
1216
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_state'>state</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RUNNING</span><span class='tstring_end'>&#39;</span></span>
1217
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully started</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1218
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1219
+ <span class='kw'>end</span>
1220
+
1221
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be started</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1222
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1223
+ <span class='kw'>end</span></pre>
1224
+ </td>
1225
+ </tr>
1226
+ </table>
1227
+ </div>
1228
+
1229
+ <div class="method_details ">
1230
+ <h3 class="signature " id="stop-instance_method">
1231
+
1232
+ - (<tt>String</tt>) <strong>stop</strong>(name)
1233
+
1234
+
1235
+
1236
+
1237
+
1238
+ </h3><div class="docstring">
1239
+ <div class="discussion">
1240
+
1241
+ <p>Stops a container with the given name</p>
1242
+
1243
+
1244
+ </div>
1245
+ </div>
1246
+ <div class="tags">
1247
+ <p class="tag_title">Parameters:</p>
1248
+ <ul class="param">
1249
+
1250
+ <li>
1251
+
1252
+ <span class='name'>name</span>
1253
+
1254
+
1255
+ <span class='type'>(<tt>String</tt>)</span>
1256
+
1257
+
1258
+
1259
+ &mdash;
1260
+ <div class='inline'>
1261
+ <p>The container name</p>
1262
+ </div>
1263
+
1264
+ </li>
1265
+
1266
+ </ul>
1267
+
1268
+ <p class="tag_title">Returns:</p>
1269
+ <ul class="return">
1270
+
1271
+ <li>
1272
+
1273
+
1274
+ <span class='type'>(<tt>String</tt>)</span>
1275
+
1276
+
1277
+
1278
+ &mdash;
1279
+ <div class='inline'>
1280
+ <p>CLI output</p>
1281
+ </div>
1282
+
1283
+ </li>
1284
+
1285
+ </ul>
1286
+ <p class="tag_title">Raises:</p>
1287
+ <ul class="raise">
1288
+
1289
+ <li>
1290
+
1291
+
1292
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
1293
+
1294
+
1295
+
1296
+ </li>
1297
+
1298
+ </ul>
1299
+
1300
+ </div><table class="source_code">
1301
+ <tr>
1302
+ <td>
1303
+ <pre class="lines">
1304
+
1305
+
1306
+ 69
1307
+ 70
1308
+ 71
1309
+ 72
1310
+ 73
1311
+ 74
1312
+ 75
1313
+ 76
1314
+ 77
1315
+ 78
1316
+ 79
1317
+ 80
1318
+ 81
1319
+ 82
1320
+ 83
1321
+ 84</pre>
1322
+ </td>
1323
+ <td>
1324
+ <pre class="code"><span class="info file"># File 'lib/wf_node_api/container_manager_adapter/vserver.rb', line 69</span>
1325
+
1326
+ <span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1327
+ <span class='kw'>if</span> <span class='id identifier rubyid_state'>state</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>STOPPED</span><span class='tstring_end'>&#39;</span></span>
1328
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be stopped, because it is not running</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1329
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>container is not running</span><span class='tstring_end'>&#39;</span></span>
1330
+ <span class='kw'>end</span>
1331
+
1332
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='gvar'>$vserver_cmd_stop</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[name]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
1333
+
1334
+ <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_state'>state</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>STOPPED</span><span class='tstring_end'>&#39;</span></span>
1335
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> successfully stopped</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1336
+ <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1337
+ <span class='kw'>end</span>
1338
+
1339
+ <span class='gvar'>$logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>container </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> could not be stopped</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1340
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1341
+ <span class='kw'>end</span></pre>
1342
+ </td>
1343
+ </tr>
1344
+ </table>
1345
+ </div>
1346
+
1347
+ </div>
1348
+
1349
+ </div>
1350
+
1351
+ <div id="footer">
1352
+ Generated on Mon Jul 20 18:09:05 2015 by
1353
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1354
+ 0.8.7.6 (ruby-2.0.0).
1355
+ </div>
1356
+
1357
+ </body>
1358
+ </html>