Commit Graph

2057 Commits

Author SHA1 Message Date
Martin Kletzander
08e190fdda tools: Tiny clean-ups for two functions in virsh-completer.c
These two functions were duplicating some cleanup paths, so let's just merge
both cleanup and error paths together.  To distinguish whether we need to
clean-up the return value let's keep it in @tmp until the function is successful
in which case we set @ret to the value of @tmp and set @tmp to NULL.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-05-21 15:18:40 +02:00
Roland Schulz
3b90c3c463 Add virshAllocpagesPagesizeCompleter
Returns list of host page sizes from capabilities XML.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
2018-05-21 14:56:19 +02:00
Lin Ma
27e97d5c17 virsh: Add target name completion for block device options
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-17 17:06:11 +02:00
Lin Ma
14dd3b63e9 virsh: Introduce virshDomainDiskTargetCompleter
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-17 17:06:11 +02:00
Lin Ma
78809398df virsh-network: Add network name completion to 'net-uuid' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
c5a9e6a9ac virsh-network: Add macro VIRSH_COMMON_OPT_NETWORK_FULL
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
27631eac7a virsh-network: Add network name completion to 'net-event' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
de97d5600c virsh-network: Create macros for VSH_OT_STRING "network" option
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
a4bbd30400 virsh: Only return active domain names for block* command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
84d660607d virsh: Only return active domain names for 'reset' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
7c07067c1d virsh: Remove 'id' text from help message for 'domrename' command
The inactive domains don't have any ID identifier, So adjust the help
message.

Signed-off-by: Lin Ma <lma@suse.com>
2018-05-17 17:06:11 +02:00
Lin Ma
f33d02c11f virsh: Don't skip the first entry when the typed command share same prefix
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-11 13:13:22 +02:00
John Ferlan
4a3d6ed5ee util: Clean up consumers of virJSONValueArraySize
Rather than have virJSONValueArraySize return a -1 when the input
is not an array and then splat an error message, let's check for
an array before calling and then change the return to be a size_t
instead of ssize_t.

That means using the helper virJSONValueIsArray as well as using a
more generic error message such as "Malformed <something> array".
In some cases we can remove stack variables and when we cannot,
those variables should be size_t not ssize_t. Alter a few references
of if (!value) to be if (value == 0) instead as well.

Some callers can already assume an array is being worked on based
on the previous call, so there's less to do.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-05-10 14:59:15 -04:00
Lin Ma
919bb45b56 virsh: Apply macro for current VSH_OT_ARGV "domain" options
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-10 10:01:15 +02:00
Lin Ma
90396d795a virsh: Create macros for VSH_OT_ARGV "domain" option
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-10 10:01:15 +02:00
Lin Ma
0d1c1a74b7 vshReadlineParse: Ignore vshReadlineOptionsGenerator for VSH_OT_ARGV options
Currently the VSH_OT_ARGV options don't support complete, But some of
VSH_OT_ARGV options are gonna support complete in upcoming patches.

Once applied the upcoming completion patches for VSH_OT_ARGV options, If
we don't ignore VSH_OT_ARGV here, The vshReadlineOptionsGenerator will
be called, Hence complete output will consist of the result by command
completer + the result by option completer, It's confusing.
e.g.
    $ virsh domstats --domain <TAB><TAB>
    --backing     --interface      --list-paused      --perf      --vcpu
    --balloon     leap42.3         --list-persistent  --raw       win10
    --block       --list-active    --list-running     sles12sp3
    --cpu-total   --list-inactive  --list-shutoff     sles15
    --enforce     --list-other     --list-transient   --state

After this patch and the upcoming completion patches:
    $ virsh domstats --domain <TAB><TAB>
    leap42.3    sles12sp3    sles15    win10

Signed-off-by: Lin Ma <lma@suse.com>
2018-05-10 10:01:15 +02:00
Lin Ma
ee6113aaea vshReadlineOptionsGenerator: Add already provided VSH_OT_ARGV options to list
It's helpful for users while they type certain kind of VSH_OT_ARGV options.
e.g.

$ virsh domstats --domain sles12sp3 --d<TAB>

Signed-off-by: Lin Ma <lma@suse.com>
2018-05-10 10:01:15 +02:00
Lin Ma
d86531daf2 virsh: Apply macro for current VSH_OT_STRING "domain" options
These VSH_OT_STRING "domain" options support domain name completion now.

