mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 22:45:17 +00:00
qemu: use virBuffer in qemuBuildSCSIiSCSIHostdevDrvStr
Instead of source to enable use of virBuffer functions in string construction. Signed-off-by: Anya Harter <aharter@redhat.com>
This commit is contained in:
parent
2d5b332312
commit
6b770f9a3b
@ -4643,7 +4643,8 @@ static char *
|
|||||||
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
char *source = NULL;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
char *netsource = NULL;
|
char *netsource = NULL;
|
||||||
virJSONValuePtr srcprops = NULL;
|
virJSONValuePtr srcprops = NULL;
|
||||||
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
|
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
|
||||||
@ -4656,21 +4657,25 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!(netsource = virQEMUBuildDriveCommandlineFromJSON(srcprops)))
|
if (!(netsource = virQEMUBuildDriveCommandlineFromJSON(srcprops)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (virAsprintf(&source, "%s,if=none,format=raw", netsource) < 0)
|
virBufferAsprintf(&buf, "%s,if=none,format=raw", netsource);
|
||||||
goto cleanup;
|
|
||||||
} else {
|
} else {
|
||||||
/* Rather than pull what we think we want - use the network disk code */
|
/* Rather than pull what we think we want - use the network disk code */
|
||||||
if (!(netsource = qemuBuildNetworkDriveStr(iscsisrc->src, srcPriv ?
|
if (!(netsource = qemuBuildNetworkDriveStr(iscsisrc->src, srcPriv ?
|
||||||
srcPriv->secinfo : NULL)))
|
srcPriv->secinfo : NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (virAsprintf(&source, "file=%s,if=none,format=raw", netsource) < 0)
|
virBufferAsprintf(&buf, "file=%s,if=none,format=raw", netsource);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virBufferCheckError(&buf) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(netsource);
|
VIR_FREE(netsource);
|
||||||
virJSONValueFree(srcprops);
|
virJSONValueFree(srcprops);
|
||||||
return source;
|
virBufferFreeAndReset(&buf);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user