class OpenNebula::Vdc

Constants

ALL_RESOURCES

Constants and Class Methods

VDC_METHODS

Public Class Methods

build_xml(pe_id=nil) click to toggle source

Creates a Vdc description with just its identifier this method should be used to create plain Vdc objects. @param id [Integer] the id of the Vdc

Example:

vdc = Vdc.new(Vdc.build_xml(3),rpc_client)
# 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
new(xml, client) click to toggle source

Class constructor

Calls superclass method OpenNebula::PoolElement.new
# File lib/opennebula/vdc.rb, line 65
def initialize(xml, client)
    super(xml,client)
end

Public Instance Methods

add_cluster(zone_id, cluster_id) click to toggle source

Adds a cluster to this VDC @param zone_id [Integer] Zone ID @param cluster_id [Integer] Cluster ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Adds a datastore to this VDC @param zone_id [Integer] Zone ID @param datastore_id [Integer] Datastore ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Adds a group to this VDC @param group_id [Integer] Group ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Adds a host to this VDC @param zone_id [Integer] Zone ID @param host_id [Integer] Host ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Adds a vnet to this VDC @param zone_id [Integer] Zone ID @param vnet_id [Integer] Vnet ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Allocates a new Vdc in OpenNebula

@param description [String] The template of the Vdc. @return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#allocate
# File lib/opennebula/vdc.rb, line 87
def allocate(description)
    super(VDC_METHODS[:allocate], description)
end
del_cluster(zone_id, cluster_id) click to toggle source

Deletes a cluster from this VDC @param zone_id [Integer] Zone ID @param cluster_id [Integer] Cluster ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Deletes a datastore from this VDC @param zone_id [Integer] Zone ID @param datastore_id [Integer] Datastore ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Deletes a group from this VDC @param group_id [Integer] Group ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Deletes a host from this VDC @param zone_id [Integer] Zone ID @param host_id [Integer] Host ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Deletes a vnet from this VDC @param zone_id [Integer] Zone ID @param vnet_id [Integer] Vnet ID

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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() click to toggle source

Deletes the Vdc @return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#delete
# File lib/opennebula/vdc.rb, line 106
def delete()
    super(VDC_METHODS[:delete])
end
info() click to toggle source

Retrieves the information of the given Vdc. @return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#info
# File lib/opennebula/vdc.rb, line 76
def info()
    super(VDC_METHODS[:info], 'VDC')
end
Also aliased as: info!
info!()
Alias for: info
rename(name) click to toggle source

Renames this Vdc

@param name [String] New name for the Vdc.

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# 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) click to toggle source

Replaces the template contents

@param new_template [String] New template contents @param append [true, false] True to append new attributes instead of

replace the whole template

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#update
# File lib/opennebula/vdc.rb, line 99
def update(new_template=nil, append=false)
    super(VDC_METHODS[:update], new_template, append ? 1 : 0)
end