Skip to content

Commit

Permalink
Merge 18b4605 into c021388
Browse files Browse the repository at this point in the history
  • Loading branch information
plribeiro3000 committed Jul 22, 2014
2 parents c021388 + 18b4605 commit 23b5803
Show file tree
Hide file tree
Showing 71 changed files with 361 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/blob.rb
Expand Up @@ -7,6 +7,7 @@ class Blob < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=blob

provider_class :blob
collection_name :blobs

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/bond.rb
Expand Up @@ -7,6 +7,7 @@ class Bond < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=Bond

provider_class :Bond
collection_name :bonds

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/console.rb
Expand Up @@ -7,6 +7,7 @@ class Console < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=console

provider_class :console
collection_name :consoles

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/crash_dump.rb
Expand Up @@ -7,6 +7,7 @@ class CrashDump < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=crashdump

provider_class :crashdump
collection_name :crash_dumps

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/dr_task.rb
Expand Up @@ -7,6 +7,7 @@ class DrTask < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=DR_task

provider_class :DR_task
collection_name :dr_tasks

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/gpu_group.rb
Expand Up @@ -7,6 +7,7 @@ class GpuGroup < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=GPU_group

provider_class :GPU_group
collection_name :gpu_groups

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/guest_metrics.rb
Expand Up @@ -7,6 +7,7 @@ class GuestMetrics < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VM_guest_metrics

provider_class :VM_guest_metrics
collection_name :guests_metrics

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/host.rb
Expand Up @@ -7,6 +7,7 @@ class Host < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host

provider_class :host
collection_name :hosts

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/host_cpu.rb
Expand Up @@ -7,6 +7,7 @@ class HostCpu < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host_cpu

provider_class :host_cpu
collection_name :host_cpus

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/host_crash_dump.rb
Expand Up @@ -7,6 +7,7 @@ class HostCrashDump < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host_crashdump

provider_class :host_crashdump
collection_name :host_crash_dumps

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/host_metrics.rb
Expand Up @@ -7,6 +7,7 @@ class HostMetrics < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host_metrics

provider_class :host_metrics
collection_name :hosts_metrics

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/host_patch.rb
Expand Up @@ -7,6 +7,7 @@ class HostPatch < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host_patch

provider_class :host_patch
collection_name :host_patchs

identity :reference

Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/network.rb
Expand Up @@ -7,6 +7,7 @@ class Network < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=network

provider_class :network
collection_name :networks

identity :reference

Expand All @@ -25,10 +26,12 @@ class Network < Fog::Model
has_many :pifs, :pifs, :aliases => :PIFs
has_many :vifs, :vifs, :aliases => :VIFs

require_before_save :name

def save
requires :name
require_creation_attributes
ref = service.create_network name, attributes
merge_attributes service.networks.get(ref).attributes
merge_attributes collection.get(ref).attributes
true
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pbd.rb
Expand Up @@ -7,6 +7,7 @@ class Pbd < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=PBD

provider_class :PBD
collection_name :pbds

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pci.rb
Expand Up @@ -7,6 +7,7 @@ class Pci < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=PCI

provider_class :PCI
collection_name :pcis

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pgpu.rb
Expand Up @@ -7,6 +7,7 @@ class Pgpu < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=PGPU

provider_class :PGPU
collection_name :pgpus

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pif.rb
Expand Up @@ -7,6 +7,7 @@ class Pif < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=PIF

provider_class :PIF
collection_name :pifs

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pif_metrics.rb
Expand Up @@ -7,6 +7,7 @@ class PifMetrics < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=PIF_metrics

provider_class :PIF_metrics
collection_name :pifs_metrics

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pool.rb
Expand Up @@ -7,6 +7,7 @@ class Pool < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=pool

provider_class :pool
collection_name :pools

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/pool_patch.rb
Expand Up @@ -7,6 +7,7 @@ class PoolPatch < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=pool_patch

provider_class :pool_patch
collection_name :pool_patchs

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/role.rb
Expand Up @@ -7,6 +7,7 @@ class Role < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=role

provider_class :role
collection_name :roles

identity :reference

Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/server.rb
Expand Up @@ -9,6 +9,7 @@ class Server < Fog::Compute::Server
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VM

provider_class :VM
collection_name :servers

identity :reference

Expand Down Expand Up @@ -94,6 +95,8 @@ class Server < Fog::Compute::Server
has_many :vifs, :vifs, :aliases => :VIFs
has_many :vtpms, :vtpms, :aliases => :VTPMs

require_before_save :name

def tools_installed?
!guest_metrics.nil?
end
Expand All @@ -117,15 +120,15 @@ def halted?
end

def save(params = {})
requires :name
require_creation_attributes
nets = params.fetch(:networks, [])
auto_start = params.fetch(:auto_start, true)
if template_name
ref = service.create_server(name, template_name, nets, :auto_start => auto_start)
else
ref = service.create_server_raw(attributes)
end
merge_attributes service.servers.get(ref).attributes
merge_attributes collection.get(ref).attributes
true
end

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/server_appliance.rb
Expand Up @@ -7,6 +7,7 @@ class ServerAppliance < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VM_appliance

