smartos-manager 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smartos-manager/cli.rb +23 -3
- data/lib/smartos-manager/core.rb +11 -2
- data/lib/smartos-manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0871eeb3678ada4eb8003cbfad9b58e51a99276
|
4
|
+
data.tar.gz: 9a1468c77e3d5e63a0cf68fa8fcf987092c0e019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edffed69085bc2892f0ab771aa3c9f5bdd9e758bef82a03fabf5ecbc0e8deeca572ea260ba5feba770414d78e499735951df775dacb316ed2379aec1b32d3833
|
7
|
+
data.tar.gz: be161467db32d7722ce049a709518855a0e87b92be1d072c2d18001b4d77025f94b0428ce37e28d282b5f79944efb470f3437f91ecd58c7f382b8c6bac580a73
|
data/lib/smartos-manager/cli.rb
CHANGED
@@ -60,9 +60,12 @@ class AppCLI < Thor
|
|
60
60
|
# avail = (mem - vm_memory) - (20 * mem/100.0)
|
61
61
|
avail = [1, (mem - vm_memory) - zfs_arc_current].max
|
62
62
|
|
63
|
+
dd = sysinfos[host][:disks].map{|_, d| "#{format_size(d[:size])} GB" }.join(" - ")
|
64
|
+
|
63
65
|
rev = sysinfos[host][:smartos_version]
|
64
|
-
puts "\nHardware: #{diags[host][:system_id]} (MAC: #{sysinfos[host][:mac0].upcase.white()} )"
|
65
|
-
puts "
|
66
|
+
puts "\nHardware: #{diags[host][:system_id]} (MAC: #{sysinfos[host][:mac0].upcase.white()}, IP: #{host.address.white()} )"
|
67
|
+
puts "HDD: #{sysinfos[host][:disks].keys.size} drives - #{dd}"
|
68
|
+
puts "#{host.name} [SmartOS: #{rev.send(rev_colors.get(rev))}] (Free RAM: #{avail.human_size(1).green}/#{mem.human_size(1)} [Free Slots: #{diags[host][:free_memory_banks]}], ZFS: #{format_size(zfs_arc_current)}G/#{format_size(zfs_arc_reserved)}G)"
|
66
69
|
vms.each do |vm|
|
67
70
|
user_columns = registry.user_columns.values.map{|key| vm[key] }
|
68
71
|
|
@@ -104,6 +107,9 @@ class AppCLI < Thor
|
|
104
107
|
|
105
108
|
# (uuid name version os)
|
106
109
|
def p_img_list(uuid, name, version, os)
|
110
|
+
name ||= '-'
|
111
|
+
version ||= '-'
|
112
|
+
os ||= '-'
|
107
113
|
puts " [ #{uuid.ljust(37)}] #{name.ljust(30)} #{version.ljust(6)} #{os}"
|
108
114
|
end
|
109
115
|
|
@@ -122,7 +128,21 @@ class AppCLI < Thor
|
|
122
128
|
name = name.send(state_color)
|
123
129
|
end
|
124
130
|
|
125
|
-
|
131
|
+
line = build_vm_list_string(
|
132
|
+
size,
|
133
|
+
name,
|
134
|
+
disk_label,
|
135
|
+
uuid,
|
136
|
+
format_generic(admin_ip).cyan,
|
137
|
+
tmp
|
138
|
+
)
|
139
|
+
#line = " [ #{size.rjust(6)} #{name.ljust(35)} - #{disk_label.rjust(5)} - #{uuid.ljust(37)}][ #{format_generic(admin_ip).ljust(15).cyan} ]#{tmp}"
|
140
|
+
|
141
|
+
puts line
|
142
|
+
end
|
143
|
+
|
144
|
+
def build_vm_list_string(size, name, disk_label, uuid, admin_ip, rest)
|
145
|
+
" [ #{size.rjust(6)} #{name.ljust(35)} - #{disk_label.rjust(5)} - #{uuid.ljust(37)}][ #{admin_ip.ljust(15)} ]#{rest}"
|
126
146
|
end
|
127
147
|
|
128
148
|
def printable_state(state)
|
data/lib/smartos-manager/core.rb
CHANGED
@@ -204,17 +204,26 @@ class HostRegistry
|
|
204
204
|
run_on_all("prtconf | head -3 | grep Mem").each do |host, data|
|
205
205
|
_, _, mem, _ = data.split(" ")
|
206
206
|
ret[host] = {memory: mem.to_i.megabytes}
|
207
|
-
ret[host][:zfs_volumes] = {}
|
208
207
|
end
|
209
208
|
|
210
209
|
# main MAC address
|
211
210
|
run_on_all("ifconfig e1000g0 | grep ether | cut -d ' ' -f 2").each do |host, data|
|
212
211
|
ret[host][:mac0] = data.strip()
|
213
212
|
end
|
214
|
-
|
213
|
+
|
214
|
+
# disk infos
|
215
|
+
run_on_all("diskinfo -Hp").each do |host, data|
|
216
|
+
ret[host][:disks] = {}
|
217
|
+
|
218
|
+
data.split("\n").each do |line|
|
219
|
+
type, name, _, _, size_bytes, _, ssd = line.split("\t")
|
220
|
+
ret[host][:disks][name] = {size: size_bytes.to_i}
|
221
|
+
end
|
222
|
+
end
|
215
223
|
|
216
224
|
# disk size
|
217
225
|
run_on_all("zfs list -Ho name,quota,volsize").each do |host, data|
|
226
|
+
ret[host][:zfs_volumes] = {}
|
218
227
|
|
219
228
|
data.split("\n").each do |line|
|
220
229
|
name, quota, size = line.split("\t")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartos-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Ammous
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|