class OpenNebula::VMGroup

Constants

VMGROUP_METHODS

Constants and Class Methods

Public Class Methods

build_xml(pe_id=nil) click to toggle source

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 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
new(xml, client) click to toggle source

Class constructor

Calls superclass method OpenNebula::PoolElement.new
# File lib/opennebula/vm_group.rb, line 48
def initialize(xml, client)
    super(xml,client)

    @client = client
end

Public Instance Methods

allocate(description) click to toggle source

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
Calls superclass method OpenNebula::PoolElement#allocate
# 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) click to toggle source

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
Calls superclass method OpenNebula::PoolElement#chmod
# 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) click to toggle source

Changes the SecurityGroup permissions.

@param octet [String] Permissions octed , e.g. 640 @return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#chmod_octet
# File lib/opennebula/vm_group.rb, line 107
def chmod_octet(octet)
    super(VMGROUP_METHODS[:chmod], octet)
end
chown(uid, gid) click to toggle source

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
Calls superclass method OpenNebula::PoolElement#chown
# File lib/opennebula/vm_group.rb, line 98
def chown(uid, gid)
    super(VMGROUP_METHODS[:chown], uid, gid)
end
delete() click to toggle source

Deletes the SecurityGroup

Calls superclass method OpenNebula::PoolElement#delete
# File lib/opennebula/vm_group.rb, line 76
def delete()
    super(VMGROUP_METHODS[:delete])
end
gid() click to toggle source

Returns the group identifier

return

Integer the element's group ID

# File lib/opennebula/vm_group.rb, line 138
def gid
    self['GID'].to_i
end
info() click to toggle source

Retrieves the information of the VMGroup.

Calls superclass method OpenNebula::PoolElement#info
# File lib/opennebula/vm_group.rb, line 59
def info()
    super(VMGROUP_METHODS[:info], 'VM_GROUP')
end
Also aliased as: info!
info!()
Alias for: info
owner_id() click to toggle source
# File lib/opennebula/vm_group.rb, line 142
def owner_id
    self['UID'].to_i
end
rename(name) click to toggle source

Renames this VMGroup

@param name [String] New name for the VMGroup.

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# File lib/opennebula/vm_group.rb, line 128
def rename(name)
    return call(VMGROUP_METHODS[:rename], @pe_id, name)
end
role_names() click to toggle source
return

Array with the name of roles

# File lib/opennebula/vm_group.rb, line 147
def role_names
    self.retrieve_elements('ROLES/ROLE/NAME')
end
update(new_vmgroup, append=false) click to toggle source

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
Calls superclass method OpenNebula::PoolElement#update
# File lib/opennebula/vm_group.rb, line 88
def update(new_vmgroup, append=false)
    super(VMGROUP_METHODS[:update], new_vmgroup, append ? 1 : 0)
end