Class: Fog::Libvirt::Compute::Mock

Inherits:
Object
  • Object
show all
Includes:
Shared
Defined in:
lib/fog/libvirt/compute.rb,
lib/fog/libvirt/requests/compute/vm_action.rb,
lib/fog/libvirt/requests/compute/libversion.rb,
lib/fog/libvirt/requests/compute/list_pools.rb,
lib/fog/libvirt/requests/compute/define_pool.rb,
lib/fog/libvirt/requests/compute/dhcp_leases.rb,
lib/fog/libvirt/requests/compute/pool_action.rb,
lib/fog/libvirt/requests/compute/clone_volume.rb,
lib/fog/libvirt/requests/compute/list_domains.rb,
lib/fog/libvirt/requests/compute/list_volumes.rb,
lib/fog/libvirt/requests/compute/create_domain.rb,
lib/fog/libvirt/requests/compute/create_volume.rb,
lib/fog/libvirt/requests/compute/define_domain.rb,
lib/fog/libvirt/requests/compute/get_node_info.rb,
lib/fog/libvirt/requests/compute/list_networks.rb,
lib/fog/libvirt/requests/compute/upload_volume.rb,
lib/fog/libvirt/requests/compute/volume_action.rb,
lib/fog/libvirt/requests/compute/update_display.rb,
lib/fog/libvirt/requests/compute/destroy_network.rb,
lib/fog/libvirt/requests/compute/list_interfaces.rb,
lib/fog/libvirt/requests/compute/update_autostart.rb,
lib/fog/libvirt/requests/compute/destroy_interface.rb,
lib/fog/libvirt/requests/compute/list_pool_volumes.rb

Instance Attribute Summary

Attributes included from Shared

#client, #uri

Instance Method Summary collapse

Methods included from Shared

#catchLibvirtExceptions, #clone_volume, #create_domain, #create_volume, #define_domain, #define_pool, #destroy_interface, #destroy_network, #get_node_info, #initialize, #libversion, #list_domains, #list_interfaces, #list_networks, #list_pool_volumes, #list_pools, #list_volumes, #pool_action, #terminate, #update_autostart, #update_display, #upload_volume, #vm_action, #volume_action

Methods included from Util

#randomized_name, #xml_element, #xml_elements

Instance Method Details

#dhcp_leases(uuid, mac, flags = 0) ⇒ Object

Not implemented by the test driver



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/libvirt/requests/compute/dhcp_leases.rb', line 14

def dhcp_leases(uuid, mac, flags = 0)
  leases1 = {
    'aa:bb:cc:dd:ee:ff' => [
      { 'type' => Socket::AF_INET, 'ipaddr' => '1.2.3.4', 'prefix' => 24, 'expirytime' => 5000 },
      { 'type' => Socket::AF_INET, 'ipaddr' => '1.2.5.6', 'prefix' => 24, 'expirytime' => 5005 }
    ]
  }
  leases2 = {
    '99:88:77:66:55:44' => [
      { 'type' => Socket::AF_INET, 'ipaddr' => '10.1.1.5', 'prefix' => 24, 'expirytime' => 50 }
    ]
  }
  networks = {
    # should match the default network from the test connection
    'dd8fe884-6c02-601e-7551-cca97df1c5df' => leases1,
    'fbd4ac68-cbea-4f95-86ed-22953fd92384' => leases2
  }
  networks.dig(uuid, mac)
end

#enhance_uri(uri) ⇒ Object



121
122
123
124
125
# File 'lib/fog/libvirt/compute.rb', line 121

def enhance_uri(uri)
  uri = 'test:///default' unless ::URI.parse(uri).scheme == 'test'

  super(uri)
end