solidfire_api 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 414e691bf8c45e09ee8b2383b8843651ec7c52e7
4
- data.tar.gz: 1abe31eb762190ab7bb4da50ed313ba3c6bbfada
3
+ metadata.gz: 2dd4c4ceeeb281e08951d3a17604e6c63cb26b81
4
+ data.tar.gz: a79ee13994f5dc19b0b702e832405d21e1294d11
5
5
  SHA512:
6
- metadata.gz: bad3a5e389e3f363051b1dff2721a949a3b03f41f2ac798719c995eb7c7ccedcb0ffc4419ff78ddf44bc0eb878c0fc5b88bcb43a47484dd989826ad099800d31
7
- data.tar.gz: 57d921a1d15731596f6ad35cd65962ed8051c0d99a1fa5d9d96133fbecf576521a1f077a45d8d9f3198d9b854a71fd2124cc7a27c63bb74f52509401aceb4ede
6
+ metadata.gz: 6156442bcf340e699a7b0ab3edbd310e530925e649f50e8d66c0b1c9a3625a88300e91ec2ce142ef5e8e57347bf8fce2e559efc68033912600dabfc3a939f3b1
7
+ data.tar.gz: 6ee8a856b9d487a56a66c11e644ff1bbe86a76fd86bf30d7a69310c98bdbc8614b32aba11e074a25f5105364d4775d4cb2b3ed2eca7392bb7ee2f6afe27573d3
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SolidfireApi
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/solidfire_api.png)](https://badge.fury.io/rb/solidfire_api)
4
+
3
5
  Ruby Gem to connect on [Solidfire](http://www.solidfire.com/) storage Array API to collect stats. Currently support Simple Authentication and very basic functionalities. Work with API version 8 of SolidFire.
4
6
 
5
7
  Currently supporting volumes, cluster and disks listing and stats API call's to collect performance metrics for monitoring usage. Nothing for managing cluster yet.
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  # Cluster
3
- #
4
- # Cluster related API calls
3
+ #
4
+ # Cluster related API calls
5
5
  #
6
6
 
7
7
  module Cluster
@@ -21,7 +21,7 @@ module Cluster
21
21
 
22
22
  ##
23
23
  # Cluster Information such as hostname, mvip,svip,...
24
- #
24
+ #
25
25
  def cluster_info()
26
26
  api_call = {
27
27
  :method => "GetClusterInfo",
@@ -31,7 +31,19 @@ module Cluster
31
31
  answer = query_sf(api_call)
32
32
  return answer["clusterInfo"]
33
33
  end
34
-
34
+
35
+ ##
36
+ # Cluster fullness information
37
+ #
38
+ def cluster_fullness()
39
+ api_call = {
40
+ :method => "GetClusterFullThreshold",
41
+ :params => {}
42
+ }
43
+ answer = query_sf(api_call)
44
+ return answer
45
+ end
46
+
35
47
  ##
36
48
  # Cluster firmware version including nodes
37
49
  #
@@ -43,10 +55,10 @@ module Cluster
43
55
  }
44
56
  answer = query_sf(api_call)
45
57
  return answer["clusterVersion"]
46
- end
58
+ end
47
59
  ##
48
60
  # Cluster performance metrics, overall IOPS,..
49
- #
61
+ #
50
62
  def cluster_stats()
51
63
  api_call = {
52
64
  :method => "GetClusterStats",
@@ -55,10 +67,10 @@ module Cluster
55
67
  }
56
68
  answer = query_sf(api_call)
57
69
  return answer["clusterStats"]
58
- end
70
+ end
59
71
 
60
72
  ##
61
- # Cluster capacity
73
+ # Cluster capacity
62
74
  #
63
75
  def cluster_capacity()
64
76
  api_call = {
@@ -67,7 +79,7 @@ module Cluster
67
79
  }
68
80
  }
69
81
  answer = query_sf(api_call)["clusterCapacity"]
70
-
82
+
71
83
  # thinProvisioningFactor metric, calculated based on document instructions.
72
84
  # if condition to avoid divide by 0.
73
85
  if answer["nonZeroBlocks"] == 0
@@ -76,7 +88,7 @@ module Cluster
76
88
  answer["thinProvisioningFactor"] = (answer["nonZeroBlocks"] + answer["zeroBlocks"]) / answer["nonZeroBlocks"].to_f
77
89
  answer["thinProvisioningFactor"] = answer["thinProvisioningFactor"].round(2)
78
90
  end
79
-
91
+
80
92
  # deDuplicationFactor metric, calculated based on document instructions.
81
93
  # if condition to avoid divide by 0.
82
94
  if answer["uniqueBlocks"] == 0
@@ -85,7 +97,7 @@ module Cluster
85
97
  answer["deDuplicationFactor"] = answer["nonZeroBlocks"] / answer["uniqueBlocks"].to_f
86
98
  answer["deDuplicationFactor"] = answer["deDuplicationFactor"].round(2)
87
99
  end
88
-
100
+
89
101
  # compressionFactor metric, calculated based on document instructions.
90
102
  # if condition to avoid divide by 0.
91
103
  if answer["uniqueBlocksUsedSpace"] == 0
@@ -94,23 +106,23 @@ module Cluster
94
106
  answer["compressionFactor"] = (answer["uniqueBlocks"] * 4096) / answer["uniqueBlocksUsedSpace"].to_f
95
107
  answer["compressionFactor"] = answer["compressionFactor"].round(2)
96
108
  end
97
-
109
+
98
110
  # efficiencyFactor metric, calculated based on document instructions.
99
111
  # efficiencyFactor = thinProvisioningFactor * deDuplicationFactor * compressionFactor
100
112
  answer["efficiencyFactor"] = answer["thinProvisioningFactor"] * answer["deDuplicationFactor"] * answer["compressionFactor"]
101
113
  answer["efficiencyFactor"] = answer["efficiencyFactor"].round(2)
102
-
114
+
103
115
  return answer
104
- end
105
-
116
+ end
117
+
118
+
106
119
 
107
-
108
120
  ##
109
121
  # List all account, return Array of Hash
110
122
  #
111
123
  # Arguments:
112
124
  # limit: (integer, default=1000)
113
- #
125
+ #
114
126
  def accounts_list(limit = 1000)
115
127
  api_call = {
116
128
  :method => "ListAccounts",
@@ -125,7 +137,7 @@ module Cluster
125
137
 
126
138
  ##
127
139
  # List Cluster Faults
128
- #
140
+ #
129
141
  # Arguments:
130
142
  # fault_type: (node,drive,cluster,service, default=all)
131
143
  # node: Fault affecting an entire node
@@ -145,7 +157,7 @@ module Cluster
145
157
 
146
158
  ##
147
159
  # Cluster List iSCSI sessions.
148
- #
160
+ #
149
161
  def iscsi_sessions_list()
150
162
  api_call = {
151
163
  :method => "ListISCSISessions",
@@ -157,4 +169,3 @@ module Cluster
157
169
 
158
170
 
159
171
  end
160
-
@@ -5,9 +5,9 @@ require 'solidfire_api/cluster'
5
5
  require 'solidfire_api/volume_access_group'
6
6
 
7
7
  module SolidfireApi
8
-
8
+
9
9
  ##
10
- # Object connection
10
+ # Object connection
11
11
  #
12
12
  # Call using: SolidfireApi::Connection.new({...})
13
13
  #
@@ -15,13 +15,13 @@ module SolidfireApi
15
15
  # mvip: (String)
16
16
  # username: (String)
17
17
  # password: (String)
18
- #
19
- class Connection
18
+ #
19
+ class Connection
20
20
  include Cluster
21
21
  include Volume
22
22
  include Node
23
23
  include VolumeAccessGroup
24
-
24
+
25
25
  def self.data
26
26
  @data ||= Hash.new do |hash, key|
27
27
  hash[key] = {}
@@ -31,9 +31,9 @@ module SolidfireApi
31
31
  def self.reset
32
32
  @data = nil
33
33
  end
34
-
34
+
35
35
  ##
36
- #
36
+ #
37
37
  # Used by all other methods to connect at the SolidFire API
38
38
  # require RestClient gem to handle Rest API calls.
39
39
  # the input is the complete API query as Hash, the method will
@@ -47,17 +47,19 @@ module SolidfireApi
47
47
  # >> }
48
48
  # >> query_sf(api_call)
49
49
  #
50
- #
50
+ #
51
51
  # Arguments:
52
52
  # query: (Hash)
53
53
  # must include the complete Solidfire API query string.
54
54
  def query_sf(query)
55
55
  # query is a hash that is post in json format to SolidFire API.
56
- solidfire_rest_url = "https://#{@username}:#{@password}@#{@mvip}/json-rpc/8.0"
56
+ solidfire_rest_url = "https://#{@mvip}/json-rpc/8.0"
57
57
 
58
58
  conn = RestClient::Resource.new(
59
59
  solidfire_rest_url,
60
- :verify_ssl => @verify_ssl
60
+ :verify_ssl => @verify_ssl,
61
+ :user => @username,
62
+ :password => @password
61
63
  )
62
64
  result = JSON.parse(conn.post query.to_json)
63
65
 
@@ -67,10 +69,10 @@ module SolidfireApi
67
69
  else
68
70
  return result["error"]
69
71
  end
70
- else
72
+ else
71
73
  return result["result"]
72
74
  end
73
- end
75
+ end
74
76
 
75
77
  def initialize(options={})
76
78
  @mvip = options[:mvip]
@@ -96,14 +98,14 @@ module SolidfireApi
96
98
  def name
97
99
  @name
98
100
  end
99
-
101
+
100
102
  def mvip
101
103
  @mvip
102
104
  end
103
-
105
+
104
106
  def svip
105
107
  @svip
106
108
  end
107
-
108
- end
109
- end
109
+
110
+ end
111
+ end
@@ -1,3 +1,3 @@
1
1
  module SolidfireApi
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidfire_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Luc Dion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-19 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.4.5.1
96
+ rubygems_version: 2.4.8
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Solidfire Storage API Ruby Libraries