mirror of https://gitee.com/openkylin/libvirt.git
virDomainBlockStats(Flags): Produce saner error message on empty disk path
As of 0bd2ccdec
an empty disk path for virDomainBlockStats (or the one
with Flags) is allowed meaning "get me overall summarized statistics".
However, running 'virsh domblkstat $dom' throws a misleading error:
# ./tools/virsh domblkstat dom
error: Failed to get block stats dom
error: invalid argument: invalid path:
while after this commit
# virsh domblkstat dom
error: Operation not supported: summary statistics are not supported yet
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
8277211300
commit
1df00e2b22
|
@ -9434,6 +9434,12 @@ qemuDomainBlockStats(virDomainPtr dom,
|
|||
virDomainDiskDefPtr disk = NULL;
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
|
||||
if (!*path) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("summary statistics are not supported yet"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -9507,6 +9513,12 @@ qemuDomainBlockStatsFlags(virDomainPtr dom,
|
|||
|
||||
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
|
||||
|
||||
if (!*path) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("summary statistics are not supported yet"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* We don't return strings, and thus trivially support this flag. */
|
||||
flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
|
||||
|
||||
|
|
|
@ -3362,6 +3362,12 @@ static int testDomainBlockStats(virDomainPtr domain,
|
|||
unsigned long long statbase;
|
||||
int ret = -1;
|
||||
|
||||
if (!*path) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("summary statistics are not supported yet"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
testDriverLock(privconn);
|
||||
privdom = virDomainObjListFindByName(privconn->domains,
|
||||
domain->name);
|
||||
|
|
Loading…
Reference in New Issue