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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39ffb2500bd4989756261d509d4ea65897efd59f
4
- data.tar.gz: d4f446084930370ef72c3430bf81c2e0d6718ceb
3
+ metadata.gz: 137ad132fca39b6b0324020fa234dfe5f6ce27e0
4
+ data.tar.gz: 14abd66feaf04836cae4d34446776b82b8e0a399
5
5
  SHA512:
6
- metadata.gz: 65170d224da12a1465b92aa5a2fd881c0ee660898622e4e56b927a45af462ba53e4b6a743df469070757f82ea76e095b3f2d9e06f0fddac7d3394cd2c975fdbc
7
- data.tar.gz: 34737678da03694f3137b68293ab779810ffe5568496009f4211db989ff1e4eea2c6a9ba9a003f450b5c3e2e7d0f58bad67bd6ae96d146dc61ca864f116b836e
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 this one will be used, otherwise the global one will be used.
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
 
@@ -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
- p_vm_list(vm.memory.human_size(1), vm.name, vm.type, vm.uuid, printable_state(vm.state), vm.admin_ip, *user_columns)
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
- puts " [ #{size.rjust(6)} #{name.ljust(30)} - #{uuid.ljust(37)}][ #{format_generic(admin_ip).ljust(15).cyan} ]#{tmp}[ #{state} ]"
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SmartosManager
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
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
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-07-21 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb