testlab 1.11.2 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,7 @@ class TestLab
|
|
13
13
|
@ui.logger.debug { "Container Create: #{self.id}" }
|
14
14
|
|
15
15
|
self.node.alive? or return false
|
16
|
+
self.node.ok?
|
16
17
|
|
17
18
|
persistent_operation_check(:create)
|
18
19
|
|
@@ -36,6 +37,7 @@ class TestLab
|
|
36
37
|
@ui.logger.debug { "Container Destroy: #{self.id}" }
|
37
38
|
|
38
39
|
self.node.alive? or return false
|
40
|
+
self.node.ok?
|
39
41
|
|
40
42
|
please_wait(:ui => @ui, :message => format_object_action(self, 'Destroy', :red)) do
|
41
43
|
self.lxc.destroy(%(-f))
|
@@ -56,6 +58,7 @@ class TestLab
|
|
56
58
|
@ui.logger.debug { "Container Up: #{self.id}" }
|
57
59
|
|
58
60
|
self.node.alive? or return false
|
61
|
+
self.node.ok?
|
59
62
|
|
60
63
|
please_wait(:ui => @ui, :message => format_object_action(self, 'Up', :green)) do
|
61
64
|
configure
|
@@ -101,6 +104,7 @@ class TestLab
|
|
101
104
|
@ui.logger.debug { "Container Down: #{self.id}" }
|
102
105
|
|
103
106
|
self.node.alive? or return false
|
107
|
+
self.node.ok?
|
104
108
|
|
105
109
|
please_wait(:ui => @ui, :message => format_object_action(self, 'Down', :red)) do
|
106
110
|
|
data/lib/testlab/container/io.rb
CHANGED
@@ -8,9 +8,9 @@ class TestLab
|
|
8
8
|
|
9
9
|
PBZIP2_MEMORY = 1024
|
10
10
|
READ_SIZE = ((64 * 1024) - 1)
|
11
|
-
TRANSFER_MESSAGE = "
|
11
|
+
TRANSFER_MESSAGE = "%s '%s' at %0.2fMB/s -- %0.2fMB of %0.2fMB -- %d%% (%01d:%02dT-%01d:%02d) \r"
|
12
12
|
|
13
|
-
def transfer_message(filename, current_size, total_size, elapsed)
|
13
|
+
def transfer_message(what, filename, current_size, total_size, elapsed)
|
14
14
|
total_size_mb = (total_size.to_f / (1024 * 1024).to_f)
|
15
15
|
current_size_mb = (current_size.to_f / (1024 * 1024).to_f)
|
16
16
|
|
@@ -27,7 +27,7 @@ class TestLab
|
|
27
27
|
|
28
28
|
percentage_done = ((current_size * 100) / total_size)
|
29
29
|
|
30
|
-
@ui.stdout.print(format_message(TRANSFER_MESSAGE.yellow % [File.basename(filename), speed_mb, current_size_mb, total_size_mb, percentage_done, minutes, seconds, est_minutes, est_seconds]))
|
30
|
+
@ui.stdout.print(format_message(TRANSFER_MESSAGE.yellow % [what, File.basename(filename), speed_mb, current_size_mb, total_size_mb, percentage_done, minutes, seconds, est_minutes, est_seconds]))
|
31
31
|
end
|
32
32
|
|
33
33
|
def progress_callback(action, args)
|
@@ -44,7 +44,7 @@ class TestLab
|
|
44
44
|
elapsed = (Time.now - @start_time)
|
45
45
|
current_size = (args[1] + args[2].length)
|
46
46
|
|
47
|
-
transfer_message(args[0].local, current_size, @total_size, elapsed)
|
47
|
+
transfer_message(%(uploading to node:), args[0].local, current_size, @total_size, elapsed)
|
48
48
|
|
49
49
|
when :finish
|
50
50
|
@ui.stdout.puts
|
@@ -59,6 +59,9 @@ class TestLab
|
|
59
59
|
def export(compression=9, local_file=nil)
|
60
60
|
@ui.logger.debug { "Container Export: #{self.id} " }
|
61
61
|
|
62
|
+
self.node.alive? or return false
|
63
|
+
self.node.ok?
|
64
|
+
|
62
65
|
(self.state == :not_created) and raise ContainerError, 'You must create a container before you can export it!'
|
63
66
|
|
64
67
|
# Throw an exception if we are attempting to export a container in a
|
@@ -119,6 +122,9 @@ EOF
|
|
119
122
|
def import(local_file)
|
120
123
|
@ui.logger.debug { "Container Import: #{self.id}" }
|
121
124
|
|
125
|
+
self.node.alive? or return false
|
126
|
+
self.node.ok?
|
127
|
+
|
122
128
|
import_tempfile = Tempfile.new('import')
|
123
129
|
remote_filename = File.basename(import_tempfile.path.dup)
|
124
130
|
import_tempfile.close!
|
@@ -254,7 +260,7 @@ EOF
|
|
254
260
|
elapsed = (Time.now - start_time)
|
255
261
|
current_size += chunk.size
|
256
262
|
|
257
|
-
transfer_message(local_file, current_size, total_size, elapsed)
|
263
|
+
transfer_message(%(downloading locally:), local_file, current_size, total_size, elapsed)
|
258
264
|
end
|
259
265
|
@ui.stdout.puts
|
260
266
|
|
@@ -13,6 +13,7 @@ class TestLab
|
|
13
13
|
@ui.logger.debug { "Container Provision: #{self.id} " }
|
14
14
|
|
15
15
|
self.node.alive? or return false
|
16
|
+
self.node.ok?
|
16
17
|
|
17
18
|
please_wait(:ui => @ui, :message => format_object_action(self, :provision, :green)) do
|
18
19
|
do_provisioner_callbacks(self, :provision, @ui)
|
@@ -31,6 +32,7 @@ class TestLab
|
|
31
32
|
@ui.logger.debug { "Container Deprovision: #{self.id} " }
|
32
33
|
|
33
34
|
self.node.alive? or return false
|
35
|
+
self.node.ok?
|
34
36
|
|
35
37
|
persistent_operation_check(:deprovision)
|
36
38
|
|
data/lib/testlab/node/status.rb
CHANGED
@@ -20,6 +20,22 @@ class TestLab
|
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
+
def ok?
|
24
|
+
result = true
|
25
|
+
|
26
|
+
# make sure the node has some free space
|
27
|
+
free_space_percent = (self.exec(%(df -P /), :ignore_exit_status => true).output.split("\n")[1].split[-2].to_i rescue nil)
|
28
|
+
if free_space_percent.nil?
|
29
|
+
@ui.stderr.puts(format_message("ERROR: We could not determine how much free space node #{self.id.inspect} has!".red.bold))
|
30
|
+
result = false
|
31
|
+
elsif (free_space_percent >= 90)
|
32
|
+
@ui.stderr.puts(format_message("WARNING: Your TestLab node #{self.id.inspect} is using #{free_space_percent}% of its available disk space!".red.bold))
|
33
|
+
result = false
|
34
|
+
end
|
35
|
+
|
36
|
+
result
|
37
|
+
end
|
38
|
+
|
23
39
|
end
|
24
40
|
|
25
41
|
end
|
data/lib/testlab/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|