diff --git a/include/RequestManagerPoolInfoFilter.h b/include/RequestManagerPoolInfoFilter.h index 88e829cec3..1281c5f6c5 100644 --- a/include/RequestManagerPoolInfoFilter.h +++ b/include/RequestManagerPoolInfoFilter.h @@ -59,8 +59,8 @@ class VirtualMachinePoolInfo : public RequestManagerPoolInfoFilter public: /* -------------------------------------------------------------------- */ - static const int ALL_VM; /**< VMs in any state (-2) */ - static const int ACTIVE; /**< VMs in any state expect DONE (-1)*/ + static const int ALL_VM; /**< VMs in any state (-2) */ + static const int NOT_DONE; /**< VMs in any state expect DONE (-1)*/ /* -------------------------------------------------------------------- */ diff --git a/src/oca/ruby/OpenNebula/VirtualMachinePool.rb b/src/oca/ruby/OpenNebula/VirtualMachinePool.rb index 7a61c1ae98..4613da0c2b 100644 --- a/src/oca/ruby/OpenNebula/VirtualMachinePool.rb +++ b/src/oca/ruby/OpenNebula/VirtualMachinePool.rb @@ -26,6 +26,10 @@ module OpenNebula :info => "vmpool.info" } + # Constants for info queries (include/RequestManagerPoolInfoFilter.h) + INFO_NOT_DONE = -1 + INFO_ALL_VM = -2 + ####################################################################### # Class constructor & Pool Methods ####################################################################### @@ -48,25 +52,54 @@ module OpenNebula ####################################################################### # 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] def info(*args) case args.size when 0 - info_filter(VM_POOL_METHODS[:info],@user_id,-1,-1) + info_filter(VM_POOL_METHODS[:info], + @user_id, + -1, + -1, + INFO_NOT_DONE) when 3 - info_filter(VM_POOL_METHODS[:info],args[0],args[1],args[2]) + 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 def info_all() - return super(VM_POOL_METHODS[:info]) + return info_filter(VM_POOL_METHODS[:info], + INFO_ALL, + -1, + -1, + INFO_NOT_DONE) end def info_mine() - return super(VM_POOL_METHODS[:info]) + return info_filter(VM_POOL_METHODS[:info], + INFO_MINE, + -1, + -1, + INFO_NOT_DONE) end def info_group() - return super(VM_POOL_METHODS[:info]) + return info_filter(VM_POOL_METHODS[:info], + INFO_GROUP, + -1, + -1, + INFO_NOT_DONE) end end end diff --git a/src/rm/RequestManagerPoolInfoFilter.cc b/src/rm/RequestManagerPoolInfoFilter.cc index 41ea783cdc..2a2bc6c2dd 100644 --- a/src/rm/RequestManagerPoolInfoFilter.cc +++ b/src/rm/RequestManagerPoolInfoFilter.cc @@ -29,9 +29,9 @@ const int RequestManagerPoolInfoFilter::MINE_GROUP = -1; /* ------------------------------------------------------------------------- */ -const int VirtualMachinePoolInfo::ALL_VM = -2; +const int VirtualMachinePoolInfo::ALL_VM = -2; -const int VirtualMachinePoolInfo::ACTIVE = -1; +const int VirtualMachinePoolInfo::NOT_DONE = -1; /* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ @@ -117,7 +117,7 @@ void RequestManagerPoolInfoFilter::request_execute(xmlrpc_c::paramList const& pa case VirtualMachinePoolInfo::ALL_VM: break; - case VirtualMachinePoolInfo::ACTIVE: + case VirtualMachinePoolInfo::NOT_DONE: state_filter << "state <> " << VirtualMachine::DONE; break;