2011-06-28 09:47:16 -04:00
|
|
|
require 'fog/core/model'
|
2011-08-29 11:24:39 -04:00
|
|
|
require 'fog/libvirt/models/compute/util'
|
2011-06-28 09:47:16 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Libvirt
|
|
|
|
|
|
|
|
class Network < Fog::Model
|
|
|
|
|
|
|
|
include Fog::Compute::LibvirtUtil
|
|
|
|
|
2011-08-03 06:48:44 -04:00
|
|
|
identity :uuid
|
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
attribute :name
|
|
|
|
attribute :bridge_name
|
2011-09-12 14:11:58 -04:00
|
|
|
attribute :xml
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
##https://www.redhat.com/archives/libvirt-users/2011-May/msg00091.html
|
|
|
|
# Bridged VLAN
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
# https://www.redhat.com/archives/libvirt-users/2011-April/msg00006.html
|
|
|
|
# Routed network without IP
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
# http://wiki.libvirt.org/page/Networking
|
|
|
|
#http://wiki.libvirt.org/page/VirtualNetworking#Virtual_network_switches
|
|
|
|
def initialize(attributes = {})
|
2011-08-03 06:48:44 -04:00
|
|
|
super
|
|
|
|
end
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-08-03 06:48:44 -04:00
|
|
|
def save
|
2011-08-08 17:30:09 -04:00
|
|
|
raise Fog::Errors::Error.new('Creating a new network is not yet implemented. Contributions welcome!')
|
2011-06-28 09:47:16 -04:00
|
|
|
end
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
def destroy()
|
|
|
|
requires :raw
|
|
|
|
raw.destroy
|
|
|
|
true
|
|
|
|
end
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
private
|
|
|
|
|
|
|
|
def raw
|
|
|
|
@raw
|
|
|
|
end
|
|
|
|
|
|
|
|
def raw=(new_raw)
|
|
|
|
@raw = new_raw
|
|
|
|
|
2011-08-08 17:22:55 -04:00
|
|
|
raw_attributes = {
|
2011-06-28 09:47:16 -04:00
|
|
|
:uuid => new_raw.uuid,
|
|
|
|
:name => new_raw.name,
|
|
|
|
:bridge_name => new_raw.bridge_name,
|
2011-09-12 14:11:58 -04:00
|
|
|
:xml => new_raw.xml_desc,
|
2011-06-28 09:47:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
merge_attributes(raw_attributes)
|
|
|
|
|
|
|
|
end
|
2011-08-08 17:22:55 -04:00
|
|
|
|
2011-06-28 09:47:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|