Commit Graph

1808 Commits

Author SHA1 Message Date
Erik Skultety
bdd6899b55 tools: Replace vshPrint with vshPrintExtra on places we forgot about
Although there already was an effort (b620bdee) to replace vshPrint occurrences
with vshPrintExtra due to '--quiet' flag, there were still some leftovers. So
this patch fixes them, hopefully for good.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1356881

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-11-14 12:14:11 +01:00
Erik Skultety
53525f914d tools: use vshError rather than vshPrint on failure
There were a few places in our virsh* code where instead of calling vshError
on failure we called vshPrint.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-11-14 12:14:11 +01:00
Erik Skultety
b98b3b742b vsh: Drop conditional error reporting in vshErrorHandler
First, since commit 834c5720 the error reporting within the vshErrorHandler
doesn't work because there was a lot of renaming going on (dull mechanical
renaming without much thinking about it, yep - shame on me) and so the original
env variable VIRSH_DEBUG got renamed to VSH_DEBUG which we don't support nor
document anywhere. Second, by specifying this env variable, the last libvirt
error gets reported twice despite the fact we say the error reporting should be
deferred until the command finishes, and last but not least the vintage code's
logic is a bit 'odd', since the error would get reported iff the env variable
is set, even if the value should be equal to our DEFAULT value in which case it
doesn't make sense that we behave differently when an env variable is set to
some value and when there's no env variable at all but we use the same value
automatically as default.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-11-14 10:18:56 +01:00
Erik Skultety
7b8e1dff1a vsh: Fix the incorrect environment variable prefix in error message
Unlike the other error messages in vshInitDebug, this one relied on a hardcoded
name of a variable instead of using the prefix of the tool calling the init
routine.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1393854

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-11-11 13:44:40 +01:00
Andrea Bolognani
3abb8b6969 wireshark: Don't redefine ws_plugindir
autoconf already defines the variable for us, and prints out
a warning if we try to do it a second time. So let's not :)
2016-11-07 10:16:06 +01:00
Michal Privoznik
ea9d622c0c vshReadlineParse: Remove unused variable
After 06a7b1ff4 the @&opts_need_arg is not used anywhere. Well,
it is set but never read:

vsh.c: In function 'vshReadlineParse':
vsh.c:2658:14: warning: variable 'opts_need_arg' set but not used [-Wunused-but-set-variable]
     uint64_t opts_need_arg, opts_seen;
              ^~~~~~~~~~~~~

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-11-04 10:20:58 +01:00
John Ferlan
06a7b1ff4d vsh: Pass correct values for command line completion
Commit id 'dcfdf341' passes 'opts_need_arg' and 'opts_seen' to
vshCmddefGetData, but that seems to be incorrect as those values
are not initialized properly (something at least one compiler found).
Instead the static 'const_opts_need_arg' and 'const_opts_seen' values
should be passed.

By passing unitialized values leads to not finding possible options
for simpler commands (domfsfreeze for example), where if you're in
a virsh shell using command line completion - you'll get a list of
files in your current directory instead of two options --domain and
--mountpoint (as would happen with this patch applied.
2016-10-28 17:09:46 -04:00
Kothapally Madhu Pavan
011935457a vsh: Using VSH_REQUIRE_OPTION rather than virReportError
Correcting the error reporting method by using VSH_REQUIRE_OPTION
instead of virReportError

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2016-10-28 14:19:41 -04:00
Martin Kletzander
eacecd7437 virsh: Fix on_shutdown to on_poweroff
The 'on_shutdown' was the name in Xen, there was never such option in
libvirt's domain XML.

Reported-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-10-27 08:45:11 +02:00
Andrea Bolognani
3cbf054995 wireshark: Rename plugindir to ws_plugindir
Since we're using autoconf to substitute the right value in
Makefile.am now, we can use a less generic name without running
into circular dependencies.
2016-10-26 17:00:21 +02:00
Andrea Bolognani
c587c73549 wireshark: Inject $(prefix) at the right time
Adding $(prefix) in Makefile.am, as we were doing, means that
it would be prepended even when using --with-ws-plugindir,
which is something we don't want to happen.

Instead, we add it beforehand but take care that it doesn't
get expanded until make is called.
2016-10-26 17:00:21 +02:00
John Ferlan
13022ce430 virsh: Add _length parameters to virsh output
https://bugzilla.redhat.com/show_bug.cgi?id=1349898

Add the duration parameters to the virsh input/output for blkdeviotune
command and describe them in the pod file.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-10-25 17:20:17 -04:00
John Ferlan
49d01f9e3f virsh: Create macros to add IOTUNE values
Rework the repetitive lines to add iotune values into easier to read macros.
One to handle the SCALED values and one to handle the non scaled values.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-10-25 17:20:17 -04:00
Viktor Mihajlovski
c1be22f971 doc: update virsh domstats documentation for vcpu statistics
Added description for new vcpu.<num>.halted statistics value.
While there, also added a description for vcpu.<num>.wait and
clarified the units displayed for time and wait.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-10-24 18:54:25 -04:00
Viktor Mihajlovski
6aa324fbeb doc: Describe the VCPU states returned by virsh vcpuinfo
Added a brief description of the VCPU states.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2016-10-21 11:02:49 -04:00
Michal Privoznik
35e45760ee virt-wireshark.m4: Defer $(prefix) substitution
The autoconf manual says we shouldn't be using this variable (and
some others) outside of Makefiles as it prevents users providing
their own prefix at the installation phase.

