Commit Graph

1671 Commits

Author SHA1 Message Date
Pavel Hrdina
b1f6792cb6 virsh-domain: fix memory leak in cmdDomDisplay
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 09:14:32 +02:00
Michal Privoznik
5ec2b0cca5 virsh-network: Avoid possible NULL deref in cmdNetworkDHCPLeases
Problem is, localtime_r() returns a pointer to converted time or
NULL in case of an error. But checking the glibc sources, error
will occur iff a NULL has been passed as an either of arguments
the function takes. But GCC fails to see that:

../../tools/virsh-network.c: In function 'cmdNetworkDHCPLeases':
../../tools/virsh-network.c:1370:12: error: potential null pointer dereference [-Werror=null-dereference]
         ts = *localtime_r(&expirytime_tmp, &ts);
         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-08 15:56:08 +02:00
Pavel Hrdina
4ddde38e2d virsh: domdisplay: if listen is 0.0.0.0 or [::] print address from URI
Currently if a guest has listen address 0.0.0.0 or [::] and you run
"virsh domdisplay $domain" you always get "spice://localhost:$port".

We want to print better address if someone is connected from a different
computer using "virsh -c qemu+ssh://some.host/system".  This patch fixes the
behavior of virsh to print in this case "spice://some.host:$port".

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-08 13:54:25 +02:00
Erik Skultety
90d506e3e5 virt-admin: Introduce commands srv-clients-info and srv-clients-set
Finally wire-up virAdmServer{Get,Set}ClientLimits APIs into virt-admin client.
Update the virt-admin's man page accordingly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-05-19 12:31:53 +02:00
Peter Krempa
cb2e3e50ee util: string: Introduce virStringEncodeBase64
Add a new helper that sanitizes error semantics of base64_encode_alloc.
2016-05-16 12:58:48 +02:00
Erik Skultety
898c0bbea7 headers: Remove unnecessary keyword extern from function declaration
Usage of this keyword in front of function declaration that is exported via a
header file is unnecessary, since internally, this has been the default for most
compilers for quite some time.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-05-11 09:06:32 +02:00
Erik Skultety
90b4babeb7 virt-admin: Introduce client-disconnect command
Enable the client disconnect within virt-admin. Also, update the man page
accordingly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-05-10 16:05:17 +02:00
Nishith Shah
161713436e virsh: blkdeviotune: accept human readable values for bytes
https://bugzilla.redhat.com/show_bug.cgi?id=885380

Use vshCommandOptScaledInt instead of vshCommandOptULongLong so that
values with suffixes can be passed when bytes are being passed along.
Values for the iops parameters still need to be given in the absolute
form as they are not bytes but numbers.

Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-05-09 07:48:08 +02:00
Nitesh Konkar
aaf3ebf760 virsh: Pass the correct live/config xml to virshDomainDetachInterface.
cmdDetachInterface function checks for live config
flags and then passes the live/config domain xml
to virshDomainDetachInterface accordingly.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2016-05-04 11:33:22 -04:00
Nitesh Konkar
6289cebf40 virsh: Introduce virshDomainDetachInterface function
virshDomainDetachInterface handles virsh interface
detach from the specified live/config domain xml.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2016-05-04 11:30:46 -04:00
Bjoern Walk
71714e8549 tools: virt-host-validate: HW virt support on s390
Extend the detection of hardware virtualization to the s390 platform.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Bjoern Walk
efc23df251 tools: virt-host-validate: improve error handling
When virHostValidateCPUFlag returns NULL, that's more an unexpected
error than the sign of missing CPU flags. Let's react to this
appropriately.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Bjoern Walk
6391012852 tools: virt-host-validate: fix CPU flag detection
Let's fix CPU flag detection on s390, where the flags line begins with
a lower-case 'features'.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Bjoern Walk
45c2dcfb91 tools: virt-host-validate: fix missing translation marker
Fix a minor typo.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Peter Krempa
f4bdf2e3ab virsh: volume: Add --bytes to 'vol-info' 2016-05-04 10:03:04 +02:00
Erik Skultety
9662315df0 virt-admin: Introduce command client-info
Wire-up the client identity getter into virt-admin tool. This patch adjusts
man-page accordingly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-05-03 15:52:50 +02:00
Erik Skultety
de7703917d virt-admin: Introduce srv-clients-list command
Wire-up the public client listing API. Along with this change, a private time
simple conversion method to interpret client's timestamp obtained from server
has been added as well. Format used to for time output is as follows:
YYYY-mm-DD HH:MM:SS+ZZZZ.

Although libvirt exposes methods time-related methods through virtime.h
internally, it utilizes millisecond precision which we don't need in this case,
especially when connection timestamps use precision to seconds only.
This is just a convenience int to string conversion method.

