fix regression of cmdline.py

 * Fix regression: remove default value of member_id, member_count and
   member_type which make other command failed as extra option found.
   Example:
   ====
   lsmcli --create-access-group=gris_test --id=0000000000000099 --type=WWPN
   --system "CLARiiON+APM00114104374"
   lsmcli: error: expected options = (id,type,system) actual =
   (id,member_ids,system,type)
   ====

Signed-off-by: Gris Ge <fge@redhat.com>
smis.py: filter the output of access_groups_granted_to_volume()

 * Filter out those CIM_SCSIProtocolController who is not initiator access
   group.
 * Restricting CIM query byt ResultClass='CIM_SCSIProtocolController'.

Signed-off-by: Gris Ge <fge@redhat.com>
Make "list" cmd use _c()

For consistency with other commands.

Signed-off-by: Andy Grover <agrover@redhat.com>
Start conversion to ArgParser

Use ArgumentParser instead of OptionParser. Their usage is rather similar,
but fix up issues like changing add_option to add_argument, and
add_argument_group instead of OptionGroup.

Signed-off-by: Andy Grover <agrover@redhat.com>
Metavar not used for store_true

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix up ArgumentParser instantiation for version handling

Argparse treats version like an argument instead of a parameter to the
object, but then we set version= in the new argument.

Signed-off-by: Andy Grover <agrover@redhat.com>
Cmdline.cli() returns a single object, not two, now

Replace all usages of self.options with self.args.

Remove the one prior usage of self.args, (check for extras),
not longer applicable.

Signed-off-by: Andy Grover <agrover@redhat.com>
Fixup plugin-info argument

It's a command, so it should store instead of store_true

Set a metavar.

Signed-off-by: Andy Grover <agrover@redhat.com>
ArgParser doesn't need usage set

It generates the usage line from the parser's data.

Signed-off-by: Andy Grover <agrover@redhat.com>
Improve readability of -b's help text

Sounds like another sentence, so make it one?

Signed-off-by: Andy Grover <agrover@redhat.com>
Use Argparse subcommands for commands

Put all info on commands into a "cmds" data structure, and then use that
to register subcommands for everything.

Set self.func to the function we should call based upon the convention
that the method is named the same as the command, but perhaps with '_'s
instead of '-'s. This required some methods to be renamed to match.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove stuff we don't need any more

All command args are now associated with their applicable subcommand.

_cmds, and _validate should no longer be needed to validate input.

Signed-off-by: Andy Grover <agrover@redhat.com>
Change stuff to use new parsing and method calling style

All functions associated with subcommands take (self, args).
Instead of these functions looking at self.cmd_value and self.args,
all arguments are in args parameter.

cli() is made into a member method.

Signed-off-by: Andy Grover <agrover@redhat.com>
Make _get_item throw an ArgError if id not found

Since every caller was checking the return value and then throwing the
exception if None, we can just throw from _get_item and save some code.

We also add a friendly_name parameter so we can have a customized exception
message.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove documentation of what "self" param is

I think it's so common that it's fair to not devote documentation to it.

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix up replicate_volume_range

Clarified some logic that might be confusing. Raise an exception if
argument counts don't match. Flag arguments as 'append'.

Signed-off-by: Andy Grover <agrover@redhat.com>
Customize --help output

Unless we give add_subparser a metavar, it uses a concatenation of all
subcommands, which is not attractive. Other parameters don't seem to be
needed so remove them, and put the description for the main parser
in the instantiation instead of afterwards.

Signed-off-by: Andy Grover <agrover@redhat.com>
Allow both upper and lowercase for types

Because we're on Unix and should allow lowercase if possible.

Improve the command list walking to pass kwargs more easily.

Signed-off-by: Andy Grover <agrover@redhat.com>