[ovirt-users] obtain spm id (host id) from engine using api

joost at familiealbers.nl joost at familiealbers.nl
Fri Dec 16 16:15:49 UTC 2016


Hi Nir, thanks.

I am actually after cases where the storagepool is not mounted.And 
engine can not reach vdsm.


I can mount it using the vdsm api however i need to use a hostid.
I cant find where to get the particular id from.

at the moment, when i manually connect the storage pool (using vdsm 
api) i get end up with the following errors as soon as the connection 
between engine and vdsm is created.

jsonrpc.Executor/6::ERROR::2016-12-16 
16:01:57,131::dispatcher::77::Storage.Dispatcher::(wrapper) {'status': 
{'message': "Cannot perform action while storage pool is connected: 
('hostId=1, newHostId=2',)", 'code': 325}}

following this its a cluster of errors, gluster restarts and complains 
about quorum etc etc


if i'd redo the commands after reboot (still no connection between vdsm 
api api and engine and use host id 2 on this particular host my problems 
are resolved.



also am i right in thinking the values in the db do not change as long 
as the hosts remain the same?


It would really help me immense to find out the host id before 
conencting to the storagepool and without needed to go into the db.

thanks.

Joost








Nir Soffer schreef op 2016-12-16 16:42:
> 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