mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
qemuDomainGetGuestInfo: Suppress non-fatal errors
Don't report cases when the guest information is not requested explicitly and not present either. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c3a7f46fe3
commit
be01dbdb76
@ -22985,6 +22985,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
|
|||||||
int maxparams = 0;
|
int maxparams = 0;
|
||||||
g_autofree char *hostname = NULL;
|
g_autofree char *hostname = NULL;
|
||||||
unsigned int supportedTypes;
|
unsigned int supportedTypes;
|
||||||
|
bool report_unsupported = types != 0;
|
||||||
int rc;
|
int rc;
|
||||||
size_t nfs = 0;
|
size_t nfs = 0;
|
||||||
qemuAgentFSInfoPtr *agentfsinfo = NULL;
|
qemuAgentFSInfoPtr *agentfsinfo = NULL;
|
||||||
@ -23015,37 +23016,31 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
|
|||||||
* categories were explicitly requested (i.e. 'types' is 0), ignore
|
* categories were explicitly requested (i.e. 'types' is 0), ignore
|
||||||
* 'unsupported' errors and gather as much information as we can. In all
|
* 'unsupported' errors and gather as much information as we can. In all
|
||||||
* other cases, abort on error. */
|
* other cases, abort on error. */
|
||||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_USERS) {
|
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_USERS &&
|
||||||
rc = qemuAgentGetUsers(agent, params, nparams, &maxparams, true);
|
qemuAgentGetUsers(agent, params, nparams, &maxparams, report_unsupported) == -1)
|
||||||
if (rc < 0 && !(rc == -2 && types == 0))
|
|
||||||
goto exitagent;
|
goto exitagent;
|
||||||
}
|
|
||||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_OS) {
|
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_OS &&
|
||||||
rc = qemuAgentGetOSInfo(agent, params, nparams, &maxparams, true);
|
qemuAgentGetOSInfo(agent, params, nparams, &maxparams, report_unsupported) == -1)
|
||||||
if (rc < 0 && !(rc == -2 && types == 0))
|
|
||||||
goto exitagent;
|
goto exitagent;
|
||||||
}
|
|
||||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_TIMEZONE) {
|
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_TIMEZONE &&
|
||||||
rc = qemuAgentGetTimezone(agent, params, nparams, &maxparams, true);
|
qemuAgentGetTimezone(agent, params, nparams, &maxparams, report_unsupported) == -1)
|
||||||
if (rc < 0 && !(rc == -2 && types == 0))
|
|
||||||
goto exitagent;
|
goto exitagent;
|
||||||
}
|
|
||||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_HOSTNAME) {
|
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_HOSTNAME &&
|
||||||
rc = qemuAgentGetHostname(agent, &hostname, true);
|
qemuAgentGetHostname(agent, &hostname, report_unsupported) == -1)
|
||||||
if (rc < 0 && !(rc == -2 && types == 0))
|
|
||||||
goto exitagent;
|
goto exitagent;
|
||||||
}
|
|
||||||
|
|
||||||
if (hostname &&
|
if (hostname &&
|
||||||
virTypedParamsAddString(params, nparams, &maxparams, "hostname", hostname) < 0)
|
virTypedParamsAddString(params, nparams, &maxparams, "hostname", hostname) < 0)
|
||||||
goto exitagent;
|
goto exitagent;
|
||||||
|
|
||||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_FILESYSTEM) {
|
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_FILESYSTEM) {
|
||||||
rc = qemuAgentGetFSInfo(agent, &agentfsinfo, true);
|
rc = qemuAgentGetFSInfo(agent, &agentfsinfo, report_unsupported);
|
||||||
if (rc < 0) {
|
if (rc == -1) {
|
||||||
if (!(rc == -2 && types == 0))
|
|
||||||
goto exitagent;
|
goto exitagent;
|
||||||
} else {
|
} else if (rc >= 0) {
|
||||||
nfs = rc;
|
nfs = rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user