mirror of https://gitee.com/openkylin/libvirt.git
Fix device destroy return value
* Set return value in error cases * Clarify error message when parent device is not vport capable
This commit is contained in:
parent
a5b7965a29
commit
d3e43bad98
|
@ -1308,7 +1308,7 @@ virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
|
||||||
parent = virNodeDeviceFindByName(devs, parent_name);
|
parent = virNodeDeviceFindByName(devs, parent_name);
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find parent HBA for '%s'"),
|
_("Could not find parent device for '%s'"),
|
||||||
dev_name);
|
dev_name);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1328,7 +1328,7 @@ virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
|
||||||
|
|
||||||
if (cap == NULL) {
|
if (cap == NULL) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Parent HBA %s is not capable "
|
_("Parent device %s is not capable "
|
||||||
"of vport operations"),
|
"of vport operations"),
|
||||||
parent->def->name);
|
parent->def->name);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
|
@ -584,7 +584,7 @@ cleanup:
|
||||||
static int
|
static int
|
||||||
nodeDeviceDestroy(virNodeDevicePtr dev)
|
nodeDeviceDestroy(virNodeDevicePtr dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = -1;
|
||||||
virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData;
|
virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData;
|
||||||
virNodeDeviceObjPtr obj = NULL;
|
virNodeDeviceObjPtr obj = NULL;
|
||||||
char *parent_name = NULL, *wwnn = NULL, *wwpn = NULL;
|
char *parent_name = NULL, *wwnn = NULL, *wwpn = NULL;
|
||||||
|
@ -631,6 +631,7 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
out:
|
out:
|
||||||
if (obj)
|
if (obj)
|
||||||
virNodeDeviceObjUnlock(obj);
|
virNodeDeviceObjUnlock(obj);
|
||||||
|
|
Loading…
Reference in New Issue