provider_class :VM_appliance
collection_name :server_appliances

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/server_metrics.rb
Expand Up @@ -7,6 +7,7 @@ class ServerMetrics < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VM_metrics

provider_class :VM_metrics
collection_name :servers_metrics

identity :reference

Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/storage_manager.rb
Expand Up @@ -7,6 +7,7 @@ class StorageManager < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=SM

provider_class :SM
collection_name :storage_managers

identity :reference

Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/storage_repository.rb
Expand Up @@ -7,6 +7,7 @@ class StorageRepository < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=SR

provider_class :SR
collection_name :storage_repositories

identity :reference

Expand All @@ -31,11 +32,13 @@ class StorageRepository < Fog::Model
has_many :pbds, :pbds, :aliases => :PBDs
has_many :vdis, :vdis, :aliases => :VDIs

require_before_save :name, :type

def save(host, device_config = {})
requires :name, :type
require_creation_attributes
ref = service.create_sr(host, name, type, description, device_config, physical_size, content_type,
shared || false, sm_config)
merge_attributes service.storage_repositories.get(ref).attributes
merge_attributes collection.get(ref).attributes
true
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/tunnel.rb
Expand Up @@ -7,6 +7,7 @@ class Tunnel < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=tunnel

provider_class :tunnel
collection_name :tunnels

identity :reference

Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/vbd.rb
Expand Up @@ -7,6 +7,7 @@ class Vbd < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VBD

provider_class :VBD
collection_name :vbds

identity :reference

Expand Down Expand Up @@ -34,12 +35,14 @@ class Vbd < Fog::Model
has_one :vdi, :vdis, :aliases => :VDI
has_one :vm, :servers, :aliases => :VM

require_before_save :vdi, :server

alias_method :server, :vm

def save
requires :vdi, :server
require_creation_attributes
ref = service.create_vbd(server, vdi, attributes)
merge_attributes(service.vbds.get(ref).attributes)
merge_attributes collection.get(ref).attributes
true
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/vbd_metrics.rb
Expand Up @@ -7,6 +7,7 @@ class VbdMetrics < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VBD_metrics

provider_class :VBD_metrics
collection_name :vbds_metrics

identity :reference

Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/vdi.rb
Expand Up @@ -7,6 +7,7 @@ class Vdi < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VDI

provider_class :VDI
collection_name :vdis

identity :reference

Expand Down Expand Up @@ -42,6 +43,8 @@ class Vdi < Fog::Model
has_one :sr, :storage_repositories, :aliases => :SR
has_many :vbds, :vbds, :aliases => :VBDs

require_before_save :name, :storage_repository

alias_method :storage_repository, :sr

#
Expand All @@ -57,9 +60,9 @@ def initialize(attributes = {})
end

def save
requires :name, :storage_repository
require_creation_attributes
ref = service.create_vdi(attributes)
merge_attributes service.vdis.get(ref).attributes
merge_attributes collection.get(ref).attributes
true
end
end
Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/vif.rb
Expand Up @@ -7,6 +7,7 @@ class Vif < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VIF

provider_class :VIF
collection_name :vifs

identity :reference

Expand All @@ -33,12 +34,14 @@ class Vif < Fog::Model
has_one :network, :networks
has_one :vm, :servers, :aliases => :VM

require_before_save :server, :network

alias_method :server, :vm

def save
requires :server, :network
require_creation_attributes
ref = service.create_vif(server, network)
merge_attributes service.vifs.get(ref).attributes
merge_attributes collection.get(ref).attributes
true
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/vif_metrics.rb
Expand Up @@ -7,6 +7,7 @@ class VifMetrics < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VIF_metrics

provider_class :VIF_metrics
collection_name :vifs_metrics

identity :reference

Expand Down
7 changes: 5 additions & 2 deletions lib/fog/compute/xen_server/models/vlan.rb
Expand Up @@ -7,6 +7,7 @@ class Vlan < Fog::Model
# @see http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VLAN

provider_class :VLAN
collection_name :vlans

identity :reference

Expand All @@ -17,10 +18,12 @@ class Vlan < Fog::Model
has_one :tagged_pif, :pifs, :aliases => :tagged_PIF
has_one :untagged_pif, :pifs, :aliases => :untagged_PIF

require_before_save :tag

def save(pif, network)
requires :tag
require_creation_attributes
ref = service.create_vlan(pif, tag, network)
merge_attributes service.vlans.get(ref).attributes
merge_attributes collection.get(ref).attributes
true
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/fog/compute/xen_server/models/vmpp.rb
Expand Up @@ -7,6 +7,7 @@ class Vmpp < Fog::Model
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VMPP

provider_class :VMPP
collection_name :vmpps

identity :reference

Expand Down

0 comments on commit 23b5803

Please sign in to comment.