mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: unlink the error report from VIR_STRDUP.
The function to retrieve the file system info using QEMU-GA is using some conditionals to retrieve the info. This is wrong because the error of some conditionals will be raised if VIR_STRDUP return errors and not if some problem occurred with JSON. Signed-off-by: Julio Faracco <jcfaracco@gmail.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
53ed803ddf
commit
792113b8b8
@ -1833,6 +1833,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
|
|||||||
virJSONValuePtr data;
|
virJSONValuePtr data;
|
||||||
virDomainFSInfoPtr *info_ret = NULL;
|
virDomainFSInfoPtr *info_ret = NULL;
|
||||||
virPCIDeviceAddress pci_address;
|
virPCIDeviceAddress pci_address;
|
||||||
|
const char *result = NULL;
|
||||||
|
|
||||||
cmd = qemuAgentMakeCommand("guest-get-fsinfo", NULL);
|
cmd = qemuAgentMakeCommand("guest-get-fsinfo", NULL);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
@ -1878,28 +1879,34 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
|
|||||||
if (VIR_ALLOC(info_ret[i]) < 0)
|
if (VIR_ALLOC(info_ret[i]) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_STRDUP(info_ret[i]->mountpoint,
|
if (!(result = virJSONValueObjectGetString(entry, "mountpoint"))) {
|
||||||
virJSONValueObjectGetString(entry, "mountpoint")) < 0) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("'mountpoint' missing in reply of "
|
_("'mountpoint' missing in reply of "
|
||||||
"guest-get-fsinfo"));
|
"guest-get-fsinfo"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_STRDUP(info_ret[i]->name,
|
if (VIR_STRDUP(info_ret[i]->mountpoint, result) < 0)
|
||||||
virJSONValueObjectGetString(entry, "name")) < 0) {
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(result = virJSONValueObjectGetString(entry, "name"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("'name' missing in reply of guest-get-fsinfo"));
|
_("'name' missing in reply of guest-get-fsinfo"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_STRDUP(info_ret[i]->fstype,
|
if (VIR_STRDUP(info_ret[i]->name, result) < 0)
|
||||||
virJSONValueObjectGetString(entry, "type")) < 0) {
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(result = virJSONValueObjectGetString(entry, "type"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("'type' missing in reply of guest-get-fsinfo"));
|
_("'type' missing in reply of guest-get-fsinfo"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VIR_STRDUP(info_ret[i]->fstype, result) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!(entry = virJSONValueObjectGet(entry, "disk"))) {
|
if (!(entry = virJSONValueObjectGet(entry, "disk"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("'disk' missing in reply of guest-get-fsinfo"));
|
_("'disk' missing in reply of guest-get-fsinfo"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user