class OpenNebula::VMGroup
Constants
- VMGROUP_METHODS
Constants and Class Methods
Public Class Methods
Creates a VMGroup description with just its identifier this method should be used to create plain VMGroup objects. @param pe_id [Integer] the id of the object
# File lib/opennebula/vm_group.rb, line 40 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
Class constructor
# File lib/opennebula/vm_group.rb, line 51 def initialize(xml, client) LockableExt.make_lockable(self, VMGROUP_METHODS) super(xml,client) @client = client end
Public Instance Methods
Allocates a new VMGroup in OpenNebula
@param description [String] The contents of the VMGroup.
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/vm_group.rb, line 76 def allocate(description) super(VMGROUP_METHODS[:allocate], description) end
Changes the SecurityGroup permissions. Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/vm_group.rb, line 121 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
Changes the SecurityGroup permissions.
@param octet [String] Permissions octed , e.g. 640 @return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/vm_group.rb, line 112 def chmod_octet(octet) super(VMGROUP_METHODS[:chmod], octet) end
Changes the owner/group
@param uid [Integer] the new owner id. Set to -1 to leave the current one @param gid [Integer] the new group id. Set to -1 to leave the current one @return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/vm_group.rb, line 103 def chown(uid, gid) super(VMGROUP_METHODS[:chown], uid, gid) end
Deletes the SecurityGroup
# File lib/opennebula/vm_group.rb, line 81 def delete() super(VMGROUP_METHODS[:delete]) end
Returns the group identifier
- return
-
Integer the element's group ID
# File lib/opennebula/vm_group.rb, line 143 def gid self['GID'].to_i end
Retrieves the information of the VMGroup.
# File lib/opennebula/vm_group.rb, line 64 def info() super(VMGROUP_METHODS[:info], 'VM_GROUP') end
# File lib/opennebula/vm_group.rb, line 147 def owner_id self['UID'].to_i end
- return
-
Array with the name of roles
# File lib/opennebula/vm_group.rb, line 152 def role_names self.retrieve_elements('ROLES/ROLE/NAME') end
Replaces the vm group contents
@param new_vmgroup [String] New vmgroup contents @param append [true, false] True to append new attributes instead of
replace the whole securitygroup
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/vm_group.rb, line 93 def update(new_vmgroup, append=false) super(VMGROUP_METHODS[:update], new_vmgroup, append ? 1 : 0) end