Commit Graph

1780 Commits

Author SHA1 Message Date
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
Erik Skultety
4ba03a8e8a virt-admin: Document srv-list command in virt-admin's man page
srv-list command was missing in the man page.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-08 10:58:39 +02:00
Christophe Fergeau
184654117e virsh: Fix *-event error string
When using
virsh net-event non-existing-net
the error message says that 'either --list or event type is required'
This is misleading as 'virsh net-event $valid-event-type' is not going
to work either. What is expected is 'virsh net-event --event
$valid-event-type'

This commit fixes the string in pool-event, nodedev-event, event, and
net-event.
2016-09-08 09:54:12 +02:00
Yanqiu Zhang
ed8ba91ef2 storage: Delete extra wrap after vol-resize error
This patch is to delete the extra wrap "\n" after failed vol-resize
error for both "Failed to change size of volume to" and "Failed to change
size of volume by". For error with wrap, there will be an extra wrap
between two errors, such as:

   (1)# virsh vol-resize --pool default --vol vol-test 5M
        error: Failed to change size of volume 'vol-test' to 5M

        error: invalid argument: Can't shrink capacity below current capacity unless shrink flag explicitly specified

   (2)# virsh vol-resize /var/lib/libvirt/images/volds --shrink --delta 10M
        error: Failed to change size of volume 'volds' by 10M

        error: invalid argument: can't shrink capacity below existing allocation
2016-09-07 11:11:30 -04:00
Erik Skultety
e2c63714a8 virt-admin: Output srv-clients-set data as unsigned int rather than signed
Unfortunately, commit a8962f70 only fixed first half of the reported issue of
virt-admin outputting negative values where unsigned int is expected by
BZ below, so this commit represents the other missing half of the fix.

resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1356769

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-09-07 14:07:18 +02:00
Nishith Shah
cbbaa17faf tools: Pass opaque data in vshCompleter and introduce autoCompleteOpaque
This patch changes the signature of vshCompleters, allowing to pass along
some data that we might want to along with the completers; for example,
we might want to pass the autocomplete vshControl along with the
completer, in case the completer requires a connection to libvirtd.

Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-09-06 17:46:40 +02:00
Andrea Bolognani
fb2025ede9 libvirt-guests.service: Add Requires=libvirtd.service
Having After=libvirtd.service merely ensures that, if both
services are asked to start, libvirtd.service will start
first.

What we really want is for libvirtd.service to be started
whenever libvirt-guests.service is asked to start. Adding a
Requires= relationship guarantees that will happen.
2016-09-06 16:05:20 +02:00
Andrea Bolognani
7fbe9fa575 libvirt-guests.service: Split After= relationship
We use a separate line for each After= relationship in other
unit files: do the same here for consistency's sake, and also
to make future changes nicer to diff
2016-09-06 16:05:20 +02:00
Andrea Bolognani
f4bbbe35f3 libvirt-guests.service: Improve description
libvirt-guests.service does both suspend *and* resume guests,
depending on whether it's being started or stopped: the
description should reflect this, to avoid confusing messages
during startup.

