Widening API change - accept empty path for virDomainBlockStats

And provide domain summary stat in that case, for lxc backend.
Use case is a container inheriting all devices from the host,
e.g. when doing application containerization.
This commit is contained in:
Thorsten Behrens
2014-02-14 18:49:04 +01:00
committed by Michal Privoznik
parent dcc85c603e
commit 0bd2ccdecc
3 changed files with 17 additions and 5 deletions

View File

@@ -888,7 +888,7 @@ static const vshCmdOptDef opts_domblkstat[] = {
},
{.name = "device",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.flags = VSH_OFLAG_EMPTY_OK,
.help = N_("block device")
},
{.name = "human",
@@ -954,9 +954,16 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
/* device argument is optional now. if it's missing, supply empty
string to denote 'all devices'. A NULL device arg would violate
API contract.
*/
if (vshCommandOptStringReq(ctl, cmd, "device", &device) < 0)
goto cleanup;
if (!device)
device = "";
rc = virDomainBlockStatsFlags(dom, device, NULL, &nparams, 0);
/* It might fail when virDomainBlockStatsFlags is not