mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
rpc: virnetserverclient: Introduce new attribute conn_time to client
Besides ID, libvirt should provide several parameters to help the user distinguish two clients from each other. One of them is the connection timestamp. This patch also adds a testcase for proper JSON formatting of the new attribute too (proper formatting of older clients that did not support this attribute yet is included in the existing tests) - in order to testGenerateJSON to work, a mock of time_t time(time_t *timer) needed to be created. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
70
tests/virnetdaemondata/input-data-client-timestamp.json
Normal file
70
tests/virnetdaemondata/input-data-client-timestamp.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"servers": {
|
||||
"testServer0": {
|
||||
"min_workers": 10,
|
||||
"max_workers": 50,
|
||||
"priority_workers": 5,
|
||||
"max_clients": 100,
|
||||
"max_anonymous_clients": 10,
|
||||
"keepaliveInterval": 120,
|
||||
"keepaliveCount": 5,
|
||||
"next_client_id": 3,
|
||||
"services": [
|
||||
{
|
||||
"auth": 0,
|
||||
"readonly": true,
|
||||
"nrequests_client_max": 2,
|
||||
"socks": [
|
||||
{
|
||||
"fd": 100,
|
||||
"errfd": -1,
|
||||
"pid": 0,
|
||||
"isClient": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"auth": 2,
|
||||
"readonly": false,
|
||||
"nrequests_client_max": 5,
|
||||
"socks": [
|
||||
{
|
||||
"fd": 101,
|
||||
"errfd": -1,
|
||||
"pid": 0,
|
||||
"isClient": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clients": [
|
||||
{
|
||||
"id": 1,
|
||||
"auth": 1,
|
||||
"readonly": true,
|
||||
"nrequests_max": 15,
|
||||
"conn_time": 1234567890,
|
||||
"sock": {
|
||||
"fd": 102,
|
||||
"errfd": -1,
|
||||
"pid": -1,
|
||||
"isClient": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"auth": 2,
|
||||
"readonly": true,
|
||||
"nrequests_max": 66,
|
||||
"conn_time": 1234567890,
|
||||
"sock": {
|
||||
"fd": 103,
|
||||
"errfd": -1,
|
||||
"pid": -1,
|
||||
"isClient": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
70
tests/virnetdaemondata/output-data-client-timestamp.json
Normal file
70
tests/virnetdaemondata/output-data-client-timestamp.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"servers": {
|
||||
"testServer0": {
|
||||
"min_workers": 10,
|
||||
"max_workers": 50,
|
||||
"priority_workers": 5,
|
||||
"max_clients": 100,
|
||||
"max_anonymous_clients": 10,
|
||||
"keepaliveInterval": 120,
|
||||
"keepaliveCount": 5,
|
||||
"next_client_id": 3,
|
||||
"services": [
|
||||
{
|
||||
"auth": 0,
|
||||
"readonly": true,
|
||||
"nrequests_client_max": 2,
|
||||
"socks": [
|
||||
{
|
||||
"fd": 100,
|
||||
"errfd": -1,
|
||||
"pid": 0,
|
||||
"isClient": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"auth": 2,
|
||||
"readonly": false,
|
||||
"nrequests_client_max": 5,
|
||||
"socks": [
|
||||
{
|
||||
"fd": 101,
|
||||
"errfd": -1,
|
||||
"pid": 0,
|
||||
"isClient": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clients": [
|
||||
{
|
||||
"id": 1,
|
||||
"auth": 1,
|
||||
"readonly": true,
|
||||
"nrequests_max": 15,
|
||||
"conn_time": 1234567890,
|
||||
"sock": {
|
||||
"fd": 102,
|
||||
"errfd": -1,
|
||||
"pid": -1,
|
||||
"isClient": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"auth": 2,
|
||||
"readonly": true,
|
||||
"nrequests_max": 66,
|
||||
"conn_time": 1234567890,
|
||||
"sock": {
|
||||
"fd": 103,
|
||||
"errfd": -1,
|
||||
"pid": -1,
|
||||
"isClient": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user