Class: Fog::Proxmox::Compute::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/compute/proxmox.rb,
lib/fog/compute/proxmox/requests/get_vnc.rb,
lib/fog/compute/proxmox/requests/get_task.rb,
lib/fog/compute/proxmox/requests/log_task.rb,
lib/fog/compute/proxmox/requests/move_disk.rb,
lib/fog/compute/proxmox/requests/next_vmid.rb,
lib/fog/compute/proxmox/requests/stop_task.rb,
lib/fog/compute/proxmox/requests/create_vnc.rb,
lib/fog/compute/proxmox/requests/get_volume.rb,
lib/fog/compute/proxmox/requests/list_nodes.rb,
lib/fog/compute/proxmox/requests/list_tasks.rb,
lib/fog/compute/proxmox/requests/create_term.rb,
lib/fog/compute/proxmox/requests/move_volume.rb,
lib/fog/compute/proxmox/requests/status_task.rb,
lib/fog/compute/proxmox/requests/clone_server.rb,
lib/fog/compute/proxmox/requests/create_spice.rb,
lib/fog/compute/proxmox/requests/list_servers.rb,
lib/fog/compute/proxmox/requests/list_volumes.rb,
lib/fog/compute/proxmox/requests/action_server.rb,
lib/fog/compute/proxmox/requests/create_backup.rb,
lib/fog/compute/proxmox/requests/create_server.rb,
lib/fog/compute/proxmox/requests/delete_server.rb,
lib/fog/compute/proxmox/requests/delete_volume.rb,
lib/fog/compute/proxmox/requests/list_storages.rb,
lib/fog/compute/proxmox/requests/resize_server.rb,
lib/fog/compute/proxmox/requests/update_server.rb,
lib/fog/compute/proxmox/requests/list_snapshots.rb,
lib/fog/compute/proxmox/requests/migrate_server.rb,
lib/fog/compute/proxmox/requests/create_snapshot.rb,
lib/fog/compute/proxmox/requests/delete_snapshot.rb,
lib/fog/compute/proxmox/requests/template_server.rb,
lib/fog/compute/proxmox/requests/update_snapshot.rb,
lib/fog/compute/proxmox/requests/resize_container.rb,
lib/fog/compute/proxmox/requests/get_server_config.rb,
lib/fog/compute/proxmox/requests/get_server_status.rb,
lib/fog/compute/proxmox/requests/rollback_snapshot.rb,
lib/fog/compute/proxmox/requests/get_node_statistics.rb,
lib/fog/compute/proxmox/requests/get_snapshot_config.rb

Overview

class Mock get_snapshot_config request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mock

Returns a new instance of Mock.



104
105
106
107
108
# File 'lib/fog/compute/proxmox.rb', line 104

def initialize(options = {})
  @pve_uri = URI.parse(options[:pve_url])
  @pve_path = @pve_uri.path
  @config = options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



102
103
104
# File 'lib/fog/compute/proxmox.rb', line 102

def config
  @config
end

Instance Method Details

#action_server(_path_params, _body_params) ⇒ Object



41
# File 'lib/fog/compute/proxmox/requests/action_server.rb', line 41

def action_server(_path_params, _body_params); end

#clone_server(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/clone_server.rb', line 40

def clone_server(_path_params, _body_params); end

#create_backup(_path_params, _body_params) ⇒ Object



38
# File 'lib/fog/compute/proxmox/requests/create_backup.rb', line 38

def create_backup(_path_params, _body_params); end

#create_server(_path_params, _body_params) ⇒ Object



39
# File 'lib/fog/compute/proxmox/requests/create_server.rb', line 39

def create_server(_path_params, _body_params); end

#create_snapshot(_path_params, _body_params) ⇒ Object



40
41
42
# File 'lib/fog/compute/proxmox/requests/create_snapshot.rb', line 40

def create_snapshot(_path_params, _body_params)
  'UPID:proxmox:00003E13:6F21770F:5E37E2D0:qmsnapshot:100:root@pam:'
end

#create_spice(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/create_spice.rb', line 40

def create_spice(_path_params, _body_params); end

#create_term(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/create_term.rb', line 40

def create_term(_path_params, _body_params); end

#create_vnc(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/create_vnc.rb', line 40

def create_vnc(_path_params, _body_params); end

#delete_server(_path_params, _body_params) ⇒ Object



