Class: OpenNebula::Vdc
- Inherits:
-
PoolElement
- Object
- XMLElement
- PoolElement
- OpenNebula::Vdc
- Defined in:
- lib/opennebula/vdc.rb
Constant Summary collapse
- ALL_RESOURCES =
Constants and Class Methods
"-10"
- VDC_METHODS =
{ :info => "vdc.info", :allocate => "vdc.allocate", :update => "vdc.update", :rename => "vdc.rename", :delete => "vdc.delete", :add_group => "vdc.addgroup", :del_group => "vdc.delgroup", :add_cluster => "vdc.addcluster", :del_cluster => "vdc.delcluster", :add_host => "vdc.addhost", :del_host => "vdc.delhost", :add_datastore => "vdc.adddatastore", :del_datastore => "vdc.deldatastore", :add_vnet => "vdc.addvnet", :del_vnet => "vdc.delvnet", }
Instance Attribute Summary
Attributes inherited from PoolElement
Class Method Summary collapse
-
.build_xml(pe_id = nil) ⇒ Object
Creates a Vdc description with just its identifier this method should be used to create plain Vdc objects.
Instance Method Summary collapse
-
#add_cluster(zone_id, cluster_id) ⇒ nil, OpenNebula::Error
Adds a cluster to this VDC.
-
#add_datastore(zone_id, datastore_id) ⇒ nil, OpenNebula::Error
Adds a datastore to this VDC.
-
#add_group(group_id) ⇒ nil, OpenNebula::Error
Adds a group to this VDC.
-
#add_host(zone_id, host_id) ⇒ nil, OpenNebula::Error
Deletes a host from this VDC.
-
#add_vnet(zone_id, vnet_id) ⇒ nil, OpenNebula::Error
Adds a vnet to this VDC.
-
#allocate(description) ⇒ nil, OpenNebula::Error
Allocates a new Vdc in OpenNebula.
-
#del_cluster(zone_id, cluster_id) ⇒ nil, OpenNebula::Error
Deletes a cluster from this VDC.
-
#del_datastore(zone_id, datastore_id) ⇒ nil, OpenNebula::Error
Deletes a datastore from this VDC.
-
#del_group(group_id) ⇒ nil, OpenNebula::Error
Deletes a group from this VDC.
-
#del_host(zone_id, host_id) ⇒ nil, OpenNebula::Error
Nil in case of success, Error otherwise.
-
#del_vnet(zone_id, vnet_id) ⇒ nil, OpenNebula::Error
Deletes a vnet from this VDC.
-
#delete ⇒ nil, OpenNebula::Error
Deletes the Vdc.
-
#info ⇒ nil, OpenNebula::Error
(also: #info!)
Retrieves the information of the given Vdc.
-
#initialize(xml, client) ⇒ Vdc
constructor
Class constructor.
-
#rename(name) ⇒ nil, OpenNebula::Error
Renames this Vdc.
-
#update(new_template = nil, append = false) ⇒ nil, OpenNebula::Error
Replaces the template contents.
Methods inherited from PoolElement
#id, new_with_id, #replace, #to_str
Methods inherited from XMLElement
#[], #add_element, #attr, #delete_element, #each, #each_xpath, #element_xml, #has_elements?, #initialize_xml, #name, #retrieve_elements, #retrieve_xmlelements, #set_content, #template_like_str, #template_str, #template_xml, #text, #to_hash, #to_xml, #xml_nil?
Constructor Details
#initialize(xml, client) ⇒ Vdc
Class constructor
65 66 67 |
# File 'lib/opennebula/vdc.rb', line 65 def initialize(xml, client) super(xml,client) end |
Class Method Details
.build_xml(pe_id = nil) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/opennebula/vdc.rb', line 54 def Vdc.build_xml(pe_id=nil) if pe_id vdc_xml = "<VDC><ID>#{pe_id}</ID></VDC>" else vdc_xml = "<VDC></VDC>" end XMLElement.build_xml(vdc_xml,'VDC') end |
Instance Method Details
#add_cluster(zone_id, cluster_id) ⇒ nil, OpenNebula::Error
Adds a cluster to this VDC
144 145 146 |
# File 'lib/opennebula/vdc.rb', line 144 def add_cluster(zone_id, cluster_id) return call(VDC_METHODS[:add_cluster], @pe_id, zone_id.to_i, cluster_id.to_i) end |
#add_datastore(zone_id, datastore_id) ⇒ nil, OpenNebula::Error
Adds a datastore to this VDC
202 203 204 |
# File 'lib/opennebula/vdc.rb', line 202 def add_datastore(zone_id, datastore_id) return call(VDC_METHODS[:add_datastore], @pe_id, zone_id.to_i, datastore_id.to_i) end |
#add_group(group_id) ⇒ nil, OpenNebula::Error
Adds a group to this VDC
125 126 127 |
# File 'lib/opennebula/vdc.rb', line 125 def add_group(group_id) return call(VDC_METHODS[:add_group], @pe_id, group_id.to_i) end |
#add_host(zone_id, host_id) ⇒ nil, OpenNebula::Error
Deletes a host from this VDC
164 165 166 |
# File 'lib/opennebula/vdc.rb', line 164 def add_host(zone_id, host_id) return call(VDC_METHODS[:add_host], @pe_id, zone_id.to_i, host_id.to_i) end |
#add_vnet(zone_id, vnet_id) ⇒ nil, OpenNebula::Error
Adds a vnet to this VDC
222 223 224 |
# File 'lib/opennebula/vdc.rb', line 222 def add_vnet(zone_id, vnet_id) return call(VDC_METHODS[:add_vnet], @pe_id, zone_id.to_i, vnet_id.to_i) end |
#allocate(description) ⇒ nil, OpenNebula::Error
Allocates a new Vdc in OpenNebula
87 88 89 |
# File 'lib/opennebula/vdc.rb', line 87 def allocate(description) super(VDC_METHODS[:allocate], description) end |
#del_cluster(zone_id, cluster_id) ⇒ nil, OpenNebula::Error
Deletes a cluster from this VDC
154 155 156 |
# File 'lib/opennebula/vdc.rb', line 154 def del_cluster(zone_id, cluster_id) return call(VDC_METHODS[:del_cluster], @pe_id, zone_id.to_i, cluster_id.to_i) end |
#del_datastore(zone_id, datastore_id) ⇒ nil, OpenNebula::Error
Deletes a datastore from this VDC
212 213 214 |
# File 'lib/opennebula/vdc.rb', line 212 def del_datastore(zone_id, datastore_id) return call(VDC_METHODS[:del_datastore], @pe_id, zone_id.to_i, datastore_id.to_i) end |
#del_group(group_id) ⇒ nil, OpenNebula::Error
Deletes a group from this VDC
134 135 136 |
# File 'lib/opennebula/vdc.rb', line 134 def del_group(group_id) return call(VDC_METHODS[:del_group], @pe_id, group_id.to_i) end |
#del_host(zone_id, host_id) ⇒ nil, OpenNebula::Error
Returns nil in case of success, Error otherwise.
186 187 188 |
# File 'lib/opennebula/vdc.rb', line 186 def del_host(zone_id, host_id) return call(VDC_METHODS[:del_host], @pe_id, zone_id.to_i, host_id.to_i) end |
#del_vnet(zone_id, vnet_id) ⇒ nil, OpenNebula::Error
Deletes a vnet from this VDC
232 233 234 |
# File 'lib/opennebula/vdc.rb', line 232 def del_vnet(zone_id, vnet_id) return call(VDC_METHODS[:del_vnet], @pe_id, zone_id.to_i, vnet_id.to_i) end |
#delete ⇒ nil, OpenNebula::Error
Deletes the Vdc
106 107 108 |
# File 'lib/opennebula/vdc.rb', line 106 def delete() super(VDC_METHODS[:delete]) end |
#info ⇒ nil, OpenNebula::Error Also known as: info!
Retrieves the information of the given Vdc.
76 77 78 |
# File 'lib/opennebula/vdc.rb', line 76 def info() super(VDC_METHODS[:info], 'VDC') end |
#rename(name) ⇒ nil, OpenNebula::Error
Renames this Vdc
116 117 118 |
# File 'lib/opennebula/vdc.rb', line 116 def rename(name) return call(VDC_METHODS[:rename], @pe_id, name) end |
#update(new_template = nil, append = false) ⇒ nil, OpenNebula::Error
Replaces the template contents
99 100 101 |
# File 'lib/opennebula/vdc.rb', line 99 def update(new_template=nil, append=false) super(VDC_METHODS[:update], new_template, append ? 1 : 0) end |