Closed sessl3r closed 7 months ago
Please post the output of labgrid-client show
for the place you are using.
Some for me obvious comments: In all the printouts I have replaced place-, hostnames user, passwords etc. as I have not created a minimal place. Please also ignore the JTAG Resource - this is not a upstream resource.
For me the impression is that in client.py it goes through all resources of the target and first finds the PDUDaemonPort resource which it sees is a power resource. However it raises an exception as the name does not match instead of continuing on with the other resources. In this case the TasmotaPowerPort with the correct name.
$ labgrid-client -p test show
Place 'test':
matches:
*/test/*
acquired: host/tobias
acquired resources:
otherhost/test/NetworkQuartusUSBJTAG/jtag-board
otherhost/test/NetworkService/NetworkService
otherhost/test/PDUDaemonPort/power1
otherhost/test/TasmotaPowerPort/power2
created: 2024-03-13 07:50:49.199185
changed: 2024-03-13 09:32:48.789115
Acquired resource 'power1' (otherhost/test/PDUDaemonPort/power1):
{'acquired': 'test',
'avail': True,
'cls': 'PDUDaemonPort',
'params': {'host': 'broker', 'index': 0, 'pdu': 'power1'}}
Acquired resource 'NetworkService' (otherhost/test/NetworkService/NetworkService):
{'acquired': 'test',
'avail': True,
'cls': 'NetworkService',
'params': {'address': 'hostname',
'extra': {'proxy': 'otherhost', 'proxy_required': False},
'password': 'pass',
'username': 'user'}}
Acquired resource 'power2' (otherhost/test/TasmotaPowerPort/power2):
{'acquired': 'test',
'avail': True,
'cls': 'TasmotaPowerPort',
'params': {'avail_topic': 'tele/powerstrip-1/LWT',
'host': 'broker',
'power_topic': 'cmnd/powerstrip-1/POWER2',
'status_topic': 'stat/powerstrip-1/POWER2'}}
Acquired resource 'jtag-board' (otherhost/test/NetworkQuartusUSBJTAG/jtag-board):
{'acquired': None,
'avail': True,
'cls': 'NetworkQuartusUSBJTAG',
'params': {'device_name': 'Arrow-USB-Blaster',
'device_port': '',
'extra': {'proxy': 'otherhost', 'proxy_required': False},
'host': 'otherhost',
'jtagd_cmd': 'quartus-v23.4.sh jtagd',
'jtagd_password': '1234',
'jtagd_port': '3122'}}
Please use the add-named-match
command to setup different names between the two resources. You can also name one of the resources "default", this resource will be picked when no explicit name is provided.
Hm I don't get it. Why should this be needed when the exporter already adds names to those. The identical solution is working eg. for consoles. When having multiple we name them in exporter config and access the in client using --name
option.
From the show
command it can also be seen the resources are named correctly:
acquired resources:
otherhost/test/NetworkQuartusUSBJTAG/jtag-board
otherhost/test/NetworkService/NetworkService
otherhost/test/PDUDaemonPort/power1
otherhost/test/TasmotaPowerPort/power2
Also it is not a problem that Labgrid picks one of those - it will just never pick the second one (TasmotaPowerPort):
labgrid-client -p test power get # this will return status of power1 = PDUDaemonPort
labgrid-client -p test power get --name power1 # this will return status of power1 = PDUDaemonPort
labgrid-client -p test power get --name power2 # this raises the described Exception
Which version of labgrid are you running?
v23.0.5 with some custom resources/drivers (jtag). Can do a 23.0.5 clean test hopefully next week if I find some time due to upcoming EW24...
Retested with plain v23.0.5 for exporter and client. Same behaviour. It is important to have different driver types for both power resources. If the same driver is in use for both resources everything works as expected - which makes sense when looking on my workaround.
I tried to reproduce on master, I think the reason this is broken on stable is that a backport of ac560620ba4c4d4ab276a551ae623c2707af1b5a is missing. Can you test on master?
Yes. On master the issue seems to be solved. Great, so I will just build up onto master instead of stable. Thanks a lot.
We see a issue when having one Place with multiple Power Resources which use different Resource types (in our case PDUDaemonPort and TasmotaPowerPort. Example config:
When using such a place with labgrid-client the output is as follows:
We tackled this down to _get_driver_or_new in the client which raises. Just hacking in the following diff solves the problem: