vzlimit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -5
- data/Manifest.txt +2 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +30 -7
- data/Rakefile +3 -2
- data/config/website.yml +1 -1
- data/lib/vzlimit/cli.rb +36 -12
- data/lib/vzlimit.rb +2 -2
- data/website/index.html +9 -1
- data/website/index.html$ +17 -0
- metadata +9 -6
data/History.txt
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
=== 0.0.1 2010-01-30
|
2
2
|
|
3
|
-
*
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
* 1 major enhancement:
|
4
|
+
* Initial release
|
5
|
+
|
6
|
+
=== 0.0.2 2010-02-02
|
7
|
+
|
8
|
+
* Fixed bug that hard limit is ignored
|
9
|
+
* Changed 'limit' command to 'set'
|
10
|
+
* Changed param '--memory' and '-m' to '--ram' and '-r'
|
11
|
+
* Fixed bug when calling 'vzlimit' without any parameters
|
12
|
+
* Added help page
|
data/Manifest.txt
CHANGED
data/PostInstall.txt
ADDED
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= vzlimit
|
2
2
|
|
3
|
-
* http://
|
3
|
+
* http://github.com/#{github_username}/#{project_name}
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
7
|
+
FIX (describe your package)
|
8
8
|
|
9
9
|
== FEATURES/PROBLEMS:
|
10
10
|
|
@@ -12,14 +12,37 @@ vzlimit simplifies the resource management of the virtualization system 'OpenVZ'
|
|
12
12
|
|
13
13
|
== SYNOPSIS:
|
14
14
|
|
15
|
-
|
15
|
+
FIX (code sample of usage)
|
16
16
|
|
17
17
|
== REQUIREMENTS:
|
18
18
|
|
19
|
-
*
|
20
|
-
* rubyforge
|
21
|
-
* hirb
|
19
|
+
* FIX (list of requirements)
|
22
20
|
|
23
21
|
== INSTALL:
|
24
22
|
|
25
|
-
* sudo gem install
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2010 Remo Fritzsche
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -12,9 +12,10 @@ Hoe.plugin :website
|
|
12
12
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
13
|
$hoe = Hoe.spec 'vzlimit' do
|
14
14
|
self.developer 'Remo Fritzsche', 'dev@remofritzsche.com'
|
15
|
-
|
16
|
-
self.rubyforge_name =
|
15
|
+
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
16
|
+
self.rubyforge_name = self.name # TODO this is default value
|
17
17
|
self.extra_deps = [['highline','>= 1.5.1'], ['rubyforge','>= 2.0.3'], ['hirb', '>= 0.2.9']]
|
18
|
+
|
18
19
|
end
|
19
20
|
|
20
21
|
require 'newgem/tasks'
|
data/config/website.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
host: remofritzsche@vzlimit.rubyforge.org
|
2
|
-
remote_dir: /var/www/gforge-projects/vzlimit
|
2
|
+
remote_dir: /var/www/gforge-projects/vzlimit
|
data/lib/vzlimit/cli.rb
CHANGED
@@ -14,7 +14,7 @@ module Vzlimit
|
|
14
14
|
|
15
15
|
begin
|
16
16
|
# Check action argument
|
17
|
-
|
17
|
+
if !@arguments[0] || (!ACTIONS.include?(@arguments[0].to_sym) &&! @arguments[0] =~ /^-.*/)
|
18
18
|
usage
|
19
19
|
end
|
20
20
|
|
@@ -24,8 +24,18 @@ module Vzlimit
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# limit
|
27
|
-
if @arguments[0].to_sym == :
|
28
|
-
|
27
|
+
if @arguments[0].to_sym == :set
|
28
|
+
set
|
29
|
+
end
|
30
|
+
|
31
|
+
# help
|
32
|
+
if @arguments[0] == '-h' || @arguments[0] == '--help'
|
33
|
+
help
|
34
|
+
end
|
35
|
+
|
36
|
+
# version
|
37
|
+
if @arguments[0] == '-v' || @arguments[0] == '--version'
|
38
|
+
version
|
29
39
|
end
|
30
40
|
rescue
|
31
41
|
@h.say $!
|
@@ -96,9 +106,9 @@ module Vzlimit
|
|
96
106
|
|
97
107
|
end
|
98
108
|
|
99
|
-
def
|
109
|
+
def set
|
100
110
|
@arguments.shift
|
101
|
-
usage = 'Usage: vzlimit
|
111
|
+
usage = 'Usage: vzlimit set vpsid [options]'
|
102
112
|
raise usage unless @arguments[0]
|
103
113
|
|
104
114
|
vpsid = @arguments.shift
|
@@ -106,20 +116,20 @@ module Vzlimit
|
|
106
116
|
disk = nil
|
107
117
|
|
108
118
|
while (arg = @arguments.shift) do
|
109
|
-
if ['-
|
119
|
+
if ['-r', '--ram'].include? arg
|
110
120
|
memory = @arguments.shift
|
111
121
|
|
112
122
|
if !(memory =~ /^[-+]?[0-9]*\.?[0-9]+:[-+]?[0-9]*\.?[0-9]+$/)
|
113
|
-
raise "Usage: vzlimit
|
123
|
+
raise "Usage: vzlimit set vpsid #{arg} soft:hard"
|
114
124
|
end
|
115
125
|
elsif ['-d', '--diskspace'].include? arg
|
116
126
|
disk = @arguments.shift
|
117
127
|
|
118
128
|
if !(disk =~ /^\d+:\d+$/)
|
119
|
-
raise "Usage: vzlimit
|
129
|
+
raise "Usage: vzlimit set vpsid #{arg} soft:hard"
|
120
130
|
end
|
121
131
|
else
|
122
|
-
raise "Argument #{arg} not valid for action
|
132
|
+
raise "Argument #{arg} not valid for action 'set'."
|
123
133
|
end
|
124
134
|
end
|
125
135
|
|
@@ -145,7 +155,7 @@ module Vzlimit
|
|
145
155
|
|
146
156
|
# Convert MB limits to mempages
|
147
157
|
soft = (soft_mb.to_f * 1024 / 4).to_i
|
148
|
-
hard = (
|
158
|
+
hard = (hard_mb.to_f * 1024 / 4).to_i
|
149
159
|
|
150
160
|
# Execute command
|
151
161
|
execute "vzctl set #{vpsid} --privvmpages #{soft}:#{hard} --save"
|
@@ -168,7 +178,7 @@ module Vzlimit
|
|
168
178
|
|
169
179
|
# Convert MB limits to 1K-block
|
170
180
|
soft = (soft_mb.to_f * 1024).to_i
|
171
|
-
hard = (
|
181
|
+
hard = (hard_mb.to_f * 1024).to_i
|
172
182
|
|
173
183
|
# Execute command
|
174
184
|
execute "vzctl set #{vpsid} --diskspace #{soft}:#{hard} --save"
|
@@ -196,6 +206,20 @@ module Vzlimit
|
|
196
206
|
|
197
207
|
def usage
|
198
208
|
@h.say "Usage: vzlimit action [params...]"
|
209
|
+
exit
|
199
210
|
end
|
211
|
+
|
212
|
+
def version
|
213
|
+
@h.say "vzlimit version #{VERSION}"
|
214
|
+
end
|
215
|
+
|
216
|
+
def help
|
217
|
+
@h.say "vzlimit list | set <veid>"
|
218
|
+
@h.say "vzlimit set <veid>"
|
219
|
+
@h.say "\t[--ram, -r <soft-limit-in-mb>:<hard-limit-in-mb>]"
|
220
|
+
@h.say "\t[--diskspace, -d <soft-limit-in-mb>:<hard-limit-in-mb>]"
|
221
|
+
@h.say "vzlimit --help, -h"
|
222
|
+
@h.say "vzlimit --version, -v"
|
223
|
+
end
|
200
224
|
end
|
201
|
-
end
|
225
|
+
end
|
data/lib/vzlimit.rb
CHANGED
data/website/index.html
CHANGED
@@ -10,6 +10,14 @@
|
|
10
10
|
</head>
|
11
11
|
<body>
|
12
12
|
<h1>vzlimit</h1>
|
13
|
-
<p>
|
13
|
+
<p>A convenience way of managing OpenVZ container resource limits.</p>
|
14
|
+
|
15
|
+
<h2>Commands</h2>
|
16
|
+
<h3>List resource limits</h3>
|
17
|
+
<p><code>vzlimit list</code></p>
|
18
|
+
<h3>Set ram limit</h3>
|
19
|
+
<p><code>vzlimit set <i>vpsid</i> --ram, -r <i>soft(MB)</i>:<i>hard(MB)</i></code></p>
|
20
|
+
<h3>Set diskspace limit</h3>
|
21
|
+
<p><code>vzlimit set <i>vpsid</i> --diskspace, -d <i>soft(MB)</i>:<i>hard(MB)</i></code></p>
|
14
22
|
</body>
|
15
23
|
</html>
|
data/website/index.html$
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>vzlimit - managing OpenVZ limits with comfort</title>
|
4
|
+
<style type="text/css">
|
5
|
+
body
|
6
|
+
{
|
7
|
+
font-family: Georgia;
|
8
|
+
}
|
9
|
+
</style>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>vzlimit</h1>
|
13
|
+
<p>A relaxed way of managing resources/limits for OpenVZ.</p>
|
14
|
+
<h2>Commands</h2>
|
15
|
+
<h3>List all
|
16
|
+
</body>
|
17
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vzlimit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Remo Fritzsche
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01
|
12
|
+
date: 2010-02-01 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 2.5.0
|
74
74
|
version:
|
75
|
-
description:
|
75
|
+
description: FIX (describe your package)
|
76
76
|
email:
|
77
77
|
- dev@remofritzsche.com
|
78
78
|
executables:
|
@@ -82,9 +82,11 @@ extensions: []
|
|
82
82
|
extra_rdoc_files:
|
83
83
|
- History.txt
|
84
84
|
- Manifest.txt
|
85
|
+
- PostInstall.txt
|
85
86
|
files:
|
86
87
|
- History.txt
|
87
88
|
- Manifest.txt
|
89
|
+
- PostInstall.txt
|
88
90
|
- README.rdoc
|
89
91
|
- Rakefile
|
90
92
|
- bin/vzlimit
|
@@ -100,11 +102,12 @@ files:
|
|
100
102
|
- test/test_vzlimit_cli.rb
|
101
103
|
- vzlimit.gemspec
|
102
104
|
- website/index.html
|
105
|
+
- website/index.html$
|
103
106
|
has_rdoc: true
|
104
|
-
homepage: http://
|
107
|
+
homepage: http://github.com/#{github_username}/#{project_name}
|
105
108
|
licenses: []
|
106
109
|
|
107
|
-
post_install_message:
|
110
|
+
post_install_message: PostInstall.txt
|
108
111
|
rdoc_options:
|
109
112
|
- --main
|
110
113
|
- README.rdoc
|
@@ -128,7 +131,7 @@ rubyforge_project: vzlimit
|
|
128
131
|
rubygems_version: 1.3.5
|
129
132
|
signing_key:
|
130
133
|
specification_version: 3
|
131
|
-
summary:
|
134
|
+
summary: FIX (describe your package)
|
132
135
|
test_files:
|
133
136
|
- test/test_helper.rb
|
134
137
|
- test/test_vzlimit.rb
|