Feature #1611: Add default quota info and update methods to ruby oca

This commit is contained in:
Carlos Martín authored and Tino Vazquez committed 2012-12-21 11:13:53 +01:00
1 parent ef43829302
commit 9cc2c8f897
3 files changed
+58 -5

No files matched your search

+22 -3
View File
@@ -25,7 +25,9 @@ module OpenNebula
GROUP_POOL_METHODS = {
:info => "grouppool.info"
:info => "grouppool.info",
:quotainfo => "groupquota.info",
:quotaupdate => "groupquota.update"
}
#######################################################################
@@ -37,18 +39,35 @@ module OpenNebula
super('GROUP_POOL','GROUP',client)
end
# Factory method to create User objects
# Factory method to create Group objects
def factory(element_xml)
OpenNebula::Group.new(element_xml,@client)
end
#######################################################################
# XML-RPC Methods for the User Object
# XML-RPC Methods for the GroupPool Object
#######################################################################
# Retrieves all the Groups in the pool.
def info()
super(GROUP_POOL_METHODS[:info])
end
# Gets the default group quota limits
#
# @return [String, OpenNebula::Error] the default group quota in case
# of success, Error otherwise
def get_quota()
return @client.call(GROUP_POOL_METHODS[:quotainfo])
end
# 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
def set_quota(quota)
return call(GROUP_POOL_METHODS[:quotaupdate], quota)
end
end
end
+15
View File
@@ -48,6 +48,21 @@ module OpenNebula
# Common XML-RPC Methods for all the Pool Types
#######################################################################
# Common client call wrapper. Returns nil instead of the response
# if it is successful
#
# @param [String] xml_method xml-rpc method
# @param [Array] args any arguments for the xml-rpc method
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def call(xml_method, *args)
rc = @client.call(xml_method, *args)
rc = nil if !OpenNebula.is_error?(rc)
return rc
end
#Gets the pool without any filter. Host, Group and User Pools
# xml_method:: _String_ the name of the XML-RPC method
def info(xml_method)
+21 -2
View File
@@ -24,7 +24,9 @@ module OpenNebula
#######################################################################
USER_POOL_METHODS = {
:info => "userpool.info"
:info => "userpool.info",
:quotainfo => "userquota.info",
:quotaupdate => "userquota.update"
}
#######################################################################
@@ -42,12 +44,29 @@ module OpenNebula
end
#######################################################################
# XML-RPC Methods for the User Object
# XML-RPC Methods for the UserPool Object
#######################################################################
# Retrieves all the Users in the pool.
def info()
super(USER_POOL_METHODS[:info])
end
# Gets the default user quota limits
#
# @return [String, OpenNebula::Error] the default user quota in case
# of success, Error otherwise
def get_quota()
return @client.call(USER_POOL_METHODS[:quotainfo])
end
# 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
def set_quota(quota)
return call(USER_POOL_METHODS[:quotaupdate], quota)
end
end
end