mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
util: eliminate bogus error log in virNetDevVPortProfileGetStatus
if instanceId is NULL When virNetDevVPortProfileGetStatus() was called with instanceId = NULL (which is the case for all DISASSOCIATE requests in 802.1Qbh) it would log the following error: Could not find netlink response with expected parameters even though the disassociate had been successfully completely. Then, due to the fortunate coincidence of status having been initialized to 0 and then not changed when the "failure" was encountered, it would still return a status of 0 (PORT_VDP_RESPONSE_SUCCESS), so the caller would assume a successful operation. This would result in a spurious log message though, and would fill in LastErrorMessage, so that the API would return that error if it happened during cleanup from some other error. That, in turn, would lead to an incorrect supposition that the response to the port profile disassociate was the cause of the failure. During debugging, I noticed that the VF in question usually had *no uuid* associated with it (big surprise)by the time the disassociate completed, so the solution is *not* to send the previous instanceId down. This patch fixes virNetDevVPortProfileGetStatus() to only check the VF's uuid in the status if it was given an instanceId to check against when originally called. Otherwise it only checks that the particular VF is present (it will be). This does cause a slight difference in behavior - rather than returning with status unchanged (and thus always 0) it will actually get the IFLA_PORT_RESPONSE. This could lead to revelation of error conditions we were previously ignoring. Or not. So far "not".
This commit is contained in:
parent
47b830370a
commit
21e63916dc
@ -544,14 +544,22 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instanceId &&
|
/* This ensures that the given VF is present in the
|
||||||
tb_port[IFLA_PORT_INSTANCE_UUID] &&
|
* IFLA_VF_PORTS list, and that its uuid matches the
|
||||||
!memcmp(instanceId,
|
* instanceId (in case we've associated it). If no
|
||||||
(unsigned char *)
|
* instanceId is sent from the caller, that means we've
|
||||||
RTA_DATA(tb_port[IFLA_PORT_INSTANCE_UUID]),
|
* disassociated it from this instanceId, and the uuid
|
||||||
VIR_UUID_BUFLEN) &&
|
* will either be unset (if still not associated with
|
||||||
tb_port[IFLA_PORT_VF] &&
|
* anything) or will be set to a new and different uuid
|
||||||
vf == *(uint32_t *)RTA_DATA(tb_port[IFLA_PORT_VF])) {
|
*/
|
||||||
|
if ((tb_port[IFLA_PORT_VF] &&
|
||||||
|
vf == *(uint32_t *)RTA_DATA(tb_port[IFLA_PORT_VF])) &&
|
||||||
|
(!instanceId ||
|
||||||
|
(tb_port[IFLA_PORT_INSTANCE_UUID] &&
|
||||||
|
!memcmp(instanceId,
|
||||||
|
(unsigned char *)
|
||||||
|
RTA_DATA(tb_port[IFLA_PORT_INSTANCE_UUID]),
|
||||||
|
VIR_UUID_BUFLEN)))) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user