[PATCH 00/14] virsh: Completion improvements and checking tool

Peter Krempa pkrempa at redhat.com
Thu Sep 16 17:10:31 UTC 2021


When inspecting whether https://gitlab.com/libvirt/libvirt/-/issues/9 is
still valid I wrote a tool which outputs command options missing
completers. Now that I had a bit of time with lot of interruptions which
is ideal for going through such a thing  I decided to clean up
the tool and post it along with a few fixes and additions to completers.

After this patchset the following completers are still missing:

$ virsh self-test --completers-missing
attach-disk: source, targetbus, driver, subdriver, cache, io, type, mode, sourcetype, source-protocol, source-host-transport, source-host-socket
attach-interface: type, source, script, model
blockcopy: dest
change-media: source
detach-interface: type
domdisplay: type
domxml-from-native: format
domxml-to-native: format
dump: file
get-user-sshkeys: user
metadata: uri, key
numatune: mode, nodeset
qemu-monitor-event: event
restore: file
save: file
save-image-define: file
save-image-dumpxml: file
save-image-edit: file
screenshot: file
set-user-sshkeys: user
set-user-password: user
cpu-models: arch
domcapabilities: virttype, emulatorbin, arch, machine
hypervisor-cpu-baseline: virttype, emulator, arch, machine
hypervisor-cpu-compare: virttype, emulator, arch, machine
maxvcpus: type
iface-bridge: bridge
iface-unbridge: bridge
net-update: command, section
nodedev-detach: driver
snapshot-create-as: memspec
find-storage-pool-sources-as: type
find-storage-pool-sources: type
pool-create-as: source-path, source-dev, source-name, target, source-format, auth-type, secret-usage, secret-uuid, adapter-name, adapter-wwnn, adapter-wwpn, adapter-parent, adapter-parent-wwnn, adapter-parent-wwpn, adapter-parent-fabric-wwn, source-protocol-ver
pool-define-as: source-path, source-dev, source-name, target, source-format, auth-type, secret-usage, secret-uuid, adapter-name, adapter-wwnn, adapter-wwpn, adapter-parent, adapter-parent-wwnn, adapter-parent-wwpn, adapter-parent-fabric-wwn, source-protocol-ver
vol-create-as: format, backing-vol, backing-vol-format
vol-download: file
vol-wipe: algorithm
cd: dir

The list is not so long any more. Mostly missing completers are for
remote file paths (passed to libvirt or the VM itself), few enums,
guest-agent-based user list and a few which need to be assesed.


Peter Krempa (14):
  virshCheckpointNameCompleter: Sanitize forward declaration use
  virsh-completer*.h: Use modern header style
  virsh: Remove hack using 'VSH_CMD_FLAG_ALIAS' to hide virsh commands
  vshCmddefCheckInternals: Sanitize command alias validation
  vsh: Introduce '--completers-missing' for 'self-test' command
  virsh-snapshot: Use 'virshSnapshotNameCompleter' for '--from' of
    'snapshot-list'
  virsh: Use 'virshStoragePoolNameCompleter' for two options
  vsh: Add completer for '--command' of 'help' command
  virsh: Provide completers for options taking comma separated list of
    disk targets
  virsh: Expand VIRSH_COMMON_OPT_FILE for cases when it's not a local
    file used by virsh
  virsh: completer: Introduce dummy completer for local files
  virsh: Use 'virshCompletePathLocalExisting' for options reading local
    files
  virsh: Introduce virshCompleteEmpty and use it for places where we
    can't suggest anything
  virsh-completer: Provide completer for '--top' and '--base' for
    blockjobs

 tools/virsh-backup.c               |   2 +
 tools/virsh-checkpoint.c           |   3 +
 tools/virsh-completer-checkpoint.h |   7 +-
 tools/virsh-completer-domain.c     | 136 +++++++++++++++++++++++
 tools/virsh-completer-domain.h     | 170 ++++++++++++++++++-----------
 tools/virsh-completer-host.h       |  28 +++--
 tools/virsh-completer-interface.h  |  14 ++-
 tools/virsh-completer-network.h    |  35 +++---
 tools/virsh-completer-nodedev.h    |  21 ++--
 tools/virsh-completer-nwfilter.h   |  14 ++-
 tools/virsh-completer-pool.h       |  21 ++--
 tools/virsh-completer-secret.h     |  14 ++-
 tools/virsh-completer-snapshot.h   |   7 +-
 tools/virsh-completer-volume.h     |  14 ++-
 tools/virsh-completer.c            |  35 ++++++
 tools/virsh-completer.h            |  18 ++-
 tools/virsh-domain.c               |  84 +++++++++++++-
 tools/virsh-network.c              |   1 +
 tools/virsh-pool.c                 |   9 ++
 tools/virsh-secret.c               |   2 +
 tools/virsh-snapshot.c             |   4 +
 tools/virsh-volume.c               |  12 +-
 tools/virsh.c                      |   4 +-
 tools/virsh.h                      |   2 +
 tools/virt-admin.c                 |   3 +-
 tools/vsh.c                        |  66 +++++++++--
 tools/vsh.h                        |  10 +-
 27 files changed, 568 insertions(+), 168 deletions(-)

-- 
2.31.1




More information about the libvir-list mailing list