Sha256: b29410b9d596b97d09370449c8f22a09523e6ab143886e5783e3ee5cf7750d8e

Contents?: true

Size: 921 Bytes

Versions: 4

Compression:

Stored size: 921 Bytes

Contents

module Fog
  module Vsphere
    class Compute
      class Real
        def list_vm_nvme_controllers(vm_id)
          list_vm_nvme_controllers_raw(vm_id).map do |raw_controller|
            Fog::Vsphere::Compute::NVMEController.new(raw_controller)
          end
        end

        def list_vm_nvme_controllers_raw(vm_id)
          get_vm_ref(vm_id).config.hardware.device.grep(RbVmomi::VIM::VirtualNVMEController).map do |ctrl|
            {
              type: ctrl.class.to_s,
              key: ctrl.key
            }
          end
        end
      end
      class Mock
        def list_vm_nvme_controllers(vm_id)
          raise Fog::Vsphere::Compute::NotFound, 'VM not Found' unless data[:servers].key?(vm_id)
          return [] unless data[:servers][vm_id].key?('nvme_controllers')
          data[:servers][vm_id]['nvme_controllers'].map { |h| h.merge(server_id: vm_id) }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-vsphere-3.7.0 lib/fog/vsphere/requests/compute/list_vm_nvme_controllers.rb
fog-vsphere-3.6.8 lib/fog/vsphere/requests/compute/list_vm_nvme_controllers.rb
fog-vsphere-3.6.7 lib/fog/vsphere/requests/compute/list_vm_nvme_controllers.rb
fog-vsphere-3.6.6 lib/fog/vsphere/requests/compute/list_vm_nvme_controllers.rb