cft_smartcloud 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -89,10 +89,6 @@ This project uses the jeweler gem for packaging. See the tasks:
89
89
  rake version:bump:...
90
90
  rake build
91
91
 
92
- To publish to RubyForge
93
-
94
- rake gemcutter:release
95
-
96
92
  Screencast
97
93
  ===
98
94
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cft_smartcloud}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["yan", "cohesive"]
12
- s.date = %q{2012-03-12}
12
+ s.date = %q{2011-11-22}
13
13
  s.description = %q{CohesiveFT Ruby Interface for IBM SmartCloud and 'smartcloud' command line helper.}
14
14
  s.email = %q{yan.pritzker@cohesiveft.com}
15
15
  s.executables = ["cft_smartcloud", "smartcloud"]
@@ -46,7 +46,7 @@ module DynamicHelpGenerator
46
46
  puts %{ * #{method.to_s}#{'(' + args + ')' if args}#{extra_help}}
47
47
  else
48
48
  # These verbs help us figure out what 'group' the method belongs to
49
- verbs = %w(describe display create get allocate clone export attach detach delete generate update remove restart rename)
49
+ verbs = %w(describe display create get allocate clone export attach detach delete generate update remove restart rename save)
50
50
  verb_noun = /(#{verbs.join('|')})_(.*)(s|es)?/ # we're going to remove the verb and trailing 's'
51
51
 
52
52
  methods = public_methods - Object.public_methods - ['post','get','put','delete','logger','logger=','help']
data/lib/smartcloud.rb CHANGED
@@ -202,6 +202,24 @@ class IBMSmartCloud
202
202
  response.Image.ID
203
203
  end
204
204
 
205
+ help_for :delete_image, [:image_id => :req],
206
+ def delete_image(image_id)
207
+ delete("/offerings/image/#{image_id}")
208
+ true
209
+ end
210
+
211
+ help_for :delete_images, [:image_ids], %{
212
+ Example: smartcloud "delete_images(12345,12346,12347)"
213
+ }
214
+ def delete_images(*image_id_list)
215
+ threads=[]
216
+ image_id_list.each {|image|
217
+ threads << Thread.new { logger.info "Sending delete request for: #{image}..."; delete_image(image); logger.info "Finished delete request for #{image}" }
218
+ }
219
+ threads.each(&:join)
220
+ true
221
+ end
222
+
205
223
  # Launches a clone request and returns ID of new volume
206
224
  # TODO: the API call does not work, we have to use the cli for now
207
225
  help_for :clone_volume, [:name, :source_disk_id]
@@ -360,15 +378,26 @@ class IBMSmartCloud
360
378
  # ex: create_volume("yan", 61, "Small", "20001208", 61)
361
379
  #
362
380
  # NOTE: storage area id is not currently supported by IBM (according to docs)
363
- help_for :create_volume, [{:name => :req},{:location_id => :req},{:size => ['Small','Medium','Large']}, {:offering_id => :opt}, {:format => :opt}]
381
+ # NOTE: At one point sizes were only handled by "Name". Now they seem to support
382
+ # the numbers 60, 256, 512, 1024, 2048, 4112, 8224 and 10240.
383
+ # The original names were:
384
+ # Small == 256 GB
385
+ # Medium == 512 GB
386
+ # Large == 2048 GB
387
+ #
388
+ help_for :create_volume, [{:name => :req},{:location_id => :req},
389
+ {:size => ['Small','Medium','Large','60','256','512','1024','2048','4112','8224','10240']},
390
+ {:offering_id => :opt}, {:format => :opt}]
364
391
  def create_volume(name, location, size, offering_id=nil, format="EXT3")
365
392
 
366
393
  # figure out the offering ID automatically based on location and size
367
394
  if offering_id.nil?
368
395
  logger.debug "Looking up volume offerings based on location: #{location} and size: #{size}"
369
- offering = describe_volume_offerings(location, size)
370
- offering_id = if offering
371
- offering.ID
396
+
397
+ filter_size = ( ["Small", "Medium", "Large"].include?( size )) ? size: "Storage"
398
+ offering = describe_volume_offerings(location, filter_size)
399
+ if( offering && offering.SupportedSizes.split(",").include?(size) || ["Small", "Medium", "Large"].include?( size ))
400
+ offering_id = offering.ID
372
401
  else
373
402
  raise "Unable to locate offering with location #{location}, size #{size}."
374
403
  end
@@ -502,6 +531,12 @@ class IBMSmartCloud
502
531
  put("/instances/#{instance_id}", :state => "restart")
503
532
  true
504
533
  end
534
+
535
+ help_for :save_instance, [:instance_id, :name, :desc]
536
+ def save_instance(instance_id, name, desc = "")
537
+ put("/instances/#{instance_id}", :state => "save", :name => name, :description => desc)
538
+ true
539
+ end
505
540
 
506
541
  help_for :describe_instance, [:instance_id]
507
542
  def describe_instance(instance_id)
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cft_smartcloud
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 1
9
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - yan
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2012-03-12 00:00:00 -05:00
19
+ date: 2011-11-22 00:00:00 -06:00
19
20
  default_executable:
20
21
  dependencies: []
21
22
 
@@ -232,23 +233,27 @@ rdoc_options:
232
233
  require_paths:
233
234
  - lib
234
235
  required_ruby_version: !ruby/object:Gem::Requirement
236
+ none: false
235
237
  requirements:
236
238
  - - ">="
237
239
  - !ruby/object:Gem::Version
240
+ hash: 3
238
241
  segments:
239
242
  - 0
240
243
  version: "0"
241
244
  required_rubygems_version: !ruby/object:Gem::Requirement
245
+ none: false
242
246
  requirements:
243
247
  - - ">="
244
248
  - !ruby/object:Gem::Version
249
+ hash: 3
245
250
  segments:
246
251
  - 0
247
252
  version: "0"
248
253
  requirements: []
249
254
 
250
255
  rubyforge_project:
251
- rubygems_version: 1.3.6
256
+ rubygems_version: 1.3.7
252
257
  signing_key:
253
258
  specification_version: 3
254
259
  summary: CohesiveFT IBM SmartCloud API Gem