Signed-off-by: Lin Ma <lma@suse.com>
2018-05-10 09:21:13 +02:00
Lin Ma
4be3b50dcc virsh: Create macros for VSH_OT_STRING "domain" option
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-10 09:21:04 +02:00
Lin Ma
55948988e8 virsh: Conditionally Ignore the first entry in list of completions
The first entry in the returned array is the substitution for TEXT. It
causes unnecessary output if other commands or options share the same
prefix, e.g.

$ virsh des<TAB><TAB>
des      desc     destroy

or

$ virsh domblklist --d<TAB><TAB>
--d        --details  --domain

This patch fixes the above issue.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-10 09:05:46 +02:00
Lin Ma
f3097dc8b6 virsh: Add domain name completion to 'migrate-postcopy' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-10 07:51:50 +02:00
Lin Ma
8379895227 virsh: Move the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h
centralize the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h
to avoid unnecessary duplicated definition

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-10 07:51:37 +02:00
Lin Ma
fea03bd31d virsh: Simplify control flow for 'qemu-agent-command' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-04 12:46:22 +02:00
Lin Ma
b9e3c8c5c0 virsh: Simplify control flow for 'desc' command
Just like the commit 8941c800, It does the similar thing.

Signed-off-by: Lin Ma <lma@suse.com>
2018-05-04 12:46:22 +02:00
Lin Ma
2273e408d9 virsh: Error out while domain not found for 'event' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-04 12:46:22 +02:00
Lin Ma
b925e6625c virsh: Error out while domain not found for 'qemu-monitor-event' command
Signed-off-by: Lin Ma <lma@suse.com>
2018-05-04 12:46:22 +02:00
Daniel P. Berrangé
078c80b6e7 virsh: remove left over print statement wrt Xen driver
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-24 16:59:21 +01:00
Christian Ehrhardt
cce57265c4 tools: do not report unknown guests in print_guests_shutdown
If another event in background while running libvirt-guests.sh
completely undefines a guest it will no more be available for proper
reporting of its shutdown.

This appears in the log as:
  Failed to determint state of guest: <UUID>. Not tracking it anymore
  Shutdown of guest  complete

The first message already reports that we are giving up on the guest
(per UUID which is all we have left at that point). To avoid the message
with an empty guest_name in such a case lets check what guest_name
returned and only print a report on valid content.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Dariusz Gadomski <dariusz.gadomski@canonical.com>
2018-04-24 10:46:41 +02:00
Christian Ehrhardt
08bb5eeba7 tools: fix check_guests_shutdown loop
The recent fix to libvirt-guests.sh.in works for what it intended to fix
(variable scope) but failed to adapt the loop in check_guests_shutdown
correctly. Due to that it currently might detect all guests as "Failed to
determine state of guest" by bad var content or just assumes they are shut
down by picking up an empty variable.

This commit fixes loop to use the passed value and the call in the loop
to actually use the variable assigned in the iterated.

Fixes: 7e476356 "tools: fix variable scope in in check_guests_shutdown"
Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1764668

Reviewed-by: Dariusz Gadomski <dariusz.gadomski@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-24 10:43:42 +02:00
Daniel P. Berrangé
c0a8ea450d po: provide custom make rules for po file management
Historically we have relied on autopoint/gettextize to install a
standard po/Makefile.in.in. There is very limited scope for customizing
this and it also causes a bunch of extra stuff to be pulled into
configure.ac which potentially clashes with gnulib. Writing make rules
for po file management is no more difficult than any other rules libvirt
has, so stop using autopoint/gettextize.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-19 10:35:58 +01:00
John Ferlan
0d6e834103 virsh: Clear vsh last error during virshCommandOptVolBy
https://bugzilla.redhat.com/show_bug.cgi?id=1529256

If one of the virStorageVolLookupBy{Key|Name|Path} succeeds and
we have a @vol, then clear the last libvirt error; otherwise, a
subsequent "other" failure may cause vshReportError to erroneously
report the wrong error as well as a reported 'vshError' error that
caused the failure.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-04-17 11:19:13 -04:00
Daniel P. Berrangé
a2fd657b86 lxc: allow use of lxc:///system URI as preferred format
Historically we have used a bare lxc:/// URI for connecting to LXC. This
is different from our practice with QEMU, UML, Parallels, Libxl, BHyve
and VirtualBox drivers, which all use a path of '/system' or '/session'
or both.

By making LXC allow '/system', we have fully standardized on the use of
either '/system' or '/session' for all the stateful drivers that run
inside libvirtd.

