Class: OpenNebula::VirtualMachinePool

Inherits:
Pool show all
Defined in:
lib/OpenNebula/VirtualMachinePool.rb

Constant Summary

VM_POOL_METHODS =
{
    :info => "vmpool.info"
}
INFO_NOT_DONE =

Constants for info queries (include/RequestManagerPoolInfoFilter.h)

-1
INFO_ALL_VM =
-2

Constants inherited from Pool

Pool::INFO_ALL, Pool::INFO_GROUP, Pool::INFO_MINE

Instance Method Summary collapse

Methods inherited from Pool

#each, #to_str

Methods inherited from XMLPool

#each_element

Methods inherited from XMLElement

#[], #attr, build_xml, #each, #each_xpath, #has_elements?, #initialize_xml, #name, #retrieve_elements, #template_like_str, #template_str, #text, #to_hash, #to_xml

Constructor Details

#initialize(client, user_id = 0) ⇒ VirtualMachinePool

+client+ a Client object that represents a XML-RPC connection +user_id+ is to refer to a Pool with VirtualMachines from that user



42
43
44
45
46
# File 'lib/OpenNebula/VirtualMachinePool.rb', line 42

def initialize(client, user_id=0)
    super('VM_POOL','VM',client)

    @user_id  = user_id
end

Instance Method Details

#factory(element_xml) ⇒ Object

Default Factory Method for the Pools



49
50
51
# File 'lib/OpenNebula/VirtualMachinePool.rb', line 49

def factory(element_xml)
    OpenNebula::VirtualMachine.new(element_xml,@client)
end

#info(*args) ⇒ Object

Retrieves all or part of the VirtualMachines in the pool. No arguments, returns the not-in-done VMs for the user [user_id, start_id, end_id] [user_id, start_id, end_id, state]



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/OpenNebula/VirtualMachinePool.rb', line 61

def info(*args)
    case args.size
        when 0
            info_filter(VM_POOL_METHODS[:info],
                        @user_id,
                        -1,
                        -1,
                        INFO_NOT_DONE)
        when 1
            info_filter(VM_POOL_METHODS[:info],
                        args[0],
                        -1,
                        -1,
                        INFO_NOT_DONE)
        when 3
            info_filter(VM_POOL_METHODS[:info],
                        args[0],
                        args[1],
                        args[2],
                        INFO_NOT_DONE)
        when 4
            info_filter(VM_POOL_METHODS[:info],
                        args[0],
                        args[1],
                        args[2],
                        args[3])
    end
end

#info_allObject



90
91
92
93
94
95
96
# File 'lib/OpenNebula/VirtualMachinePool.rb', line 90

def info_all()
    return info_filter(VM_POOL_METHODS[:info],
                       INFO_ALL,
                       -1,
                       -1,
                       INFO_NOT_DONE)
end

#info_groupObject



106
107
108
109
110
111
112
# File 'lib/OpenNebula/VirtualMachinePool.rb', line 106

def info_group()
    return info_filter(VM_POOL_METHODS[:info],
                       INFO_GROUP,
                       -1,
                       -1,
                       INFO_NOT_DONE)
end

#info_mineObject



98
99
100
101
102
103
104
# File 'lib/OpenNebula/VirtualMachinePool.rb', line 98

def info_mine()
    return info_filter(VM_POOL_METHODS[:info],
                       INFO_MINE,
                       -1,
                       -1,
                       INFO_NOT_DONE)
end