.completer = virshNodeDeviceCapabilityNameCompleter,
.help = N_("capability names, separated by comma")
},
+ {.name = "inactive",
+ .type = VSH_OT_BOOL,
+ .help = N_("list inactive devices")
+ },
+ {.name = "all",
+ .type = VSH_OT_BOOL,
+ .help = N_("list inactive & active devices")
+ },
{.name = NULL}
};
int ncaps = 0;
virshNodeDeviceListPtr list = NULL;
int cap_type = -1;
+ bool inactive = vshCommandOptBool(cmd, "inactive");
+ bool all = vshCommandOptBool(cmd, "all");
ignore_value(vshCommandOptStringQuiet(ctl, cmd, "cap", &cap_str));
if (cap_str) {
- if (tree) {
- vshError(ctl, "%s", _("Options --tree and --cap are incompatible"));
- return false;
- }
if ((ncaps = vshStringToArray(cap_str, &caps)) < 0)
return false;
}
+ if (all && inactive) {
+ vshError(ctl, "%s", _("Option --all is incompatible with --inactive"));
+ return false;
+ }
+
+ if (tree && (cap_str || inactive || all)) {
+ vshError(ctl, "%s", _("Option --tree is incompatible with other options"));
+ return false;
+ }
+
for (i = 0; i < ncaps; i++) {
if ((cap_type = virNodeDevCapTypeFromString(caps[i])) < 0) {
vshError(ctl, "%s", _("Invalid capability type"));
}
}
+ if (inactive || all)
+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE;
+ if (!inactive)
+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE;
+
if (!(list = virshNodeDeviceListCollect(ctl, caps, ncaps, flags))) {
ret = false;
goto cleanup;