Parent

Class/Module Index [+]

Quicksearch

Fog::Compute::XenServer::VLAN

Public Instance Methods

destroy() click to toggle source

Destroys a VLAN.

service = Fog::Compute[:xenserver]

# Find VLAN 123 and destroy it
(service.vlans.find { |v| v.tag == 123 }).destroy
# File lib/fog/xenserver/models/compute/vlan.rb, line 70
def destroy
  requires :reference
  service.destroy_vlan reference
  true
end
save() click to toggle source

Creates a new VLAN.

service = Fog::Compute[:xenserver]

# create a network 'foo-net'
net = service.networks.create :name => 'foo-net'

# get the eth0 physical interface where the
# VLAN subinterface will be added
pif = service.pifs.find { |p| p.device == 'eth0' and p.physical }

Fog::Compute[:xenserver].vlans.create :tag => 123,
                                      :network => net,
                                      :pif => pif
# File lib/fog/xenserver/models/compute/vlan.rb, line 48
def save
  requires :tag
  pif = attributes[:pif]
  net = attributes[:network]
  unless pif and net
    raise Fog::Error.new 'save requires :pif and :network attributes'
  end
  ref = service.create_vlan attributes[:pif].reference, 
                            tag,
                            attributes[:network].reference
  data = service.get_record ref, 'VLAN'
  merge_attributes data
  true
end
tagged_pif() click to toggle source

@return [Fog::Compute::XenServer::PIF] interface on which traffic is untagged

@see docs.vmd.citrix.com/XenServer/6.1.0/1.0/en_gb/api/?c=VLAN

# File lib/fog/xenserver/models/compute/vlan.rb, line 30
def tagged_pif
  service.pifs.get __tagged_pif
end
untagged_pif() click to toggle source

@return [Fog::Compute::XenServer::PIF] interface on which traffic is tagged

@see docs.vmd.citrix.com/XenServer/6.1.0/1.0/en_gb/api/?c=VLAN

# File lib/fog/xenserver/models/compute/vlan.rb, line 22
def untagged_pif
  service.pifs.get __untagged_pif
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.