To reflect the new API, man page has been adjusted accordingly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-05-03 10:04:54 +02:00
Martin Kletzander
0c56d94318 tools: Fix connect command
The man page says: "(Re)-Connect to the hypervisor. When the shell is
first started, this is automatically run with the URI parameter
requested by the "-c" option on the command line."  However, if you run:

  virsh -c 'test://default' 'connect; uri'

the output will not be 'test://default'.  That's because the 'connect'
command does not care about any virsh-only related settings and if it is
run without parameters, it connects with @uri == NULL.  Not only that
doesn't comply to what the man page describes, but it also doesn't make
sense.  It also means you aren't able to reconnect to whatever you are
connected currently.

So let's fix that in both virsh and virt-admin add a test case for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-05-02 07:18:25 +02:00
Yuri Chornoivan
50fc4b4bdd Fix minor typos in messages
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2016-04-30 15:37:31 +02:00
Nikolay Shirokovskiy
4d28d0931f virsh: Fix support for 64 migration options
Add ULL suffix to all related operands of << or shift will give
all zeros instead of correct mask.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-28 20:16:41 +02:00
Michal Privoznik
90bf5f5cb2 tools: Introduce install-nss targets
We do have something similar for installing init system files.
Basically I'm trying to avoid the following warning produced by
automake:

tools/Makefile.am:429: warning: uninstall-local was already defined in condition TRUE, which includes condition WITH_BSD_NSS ...
tools/Makefile.am:292: ... 'uninstall-local' previously defined here

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-04-25 18:56:48 +02:00
Andrea Bolognani
9538ecd52e man: Fix links
Use L<> instead of C<> for URLs and man pages.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
92b2c047d6 man: Fix SYNOPSIS section
Format the text properly.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
acd58c48c4 man: Fix NAME section
podchecker(1) complained about these, eg.

  *** WARNING: Verbatim paragraph in NAME section at line 3 in
               file tools/virt-host-validate.pod
2016-04-25 15:40:44 +02:00
Andrea Bolognani
6e742c7f18 build: Always ship virt-login-shell.conf
No need to special-case this one: we can add it to EXTRA_DIST so
that it will be shipped in any case, and if WITH_LOGIN_SHELL
happens to be enabled we mark it for installation as well.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
49ba028aed build: Replace variables in man pages
We can't use eg. @sysconfdir@ directly in the .pod file, because
pod2man(1) will interpret that as a variable name and format it
accordingly.

Instead, we use eg. SYSCONFDIR and use a subsequent sed(1) call
to turn it into the expected @sysconfdir@.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
f806febbdf build: Ensure intermediate files are cleaned up properly
All $(MANINFILES) should be deleted on distclean.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
7351f7fe68 build: Group files
Define $(PODFILES) and $(MANINFILES) so that adding a new man
page only requires changes in a few, well defined spots.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
378338ba28 build: Never ship man pages
The generated man pages may contain information that depend on
the build configuration, so they should not be shipped but
rather always built on the user's machine.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
5b479f3b5b build: Standardize on .pod -> .x.in -> .x
After this commit, all man pages are generated using the same two
steps:

  1. Process a source $command.pod file with pod2man(1) to obtain
     a valid man page in $command.$section.in

  2. Process $command.$section.in with sed(1) to obtain the final
     man page in $command.$section
2016-04-25 15:40:44 +02:00
Andrea Bolognani
9b77ce63f1 build: Perform post-processing on all man pages
Man pages in daemon/ and src/ are being already subjected to this
post-processing step: make it so those in tools/ are as well.
2016-04-25 15:40:44 +02:00
Andrea Bolognani
90709d8d22 build: Build man pages in $(builddir)
No file should be created inside $(srcdir) during build.
2016-04-25 15:40:43 +02:00
Andrea Bolognani
94bf7e5d84 build: Extract pod from source files
Instead of embedding the pod information inside the respective
source files, store them in separate files.

This allows us to reduce the number of custom build rules as
most of the information can be inferred for the file name;
moreover, text editors are more likely to use proper syntax
highlighting for standalone pod files.
2016-04-25 15:40:43 +02:00
Andrea Bolognani
2d1269605c build: Ship virt-admin.pod
This is the source file for the virt-admin(1) manual page, so
it should be shipped.
2016-04-25 15:40:43 +02:00
Peter Krempa
3a703b8120 virsh: host: Use bitmap size in bytes rather than bit count
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329819
2016-04-25 13:27:16 +02:00
Andrea Bolognani
d0062fb9b5 dist: ln(1) is not guaranteed to have a '-f' option
According to the autoconf manual, using '$(LN_S) -f' is not
portable; remove the target explicitly beforehand to work around
this limitation.

Adjust some slightly awkward indentation while at it.
2016-04-21 15:36:14 +02:00
Cole Robinson
a02a859be4 virsh: Don't clear old connection if 'connect $uri' fails
virsh # list --all
     Id    Name                           State
    ----------------------------------------------------
     1     test                           running

    virsh # connect frob
    error: Failed to connect to the hypervisor
    error: no connection driver available for frob

    virsh # list --all
    error: failed to connect to the hypervisor
    error: no valid connection
    error: no connection driver available for frob

