mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-17 18:33:32 +09:00
Feature #1611: Add default quota info and update methods to ruby oca
This commit is contained in:
1 parent
ef43829302
commit
9cc2c8f897
3 files changed
+58
-5
No files matched your search
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user