lxc 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -1
- data/Gemfile +4 -0
- data/lib/lxc/container.rb +8 -2
- data/lib/lxc/version.rb +1 -1
- data/spec/lxc_spec.rb +3 -1
- metadata +4 -4
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/lib/lxc/container.rb
CHANGED
@@ -316,13 +316,19 @@ class LXC
|
|
316
316
|
# Current Memory Usage
|
317
317
|
def memory_usage
|
318
318
|
result = self.exec(%(lxc-cgroup), %(memory.usage_in_bytes))
|
319
|
-
result.empty? ? 0 : result.to_i
|
319
|
+
(result.empty? ? 0 : result.to_i)
|
320
320
|
end
|
321
321
|
|
322
322
|
# CPU Time in Seconds
|
323
323
|
def cpu_usage
|
324
324
|
result = self.exec(%(lxc-cgroup), %(cpuacct.usage))
|
325
|
-
result.empty? ? 0 : (result.to_i / 1E9).to_i
|
325
|
+
(result.empty? ? 0 : (result.to_i / 1E9).to_i)
|
326
|
+
end
|
327
|
+
|
328
|
+
# Current Disk Usage
|
329
|
+
def disk_usage(ephemeral=false)
|
330
|
+
result = (@lxc.exec(%(du -sb #{self.fs_root(ephemeral)})).split.first rescue nil)
|
331
|
+
((result.nil? || result.empty?) ? 0 : result.to_i)
|
326
332
|
end
|
327
333
|
|
328
334
|
# Linux container command execution wrapper
|
data/lib/lxc/version.rb
CHANGED
data/spec/lxc_spec.rb
CHANGED
@@ -167,6 +167,8 @@ describe LXC do
|
|
167
167
|
|
168
168
|
describe "#inspect" do
|
169
169
|
it "should return an information string about our class instance" do
|
170
|
+
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-version.out") }
|
171
|
+
|
170
172
|
subject.inspect.should be_kind_of(String)
|
171
173
|
subject.inspect.length.should be > 0
|
172
174
|
end
|
@@ -178,7 +180,7 @@ describe LXC do
|
|
178
180
|
it "should exec the supplied LXC command" do
|
179
181
|
subject.stub(:exec) { lxc_fixture(lxc_version, "lxc-version.out") }
|
180
182
|
|
181
|
-
subject.exec("version").should be_kind_of(String)
|
183
|
+
subject.exec("lxc-version").should be_kind_of(String)
|
182
184
|
end
|
183
185
|
end
|
184
186
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lxc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
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: ztk
|
@@ -219,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
219
219
|
version: '0'
|
220
220
|
segments:
|
221
221
|
- 0
|
222
|
-
hash:
|
222
|
+
hash: 3922610314625450617
|
223
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
224
|
none: false
|
225
225
|
requirements:
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
segments:
|
230
230
|
- 0
|
231
|
-
hash:
|
231
|
+
hash: 3922610314625450617
|
232
232
|
requirements: []
|
233
233
|
rubyforge_project:
|
234
234
|
rubygems_version: 1.8.25
|