bosh_vsphere_cpi 0.6.0 → 1.5.0.pre.1100

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/bin/vsphere_cpi_console +35 -0
  2. data/db/migrations/20120123235022_initial.rb +5 -0
  3. data/lib/cloud/vsphere/client.rb +4 -5
  4. data/lib/cloud/vsphere/cloud.rb +245 -226
  5. data/lib/cloud/vsphere/config.rb +0 -4
  6. data/lib/cloud/vsphere/models/disk.rb +3 -0
  7. data/lib/cloud/vsphere/path_finder.rb +12 -0
  8. data/lib/cloud/vsphere/resources.rb +0 -2
  9. data/lib/cloud/vsphere/version.rb +1 -1
  10. data/lib/cloud/vsphere.rb +5 -3
  11. data/lib/ruby_vim_sdk/base_type.rb +15 -0
  12. data/lib/ruby_vim_sdk/const.rb +32 -0
  13. data/lib/ruby_vim_sdk/core_types.rb +68 -0
  14. data/lib/ruby_vim_sdk/data_type.rb +14 -0
  15. data/lib/ruby_vim_sdk/enum_type.rb +12 -0
  16. data/lib/ruby_vim_sdk/ext.rb +9 -0
  17. data/lib/ruby_vim_sdk/managed_type.rb +12 -0
  18. data/lib/ruby_vim_sdk/method.rb +37 -0
  19. data/lib/ruby_vim_sdk/missing_types.rb +11 -0
  20. data/lib/ruby_vim_sdk/property.rb +49 -0
  21. data/lib/ruby_vim_sdk/server_objects.rb +2718 -0
  22. data/lib/ruby_vim_sdk/soap/deserializer.rb +301 -0
  23. data/lib/ruby_vim_sdk/soap/serializer.rb +225 -0
  24. data/lib/ruby_vim_sdk/soap/stub_adapter.rb +123 -0
  25. data/lib/ruby_vim_sdk/soap_exception.rb +12 -0
  26. data/lib/ruby_vim_sdk/typed_array.rb +9 -0
  27. data/lib/ruby_vim_sdk/types.rb +22 -0
  28. data/lib/ruby_vim_sdk/version.rb +5 -0
  29. data/lib/ruby_vim_sdk/vmodl/data_object.rb +102 -0
  30. data/lib/ruby_vim_sdk/vmodl/managed_object.rb +78 -0
  31. data/lib/ruby_vim_sdk/vmodl/method_name.rb +7 -0
  32. data/lib/ruby_vim_sdk/vmodl/property_path.rb +7 -0
  33. data/lib/ruby_vim_sdk/vmodl/type_name.rb +7 -0
  34. data/lib/ruby_vim_sdk/vmodl_helper.rb +33 -0
  35. data/lib/ruby_vim_sdk/vmomi_support.rb +280 -0
  36. data/lib/ruby_vim_sdk.rb +45 -0
  37. metadata +65 -53
  38. data/Rakefile +0 -50
  39. data/spec/spec_helper.rb +0 -33
  40. data/spec/unit/cloud/vsphere/resources/cluster_spec.rb +0 -383
  41. data/spec/unit/cloud/vsphere/resources/datacenter_spec.rb +0 -72
  42. data/spec/unit/cloud/vsphere/resources/datastore_spec.rb +0 -43
  43. data/spec/unit/cloud/vsphere/resources/folder_spec.rb +0 -63
  44. data/spec/unit/cloud/vsphere/resources/resource_pool_spec.rb +0 -42
  45. data/spec/unit/cloud/vsphere/resources/scorer_spec.rb +0 -73
  46. data/spec/unit/cloud/vsphere/resources/util_spec.rb +0 -35
  47. data/spec/unit/cloud/vsphere/resources_spec.rb +0 -216
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ unless ARGV[0]
4
+ puts 'Usage: pry.rb <director_config_yaml>'
5
+ exit 1
6
+ end
7
+
8
+ require 'yaml'
9
+
10
+ require 'pry'
11
+ require 'sequel'
12
+ require 'sequel/adapters/sqlite'
13
+ require 'cloud'
14
+ require 'cloud/vsphere'
15
+
16
+ db = Sequel.sqlite
17
+ Sequel.extension :migration
18
+
19
+ Sequel::TimestampMigrator.new(db, File.expand_path('../../db/migrations', __FILE__), {}).run
20
+
21
+ bosh_director_config = OpenStruct.new(logger: Logger.new(STDOUT), uuid: 'uuid', task_checkpoint: nil, db: Sequel.sqlite)
22
+
23
+ Bosh::Clouds::Config.configure(bosh_director_config)
24
+
25
+ director_config = YAML.load_file(ARGV[0])
26
+ vsphere_properties = director_config['cloud']['properties']
27
+
28
+ cpi = Bosh::Clouds::VSphere.new(vsphere_properties)
29
+
30
+ puts "You are connected to #{vsphere_properties['vcenters'].first['host']}"
31
+
32
+ # Welcome to the vSphere console!
33
+ # you can access the cpi through the 'cpi' object
34
+
35
+ Pry.start binding
@@ -1,6 +1,11 @@
1
1
  # Copyright (c) 2009-2012 VMware, Inc.
2
2
 
3
3
  Sequel.migration do
4
+ # there is a bug in sequel where create_table? on postgres causes the transaction to abort with:
5
+ # PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block
6
+ # to work around this until it is fixed, transactions are disabled, which is fine as it is an atomic operation
7
+ no_transaction
8
+
4
9
  up do
5
10
  # This used to be included in the director migrations, so we should not fail (hence create_table?) if this table
6
11
  # already exists to allow old installations to keep working with the new migrations.
@@ -1,3 +1,5 @@
1
+ require 'ruby_vim_sdk'
2
+
1
3
  module VSphereCloud
2
4
 
3
5
  class Client
@@ -56,7 +58,6 @@ module VSphereCloud
56
58
 
57
59
  filter_spec = PC::FilterSpec.new(:prop_set => property_specs, :object_set => object_spec)
58
60
 
59
- # TODO: cache partial results
60
61
  attempts = 0
61
62
  begin
62
63
  properties_response = get_all_properties(filter_spec)
@@ -201,9 +202,8 @@ module VSphereCloud
201
202
  end
202
203
 
203
204
  def find_by_inventory_path(path)
204
- path = [path] unless path.kind_of?(Array)
205
- path = path.flatten.collect { |name| name.gsub("/", "%2f") }.join("/")
206
- @service_content.search_index.find_by_inventory_path(path)
205
+ full_path = Array(path).join("/")
206
+ @service_content.search_index.find_by_inventory_path(full_path)
207
207
  end
208
208
 
209
209
  def wait_for_task(task)
@@ -214,7 +214,6 @@ module VSphereCloud
214
214
  :ensure => ["info.state"])[task]
215
215
 
216
216
  duration = Time.now - started
217
- # TODO: make configurable?
218
217
  raise "Task taking too long" if duration > 3600 # 1 hour
219
218
 
220
219
  # Update the polling interval based on task progress