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

Add user quotas to OCCI

(cherry picked from commit 1a29a208d1d96e4c99e1c324bf57c8e5812229ae)
This commit is contained in:
Jaime Melis 2012-07-03 18:28:43 +02:00
parent 75a0cbb582
commit afaedadcc7
2 changed files with 15 additions and 2 deletions

View File

@ -26,6 +26,10 @@ class UserOCCI < User
<ID><%= self.id.to_s %></ID>
<NAME><%= self.name %></NAME>
<GROUP><%= self['GNAME'] %></GROUP>
<%= self.element_xml('DATASTORE_QUOTA') %>
<%= self.element_xml('NETWORK_QUOTA') %>
<%= self.element_xml('VM_QUOTA') %>
<%= self.element_xml('IMAGE_QUOTA') %>
</USER>
}

View File

@ -261,6 +261,15 @@ module OpenNebula
end
end
# Returns the xml of an element
def element_xml(xpath)
if NOKOGIRI
@xml.xpath(xpath).to_s
else
@xml.elements[xpath].to_s
end
end
# Returns elements in text form
# root_element:: _String_ base element
# indent:: _Boolean_ indents the resulting string, default true
@ -368,14 +377,14 @@ module OpenNebula
end
private
#
#
#
def attr_to_str(attr)
attr.gsub!('"',"\\\"")
attr = "\"#{attr}\""
return attr
end
end