usertools/hugepages: show usage if no action specified

Previously, the script was doing nothing if no argument was provided.

If neither show, mount/unmount, clear/reserve are specified,
it is assumed that the user does not know how to use the script.
So the usage and an error message are printed.
The exit code will be non-zero.
The user will understand something is wrong,
and can recall the script with the option -h to get more information.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Thomas Monjalon 2022-11-04 12:30:18 +01:00
parent e24b8ad46b
commit b41bd04636
1 changed files with 3 additions and 0 deletions

View File

@ -272,6 +272,9 @@ To a complete setup of with 2 Gigabyte of 1G huge pages:
args.reserve = args.setup
args.mount = True
if not (args.show or args.mount or args.unmount or args.clear or args.reserve):
parser.error("no action specified")
if args.pagesize:
pagesize_kb = get_memsize(args.pagesize)
else: