Revision ad51adc0 src/vmm_mad/remotes/lib/vcenter_driver/vi_client.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/vi_client.rb
11 11
        opts = {:insecure => true}.merge(opts)
12 12
        @vim = RbVmomi::VIM.connect(opts)
13 13

  
14
        # Get ccr
14
        # Get ccr and get rp
15 15
        ccr_ref = opts.delete(:ccr)
16
        ccr = RbVmomi::VIM::ClusterComputeResource.new(@vim, ccr_ref)
17

  
18
        #Get ref for rp
19
        if ccr
20
            rp = opts.delete(:rp)
21
            rp_list = get_resource_pool_list(ccr)
22
            rp_ref = rp_list.select { |r| r[:name] == rp }.first._ref rescue nil
23
            @rp = RbVmomi::VIM::ResourcePool(@vim, rp_ref) if rp_ref
16
        if ccr_ref
17
            ccr = RbVmomi::VIM::ClusterComputeResource.new(@vim, ccr_ref)
18

  
19
            #Get ref for rp
20
            if ccr
21
                rp = opts.delete(:rp)
22
                if rp
23
                    rp_list = get_resource_pool_list(ccr)
24
                    rp_ref = rp_list.select { |r| r[:name] == rp }.first._ref rescue nil
25
                    @rp = RbVmomi::VIM::ResourcePool(@vim, rp_ref) if rp_ref
26
                end
27
            end
24 28
        end
25 29
    end
26 30

  
......
32 36

  
33 37
        current_rp = ""
34 38

  
35
        if rp.nil?
39
        if !rp
36 40
            rp = ccr.resourcePool
37 41
        else
38 42
            if !parent_prefix.empty?

Also available in: Unified diff