Support for lxc:/// is of course maintained for back-compat.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-12 16:52:01 +01:00
Daniel P. Berrangé
a8ea89d258 xen: encourage use of xen:///system URI as preferred format
Historically we have used a bare xen:/// URI for connecting to the
legacy Xen driver. The new libxl Xen driver follows the new practice
of allowing '/system' as a path, as well as bare '/' for compat with
the old Xen driver.

This documents xen:///system as the preferred format for Xen, leaving
xen:/// as an undocumented feature just for back-compat.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-12 16:52:01 +01:00
Chen Hanxiao
c595fc788e virsh: add missing help info of --source to domifaddr
commit b4b5c82ce forgot to add this.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2018-03-29 13:29:49 -04:00
Christian Ehrhardt
7e476356c2 tools: fix variable scope in in check_guests_shutdown
libvirt-guests.sh when run with more active guests than requested to
shut down in parallel will run until it times out only shutting down
the first set of guests.

This patch fixes parallel shutdown by fixing a variable scope issue
where check_guests_shutdown unintentionally reset $guests which
prevented further progress.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1688508

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2018-03-19 13:06:03 +01:00
John Ferlan
ddbee9f82a tools: Clean up the vol-resize man page
Instead of appearing as one long paragraph, split the output to list
each command option on its own line for better readability.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:42 -04:00
John Ferlan
464f6ee3ff virsh: Fix man page argument ordering for vol-{path|name|key} commands
The proper command order is 'virsh vol-path volume pool', or
'virsh vol-name volume pool', or 'virsh vol-key volume'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:41 -04:00
John Ferlan
031ef3d8b0 virsh: Clean up man page formatting for vol-list and vol-pool
Make the output more readable.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:40 -04:00
John Ferlan
216efc893f virsh: Fix man page argument ordering for vol-info command
The proper command order is 'virsh vol-info volume pool'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:39 -04:00
John Ferlan
e3836b349c virsh: Fix man page argument ordering for vol-dumpxml command
The proper command order is 'virsh vol-dumpxml volume pool'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:38 -04:00
John Ferlan
442f8b44c2 virsh: Fix man page argument ordering for vol-wipe command
The proper command order is 'virsh vol-wipe volume pool algorithm'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:37 -04:00
John Ferlan
3bf2f7607c virsh: Fix man page argument ordering for vol-download command
The proper command order is 'virsh vol-download volume file pool'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:35 -04:00
John Ferlan
924c70552f virsh: Fix man page argument ordering for vol-upload command
The proper command order is 'virsh vol-upload volume file pool'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:34 -04:00
John Ferlan
3183f5ad30 virsh: Fix man page argument ordering for vol-delete command
The proper command order is 'virsh vol-delete volume pool'. While
making the modification clean up the description a bit too in order
to help clarify under what circumstances the volume could be found
if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:33 -04:00
John Ferlan
4e98d2bb79 virsh: Fix man page argument ordering for vol-clone command
The proper command order is 'virsh vol-clone source-vol target-vol pool'.
While making the modification clean up the description a bit too in
order to help clarify under what circumstances the source-vol could be
found if the pool name was not provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:32 -04:00
John Ferlan
f0b806e0de virsh: Clean up formatting of the vol-create* commands
Clean up the formatting to make the output a bit more readable at
least with respect to not having one paragraph of output. Each
option will start on its own line.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-15 17:11:30 -04:00
Chen Hanxiao
b4b5c82ce8 virsh: add --source arp to domifaddr
We can use:
  domifaddr f26-cloud --source arp
to get the address.

Acked-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2018-03-15 11:22:42 +01:00
Andrea Bolognani
ea9b0e580a keycodemapdb: Update submodule
This time around it's not enough to just pick the latest commit,
because with aed87bb2aa6ed83b49574eb982e3bdd4c36acf17 keycodemapdb
renamed the 'rfb' keycode to 'qnum' and we need to accept the new
name while maintaining backwards compatibility.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-12 16:30:49 +01:00
John Ferlan
d45bee449c tools: Add support for additional adapter parent options
Add the ability to provide the adapter parent_wwnn and parent_wwpn
or the parent_fabric_wwn on the virsh command line for the pool
define/create as commands.  Update the virsh.pod description.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-12 09:00:37 -04:00
John Ferlan
8d2247dfd1 tools: Update the help description of the adapter-parent field
One short sentence won't do it justice, but it could help by listing
scsi_hostN and vHBA to point one in the right direction.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-03-12 09:00:32 -04:00