solidfire_api 0.0.8 → 0.0.11

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: 4e4362dac5d531f0fde18a6a0d6fbaf6ed84261f
4
- data.tar.gz: b1c6cd47bc3ae7061c873dfb1539a9fc3b8e1d62
3
+ metadata.gz: 414e691bf8c45e09ee8b2383b8843651ec7c52e7
4
+ data.tar.gz: 1abe31eb762190ab7bb4da50ed313ba3c6bbfada
5
5
  SHA512:
6
- metadata.gz: 90b83710a6cececf2f911f5d19786af1bd528fe36ab11e8b3ef55f2a421032fb322d02e4fdce16872981fa51d0c55a6fd921ec6257bcc38dd2e339e03e47420e
7
- data.tar.gz: 95c9d38319bc23779c7e9ab9556373593cfd66bc95d771d4051dcb2498a2063ce13a47aa729a18bd1b672789d0895aa90a05f92dc62844546340104327f66443
6
+ metadata.gz: bad3a5e389e3f363051b1dff2721a949a3b03f41f2ac798719c995eb7c7ccedcb0ffc4419ff78ddf44bc0eb878c0fc5b88bcb43a47484dd989826ad099800d31
7
+ data.tar.gz: 57d921a1d15731596f6ad35cd65962ed8051c0d99a1fa5d9d96133fbecf576521a1f077a45d8d9f3198d9b854a71fd2124cc7a27c63bb74f52509401aceb4ede
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2014 Pierre-Luc Dion
1
+ Copyright 2015 Pierre-Luc Dion
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SolidfireApi
2
2
 
3
- Ruby Gem to connect on [Solidfire](http://www.solidfire.com/) storage Array API to collect stats. Currently support Simple Authentication and very basic functionalities.
3
+ 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
4
 
5
5
  Currently supporting volumes, cluster and disks listing and stats API call's to collect performance metrics for monitoring usage. Nothing for managing cluster yet.
6
6
 
@@ -73,7 +73,8 @@ module Cluster
73
73
  if answer["nonZeroBlocks"] == 0
74
74
  answer["thinProvisioningFactor"] = 0
75
75
  else
76
- answer["thinProvisioningFactor"] = (answer["nonZeroBlocks"] + answer["zeroBlocks"]) / answer["nonZeroBlocks"]
76
+ answer["thinProvisioningFactor"] = (answer["nonZeroBlocks"] + answer["zeroBlocks"]) / answer["nonZeroBlocks"].to_f
77
+ answer["thinProvisioningFactor"] = answer["thinProvisioningFactor"].round(2)
77
78
  end
78
79
 
79
80
  # deDuplicationFactor metric, calculated based on document instructions.
@@ -81,7 +82,8 @@ module Cluster
81
82
  if answer["uniqueBlocks"] == 0
82
83
  answer["deDuplicationFactor"] = 0
83
84
  else
84
- answer["deDuplicationFactor"] = answer["nonZeroBlocks"] / answer["uniqueBlocks"]
85
+ answer["deDuplicationFactor"] = answer["nonZeroBlocks"] / answer["uniqueBlocks"].to_f
86
+ answer["deDuplicationFactor"] = answer["deDuplicationFactor"].round(2)
85
87
  end
86
88
 
87
89
  # compressionFactor metric, calculated based on document instructions.
@@ -89,12 +91,14 @@ module Cluster
89
91
  if answer["uniqueBlocksUsedSpace"] == 0
90
92
  answer["compressionFactor"] = 0
91
93
  else
92
- answer["compressionFactor"] = (answer["uniqueBlocks"] * 4096) / answer["uniqueBlocksUsedSpace"]
94
+ answer["compressionFactor"] = (answer["uniqueBlocks"] * 4096) / answer["uniqueBlocksUsedSpace"].to_f
95
+ answer["compressionFactor"] = answer["compressionFactor"].round(2)
93
96
  end
94
97
 
95
98
  # efficiencyFactor metric, calculated based on document instructions.
96
99
  # efficiencyFactor = thinProvisioningFactor * deDuplicationFactor * compressionFactor
97
100
  answer["efficiencyFactor"] = answer["thinProvisioningFactor"] * answer["deDuplicationFactor"] * answer["compressionFactor"]
101
+ answer["efficiencyFactor"] = answer["efficiencyFactor"].round(2)
98
102
 
99
103
  return answer
100
104
  end
@@ -53,7 +53,7 @@ module SolidfireApi
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/5.0"
56
+ solidfire_rest_url = "https://#{@username}:#{@password}@#{@mvip}/json-rpc/8.0"
57
57
 
58
58
  conn = RestClient::Resource.new(
59
59
  solidfire_rest_url,
@@ -1,3 +1,3 @@
1
1
  module SolidfireApi
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -1,5 +1,23 @@
1
1
  module Volume
2
2
 
3
+ ##
4
+ # list active volumes, return Array of Hash
5
+ #
6
+ # Arguments:
7
+ # state: (String, active or deleted, default = active)
8
+ # limit: (Integer, default = 1000)
9
+ #
10
+ def volumes_create()
11
+ api_call = {
12
+ :method => "CreateVolume",
13
+ :params => {
14
+ :startVolumeID => 0,
15
+ :limit => limit
16
+ }
17
+ }
18
+ answer = query_sf(api_call)
19
+ return answer["volumes"]
20
+ end
3
21
 
4
22
  ##
5
23
  # list active volumes, return Array of Hash
@@ -15,7 +33,7 @@ module Volume
15
33
  :method => "ListActiveVolumes",
16
34
  :params => {
17
35
  :startVolumeID => 0,
18
- :limit => 1000
36
+ :limit => limit
19
37
  }
20
38
  }
21
39
  when "deleted"
@@ -45,7 +63,25 @@ module Volume
45
63
  answer = query_sf(api_call)
46
64
  return answer["volumeStats"]
47
65
  end
48
-
66
+
67
+ ##
68
+ # return volume performance metrics as Hash
69
+ #
70
+ # Arguments:
71
+ # vol_id: (Integer)
72
+ # Volume ID from the Solidfire Cluster.
73
+ #
74
+ def volume_efficiency(vol_id)
75
+ api_call = {
76
+ :method => "GetVolumeEfficiency",
77
+ :params => {
78
+ :volumeID => vol_id
79
+ }
80
+ }
81
+ answer = query_sf(api_call)
82
+ return answer
83
+ end
84
+
49
85
  ##
50
86
  # Return volumes list per account
51
87
  #
@@ -60,7 +96,7 @@ module Volume
60
96
  }
61
97
  }
62
98
  answer = query_sf(api_call)
63
- return answer["result"]
99
+ return answer
64
100
  end
65
101
 
66
102
 
@@ -71,6 +107,6 @@ module Volume
71
107
  :id => 1
72
108
  }
73
109
  answer = query_sf(api_call)
74
- return answer["result"]
110
+ return answer
75
111
  end
76
112
  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.8
4
+ version: 0.0.11
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: 2014-10-11 00:00:00.000000000 Z
11
+ date: 2015-12-19 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.2.2
96
+ rubygems_version: 2.4.5.1
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Solidfire Storage API Ruby Libraries