41
# File 'lib/fog/compute/proxmox/requests/delete_server.rb', line 41

def delete_server(_path_params, _body_params); end

#delete_snapshot(_path_params, _query_params) ⇒ Object



41
42
43
# File 'lib/fog/compute/proxmox/requests/delete_snapshot.rb', line 41

def delete_snapshot(_path_params, _query_params)
  'UPID:proxmox:00002CC5:646E24B1:5E1C7E26:qmdelsnapshot:100:root@pam:'
end

#delete_volume(_node, _storage, _volume) ⇒ Object



36
# File 'lib/fog/compute/proxmox/requests/delete_volume.rb', line 36

def delete_volume(_node, _storage, _volume); end

#get_node_statistics(_path_params, _query_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/get_node_statistics.rb', line 40

def get_node_statistics(_path_params, _query_params); end

#get_server_config(_path_params) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/compute/proxmox/requests/get_server_config.rb', line 39

def get_server_config(_path_params)
  {
    :onboot => 0,
    :memory => 512,
    :ostype => 'l26',
    :cores => 1,
    :keyboard => 'en-us',
    :digest => nil,
    :smbios1 => nil,
    :vmgenid => nil,
    :balloon => 0,
    :kvm => 0,
    :cpu => 'cputype=kvm64',
    :sockets => 1,
    :bootdisk => 'scsi0',
    :vga => 'std'
  }
end

#get_server_status(_path_params) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/compute/proxmox/requests/get_server_status.rb', line 39

def get_server_status(_path_params)
  {
    :netout => 0,
    :ha => { 'managed' => 0 },
    :mem => 0,
    :vmid => '100',
    :maxdisk => 8_589_934_592,
    :diskread => 0,
    :template => '',
    :qmpstatus => 'stopped',
    :diskwrite => 0,
    :maxmem => 536_870_912,
    :pid => nil,
    :uptime => 0,
    :status => 'stopped',
    :cpu => 'cputype=kvm64',
    :cpus => 1,
    :disk => 0,
    :netin => 0
  }
end

#get_snapshot_config(_path_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/get_snapshot_config.rb', line 40

def get_snapshot_config(_path_params); end

#get_task(_node, _upid) ⇒ Object



37
# File 'lib/fog/compute/proxmox/requests/get_task.rb', line 37

def get_task(_node, _upid); end

#get_vnc(_path_params, _query_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/get_vnc.rb', line 40

def get_vnc(_path_params, _query_params); end

#get_volume(_node, _storage, _volume) ⇒ Object



38
# File 'lib/fog/compute/proxmox/requests/get_volume.rb', line 38

def get_volume(_node, _storage, _volume); end

#list_nodesObject



37
38
39
40
41
42
43
44
# File 'lib/fog/compute/proxmox/requests/list_nodes.rb', line 37

def list_nodes
  [
    {
      'node' => 'proxmox',
      'type' => 'node'
    }
  ]
end

#list_servers(_options = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fog/compute/proxmox/requests/list_servers.rb', line 38

def list_servers(_options = {})
  if options[:type] == 'qemu'
    [
      {
        'vmid' => '100',
        'type' => 'qemu',
        'node_id' => 'proxmox',
        'config' => {
          'vmid' => '100',
          'description' => nil,
          'smbios1' => nil,
          'numa' => 0,
          'kvm' => 0,
          'vcpus' => nil,
          'cores' => 1,
          'bootdisk' => 'scsi0',
          'onboot' => 0,
          'boot' => nil,
          'agent' => '0',
          'scsihw' => nil,
          'sockets' => 1,
          'memory' => 512,
          'min_memory' => nil,
          'shares' => nil,
          'balloon' => 0,
          'cpu' => 'cputype=kvm64',
          'cpulimit' => nil,
          'cpuunits' => nil,
          'keyboard' => 'en-us',
          'vga' => 'std',
          'storage' => nil,
          'template' => '',
          'arch' => nil,
          'swap' => nil,
          'hostname' => nil,
          'nameserver' => nil,
          'searchdomain' => nil,
          'password' => nil,
          'startup' => nil,
          'console' => nil
        },
        'digest' => nil,
        'maxdisk' => 8_589_934_592,
        'disk' => 0,
        'diskwrite' => 0,
        'diskread' => 0,
        'uptime' => 0,
        'netout' => 0,
        'netin' => 0,
        'cpu' => 'cputype=kvm64',
        'cpus' => 1,
        'template' => '',
        'status' => 'stopped',
        'maxcpu' => nil,
        'mem' => 0,
        'maxmem' => 536_870_912,
        'qmpstatus' => 'stopped',
        'ha' => { 'managed' => 0 },
        'pid' => nil,
        'blockstat' => nil,
        'balloon' => 0,
        'ballooninfo' => nil,
        'vmgenid' => nil,
        'lock' => nil,
        'maxswap' => nil,
        'swap' => nil
      }
    ]
  else
    []
  end
