smartos-manager 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/smartos-manager/cli.rb +26 -4
- data/lib/smartos-manager/core.rb +10 -0
- 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: 137ad132fca39b6b0324020fa234dfe5f6ce27e0
|
4
|
+
data.tar.gz: 14abd66feaf04836cae4d34446776b82b8e0a399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8276fb6b3155b61d3f5776a4a97a4500c261e5954668ad57db7ad0539130949d31501e3200dfd731255a03d0a369b7a12e5f285a7d5d43fb2f60da48e99d7ea
|
7
|
+
data.tar.gz: 21dc78194fe6fa6334016ce4dbb5ff798e4d543aeec808fe91a2697939af0c72afe0a2137fcb6a5f9d1802ba39fabdb4f28a39aba9362fdda84450538b7441df
|
data/README.md
CHANGED
@@ -36,7 +36,10 @@ first you need to create a config file to define your environment:
|
|
36
36
|
|
37
37
|
```
|
38
38
|
|
39
|
-
All options except address (which makes no sense) can be defined in a global section, if present a host section
|
39
|
+
All options except address (which makes no sense) can be defined in a global section, if present in a host section the later will be used, otherwise the global one is used.
|
40
|
+
|
41
|
+
Save te config file as "smartos_hosts.toml" and run the followings commands
|
42
|
+
in the same folder.
|
40
43
|
|
41
44
|
Once you have your file you can use the smanager command:
|
42
45
|
|
data/lib/smartos-manager/cli.rb
CHANGED
@@ -30,7 +30,7 @@ class AppCLI < Thor
|
|
30
30
|
|
31
31
|
user_columns = registry.user_columns.keys.map{|s| humanize(s) }
|
32
32
|
|
33
|
-
p_vm_list("Memory", "Name", "Type", "UUID", "State", "Admin IP", *user_columns)
|
33
|
+
p_vm_list("Memory", "Name (gray = online)", "Type", "UUID", "State", "Admin IP", "DD(GB)", *user_columns)
|
34
34
|
|
35
35
|
ret.each do |host, vms|
|
36
36
|
mem = sysinfos[host][:memory]
|
@@ -47,7 +47,16 @@ class AppCLI < Thor
|
|
47
47
|
puts "#{host.name} [SmartOS: #{rev.send(rev_colors.get(rev))}] (#{host.address}) (Total RAM: #{mem.human_size(1).green} [Free Slots: #{diags[host][:free_memory_banks]}], ZFS: #{format_size(zfs_arc_current)}G/#{format_size(zfs_arc_reserved)}G, Avail: #{avail.human_size(1).magenta})"
|
48
48
|
vms.each do |vm|
|
49
49
|
user_columns = registry.user_columns.values.map{|key| vm[key] }
|
50
|
-
|
50
|
+
|
51
|
+
if vm.type == "KVM"
|
52
|
+
vm_disk = sysinfos[host][:zfs_volumes]["zones/#{vm.uuid}-disk0"]
|
53
|
+
vm_disk_label = "#{vm_disk[:size]}"
|
54
|
+
else
|
55
|
+
vm_disk = sysinfos[host][:zfs_volumes]["zones/#{vm.uuid}"]
|
56
|
+
vm_disk_label = "#{vm_disk[:quota]}"
|
57
|
+
end
|
58
|
+
|
59
|
+
p_vm_list(vm.memory.human_size(1), vm.name, vm.type, vm.uuid, vm.state, vm.admin_ip, vm_disk_label, *user_columns)
|
51
60
|
end
|
52
61
|
|
53
62
|
if vms.empty?
|
@@ -75,9 +84,22 @@ class AppCLI < Thor
|
|
75
84
|
str
|
76
85
|
end
|
77
86
|
|
78
|
-
def p_vm_list(size, name, type, uuid, state, admin_ip, *user_columns)
|
87
|
+
def p_vm_list(size, name, type, uuid, state, admin_ip, disk_label, *user_columns)
|
79
88
|
tmp = user_columns.map{|val| "[ #{format_generic(val).to_s.ljust(15).cyan} ]" }.join('')
|
80
|
-
|
89
|
+
|
90
|
+
if name.start_with?('Name')
|
91
|
+
name = name.white()
|
92
|
+
else
|
93
|
+
state_color = case state
|
94
|
+
when 'running' then :white
|
95
|
+
else
|
96
|
+
:red
|
97
|
+
end
|
98
|
+
|
99
|
+
name = name.send(state_color)
|
100
|
+
end
|
101
|
+
|
102
|
+
puts " [ #{size.rjust(6)} #{name.ljust(35)} - #{disk_label.rjust(5)} - #{uuid.ljust(37)}][ #{format_generic(admin_ip).ljust(15).cyan} ]#{tmp}"
|
81
103
|
end
|
82
104
|
|
83
105
|
def printable_state(state)
|
data/lib/smartos-manager/core.rb
CHANGED
@@ -171,6 +171,16 @@ class HostRegistry
|
|
171
171
|
run_on_all("prtconf | head -3 | grep Mem").each do |host, data|
|
172
172
|
_, _, mem, _ = data.split(" ")
|
173
173
|
ret[host] = {memory: mem.to_i.megabytes}
|
174
|
+
ret[host][:zfs_volumes] = {}
|
175
|
+
end
|
176
|
+
|
177
|
+
# disk size
|
178
|
+
run_on_all("zfs list -Ho name,quota,volsize").each do |host, data|
|
179
|
+
|
180
|
+
data.split("\n").each do |line|
|
181
|
+
name, quota, size = line.split("\t")
|
182
|
+
ret[host][:zfs_volumes][name] = {size: size[0...-1].split(',').first, quota: quota[0...-1].split(',').first}
|
183
|
+
end
|
174
184
|
end
|
175
185
|
|
176
186
|
# ARC Max Size
|
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.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Ammous
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|