https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Installation-Directory-Variables.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-10-21 09:27:33 +08:00
Ivan Baldo
83adcb5bdf virsh: Be explicit that vol-resize is an offline operation.
It is stated in the manual already, so let's mention the same thing in
the description to avoid causing problems.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-10-13 07:57:31 +02:00
Nitesh Konkar
d4a9b21511 virsh: Fix typos in manpage
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2016-10-12 17:55:25 -04:00
Nitesh Konkar
a75259d977 virsh: Fix commas in manpage to enhance readability.
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2016-10-12 17:55:25 -04:00
Peter Krempa
a62655f9c3 virsh: vcpuinfo: Report proper vcpu numbers and data for offline VMs
If the VM is offline virsh attempted to at least report the pinning
information for the VM. This would not work properly now that the vcpus
can be sparse. Fix it by getting the vcpu states from the XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1375920
2016-10-12 17:29:07 +02:00
Peter Krempa
c946a30af2 virsh: Extract fallback handling in cmdVcpuinfo
Put it into a separate function so that more fallback handling can be
added without making a mess.
2016-10-12 17:29:07 +02:00
Peter Krempa
63c56a0651 virsh: Extract cpumap formatting in cmdVcpuinfo
cmdVcpuinfo will be split in upcomming patches thus extract the common
code that formats pinning cpumaps for the vcpus.
2016-10-12 17:29:07 +02:00
Peter Krempa
5e61be54d8 virsh: Fix xpath queries for retrieving vcpu count
The fallback code used if virDomainGetVcpusFlags is not supported used
wrong XPath queries and basically did not work at all. Fix them to point
to the <domain> <vcpu> element instead of <vcpus> which was not present
until lately.
2016-10-12 17:29:07 +02:00
Peter Krempa
be69859255 virsh: domain: Fix broken indentation in virshCPUCountCollect
I managed to space most of the code by 5 spaces instead of 4 when
orignally implementing this function.
2016-10-12 17:29:07 +02:00
Andrea Bolognani
2273bbd457 libvirt-guests: Weaken dependency on libvirtd
The Requires relationship is very strong, in that it prevents
a unit from running unless all the units it Requires are
running as well.

This turns out to be a problem because we want to be able to
restart libvirtd at any time without having libvirt-guests
suspend or shutdown running guests.

Turn the Requires relationship into a Wants relationship:
this way starting libvirt-guests will cause systemd to (attempt
to) start libvirtd as well, but stopping or restarting libvirtd
will not alter libvirt-guests' running state.
2016-10-12 15:45:01 +02:00
John Ferlan
f6a4ccdc83 vsh: Fix some issues in auto completion code
1. Move the declaration of const vshCmdDef *help - it should be at the
   top of the "if" rather than in the middle.

2. Change a comparison from && to || - without doing so we could crash
   on commands like 'virsh list' which would allow completion of some
   non -- option based on whatever was found in the current working
   directory and then as soon as that was completed, the next <tab>
   would crash since "opt" would be returned as NULL, but the check
   was dereferencing "&& opt->type"

