mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
virscsi: hostdev SCSI AdapterId retrieval fix
Fixed the retrieval of the AdapterId from the AdapterName of the hostdev source so it does return an error instead of leaving the adapter_id uninitialized. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
parent
0c500a4f2e
commit
11d9dd7ba0
@ -88,17 +88,14 @@ static int
|
||||
virSCSIDeviceGetAdapterId(const char *adapter,
|
||||
unsigned int *adapter_id)
|
||||
{
|
||||
if (STRPREFIX(adapter, "scsi_host")) {
|
||||
if (virStrToLong_ui(adapter + strlen("scsi_host"),
|
||||
NULL, 0, adapter_id) < 0) {
|
||||
if (STRPREFIX(adapter, "scsi_host") &&
|
||||
virStrToLong_ui(adapter + strlen("scsi_host"),
|
||||
NULL, 0, adapter_id) == 0)
|
||||
return 0;
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Cannot parse adapter '%s'"), adapter);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
virSCSIDeviceGetSgName(const char *adapter,
|
||||
|
Loading…
Reference in New Issue
Block a user