[ovirt-users] obtain spm id (host id) from engine using api
Nir Soffer
nsoffer at redhat.com
Fri Dec 16 15:42:44 UTC 2016
On Fri, Dec 16, 2016 at 5:20 PM, <joost at familiealbers.nl> wrote:
> in ovirt engine the table.
>
> vds_spm_id_map
>
> holds the ids used in spm election.
>
> engine_20150824095956=# select * from vds_spm_id_map ;
> storage_pool_id | vds_spm_id | vds_id
> --------------------------------------+------------+--------------------------------------
> 144fb47d-b38c-4bb7-867b-373d7ba9f0a9 | 1 |
> 313ed02c-8029-4fb3-ba1c-5b3c9902ddb1
> 144fb47d-b38c-4bb7-867b-373d7ba9f0a9 | 2 |
> 7fdebf8a-1503-4b54-9681-0201ee330381
>
> these particular id's seem to be added when a vds is added to the engine or
> when the storage pool is first setup.
>
> I would like to be able to obtain this nr (in my case its generally 1 or 2
> as i have two hosts per dc / cluster) through an api or even better from the
> hosts itself.
>
> When testing I connect to the storage pools using the api
Do you mean vdsm api?
You can get the host id using vdsClient:
# vdsClient -s 0 getStoragePoolInfo fe307b9e-8f6b-4958-955a-0faeeae8b017
name = No Description
isoprefix =
pool_status = connected
lver = 7
spm_id = 1
master_uuid = eeb8e812-4e69-469a-a07a-272ea3a79105
version = 4
domains = 16fe0625-be29-4a77-81c5-1bc0e5267eea:Active,eeb8e812-4e69-469a-a07a-272ea3a79105:Active
type = ISCSI
master_ver = 3
16fe0625-be29-4a77-81c5-1bc0e5267eea = {'status': 'Active',
'diskfree': '97844723712', 'isoprefix': '', 'alerts': [], 'disktotal':
'106568876032', 'version': 4}
eeb8e812-4e69-469a-a07a-272ea3a79105 = {'status': 'Active',
'diskfree': '98918465536', 'isoprefix': '', 'alerts': [], 'disktotal':
'106568876032', 'version': 4}
If you have vdsm source, you can use the new client:
# contrib/jsonrpc StoragePool getInfo
storagepoolID=fe307b9e-8f6b-4958-955a-0faeeae8b017
{
"info": {
"name": "No Description",
"isoprefix": "",
"pool_status": "connected",
"lver": 7,
"spm_id": 1,
"master_uuid": "eeb8e812-4e69-469a-a07a-272ea3a79105",
"version": "4",
"domains":
"16fe0625-be29-4a77-81c5-1bc0e5267eea:Active,eeb8e812-4e69-469a-a07a-272ea3a79105:Active",
"type": "ISCSI",
"master_ver": 3
},
"dominfo": {
"16fe0625-be29-4a77-81c5-1bc0e5267eea": {
"status": "Active",
"diskfree": "97844723712",
"isoprefix": "",
"alerts": [],
"disktotal": "106568876032",
"version": 4
},
"eeb8e812-4e69-469a-a07a-272ea3a79105": {
"status": "Active",
"diskfree": "98918465536",
"isoprefix": "",
"alerts": [],
"disktotal": "106568876032",
"version": 4
}
}
}
> and its important
> the hostid used when making this api call is correct or bad things happen.
>
> I have been searching high and low to no avail. In understand the engine is
> in charge here but i really would be helped if this values can be obtained
> without going into the db.
>
> As i am continuously rebuilding dc's / storage pools and hosts i cannot keep
> track of when which host is installed hence the need to know the spm_id as
> listed.
>
> It might be i am all wrong but the when i use the vds_spm_id as listed i can
> connect the host to the storage pools using the api.
More information about the Users
mailing list