1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Bug #2504: Improve defaultquota help text

This commit is contained in:
Carlos Martín 2014-04-08 16:49:16 +02:00
parent 0589944e63
commit c258ba8f23
3 changed files with 25 additions and 4 deletions

View File

@ -46,9 +46,12 @@ class OneQuotaHelper
# ID = <ID of the image>
# RVMS = <Max. number of VMs using the image>
# ]
EOT
HELP_QUOTA_FOOTER = <<-EOT.unindent
#
# In any quota:
# -1 means use the default limit ('defaultquota' command)
# -1 means use the default limit (set with the 'defaultquota' command)
# 0 means unlimited.
#
# The usage counters "*_USED" are shown for information
@ -56,12 +59,23 @@ class OneQuotaHelper
#-----------------------------------------------------------------------
EOT
HELP_DEFAULT_QUOTA_FOOTER = <<-EOT.unindent
#
# In any quota:
# 0 means unlimited.
#
# The usage counters "*_USED" will always be 0 for the default
# quotas, and can be ignored.
#-----------------------------------------------------------------------
EOT
# Edits the quota template of a resource
# @param [XMLElement] resource to get the current info from
# @param [String] path to the new contents. If nil a editor will be
# used
# @param [True|False] is_default To change the help text
# @return [String] contents of the new quotas
def self.set_quota(resource, path)
def self.set_quota(resource, path, is_default=false)
str = ""
if path.nil?
@ -71,6 +85,13 @@ class OneQuotaHelper
path = tmp.path
tmp << HELP_QUOTA
if (is_default)
tmp << HELP_DEFAULT_QUOTA_FOOTER
else
tmp << HELP_QUOTA_FOOTER
end
tmp << resource.template_like_str("DATASTORE_QUOTA") << "\n"
tmp << resource.template_like_str("VM_QUOTA") << "\n"
tmp << resource.template_like_str("NETWORK_QUOTA") << "\n"

View File

@ -232,7 +232,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
exit(-1)
end
str = OneQuotaHelper.set_quota(default_quotas, args[0])
str = OneQuotaHelper.set_quota(default_quotas, args[0], true)
rc = system.set_group_quotas(str)

View File

@ -265,7 +265,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
exit(-1)
end
str = OneQuotaHelper.set_quota(default_quotas, args[0])
str = OneQuotaHelper.set_quota(default_quotas, args[0], true)
rc = system.set_user_quotas(str)