class OpenNebula::System

Constants

SYSTEM_METHODS

Constants and Class attribute accessors

Public Class Methods

new(client) click to toggle source

Constructor

@param [Client] client that represents a XML-RPC connection
# File lib/opennebula/system.rb, line 41
def initialize(client)
    @client = client
end

Public Instance Methods

compatible_version() click to toggle source

Returns whether of not the oned version is the same as the OCA version

@return [true, false, OpenNebula::Error] true if oned is the same

version
# File lib/opennebula/system.rb, line 61
def compatible_version()
    no_revision = VERSION[/^\d+\.\d+\./]
    oned_v = get_oned_version

    if OpenNebula.is_error?(oned_v)
        return oned_v
    end

    return (oned_v =~ /#{no_revision}/) != nil
end
get_configuration() click to toggle source

Gets the oned configuration

@return [XMLElement, OpenNebula::Error] the oned configuration in case

of success, Error otherwise
# File lib/opennebula/system.rb, line 76
def get_configuration()
    rc = @client.call(SYSTEM_METHODS[:config])

    if OpenNebula.is_error?(rc)
        return rc
    end

    config = XMLElement.new
    config.initialize_xml(rc, 'TEMPLATE')

    return config
end
get_group_quotas() click to toggle source

Gets the default group quota limits

@return [XMLElement, OpenNebula::Error] the default group quota in case

of success, Error otherwise
# File lib/opennebula/system.rb, line 119
def get_group_quotas()
    rc = @client.call(SYSTEM_METHODS[:groupquotainfo])

    if OpenNebula.is_error?(rc)
        return rc
    end

    default_quotas = XMLElement.new
    default_quotas.initialize_xml(rc, 'DEFAULT_GROUP_QUOTAS')

    return default_quotas
end
get_oned_version() click to toggle source

Gets the oned version

@return [String, OpenNebula::Error] the oned version in case

of success, Error otherwise
# File lib/opennebula/system.rb, line 53
def get_oned_version()
    return @client.call("system.version")
end
get_user_quotas() click to toggle source

Gets the default user quota limits

@return [XMLElement, OpenNebula::Error] the default user quota in case

of success, Error otherwise
# File lib/opennebula/system.rb, line 93
def get_user_quotas()
    rc = @client.call(SYSTEM_METHODS[:userquotainfo])

    if OpenNebula.is_error?(rc)
        return rc
    end

    default_quotas = XMLElement.new
    default_quotas.initialize_xml(rc, 'DEFAULT_USER_QUOTAS')

    return default_quotas
end
set_group_quotas(quota) click to toggle source

Sets the default group quota limits @param quota [String] a template (XML or txt) with the new quota limits

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

otherwise
# File lib/opennebula/system.rb, line 137
def set_group_quotas(quota)
    return @client.call(SYSTEM_METHODS[:groupquotaupdate], quota)
end
set_user_quotas(quota) click to toggle source

Sets the default user quota limits @param quota [String] a template (XML or txt) with the new quota limits

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

otherwise
# File lib/opennebula/system.rb, line 111
def set_user_quotas(quota)
    return @client.call(SYSTEM_METHODS[:userquotaupdate], quota)
end