Class: OpenNebula::System
- Inherits:
-
Object
- Object
- OpenNebula::System
- Defined in:
- lib/opennebula/system.rb
Constant Summary collapse
- SYSTEM_METHODS =
Constants and Class attribute accessors
{ :userquotainfo => "userquota.info", :userquotaupdate => "userquota.update", :groupquotainfo => "groupquota.info", :groupquotaupdate => "groupquota.update", :version => "system.version", :config => "system.config" }
Instance Method Summary collapse
-
#compatible_version ⇒ true, ...
Returns whether of not the oned version is the same as the OCA version.
-
#get_configuration ⇒ XMLElement, OpenNebula::Error
Gets the oned configuration.
-
#get_group_quotas ⇒ XMLElement, OpenNebula::Error
Gets the default group quota limits.
-
#get_oned_version ⇒ String, OpenNebula::Error
Gets the oned version.
-
#get_user_quotas ⇒ XMLElement, OpenNebula::Error
Gets the default user quota limits.
-
#initialize(client) ⇒ System
constructor
Constructor @param [Client] client that represents a XML-RPC connection.
-
#set_group_quotas(quota) ⇒ nil, OpenNebula::Error
Sets the default group quota limits.
-
#set_user_quotas(quota) ⇒ nil, OpenNebula::Error
Sets the default user quota limits.
Constructor Details
#initialize(client) ⇒ System
Constructor
@param [Client] client that represents a XML-RPC connection
41 42 43 |
# File 'lib/opennebula/system.rb', line 41 def initialize(client) @client = client end |
Instance Method Details
#compatible_version ⇒ true, ...
Returns whether of not the oned version is the same as the OCA version
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/opennebula/system.rb', line 61 def compatible_version() no_revision = VERSION[/^\d+\.\d+\./] oned_v = get_oned_version if OpenNebula.is_error?(oned_v) return oned_v end return (oned_v =~ /#{no_revision}/) != nil end |
#get_configuration ⇒ XMLElement, OpenNebula::Error
Gets the oned configuration
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/opennebula/system.rb', line 76 def get_configuration() rc = @client.call(SYSTEM_METHODS[:config]) if OpenNebula.is_error?(rc) return rc end config = XMLElement.new config.initialize_xml(rc, 'TEMPLATE') return config end |
#get_group_quotas ⇒ XMLElement, OpenNebula::Error
Gets the default group quota limits
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/opennebula/system.rb', line 119 def get_group_quotas() rc = @client.call(SYSTEM_METHODS[:groupquotainfo]) if OpenNebula.is_error?(rc) return rc end default_quotas = XMLElement.new default_quotas.initialize_xml(rc, 'DEFAULT_GROUP_QUOTAS') return default_quotas end |
#get_oned_version ⇒ String, OpenNebula::Error
Gets the oned version
53 54 55 |
# File 'lib/opennebula/system.rb', line 53 def get_oned_version() return @client.call("system.version") end |
#get_user_quotas ⇒ XMLElement, OpenNebula::Error
Gets the default user quota limits
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/opennebula/system.rb', line 93 def get_user_quotas() rc = @client.call(SYSTEM_METHODS[:userquotainfo]) if OpenNebula.is_error?(rc) return rc end default_quotas = XMLElement.new default_quotas.initialize_xml(rc, 'DEFAULT_USER_QUOTAS') return default_quotas end |
#set_group_quotas(quota) ⇒ nil, OpenNebula::Error
Sets the default group quota limits
137 138 139 |
# File 'lib/opennebula/system.rb', line 137 def set_group_quotas(quota) return @client.call(SYSTEM_METHODS[:groupquotaupdate], quota) end |
#set_user_quotas(quota) ⇒ nil, OpenNebula::Error
Sets the default user quota limits
111 112 113 |
# File 'lib/opennebula/system.rb', line 111 def set_user_quotas(quota) return @client.call(SYSTEM_METHODS[:userquotaupdate], quota) end |