Class: RbVmomi::VIM::HostVsanInternalSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/rvc/modules/vsan.rb

Instance Method Summary collapse

Instance Method Details

#_parseJson(json) ⇒ Object



2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
# File 'lib/rvc/modules/vsan.rb', line 2898

def _parseJson json
  if json == "BAD"
    return nil
  end
  begin
    json = JSON.load(json)
  rescue
    nil
  end
end

#query_cmmds(queries, opts = {}) ⇒ Object



2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
# File 'lib/rvc/modules/vsan.rb', line 2909

def query_cmmds queries, opts = {}
  useGzip = (opts[:gzip]) && $vsanUseGzipApis
  if useGzip
    queries = queries + [{:type => "GZIP"}]
  end
  json = self.QueryCmmds(:queries => queries)
  if useGzip
    gzip = Base64.decode64(json)
    gz = Zlib::GzipReader.new(StringIO.new(gzip))
    json = gz.read
  end
  objects = _parseJson json
  if !objects
    raise "Server failed to gather CMMDS entries: JSON = '#{json}'"
#      raise "Server failed to gather CMMDS entries: JSON = #{json.length}"
  end
  objects = objects['result']
  objects    
end

#query_objects_on_physical_vsan_disk(opts) ⇒ Object



2965
2966
2967
2968
2969
2970
2971
2972
# File 'lib/rvc/modules/vsan.rb', line 2965

def query_objects_on_physical_vsan_disk(opts)
  json = self.QueryObjectsOnPhysicalVsanDisk(opts)
  objects = _parseJson json
  if !objects
    raise "Server failed to query objects on vsan disks: JSON = '#{json}'"
  end
  objects    
end

#query_physical_vsan_disks(opts) ⇒ Object



2956
2957
2958
2959
2960
2961
2962
2963
# File 'lib/rvc/modules/vsan.rb', line 2956

def query_physical_vsan_disks(opts)
  json = self.QueryPhysicalVsanDisks(opts)
  objects = _parseJson json
  if !objects
    raise "Server failed to query vsan disks: JSON = '#{json}'"
  end
  objects    
end

#query_syncing_vsan_objects(opts = {}) ⇒ Object



2938
2939
2940
2941
2942
2943
2944
2945
# File 'lib/rvc/modules/vsan.rb', line 2938

def query_syncing_vsan_objects(opts = {})
  json = self.QuerySyncingVsanObjects(opts)
  objects = _parseJson json
  if !objects
    raise "Server failed to query syncing objects: JSON = '#{json}'"
  end
  objects    
end

#query_vsan_objects(opts) ⇒ Object



2929
2930
2931
2932
2933
2934
2935
2936
# File 'lib/rvc/modules/vsan.rb', line 2929

def query_vsan_objects(opts)
  json = self.QueryVsanObjects(opts)
  objects = _parseJson json
  if !objects
    raise "Server failed to gather VSAN object info for #{obj_uuids}: JSON = '#{json}'"
  end
  objects    
end

#query_vsan_statistics(opts = {}) ⇒ Object



2947
2948
2949
2950
2951
2952
2953
2954
# File 'lib/rvc/modules/vsan.rb', line 2947

def query_vsan_statistics(opts = {})
  json = self.QueryVsanStatistics(opts)
  objects = _parseJson json
  if !objects
    raise "Server failed to query vsan stats: JSON = '#{json}'"
  end
  objects    
end