3. Before dereferencing opt->completer, be sure opt isn't NULL.
2016-10-10 15:27:45 -04:00
Stefan Bader
cc38d5661f tools: Exclude Xen dom0 from libvirt-guests.sh list
With newer versions of libvirt Domain-0 is again visible in the list of
running guests but it should not be considered as a guest for shutdown
or suspend.

Signed-off-by Stefan Bader <stefan.bader@canonical.com>
2016-10-10 16:52:08 +08:00
Stefan Bader
69722fd7ac tools: Ignore newlines in libvirt-guests.sh guest list
The list file expects all guest UUIDs on the same line as the URI
which the guests run on. This does not happen when the list is
echo'ed in quotes. When stripping the quotes, newlines get transformed
into spaces. Without this, only the first guest on the list is actually
handled.

Based on a fix by Omar Siam <simar@gmx.net>

Bug-Ubuntu: http://bugs.launchpad.net/bugs/1591695

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2016-10-10 16:52:08 +08:00
Chen Hanxiao
599e966efb virsh domdisplay: introduce '--all' for showing all possible graphical displays
For one VM, it could had more than one graphical display.
Such as we coud add both vnc and spice display to a VM.

This patch introduces '--all' for showing all
possible graphical display of a active VM.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2016-10-10 04:21:38 +02:00
John Ferlan
12629888fc docs: Alter descriptions of perf cpu_cycles
https://bugzilla.redhat.com/show_bug.cgi?id=1381714

Alter the descriptions to match what the cpu_cycles actually is
2016-10-07 13:27:16 -04:00
Jiri Denemark
7fe613af57 vsh: Fix warnings in command line completer
GCC complained that

vsh.c: In function 'vshReadlineOptionsGenerator':
vsh.c:2622:29: warning: unused variable 'opt' [-Wunused-variable]
         const vshCmdOptDef *opt = &cmd->opts[list_index];
                             ^