end

#list_snapshots(_path_params) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fog/compute/proxmox/requests/list_snapshots.rb', line 39

def list_snapshots(_path_params)
  [
    {
      'name' => 'snapshot1',
      'description' => 'latest snapshot',
      'snaptime' => 1_578_057_452,
      'vmstate' => 0,
      'node_id' => 'proxmox',
      'server_id' => '100',
      'server_type' => 'qemu',
      'vmgenid' => nil
    },
    {
      'name' => 'snapshot2',
      'description' => 'latest snapshot2',
      'snaptime' => 1_578_058_452,
      'vmstate' => 0,
      'node_id' => 'proxmox',
      'server_id' => '100',
      'server_type' => 'qemu',
      'vmgenid' => nil
    }
  ]
end

#list_storages(_node, _options = {}) ⇒ Object



40
41
42
# File 'lib/fog/compute/proxmox/requests/list_storages.rb', line 40

def list_storages(_node, _options = {})
  []
end

#list_tasks(_node, _options = {}) ⇒ Object



38
39
40
# File 'lib/fog/compute/proxmox/requests/list_tasks.rb', line 38

def list_tasks(_node, _options = {})
  []
end

#list_volumes(_node, _storage, _options = {}) ⇒ Object



38
39
40
# File 'lib/fog/compute/proxmox/requests/list_volumes.rb', line 38

def list_volumes(_node, _storage, _options = {})
  []
end

#log_task(_node, _upid, options = {}) ⇒ Object



38
39
40
# File 'lib/fog/compute/proxmox/requests/log_task.rb', line 38

def log_task(_node, _upid, options = {})
  [{ 't' => 'TASK OK', 'n' => 1 }]
end

#migrate_server(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/migrate_server.rb', line 40

def migrate_server(_path_params, _body_params); end

#move_disk(_path_params, _body_params) ⇒ Object



39
# File 'lib/fog/compute/proxmox/requests/move_disk.rb', line 39

def move_disk(_path_params, _body_params); end

#move_volume(_path_params, _body_params) ⇒ Object



39
# File 'lib/fog/compute/proxmox/requests/move_volume.rb', line 39

def move_volume(_path_params, _body_params); end

#next_vmidObject



38
# File 'lib/fog/compute/proxmox/requests/next_vmid.rb', line 38

def next_vmid; end

#resize_container(_path_params, _body_params) ⇒ Object



39
# File 'lib/fog/compute/proxmox/requests/resize_container.rb', line 39

def resize_container(_path_params, _body_params); end

#resize_server(_path_params, _body_params) ⇒ Object



39
# File 'lib/fog/compute/proxmox/requests/resize_server.rb', line 39

def resize_server(_path_params, _body_params); end

#rollback_snapshot(_path_params) ⇒ Object



42
43
44
# File 'lib/fog/compute/proxmox/requests/rollback_snapshot.rb', line 42

def rollback_snapshot(_path_params)
  'UPID:proxmox:00002EBF:646E2BF3:5E1C7E39:qmrollback:100:root@pam:'
end

#status_task(_node, _upid) ⇒ Object



37
# File 'lib/fog/compute/proxmox/requests/status_task.rb', line 37

def status_task(_node, _upid); end

#stop_task(_node, _taskid) ⇒ Object



37
# File 'lib/fog/compute/proxmox/requests/stop_task.rb', line 37

def stop_task(_node, _taskid); end

#template_server(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/template_server.rb', line 40

def template_server(_path_params, _body_params); end

#update_server(_path_params, _body_params) ⇒ Object



40
# File 'lib/fog/compute/proxmox/requests/update_server.rb', line 40

def update_server(_path_params, _body_params); end

#update_snapshot(_path_params, _body_params) ⇒ Object



41
# File 'lib/fog/compute/proxmox/requests/update_snapshot.rb', line 41

def update_snapshot(_path_params, _body_params); end