Replace "active" with "running" (to match virsh list's output)
and don't capitalize libvirt.
2016-09-06 16:05:20 +02:00
Nishith Shah
731ee28c5b virsh: Complete multiple options when any one option requires data
Before this patch:
    virsh # start --domain dom1 [TAB][TAB] <- offers filename completion
    virsh # start --domain [TAB][TAB] <- offers filename completion

After this patch:
    virsh # start --domain dom1 [TAB][TAB] <- offers command completion
    virsh # start --domain [TAB][TAB] <- calls domain completer if
    defined, otherwise falls back to filename completion

Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-09-05 14:16:45 +02:00
Nishith Shah
2550579669 virsh: Allow data or argument options to be completed as well
Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-09-05 14:16:45 +02:00
Nishith Shah
dcfdf341ea virsh: Introduce usage of option completers to auto-complete arguments
Call option completers if argument completion is requested using the
corresponding option completer, if it is defined.

Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-09-05 14:16:45 +02:00
Qiaowei Ren
bae660869d perf: add more perf events support
With current perf framework, this patch adds support and documentation
for more perf events, including cache misses, cache references, cpu cycles,
and instructions.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
2016-09-02 17:00:58 -04:00
John Ferlan
6a0e41519c virsh: Rework the perf event names into a table.
Should be easier to read
2016-09-02 17:00:58 -04:00
John Ferlan
29b2f253af virsh: Add a forward reference to perf command from domstats --perf
Keep the details in one place...
2016-09-02 17:00:58 -04:00
Kothapally Madhu Pavan
04597a7038 Make --postcopy flag mandatory with --postcopy-after-precopy
--postcopy-after-precopy is just an aditional flag for
postcopy migration.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2016-09-02 14:42:53 +02:00
Michal Privoznik
8540301b78 tools: Don't list virsh-* under EXTRA_DIST
When we wanted to break huge and unmaintainable virsh into
smaller files first thing we did was to just move funcs into
virsh-.c files and then #include them from virsh. Having it done
this way we also needed to have them listed under EXTRA_DIST.
However, things got changed since then and now all the virsh-*.c
files are proper source files. Therefore they are listed under
virsh_SOURCES too. But for some reason we forgot to remove them
from EXTRA_DIST.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-08-31 12:52:11 +02:00
Kothapally Madhu Pavan
67af358d11 Check for --live flag for postcopy-after-precopy migration
Unlike postcopy migration there is no --live flag check for
postcopy-after-precopy.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2016-08-26 21:38:11 +02:00
Peter Krempa
64f26276bf virsh: vcpuinfo: Report vcpu number from the structure rather than it's position
virVcpuInfo contains the vcpu number that the data refers to. Report
what's returned by the daemon rather than the sequence number as with
sparse vcpu topologies they won't match.
2016-08-26 11:23:00 -04:00
Pino Toscano
4362ff4337 virsh: use vshError consistently after virBufferError checks
If virBufferError() reports an error, then vshError() is needed to
report the error situation instead of a simple vshError().
2016-08-24 17:43:29 +02:00
Pino Toscano
a144f28467 virsh: avoid i18n puzzle
Use the full versions of the message, instead of composing a base
message with what was updated; the change makes the messages properly
translatable, since different parts of a sentence might need different
declensions for example.
2016-08-24 17:43:29 +02:00
Pino Toscano
b620bdee14 virsh: respect -q/--quiet more
Turn various vshPrint() informative messages into vshPrintExtra(), so
they are not printed when requesting the quiet mode; neither XML/info
outputs nor the results of commands are affected.
Also change the expected outputs of the virsh-undefine test, since virsh
is invoked in quiet mode there.

Some informative messages might still be converted (and thus silenced
when in quiet mode), but this is an improvements nonetheless.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1358179
2016-08-24 17:43:29 +02:00
Jovanka Gulicoska
43a6b37b24 Introduce node device update event as top level event
This event is emitted when a nodedev XML definition is updated,
like when cdrom media is changed in a cdrom block device.

Also includes node device update event implementation for udev
backend, virsh nodedev-event support, and event-test support
2016-08-15 08:30:56 -04:00
John Ferlan
18701e9d62 virsh: Fix core for cmdSecretGetValue
https://bugzilla.redhat.com/show_bug.cgi?id=1366611

When commit id 'cb2e3e50' reworked the cmdSecretGetValue call to use
VIR_DISPOSE_STRING for base64, it neglected to initialize the base64
value to NULL since the cleanup: label could be reached prior to the
base64 value being set or not.  This resulted in a core dump, adding
the initialization will avoid the issue.
2016-08-15 07:53:45 -04:00
Erik Skultety
4914494eb8 virt-admin: Fix the error when an invalid URI has been provided
After commit 9d479dd1 fiddled with the cmdConnect's output which used to be a
bit more verbose prior to the mentioned commit, the program flow would result
in a quite confusing error if an invalid URI has been provided:

    error: Failed to connect to the admin server
    Connected to the admin server
    error: <some error>

The problem is that the commit mentioned above relied on the fact that
connect routine always succeeds which is not true.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-08-10 15:24:07 +02:00
Chen Hanxiao
73b647d418 virsh: clarify snapshot --live
In libvirt, snapshot means disk snapshot.
snapshot --live is more like VM checkpoint.
Make it clear in virsh.pod.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-08-10 13:29:54 +02:00
Jovanka Gulicoska
5b8643099a virsh: Introduce nodedev-event command
Add nodedev-event support for node device lifecycle events
2016-08-09 11:05:32 -04:00
Michal Privoznik
7584d992b8 virshConnect: Don't leak polkit agent
In our attempts to reconnect, we may create a polkit daemon.
However, it may happen that we would rewrite the variable that
already holds pointer to the agent.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-08-04 15:32:21 +02:00
John Ferlan
2197ea56d7 conf: Add IOThread quota and period scheduler/cputune defs
https://bugzilla.redhat.com/show_bug.cgi?id=1356937

Add the definitions to allow for viewing/setting cgroup period and quota
limits for IOThreads.

This is similar to the work done for emulator quota and period by
commit ids 'b65dafa' and 'e051c482'.

Being able to view/set the IOThread specific values is related to more
recent changes adding global period (commmit id '4d92d58f') and global
quota (commit id '55ecdae') definitions and qemu support (commit id
'4e17ff79' and 'fbcbd1b2'). With a global setting though, if somehow
the IOThread value in the cgroup hierarchy was set "outside of libvirt"
to a value that is incompatible with the global value.

Allowing control over IOThread specific values provides the capability
to alter the IOThread values as necessary.
2016-08-03 06:36:22 -04:00