diff options
author | Eric Blake <eblake@redhat.com> | 2011-11-22 15:55:30 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-11-23 06:10:30 -0700 |
commit | c725e2dc5add8ed6d59fe9f5eb807d7af39a668a (patch) | |
tree | c588e258333f954497304699ada59975582dbc2a /src/test | |
parent | nwfilter: Initialize virNWFilterAddIpAddrForIfname return variable (diff) | |
download | libvirt-c725e2dc5add8ed6d59fe9f5eb807d7af39a668a.tar.gz libvirt-c725e2dc5add8ed6d59fe9f5eb807d7af39a668a.tar.bz2 libvirt-c725e2dc5add8ed6d59fe9f5eb807d7af39a668a.zip |
blockstats: support lookup by path in blockstats
Commit 89b6284f made it possible to pass either a source name or
the target device to most API demanding a disk designation, but
forgot to update the documentation. It also failed to update
virDomainBlockStats to take both forms. This patch fixes both the
documentation and the remaining function.
Xen continues to use just device shorthand (that is, I did not
implement path lookup there, since xen does not track a domain_conf
to quickly tie a path back to the device shorthand).
* src/libvirt.c (virDomainBlockStats, virDomainBlockStatsFlags)
(virDomainGetBlockInfo, virDomainBlockPeek)
(virDomainBlockJobAbort, virDomainGetBlockJobInfo)
(virDomainBlockJobSetSpeed, virDomainBlockPull): Document
acceptable disk naming conventions.
* src/qemu/qemu_driver.c (qemuDomainBlockStats)
(qemuDomainBlockStatsFlags): Allow lookup by source name.
* src/test/test_driver.c (testDomainBlockStats): Likewise.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_driver.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/test/test_driver.c b/src/test/test_driver.c index e6ff696f6..f365bf440 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2803,7 +2803,7 @@ static int testDomainBlockStats(virDomainPtr domain, virDomainObjPtr privdom; struct timeval tv; unsigned long long statbase; - int i, found = 0, ret = -1; + int ret = -1; testDriverLock(privconn); privdom = virDomainFindByName(&privconn->domains, @@ -2815,14 +2815,7 @@ static int testDomainBlockStats(virDomainPtr domain, goto error; } - for (i = 0 ; i < privdom->def->ndisks ; i++) { - if (STREQ(path, privdom->def->disks[i]->dst)) { - found = 1; - break; - } - } - - if (!found) { + if (virDomainDiskIndexByName(privdom->def, path, false) < 0) { testError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), path); goto error; |