testlab 1.11.3 → 1.11.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,6 +58,7 @@ class TestLab
58
58
  :state => self.state,
59
59
  :memory_usage => "#{self.memory_usage}M",
60
60
  :cpu_time => "#{self.cpu_usage}s",
61
+ :disk_usage => "#{self.disk_usage}MB",
61
62
  :distro => self.distro,
62
63
  :release => self.release,
63
64
  :interfaces => interfaces,
@@ -85,6 +86,15 @@ class TestLab
85
86
  end
86
87
  end
87
88
 
89
+ # Container Disk Usage
90
+ def disk_usage
91
+ if self.node.dead?
92
+ 0
93
+ else
94
+ self.lxc.disk_usage / (1024 * 1024)
95
+ end
96
+ end
97
+
88
98
  # Container State
89
99
  #
90
100
  # What state the container is in.
@@ -72,7 +72,7 @@ class TestLab
72
72
  # An array of symbols of the various keys in our status hash.
73
73
  #
74
74
  # @see TestLab::Container::Status
75
- STATUS_KEYS = %w(id node_id cpu_time memory_usage mode fqdn state distro release interfaces provisioners inherited).map(&:to_sym)
75
+ STATUS_KEYS = %w(id node_id cpu_time memory_usage disk_usage mode fqdn state distro release interfaces provisioners inherited).map(&:to_sym)
76
76
 
77
77
  # Sub-Modules
78
78
  autoload :Actions, 'testlab/container/actions'
@@ -33,6 +33,22 @@ class TestLab
33
33
  result = false
34
34
  end
35
35
 
36
+ my_container_names = self.containers.map(&:id)
37
+ node_container_names = self.lxc.containers.map(&:name)
38
+
39
+ unknown_container_names = (node_container_names - my_container_names)
40
+ unknown_running_container_names = self.lxc.containers.select{ |c| (unknown_container_names.include?(c.name) && (c.state == :running)) }.map(&:name)
41
+
42
+ if unknown_container_names.count > 0
43
+ if unknown_running_container_names.count > 0
44
+ @ui.stderr.puts(format_message("WARNING: You have *running* containers on your TestLab node which are not defined in your Labfile!".red.bold))
45
+ @ui.stderr.puts(format_message("WARNING: You may need to manually stop the following containers: #{unknown_running_container_names.join(', ')}".red))
46
+ end
47
+
48
+ @ui.stderr.puts(format_message("WARNING: You have containers on your TestLab node which are not defined in your Labfile!".yellow.bold))
49
+ @ui.stderr.puts(format_message("WARNING: You may need to manually remove the following containers: #{unknown_container_names.join(', ')}".yellow))
50
+ end
51
+
36
52
  result
37
53
  end
38
54
 
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "1.11.3"
4
+ VERSION = "1.11.4"
5
5
  end
6
6
  end
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.3
4
+ version: 1.11.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -348,12 +348,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
348
  - - ! '>='
349
349
  - !ruby/object:Gem::Version
350
350
  version: '0'
351
+ segments:
352
+ - 0
353
+ hash: -2336780269824604665
351
354
  required_rubygems_version: !ruby/object:Gem::Requirement
352
355
  none: false
353
356
  requirements:
354
357
  - - ! '>='
355
358
  - !ruby/object:Gem::Version
356
359
  version: '0'
360
+ segments:
361
+ - 0
362
+ hash: -2336780269824604665
357
363
  requirements: []
358
364
  rubyforge_project:
359
365
  rubygems_version: 1.8.25