Sha256: ce606d261a974d2d29eb8dd7bb704804c1ea7dcd53103a98a36e60e7cd7681d0

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module Compute
    class Vsphere
      class Real
  # => VirtualE1000(
  #addressType: "assigned",
  #backing: VirtualEthernetCardNetworkBackingInfo(
  #  deviceName: "VM Network",
  #  dynamicProperty: [],
  #  network: Network("network-163"),
  #  useAutoDetect: false
  #),
  #connectable: VirtualDeviceConnectInfo(
  #  allowGuestControl: true,
  #  connected: true,
  #  dynamicProperty: [],
  #  startConnected: true,
  #  status: "ok"
  #),
  #controllerKey: 100,
  #deviceInfo: Description(
  #  dynamicProperty: [],
  #  label: "Network adapter 1",
  #  summary: "VM Network"
  #),
  #dynamicProperty: [],
  #key: 4000,
  #macAddress: "00:50:56:a9:00:28",
  #unitNumber: 7,
  #
        def list_vm_interfaces(vm_id)
          get_vm_ref(vm_id).config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).map do |nic|
            {
              :name    => nic.deviceInfo.label,
              :mac     => nic.macAddress,
              :network => nic.backing.respond_to?("network") ? nic.backing.network.name : nic.backing.port.portgroupKey,
              :status  => nic.connectable.status,
              :summary => nic.deviceInfo.summary,
              :type    => nic.class,
            }
          end

        end

      end
      class Mock
        def list_vm_interfaces(vm_id)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 4 rubygems

Version Path
hpfog-0.0.20 lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
fog-1.11.0 lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
fog-1.10.1 lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
fog-test-me-1.10.0 lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
fog-1.10.0 lib/fog/vsphere/requests/compute/list_vm_interfaces.rb