Closed robin2008 closed 5 years ago
curl -X GET "http://10.6.27.1:5000/api/v2/manager/resmgr" -H "accept: application/json" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02"
[
"testnode"
]
curl -X GET "http://10.6.27.1:5000/api/v2/manager/resmgr?pool=1" -H "accept: application/json" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02"
{
"total": 3,
"pool": [
"node0001",
"node0002",
"node000211"
]
}
Prepare the pool as below:
lsdef -t node __TFPOOL-FREE
Object name: node0001
arch=x86_64
groups=all,__TFPOOL-FREE
mtm=fake1
postbootscripts=otherpkgs
postscripts=syslog,remoteshell,syncfiles
rack=N1
usercomment=tags:[ib,gpu,china]
Object name: node0002
arch=x86_64
groups=all,__TFPOOL-FREE
mtm=fake2
postbootscripts=otherpkgs
postscripts=syslog,remoteshell,syncfiles
usercomment=tags:[ib,gpu,china]
Object name: node000211
arch=x86_64
groups=all,__TFPOOL-FREE
mtm=fake1
postbootscripts=otherpkgs
postscripts=syslog,remoteshell,syncfiles
usercomment=tags:[gpu,china]
Apply with attribute:
curl -X POST "http://10.6.27.1:5000/api/v2/manager/resmgr" -H "accept: application/json" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02" -H "Content-Type: application/json" -d "{ \"capacity\": 1, \"criteria_spec\": { \"machinetype\":\"fake1\" }}"
{
"51ba69a0-7c5f-11e9-b2bd-0cc47aea9e02": "node0001"
}
Free specified nodes:
curl -X DELETE "http://10.6.27.1:5000/api/v2/manager/resmgr?names=node0001" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02"
null
# lsdef node0001
Object name: node0001
arch=x86_64
groups=all,__TFPOOL-FREE
mtm=fake1
postbootscripts=otherpkgs
postscripts=syslog,remoteshell,syncfiles
rack=N1
usercomment=tags:[ib,gpu,china]
Free specified nodes with wrong name:
curl -X DELETE "http://10.6.27.1:5000/api/v2/manager/resmgr?names=node000211,abc" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02"
{
"message": "Nodes are not owned by user: test01, no permission to free: abc."
}
Using tags and not enough resource:
curl -X POST "http://10.6.27.1:5000/api/v2/manager/resmgr" -H "accept: application/json" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02" -H "Content-Type: application/json" -d "{ \"capacity\": 2, \"criteria_spec\": { \"machinetype\":\"fake1\", \"tags\": \"-ib,china\" }}"
{
"message": "Not enough free resource matched with the specified attributes."
}
expect the number which meet the pool
curl -X POST "http://10.6.27.1:5000/api/v2/manager/resmgr" -H "accept: application/json" -H "Authorization: token c61bdb8a-7c37-11e9-b7ac-0cc47aea9e02" -H "Content-Type: application/json" -d "{ \"capacity\": 1, \"criteria_spec\": { \"machinetype\":\"fake1\", \"tags\": \"-ib,china\" }}"
{
"8b031b48-7c65-11e9-bc76-0cc47aea9e02": "node000211"
}
Good to me, I agree to merge.
To address https://github.ibm.com/xcat2/task_management/issues/271
__TFPOOL-FREE
as free pool, and for occupied:__TFPOOL-<username>
nodelist.comments
as format oftags=[tag1,tag2,tag2]
g
when using token