class Fog::Compute::Proxmox::Container

Container model

Public Instance Methods

action(action, options = {}) click to toggle source
Calls superclass method Fog::Compute::Proxmox::Server#action
# File lib/fog/compute/proxmox/models/container.rb, line 78
def action(action, options = {})
  raise Fog::Errors::Error, "Action #{action} not implemented" unless %w[start stop shutdown].include? action
  super
end
config() click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 60
def config
  path_params = { node: node, type: type, vmid: vmid }
  set_config(service.get_server_config(path_params)) if uptime
  @config
end
detach(mpid) click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 66
def detach(mpid)
  update(delete: mpid)
end
extend(disk, size, options = {}) click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 70
def extend(disk, size, options = {})
  requires :vmid, :node
  path_params = { node: node, vmid: vmid }
  body_params = options.merge(disk: disk, size: size)
  task_upid = service.resize_container(path_params, body_params)
  tasks.wait_for(task_upid)
end
move(volume, storage, options = {}) click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 41
def move(volume, storage, options = {})
  requires :vmid, :node
  path_params = { node: node, vmid: vmid }
  body_params = options.merge(volume: volume, storage: storage)
  task_upid = service.move_volume(path_params, body_params)
  tasks.wait_for(task_upid)
end
restore(backup, options = {}) click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 33
def restore(backup, options = {})
  requires :node, :vmid
  path_params = { node: node, type: type }
  body_params = options.merge(vmid: vmid, ostemplate: backup.volid, force: 1, restore: 1)
  task_upid = service.create_server(path_params, body_params)
  tasks.wait_for(task_upid)
end
set_config(attributes = {}) click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 56
def set_config(attributes = {})
  @config = Fog::Compute::Proxmox::ContainerConfig.new({ service: service, vmid: vmid }.merge(attributes))
end
update(config = {}) click to toggle source
# File lib/fog/compute/proxmox/models/container.rb, line 49
def update(config = {})
  requires :node, :vmid
  path_params = { node: node, type: type, vmid: vmid }
  body_params = config
  service.update_server(path_params, body_params)
end