Class: OpenNebula::VMGroup
- Inherits:
-
PoolElement
- Object
- XMLElement
- PoolElement
- OpenNebula::VMGroup
- Defined in:
- lib/opennebula/vm_group.rb
Constant Summary collapse
- VMGROUP_METHODS =
Constants and Class Methods
{ :allocate => "vmgroup.allocate", :info => "vmgroup.info", :update => "vmgroup.update", :delete => "vmgroup.delete", :chown => "vmgroup.chown", :chmod => "vmgroup.chmod", :rename => "vmgroup.rename" }
Class Method Summary collapse
-
.build_xml(pe_id = nil) ⇒ Object
Creates a VMGroup description with just its identifier this method should be used to create plain VMGroup objects.
Instance Method Summary collapse
-
#allocate(description) ⇒ nil, OpenNebula::Error
Allocates a new VMGroup in OpenNebula.
-
#chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) ⇒ nil, OpenNebula::Error
Changes the SecurityGroup permissions.
-
#chmod_octet(octet) ⇒ nil, OpenNebula::Error
Changes the SecurityGroup permissions.
-
#chown(uid, gid) ⇒ nil, OpenNebula::Error
Changes the owner/group.
-
#delete ⇒ Object
Deletes the SecurityGroup.
-
#gid ⇒ Object
Returns the group identifier [return] Integer the element’s group ID.
-
#info ⇒ Object
(also: #info!)
Retrieves the information of the VMGroup.
-
#initialize(xml, client) ⇒ VMGroup
constructor
Class constructor.
- #owner_id ⇒ Object
-
#rename(name) ⇒ nil, OpenNebula::Error
Renames this VMGroup.
-
#role_names ⇒ Object
- return
-
Array with the name of roles.
-
#update(new_vmgroup, append = false) ⇒ nil, OpenNebula::Error
Replaces the vm group contents.
Methods inherited from PoolElement
#id, #name, new_with_id, #to_str
Methods inherited from XMLElement
#[], #add_element, #attr, #delete_element, #each, #each_xpath, #element_xml, #has_elements?, #initialize_xml, #name, #retrieve_elements, #retrieve_xmlelements, #template_like_str, #template_str, #template_xml, #text, #to_hash, #to_xml, #xml_nil?
Constructor Details
#initialize(xml, client) ⇒ VMGroup
Class constructor
48 49 50 51 52 |
# File 'lib/opennebula/vm_group.rb', line 48 def initialize(xml, client) super(xml,client) @client = client end |
Class Method Details
.build_xml(pe_id = nil) ⇒ Object
Creates a VMGroup description with just its identifier this method should be used to create plain VMGroup objects.
37 38 39 40 41 42 43 44 45 |
# File 'lib/opennebula/vm_group.rb', line 37 def VMGroup.build_xml(pe_id=nil) if pe_id obj_xml = "<VM_GROUP><ID>#{pe_id}</ID></VM_GROUP>" else obj_xml = "<VM_GROUP></VM_GROUP>" end XMLElement.build_xml(obj_xml,'VM_GROUP') end |
Instance Method Details
#allocate(description) ⇒ nil, OpenNebula::Error
Allocates a new VMGroup in OpenNebula
71 72 73 |
# File 'lib/opennebula/vm_group.rb', line 71 def allocate(description) super(VMGROUP_METHODS[:allocate], description) end |
#chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) ⇒ nil, OpenNebula::Error
Changes the SecurityGroup permissions. Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
116 117 118 119 120 |
# File 'lib/opennebula/vm_group.rb', line 116 def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) super(VMGROUP_METHODS[:chmod], owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) end |
#chmod_octet(octet) ⇒ nil, OpenNebula::Error
Changes the SecurityGroup permissions.
107 108 109 |
# File 'lib/opennebula/vm_group.rb', line 107 def chmod_octet(octet) super(VMGROUP_METHODS[:chmod], octet) end |
#chown(uid, gid) ⇒ nil, OpenNebula::Error
Changes the owner/group
98 99 100 |
# File 'lib/opennebula/vm_group.rb', line 98 def chown(uid, gid) super(VMGROUP_METHODS[:chown], uid, gid) end |
#delete ⇒ Object
Deletes the SecurityGroup
76 77 78 |
# File 'lib/opennebula/vm_group.rb', line 76 def delete() super(VMGROUP_METHODS[:delete]) end |
#gid ⇒ Object
Returns the group identifier
- return
-
Integer the element’s group ID
138 139 140 |
# File 'lib/opennebula/vm_group.rb', line 138 def gid self['GID'].to_i end |
#info ⇒ Object Also known as: info!
Retrieves the information of the VMGroup.
59 60 61 |
# File 'lib/opennebula/vm_group.rb', line 59 def info() super(VMGROUP_METHODS[:info], 'VM_GROUP') end |
#owner_id ⇒ Object
142 143 144 |
# File 'lib/opennebula/vm_group.rb', line 142 def owner_id self['UID'].to_i end |
#rename(name) ⇒ nil, OpenNebula::Error
Renames this VMGroup
128 129 130 |
# File 'lib/opennebula/vm_group.rb', line 128 def rename(name) return call(VMGROUP_METHODS[:rename], @pe_id, name) end |
#role_names ⇒ Object
- return
-
Array with the name of roles
147 148 149 |
# File 'lib/opennebula/vm_group.rb', line 147 def role_names self.retrieve_elements('ROLES/ROLE/NAME') end |
#update(new_vmgroup, append = false) ⇒ nil, OpenNebula::Error
Replaces the vm group contents
88 89 90 |
# File 'lib/opennebula/vm_group.rb', line 88 def update(new_vmgroup, append=false) super(VMGROUP_METHODS[:update], new_vmgroup, append ? 1 : 0) end |