vsh.c: In function 'vshReadlineParse':
vsh.c:2830:44: warning: 'opt' may be used uninitialized in this function
[-Wmaybe-uninitialized]
             completed_list = opt->completer(autoCompleteOpaque,

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-10-05 17:26:47 +02:00
Peter Krempa
0f95f31c83 lib: Introduce VIR_DOMAIN_VCPU_HOTPLUGGABLE for virDomainSetVcpusFlags
For compatibility reasons virDomainSetVcpus needs to add vcpus as non
hotpluggable which means that the users will not be able to unplug it
after the VM has started. Add a flag that will allow to tell the API
that the unpluggable vcpus are okay.
2016-10-05 09:05:52 +02:00
Nehal J Wani
528fe535ac NSS: Add explicit check to not report expired lease
The NSS module shouldn't rely on custom leases database to not have
entries for leases which have expired.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2016-10-05 08:33:00 +02:00
John Ferlan
bcfa2f427d vsh: Write out history on "quit" or "exit" in interactive mode
https://bugzilla.redhat.com/show_bug.cgi?id=1379895

Introduced by commit id '834c5720'.

During the code motion and creation of vsh.c, the function 'vshDeinit()'
in the (new) vsh.c was altered from whence it came in virsh.c such that
calling 'vshReadlineDeinit(ctl)' was conditional on "ctl->imode".

This causes a problem for the interactive running if the "quit" and "exit"
commands are used because 'cmdQuit' will clear ctl->imode, thus when the
interactive loop in main() of virsh.c exits because ctl->mode is clear and
virshDeinit is called which calls vshDeinit, the history file is now not
written. Conversely, if one had exited the interactive loop via pressing
<ctrl>D the file would be created because loop control is broken on EOF
and ctl->imode is not set to false.

This patch will remove the conditional call to vshReadlineDeinit and
restore the former behaviour.
2016-09-29 07:00:28 -04:00
Jim Fehlig
f4332dd2d8 doc: fix note about Xen credit scheduler
Commit 6c504d6a added a note to the virsh man page about the
deprecation of 'cap' and 'weight' settings for the credit
scheduler. To this day, the default scheduler in Xen is credit
and it supports setting 'cap' and 'weight'. Remove the deprecation
notice from the note on the Xen credit scheduler.

Reported-by: Volo M. <vm@vovs.net>
2016-09-28 07:47:07 -06:00
Nitesh Konkar
8fea0ad8e2 Fix various code comment typos
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2016-09-26 08:06:30 -04:00
Jiri Denemark
1bc8484326 cpu: Special case models == NULL in cpuGetModels
Some CPU drivers (such as arm) do not provide list of CPUs libvirt
supports and just pass any CPU model from domain XML directly to QEMU.
Such driver need to return models == NULL and success from cpuGetModels.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Erik Skultety
25205c03f4 virt-admin: Add some command aliases to provide syntax sugar over ugly commands
Make use of the new recently introduced alias handling for virt-admin srv-*
commands.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:17:46 +02:00
Erik Skultety
b9d8cadeaa virt-admin: Tweak command parsing logic so that aliases point to new commands
Change the logic in a way, so that VSH_CMD_FLAG_ALIAS behaves similarly to
how VSH_OT_ALIAS for command options, i.e. there is no need for code duplication
for the alias and the aliased command structures. Along with that change,
switch any existing VSH_CMD_FLAG_ALIAS occurrences to this new format. Also,
since this patch introduces a new command structure element, adjust the
virsh-self-test test to make sure we won't ever miss to specify the '.alias'
member for an aliased command because doing that would lead to an internal
error.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:17:46 +02:00
Erik Skultety
73a2510feb virsh: man: Do not document our old deprecated nodedev-dettach command
The command is deprecated due to being grammatically incorrect, but for
backwards compatibility reasons cannot be removed. However, we should not
document such commands.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:17:40 +02:00
Erik Skultety
45a739038d vsh: discard vshCmddefOptFill and move its body to vshCmddefOptParse
Recent changes extracted the command internals validation routine from
vshCmddefOptParse method which now just calls vshCmddefOptFill. Therefore, make
vshCmddefOptFill the new vshCmddefOptParse and drop the unnecessary name.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:05:32 +02:00
Erik Skultety
3a9808b216 vsh: Extract vshCmddefCheckInternals from vshCmddefOptParse
Originally introduced by commit 2432521e which correctly split
vshCmddefOptParse into command's options validation and options parsing.
However, command's 'internals' are not tied solely to .options, rather it
should be about the overall structure, therefore the validation should be
extracted from vshCmddefOptParse and performed only within our test suite, i.e.
in vshSelfTest.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:05:32 +02:00
Erik Skultety
9b86282ecd vsh: vshCmddefHelp: Drop the unnecessary 'else' branch
If the initial check is true the function immediately returns so there's no
need to enclose the code following the check within an 'else' block.
Also, by removing the 'else' block, the declarations need to be moved to
beginning of the function block to conform with our guidelines.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:05:31 +02:00
Erik Skultety
c91cddb6f7 vsh: vshCmddefHelp: Drop unnecessary variable 'help'
Since it's used on a single place only, it can easily be replaced by the right
side of the original assignment.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:05:31 +02:00
Erik Skultety
ebb402a7c4 vsh: Enforce checking for missing help string
The intention is to move vshCmddefCheckInternals out of vshCmddefOptParse to
our test suite. First step to do that is to enforce checking for an existing
help string (that also means it's non-empty) in a command because a command
without a help is not much of a use.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-20 15:05:31 +02:00
Shivaprasad G Bhat
1ec22be550 virsh: use virConnectGetDomainCapabilities with maxvcpus
virsh maxvcpus --type kvm output is useless on PPC. Also, in
commit e6806d79 we documented not rely on virConnectGetMaxVcpus
output. Fix the  maxvcpus to use virConnectGetDomainCapabilities
now to make it useful. The call is made to use the default emulator
binary and to check for the host machine and arch which is what the
command intends to show anyway.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
2016-09-15 14:24:07 +02:00
Michal Privoznik
4a457adda6 tests: Self test virt-admin
Just like we are running 'virsh self-test' from within our test
suite, we should run 'virt-admin self-test' too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-09-14 13:18:07 +02:00
Michal Privoznik
d920090c72 virsh: Move cmdSelfTest to vsh
This command should be exposed to other shells of ours.
They are gonna need it as soon as we want to test them too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-09-14 13:18:07 +02:00
Nikolay Shirokovskiy
34a6e84748 virsh: add --keep-nvram option to undefine command
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-09-13 09:31:50 +02:00
Erik Skultety
10aec4b046 virt-admin: Fix some English grammar in the manpage
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-08 10:59:43 +02:00