Seems sensible IMO to just not clear out the old connection state
until the new virConnectOpen succeeds.

https://bugzilla.redhat.com/show_bug.cgi?id=829160
2016-04-21 09:29:20 -04:00
Roman Bogorodskiy
384dde557b virsh: re-fix help printing without connection
Re-do 0217089 so it does not add regression for commit c0726e0 that allowed to
print help without making a connection to the daemon.
2016-04-21 13:28:57 +03:00
Andrea Bolognani
ed5c929777 build: Use $(LN_S) safely
The autoconf documentation recommends to always use this
construct when creating symbolic links with $(LN_S) to avoid
unexpected behavior.
2016-04-21 10:02:36 +02:00
Andrea Bolognani
ce8379eedc build: Overwrite existing symbolic links
The current rule fails if the target already exists:

  cd /home/jenkins/build/libvirt/lib && \
    ln -s libnss_libvirt.so.1 nss_libvirt.so.1
  ln: nss_libvirt.so.1: File exists
  Makefile:3357: recipe for target 'install-exec-hook' failed

However, all other rules concerned with installation are
idempotent and will happily overwrite an existing target,
so this one should as well.
2016-04-21 10:02:36 +02:00
Peter Krempa
b4bc800cfc virsh: perf: Remove unnecessary 'error' label
The only place that uses it doesn't warrant a separate label.
2016-04-21 09:57:02 +02:00
Peter Krempa
f4f916a9e3 virsh: perf: Don't leak domain
After failing to parse the perf event list, the code would return
failure without freeing the previously acquired object. Rearrange the
code to avoid the problem.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329046
2016-04-21 09:57:02 +02:00
Roman Bogorodskiy
0217089b89 virsh: don't override connection URI from argv
Currently, if a connection URI was specified on the command line by the
'-c' switch, virsh connects to it, but after connecting overrides its
value with the one it tries to obtain from the VIRSH_DEFAULT_CONNECT_URI
environment variable.

This makes virsh connecting to the wrong URI if it disconnects from the
hypervisor and then tries to reconnect, and also leaks the original connname.

Fix by calling virGetEnvBlockSUID() before virshParseArgv().
2016-04-21 09:37:48 +03:00
Michal Privoznik
2f3c89fbbb nss: Try harder to uninstall
On BSD we are creating this symlink to libnss_libvirt.so called
nss_libvirt.so. That's just the way it is on BSD. However, when
uninstalling, we try to remove libnss_libvirt.so instead of the
symlink. Moreover, if file we are trying to remove does not exist
we error out instead of ignoring the error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-04-20 17:33:48 +02:00
Cole Robinson
2f1dc3de46 man: Clarify virsh vol-clone works within a single pool
virsh vol-clone is expected to clone a volume within a single
pool; it doesn't work for cloning across pools. Clarify the docs

https://bugzilla.redhat.com/show_bug.cgi?id=1103714
2016-04-20 08:55:31 -04:00
Erik Skultety
510991b65a virt-admin: Introduce srv-threadpool-info and srv-threadpool-set commands
Wire up the server threadpool tunable APIs to virt-admin client. Also, provide
a man page for both commands.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-04-18 17:08:11 +02:00
John Ferlan
cb31d618fd tools: Fix memory leak
Coverity found that commit id 'c661b675f' needed to create a cleanup
path to handle the closing of 'fp' if the virBitmapNewQuiet failed.
2016-04-16 08:04:14 -04:00
Olga Krishtal
ee36975597 storage: add ploop volume type
Ploop image consists of directory with two files: ploop image itself,
called root.hds and DiskDescriptor.xml that contains information about
ploop device: https://openvz.org/Ploop/format.
Such volume are difficult to manipulate in terms of existing volume types
because they are neither a single files nor a directory.
This patch introduces new volume type - ploop. This volume type is used
by ploop volume's exclusively.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2016-04-15 17:27:32 +02:00
Nitesh Konkar
0ed35e0939 Return error when --start <number> in cpu-stats is invalid.
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2016-04-15 15:20:11 +02:00
Cole Robinson
e7db227810 util: Add virGettextInitialize, convert the code
Take setlocale/gettext error handling pattern from tools/virsh-*
and use it for all standalone binaries via a new shared
virGettextInitialize routine. The virsh* pattern differed slightly
from other callers. All users now consistently:

* Ignore setlocale errors. virsh has done this forever, presumably for
  good reason. This has been partially responsible for some bug reports:

  https://bugzilla.redhat.com/show_bug.cgi?id=1312688
  https://bugzilla.redhat.com/show_bug.cgi?id=1026514
  https://bugzilla.redhat.com/show_bug.cgi?id=1016158

* Report the failed function name
* Report strerror
2016-04-14 13:22:40 -04:00