-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
vif.rb
48 lines (42 loc) · 1.66 KB
/
vif.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module Fog
module Compute
class XenServer
module Models
class Vif < Fog::Model
# API Reference here:
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VIF
provider_class :VIF
identity :reference
attribute :allowed_operations
attribute :current_operations
attribute :currently_attached
attribute :device
attribute :ipv4_allowed
attribute :ipv6_allowed
attribute :locking_mode
attribute :mac, :aliases => :MAC, :default => ''
attribute :mac_autogenerated, :aliases => :MAC_autogenerated, :default => 'True'
attribute :mtu, :aliases => :MTU, :default => '0'
attribute :other_config, :default => {}
attribute :qos_algorithm_params, :default => {}
attribute :qos_algorithm_type, :default => 'ratelimit'
attribute :qos_supported_algorithms
attribute :runtime_properties
attribute :status_code
attribute :status_detail
attribute :uuid
has_one :metrics, :vifs_metrics
has_one :network, :networks
has_one :vm, :servers, :aliases => :VM
alias_method :server, :vm
def save
requires :server, :network
ref = service.create_vif(server, network)
merge_attributes service.vifs.get(ref).attributes
true
end
end
end
end
end
end