1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

feature #788: Add delete quota functionality

This commit is contained in:
Daniel Molina 2011-08-31 18:09:24 +02:00
parent d16a20c757
commit f308f38fc5
2 changed files with 22 additions and 1 deletions

View File

@ -130,6 +130,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
exit_with_code 0
end
########################################################################
delete_desc = "Delete the defined quotas for the given user"
command :delete, delete_desc, :userid do
quota.delete_quota(args[0])
exit_with_code 0
end
########################################################################
show_desc = "Show the user's quota and usage. (usage/quota)"

View File

@ -127,13 +127,22 @@ class Quota
if limit
limit
else
@conf[:defaults]
@conf[:defaults].merge!(:uid => uid)
end
else
@db[table].all
end
end
# Delete user limits
def delete(table, uid)
quotas=@db[table].filter(:uid => uid)
if quotas.first
quotas.delete
end
end
###########################################################################
# Quota Client
###########################################################################
@ -145,6 +154,10 @@ class Quota
get(QUOTA_TABLE, uid)
end
def delete_quota(uid)
delete(QUOTA_TABLE, uid)
end
###########################################################################
# Authorization
###########################################################################