mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
feature #696: OCA now supports state filter for VMs
This commit is contained in:
parent
d5bd0e16bd
commit
1c1cb98400
@ -59,8 +59,8 @@ class VirtualMachinePoolInfo : public RequestManagerPoolInfoFilter
|
|||||||
public:
|
public:
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
static const int ALL_VM; /**< VMs in any state (-2) */
|
static const int ALL_VM; /**< VMs in any state (-2) */
|
||||||
static const int ACTIVE; /**< VMs in any state expect DONE (-1)*/
|
static const int NOT_DONE; /**< VMs in any state expect DONE (-1)*/
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ module OpenNebula
|
|||||||
:info => "vmpool.info"
|
:info => "vmpool.info"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Constants for info queries (include/RequestManagerPoolInfoFilter.h)
|
||||||
|
INFO_NOT_DONE = -1
|
||||||
|
INFO_ALL_VM = -2
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Class constructor & Pool Methods
|
# Class constructor & Pool Methods
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@ -48,25 +52,54 @@ module OpenNebula
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
# Retrieves all or part of the VirtualMachines in the pool.
|
# 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)
|
def info(*args)
|
||||||
case args.size
|
case args.size
|
||||||
when 0
|
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
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def info_all()
|
def info_all()
|
||||||
return super(VM_POOL_METHODS[:info])
|
return info_filter(VM_POOL_METHODS[:info],
|
||||||
|
INFO_ALL,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
INFO_NOT_DONE)
|
||||||
end
|
end
|
||||||
|
|
||||||
def info_mine()
|
def info_mine()
|
||||||
return super(VM_POOL_METHODS[:info])
|
return info_filter(VM_POOL_METHODS[:info],
|
||||||
|
INFO_MINE,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
INFO_NOT_DONE)
|
||||||
end
|
end
|
||||||
|
|
||||||
def info_group()
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -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:
|
case VirtualMachinePoolInfo::ALL_VM:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VirtualMachinePoolInfo::ACTIVE:
|
case VirtualMachinePoolInfo::NOT_DONE:
|
||||||
state_filter << "state <> " << VirtualMachine::DONE;
|
state_filter << "state <> " << VirtualMachine::DONE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user