Skip to content

Commit

Permalink
Refactor server and container in server only
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanrobert committed Apr 16, 2019
1 parent bbf8b2e commit ccfc290
Show file tree
Hide file tree
Showing 23 changed files with 5,254 additions and 4,329 deletions.
3 changes: 0 additions & 3 deletions lib/fog/compute/proxmox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class Proxmox < Fog::Service
collection :tasks
model :snapshot
collection :snapshots
model :container
collection :containers
model :container_config

# Requests
request_path 'fog/compute/proxmox/requests'
Expand Down
75 changes: 0 additions & 75 deletions lib/fog/compute/proxmox/models/container.rb

This file was deleted.

113 changes: 0 additions & 113 deletions lib/fog/compute/proxmox/models/container_config.rb

This file was deleted.

12 changes: 12 additions & 0 deletions lib/fog/compute/proxmox/models/disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ def cdrom?
def rootfs?
id == 'rootfs'
end

def mount_point?
id.match(/(mp)(\d+)/)
end

def controller?
id.match(/(scsi|ide|sata|virtio)(\d+)/)
end

def flatten
Fog::Proxmox::DiskHelper.flatten(attributes)
end
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/fog/compute/proxmox/models/interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

# frozen_string_literal: true

require "fog/proxmox/helpers/nic_helper"

module Fog
module Compute
class Proxmox
Expand All @@ -34,6 +36,10 @@ class Interface < Fog::Model
attribute :rate
attribute :queues
attribute :tag

def flatten
Fog::Proxmox::NicHelper.flatten(attributes)
end
end
end
end
Expand Down
9 changes: 5 additions & 4 deletions lib/fog/compute/proxmox/models/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

# frozen_string_literal: true

require 'fog/proxmox/attributes'

module Fog
module Compute
class Proxmox
Expand All @@ -49,8 +51,7 @@ class Node < Fog::Model

def initialize(new_attributes = {})
prepare_service_value(new_attributes)
attributes[:node] = new_attributes['node'] unless new_attributes['node'].nil?
attributes[:node] = new_attributes[:node] unless new_attributes[:node].nil?
Fog::Proxmox::Attributes.set_attr_and_sym('node', attributes, new_attributes)
requires :node
initialize_tasks
initialize_servers
Expand All @@ -77,11 +78,11 @@ def initialize_tasks
end

def initialize_servers
attributes[:servers] = Fog::Compute::Proxmox::Servers.new(service: service, node_id: node)
attributes[:servers] = Fog::Compute::Proxmox::Servers.new(service: service, node_id: node, type: 'qemu')
end

def initialize_containers
attributes[:containers] = Fog::Compute::Proxmox::Containers.new(service: service, node_id: node)
attributes[:containers] = Fog::Compute::Proxmox::Servers.new(service: service, node_id: node, type: 'lxc')
end

def initialize_storages
Expand Down
Loading

0 comments on commit ccfc290

Please sign in to comment.