PoolElement
Constants and Class Methods
Creates a Datastore description with just its identifier this method should be used to create plain Datastore objects. id the id of the user
Example:
datastore = Datastore.new(Datastore.build_xml(3),rpc_client)
# File lib/opennebula/datastore.rb, line 51 def Datastore.build_xml(pe_id=nil) if pe_id datastore_xml = "<DATASTORE><ID>#{pe_id}</ID></DATASTORE>" else datastore_xml = "<DATASTORE></DATASTORE>" end XMLElement.build_xml(datastore_xml,'DATASTORE') end
Allocates a new Datastore in OpenNebula
@param description [String] The template of the Datastore. @param cluster_id [Integer] Id of the cluster
@return [Integer, OpenNebula::Error] the new ID in case of
success, error otherwise
# File lib/opennebula/datastore.rb, line 98 def allocate(description, cluster_id=ClusterPool::NONE_CLUSTER_ID) super(DATASTORE_METHODS[:allocate], description, cluster_id) end
Changes the datastore permissions. Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/datastore.rb, line 144 def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) super(DATASTORE_METHODS[:chmod], owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) end
Changes the datastore permissions.
@param octet [String] Permissions octed , e.g. 640 @return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/datastore.rb, line 135 def chmod_octet(octet) super(DATASTORE_METHODS[:chmod], octet) end
Changes the owner/group
@param uid [Integer] the new owner id. Set to -1 to leave the current one @param gid [Integer] the new group id. Set to -1 to leave the current one
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/datastore.rb, line 126 def chown(uid, gid) super(DATASTORE_METHODS[:chown], uid, gid) end
Returns whether or not the image with id 'id' is part of this datastore
# File lib/opennebula/datastore.rb, line 165 def contains(id) #This doesn't work in ruby 1.8.5 #return self["DATASTORE/ID[.=#{uid}]"] != nil id_array = retrieve_elements('IMAGES/ID') return id_array != nil && id_array.include?(uid.to_s) end
Deletes the Datastore
# File lib/opennebula/datastore.rb, line 103 def delete() super(DATASTORE_METHODS[:delete]) end
Returns an array with the numeric image ids
# File lib/opennebula/datastore.rb, line 174 def img_ids array = Array.new self.each("IMAGES/ID") do |id| array << id.text.to_i end return array end
Retrieves the information of the given Datastore.
# File lib/opennebula/datastore.rb, line 85 def info() super(DATASTORE_METHODS[:info], 'DATASTORE') end
Renames this datastore
@param name [String] New name for the datastore
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/datastore.rb, line 156 def rename(name) return call(DATASTORE_METHODS[:rename], @pe_id, name) end
Returns the datastore type (string value)
# File lib/opennebula/datastore.rb, line 80 def short_type_str SHORT_DATASTORE_TYPES[type_str] end
Returns the datastore type (string value)
# File lib/opennebula/datastore.rb, line 75 def type_str DATASTORE_TYPES[type] end
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
# File lib/opennebula/datastore.rb, line 115 def update(new_template, append=false) super(DATASTORE_METHODS[:update], new_template, append ? 1 : 0) end
Generated with the Darkfish Rdoc Generator 2.